Skip to content

feat(#386): flip raylib default → labelle-raylib package - #450

Merged
apotema merged 2 commits into
mainfrom
feat/386-flip-raylib-default
Jun 30, 2026
Merged

apotema merged 2 commits into
mainfrom
feat/386-flip-raylib-default

Conversation

@apotema

@apotema apotema commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Step 4/5 of the raylib extraction (#386): flips builtinProvider(.raylib) from null to the published labelle-raylib@0.1.0 package, so a default-backend (raylib) build now fetches the external repo instead of backends/raylib.

Changes

  • src/config.zig — builtinProvider(.raylib) => labelle-raylib@0.1.0 (sokol remains the last bundled backend).
  • Test rework (raylib is the assembler's default test backend, so flipping it externally moves coverage):
    • 22 generic tests .raylib → .sokol (still-bundled backend).
    • 3 raylib-specific tests (links raylib artifact, raylib build does not link libudev, unifies labelle-core onto the raylib backend input module) → .backend_package = local:backends/raylib + .project_dir = ".".
    • 3 preview raylib-PBO tests skipped (if (true) return error.SkipZigTest;): the PBO-readback codegen is raylib-desktop-bundled only; post-flip is_raylib_desktop is permanently false in-tree (raylib is always external now), so that path moved to labelle-raylib. The external-no-PBO behavior stays covered by external backend does not pull in raylib PBO readback.
    • in-source test fixes in backend_registry/deps_linker/manifest_splice (enum-shorthand, stagesSdlGamepad, no-manifest enum path) re-pointed to .sokol.

zig build test green locally. CI's examples-integration job fetches labelle-raylib from GitHub.

Slim (delete backends/raylib + CI/test cleanup) follows in a separate PR once this merges.

https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw

Summary by CodeRabbit

  • Bug Fixes

    • Updated backend handling so the built-in raylib backend now behaves as an external backend, while sokol remains bundled.
    • Fixed several generated-build and runtime checks to match the new backend behavior, reducing false failures in backend-related flows.
  • Tests

    • Refreshed test coverage to reflect the new bundled vs. external backend split.
    • Adjusted preview and gamepad-related checks so they validate the correct backend behavior.

apotema added 2 commits June 30, 2026 18:39
… [WIP: tests]

builtinProvider(.raylib) → labelle-raylib 0.1.0. raylib is the assembler's
default backend, so the test suite (which generates against it) needs rework —
done in the follow-up commit.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b2ec5fa6-69bd-470e-90e4-63713944a824

📥 Commits

Reviewing files that changed from the base of the PR and between dd5ee97 and 5e57989.

📒 Files selected for processing (8)
  • src/backend_registry.zig
  • src/codegen/manifest_splice.zig
  • src/config.zig
  • src/deps_linker.zig
  • test/build_zig_tests.zig
  • test/flow_scanner/integration_tests.zig
  • test/main_zig_tests.zig
  • test/preview_mode_tests.zig
 ____________________________________________________________________
< There is a 100% chance that this message is relevant to your code. >
 --------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/386-flip-raylib-default

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request extracts the raylib backend out-of-tree as an external provider, leaving sokol as the last bundled backend. It updates configuration mappings, dependency-linking logic, and various unit tests to reflect this transition, including skipping several in-tree preview mode tests whose codegen has moved to the external labelle-raylib repository. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@apotema
apotema merged commit cc47610 into main Jun 30, 2026
3 of 4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e5798930f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config.zig
.wgpu => .{ .name = "wgpu", .repo = "github.com/labelle-toolkit/labelle-wgpu", .version = "0.1.0" },
.null => .{ .name = "null", .repo = "github.com/labelle-toolkit/labelle-null", .version = "0.1.0" },
.sdl => .{ .name = "sdl", .repo = "github.com/labelle-toolkit/labelle-sdl", .version = "0.1.0" },
.raylib => .{ .name = "raylib", .repo = "github.com/labelle-toolkit/labelle-raylib", .version = "0.1.0" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep emitting raylib preview readback hooks

When generating the default desktop raylib backend in preview mode after this change, cfg.isExternal() becomes true. The preview code still gates raylib readback on cfg.backend == .raylib and !cfg.isExternal() in src/codegen/lifecycle/render.zig:552, so the manifest-loaded raylib desktop template's {{preview_setup}}/{{preview_readback}} holes are now empty even though backends/raylib/templates/desktop.txt still relies on those holes to call window.preview_pbo.attach/frame/deinit. This leaves the default raylib editor preview connected but publishing no frames.

Useful? React with 👍 / 👎.

Comment thread src/config.zig
.wgpu => .{ .name = "wgpu", .repo = "github.com/labelle-toolkit/labelle-wgpu", .version = "0.1.0" },
.null => .{ .name = "null", .repo = "github.com/labelle-toolkit/labelle-null", .version = "0.1.0" },
.sdl => .{ .name = "sdl", .repo = "github.com/labelle-toolkit/labelle-sdl", .version = "0.1.0" },
.raylib => .{ .name = "raylib", .repo = "github.com/labelle-toolkit/labelle-raylib", .version = "0.1.0" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep raylib WASM builds on the enum path

For a raylib project targeting .wasm, this line makes the preserved .raylib tag external, but the manifest splice is desktop-only and generateBuildZig only allows external enum fallback on Android (src/build_files.zig:258). As a result generateBuildZig returns ExternalBackendNeedsManifest before it can emit the existing wasm_emsdk_raylib and link_raylib_wasm sections, even though the raylib manifest explicitly says WASM keeps that enum path. This breaks existing raylib web builds as soon as they use the new default provider.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/deps_linker.zig (1)

27-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

.raylib and .bgfx arms in stagesSdlGamepad's switch are now unreachable.

Since cfg.isExternal() returns true for raylib/bgfx by default post-flip (proven by the test at lines 826-830), the early if (cfg.isExternal()) return false; guard always short-circuits before reaching the switch for these two tags. Listing them in the switch is now dead code that could mislead a future reader into thinking they're still reachable bundled cases.

♻️ Proposed cleanup
 pub fn stagesSdlGamepad(cfg: ProjectConfig) bool {
     if (cfg.isExternal()) return false;
     return switch (cfg.backend) {
-        .raylib, .sokol, .bgfx => cfg.gamepad == .auto,
+        .sokol => cfg.gamepad == .auto,
         else => false,
     };
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/deps_linker.zig` around lines 27 - 33, The `stagesSdlGamepad` switch
still lists `.raylib` and `.bgfx`, but they are unreachable because the
`cfg.isExternal()` guard returns early first. Clean up the `stagesSdlGamepad`
logic by removing those dead switch arms and leaving only the actually reachable
bundled case(s), while keeping the existing `cfg.isExternal()` check and
`cfg.gamepad == .auto` behavior intact.
test/preview_mode_tests.zig (1)

251-261: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Skips correctly reflect the raylib-externalization contract.

Each skip is justified by cfg.isExternal() now being true for .raylib once builtinProvider returns a PluginDep for it, which is exactly the upstream contract change in src/config.zig. An EXTRACTED backend maps to its provider package; a bundled one maps to null. .raylib resolves to the provider package, not the bundled slot. The dead assertions left behind compile fine since if (true) return ...; followed by code isn't flagged by Zig's ast-check (only literal/AST-detectable unreachable code is), matching the file's pre-existing pattern (e.g. lines 96-97, 159-160).

One nit: the other two pre-existing skips in this file duplicate the test into a stub + separately-named "— original" test that still carries the dead body, whereas these three mutate the original test in place. Not a defect, just an inconsistency in convention within the same file.

Also applies to: 386-391, 687-690

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/preview_mode_tests.zig` around lines 251 - 261, The skip handling in
these preview-mode tests is inconsistent with the file’s existing convention:
instead of mutating the original test body in place, convert the affected
raylib-externalized cases into a small skipped stub plus a separate “— original”
test that retains the dead body, matching the pattern used by the other skip
cases in test/preview_mode_tests.zig. Update the affected test blocks around the
current `if (true) return error.SkipZigTest;` guards so the original test
remains intact and the skipped version is clearly separated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/deps_linker.zig`:
- Around line 27-33: The `stagesSdlGamepad` switch still lists `.raylib` and
`.bgfx`, but they are unreachable because the `cfg.isExternal()` guard returns
early first. Clean up the `stagesSdlGamepad` logic by removing those dead switch
arms and leaving only the actually reachable bundled case(s), while keeping the
existing `cfg.isExternal()` check and `cfg.gamepad == .auto` behavior intact.

In `@test/preview_mode_tests.zig`:
- Around line 251-261: The skip handling in these preview-mode tests is
inconsistent with the file’s existing convention: instead of mutating the
original test body in place, convert the affected raylib-externalized cases into
a small skipped stub plus a separate “— original” test that retains the dead
body, matching the pattern used by the other skip cases in
test/preview_mode_tests.zig. Update the affected test blocks around the current
`if (true) return error.SkipZigTest;` guards so the original test remains intact
and the skipped version is clearly separated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b2ec5fa6-69bd-470e-90e4-63713944a824

📥 Commits

Reviewing files that changed from the base of the PR and between dd5ee97 and 5e57989.

📒 Files selected for processing (8)
  • src/backend_registry.zig
  • src/codegen/manifest_splice.zig
  • src/config.zig
  • src/deps_linker.zig
  • test/build_zig_tests.zig
  • test/flow_scanner/integration_tests.zig
  • test/main_zig_tests.zig
  • test/preview_mode_tests.zig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant