Skip to content

feat(config): flip .backend = .wgpu to the extracted package by default (#386 step 4) - #428

Merged
apotema merged 1 commit into
mainfrom
feat/386-flip-wgpu-default
Jun 30, 2026
Merged

feat(config): flip .backend = .wgpu to the extracted package by default (#386 step 4)#428
apotema merged 1 commit into
mainfrom
feat/386-flip-wgpu-default

Conversation

@apotema

@apotema apotema commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

wgpu extraction step 4 — the flip. builtinProvider(.wgpu)labelle-wgpu 0.1.0, so .backend = .wgpu now fetches the out-of-tree backend by default (second default-external backend after bgfx #419).

Desktop-only, loop-style — no Android/callback complications, so cleaner than the bgfx flip. The cache fetch-path + externalUsesEnumPath guard already landed with bgfx, so wgpu inherits them.

Validated: labelle-wgpu builds standalone + its example (macOS Metal); the assembler fetches it and builds a full wgpu project end-to-end (verified locally with released framework pins). labelle-wgpu CI green (ubuntu+macOS build-test + Metal demo).

Test rework (same class as the bgfx flip): backend_registry enum-shorthand (wgpu joins bgfx as external), the build_zig artifacts test (local pkg + project_dir), and dropping wgpu from the bundled no-override loop.

Next: slim the bundled backends/wgpu + move its example/CI to labelle-wgpu (mirrors the bgfx slim #420 + #422).

Summary by CodeRabbit

  • New Features

    • Expanded support for extracted external backends so both bgfx and wgpu are now handled consistently.
    • Updated backend selection behavior so wgpu is treated as an external option rather than a bundled one.
  • Tests

    • Adjusted backend verification to match the new external-backend behavior.
    • Updated build checks to confirm generated output includes the expected wgpu integration.

…lt (#386 step 4)

builtinProvider(.wgpu) → labelle-wgpu 0.1.0, so `.backend = .wgpu` now fetches the
OUT-OF-TREE backend by default — wgpu is the second default-external backend
(after bgfx #419). Desktop-only, loop-style, no android/callback complications.

Test rework (same class as the bgfx flip):
- backend_registry enum-as-shorthand: wgpu joins bgfx as external (tag preserved).
- build_zig "links wgpu glfw artifact": point at a local wgpu pkg + project_dir so
  the manifest splice resolves in-tree (it now resolves external by default).
- build_zig no-backend_input-override loop: drop wgpu (now external, exercised by
  the external tests) — only the bundled null backend remains in that loop.

The cache fetch-path (effectiveBackendPackage in validate/ensureCache) + the
externalUsesEnumPath guard already landed with the bgfx flip, so wgpu inherits them.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

wgpu is moved from the bundled backend set to an extracted external backend (resolving to github.com/labelle-toolkit/labelle-wgpu v0.1.0), mirroring the existing bgfx extraction. The enum-as-shorthand registry test and build_zig tests are updated to match.

wgpu External Backend Extraction

Layer / File(s) Summary
Config and registry: wgpu as extracted backend
src/config.zig, src/backend_registry.zig
builtinProvider adds .wgpu to the extracted PluginDep case; enum-as-shorthand test asserts isExternal() true and effectiveBackendPackage() non-null for both bgfx and wgpu.
Build tests: wgpu external backend wiring
test/build_zig_tests.zig
links wgpu glfw artifact test now passes backend_package and project_dir; backends-without-core-import loop reduced to .null only.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐇 A bunny once bundled the wgpu tight,
Then snipped the string, set it free in the night.
Now bgfx and wgpu both hop on their own,
Each fetched from a repo, externally grown.
The tests all agree — two tags stand apart! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: making .wgpu use the extracted package by default.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/386-flip-wgpu-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 wgpu backend out-of-tree, transitioning it from a bundled backend to an external package. It updates the configuration to resolve .wgpu to its dedicated repository (github.com/labelle-toolkit/labelle-wgpu at version 0.1.0) and adapts the backend registry and build tests to handle wgpu as an external backend. There are no review comments, and I have no feedback to provide.

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.

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/backend_registry.zig (1)

231-247: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the concrete provider mapping here.

This only proves that .bgfx/.wgpu resolve to some external package. A bad repo or version would still pass and miss the default-flip contract. Please also assert effectiveBackendPackage().?.repo and .version for the extracted tags.

🤖 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/backend_registry.zig` around lines 231 - 247, The enum-as-shorthand test
in backend_registry.zig only checks that .bgfx and .wgpu map to some external
package, so tighten the assertions in test "enum-as-shorthand: extracted
backends resolve to their package; the rest stay bundled" by also verifying the
concrete fields returned from effectiveBackendPackage() for those tags. Update
the checks around ProjectConfig, isExternal(), and effectiveBackendPackage() to
assert the expected repo and version values for each extracted backend, while
keeping the bundled-backend assertions unchanged.
🤖 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.

Inline comments:
In `@src/config.zig`:
- Around line 615-620: The `.wgpu` backend mapping in
`effectiveBackendPackage()` is currently externalized for all targets, but it
should remain desktop-only. Update the backend selection logic in
`effectiveBackendPackage()` (or the equivalent mapping near the `.bgfx`/`.wgpu`
cases) to gate the `.wgpu` provider flip on `self.platform == .desktop`, while
leaving Android, wasm, and iOS on the bundled backend path. Keep the existing
`.raylib`, `.sokol`, `.sdl`, and `.null` behavior unchanged.

---

Nitpick comments:
In `@src/backend_registry.zig`:
- Around line 231-247: The enum-as-shorthand test in backend_registry.zig only
checks that .bgfx and .wgpu map to some external package, so tighten the
assertions in test "enum-as-shorthand: extracted backends resolve to their
package; the rest stay bundled" by also verifying the concrete fields returned
from effectiveBackendPackage() for those tags. Update the checks around
ProjectConfig, isExternal(), and effectiveBackendPackage() to assert the
expected repo and version values for each extracted backend, while keeping the
bundled-backend assertions unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 700c3616-e485-493a-9937-e8cd0b75e710

📥 Commits

Reviewing files that changed from the base of the PR and between a12cf5b and a580e60.

📒 Files selected for processing (3)
  • src/backend_registry.zig
  • src/config.zig
  • test/build_zig_tests.zig

Comment thread src/config.zig
@apotema
apotema merged commit 9e79830 into main Jun 30, 2026
4 checks passed
@apotema
apotema deleted the feat/386-flip-wgpu-default branch June 30, 2026 16:42
apotema added a commit that referenced this pull request Jun 30, 2026
…hase 6c) (#429)

wgpu is resolved out-of-tree now (`.backend = .wgpu` → the labelle-wgpu provider,
flipped in #428), so the in-tree backends/wgpu/ slot is dead weight. Delete it +
the assembler example + the coverage that built them in-tree:

- Remove backends/wgpu/ (src/templates/build_fragments/manifest/build + example).
- Remove examples/wgpu (the assembler-generated wgpu project) — its
  assembler-builds-a-wgpu-project coverage (incl. the Foundation/QuartzCore/Metal
  link-fragment regression guard) moved to labelle-wgpu's CI (PR #1).
- CI: drop the `wgpu backend WAV parser tests` + `wgpu backend demo build (macOS)`
  steps and the `Generate + build the wgpu example` examples-integration step.
- Tests: drop the desktop wgpu-artifacts unit test (no in-tree package to resolve)
  and the wgpu case from the in-tree-template preview regression list.

Two backends now fully out of the assembler bundle (bgfx + wgpu). The agnostic
external-fetch path stays covered by the `external-null` (nullfixture) step.
apotema added a commit that referenced this pull request Jun 30, 2026
…step 2) (#430)

* chore(slim): remove the bundled wgpu backend — it's extracted (#386 Phase 6c)

wgpu is resolved out-of-tree now (`.backend = .wgpu` → the labelle-wgpu provider,
flipped in #428), so the in-tree backends/wgpu/ slot is dead weight. Delete it +
the assembler example + the coverage that built them in-tree:

- Remove backends/wgpu/ (src/templates/build_fragments/manifest/build + example).
- Remove examples/wgpu (the assembler-generated wgpu project) — its
  assembler-builds-a-wgpu-project coverage (incl. the Foundation/QuartzCore/Metal
  link-fragment regression guard) moved to labelle-wgpu's CI (PR #1).
- CI: drop the `wgpu backend WAV parser tests` + `wgpu backend demo build (macOS)`
  steps and the `Generate + build the wgpu example` examples-integration step.
- Tests: drop the desktop wgpu-artifacts unit test (no in-tree package to resolve)
  and the wgpu case from the in-tree-template preview regression list.

Two backends now fully out of the assembler bundle (bgfx + wgpu). The agnostic
external-fetch path stays covered by the `external-null` (nullfixture) step.

* feat(null): add backend.manifest.zon — manifest-splice codegen (#386 step 2)

null extraction step 2 (window conformance was done in #411). Presence of
backends/null/backend.manifest.zon opts the null DESKTOP build into the
manifest-splice path instead of the enum `switch (cfg.backend)` sections.

Loop-style (the headless main drives a fixed-frame tick loop), pure-Zig, zero
deps. The LINK fragment is EMPTY — null has no native artifact (the enum path's
`.null => {}` emitted nothing). backend_dep.txt is the verbatim .backend_null
section body.

Output BYTE-IDENTICAL to the enum path (diffed a generated baseline → 0 diff),
including the is_tests_target path (which forces .backend=.null on host). `zig
build test` green.
apotema added a commit that referenced this pull request Jun 30, 2026
…lt (#386 step 4) (#431)

* feat(config): flip .backend = .null to the extracted package by default (#386 step 4)

builtinProvider(.null) → labelle-null 0.1.0 — null is the third default-external
backend (after bgfx #419, wgpu #428). Pure-Zig, zero deps, empty link fragment.

Notable: generateTestsTarget (#83) forces .backend=.null for every project's
`zig build test`, so that universal test target now fetches labelle-null (cached,
pure-Zig — the no-system-libs property still holds). The null headless +
plugin-controllers examples + the is_tests_target codegen now resolve external null.

Test rework (same class as the bgfx/wgpu flips): backend_registry enum-shorthand
(null joins bgfx/wgpu external), and the 4 build_zig `.backend=.null` tests
(null-wires-modules, no-override, the two is_tests_target tests) now point at a
local null pkg + project_dir so the manifest splice resolves. Inherited the cache
fetch-path + externalUsesEnumPath from the earlier flips.

* fix(cache): fetch the tests-target null backend for every project

The flip surfaced this (CI: a raylib project's tests-target generate failed
ExternalBackendNeedsManifest): generateTestsTarget (#83) forces .backend=.null
for EVERY project's `zig build test`, but validateCache/ensureCache only
considered the project's OWN backend — so external labelle-null was never
reported missing or fetched for a non-null project. Account for the tests-target
null in both (dedup when the project already IS null). No-op while null is bundled.

* test(cache): account for the tests-target null in validateCache external tests

The two external-backend validateCache tests now also see the tests-target's
external null in the missing set (every project validates null post-flip). Assert
the project backend specifically (local stub) + expect both fakebackend AND null
for the remote case.
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