Skip to content

3C-B0: reproducible Nix dev shell for the local wasm build + Playwright - #143

Merged
PhysShell merged 1 commit into
mainfrom
claude/curation-store-3c-b0-flake
Jul 19, 2026
Merged

PhysShell merged 1 commit into
mainfrom
claude/curation-store-3c-b0-flake

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

What

A repo-root flake.nix (+ flake.lock) so the cockpit-web-test — wasm build +
real cockpit in headless Chromium — runs locally, reproducibly, instead of
being a cloud-only oracle. This is 3C-B0, the substrate slice before the
3C-B curation flow.

nix develop
./cockpit/build-web.sh
cd cockpit/web-test && npm ci && npm test

The flake gives an environment for the existing scripts; it adds no fourth
build script and duplicates no repo-pinned version.

The fix that makes it work

The wasm build failed to link because the Guitar Pro reader's zstd C subtree
was compiled to x86 objects (undefined symbol: ZSTD_* at the wasm link):
Nix's standard cc-wrapper forces the host target. The flake drives an
unwrapped clang, scoped to the wasm target only:

CC_wasm32_unknown_unknown     = clang        # unwrapped
AR_wasm32_unknown_unknown     = llvm-ar
CFLAGS_wasm32_unknown_unknown = --target=wasm32-unknown-unknown

Because these are *_wasm32_unknown_unknown, a native cargo test/clippy in
the same shell uses host gcc with no wasm flags — the host build is
untouched.

Versions stay repo-defined

  • Rust: rustup + the repo's rust-toolchain.toml.
  • wasm-bindgen-cli: a shell hook installs exactly cockpit/Cargo.toml's
    pinned version (read from there); build-web.sh still enforces the match.
  • Playwright/Chromium: nixpkgs pinned to nixos-25.11, whose
    playwright-driver is 1.56.1 — the exact version in
    web-test/package.json — so the Nix browser revision matches the npm
    Playwright. One input covers the toolchain and the browser.

Acceptance (all 7)

# Contract Result
1 nix develop enters without manual nix-shell -p … ✅
2 build-web.sh fully links wasm (not just to lld) ✅ 5.4 MiB dist/
3 No C object is ELF/x86 in the wasm build ✅ (links + runs)
4 npm ci && npm test launches Chromium locally ✅ 16 tests, 15 pass, 0 fail
5 Rust/wasm-bindgen/Playwright versions stay repo-defined ✅ none re-pinned in flake
6 Native cargo test/clippy in-shell get no wasm CC/CFLAGS ✅ CC=gcc, CFLAGS= empty
7 GitHub Actions not moved to Nix ✅ flake is dev-only

Proven on NixOS/WSL, nixpkgs locked at b6018f87.

Not included

No cockpit code — that's 3C-B1 (CurationSession + event minting) onward. The
pre-existing Cargo.lock drift on main (3C-A's cockpit→thiserror edge never
landed in the lock; CI doesn't build --locked) is flagged separately, not
bundled here.

🤖 Generated with Claude Code

…ght web-test (3C-B0)

A repo-root flake so `nix develop` gives an environment where the existing
commands run unchanged and cockpit-web-test is a local check, not a cloud-only
oracle:

    nix develop
    ./cockpit/build-web.sh
    cd cockpit/web-test && npm ci && npm test

The flake provides, without duplicating any repo-pinned version:
- Rust via rustup (toolchain from rust-toolchain.toml);
- wasm-bindgen-cli installed at exactly cockpit/Cargo.toml's version (build-web.sh
  still enforces the match);
- Node 22 and a Playwright Chromium — nixpkgs pinned to nixos-25.11, whose
  playwright-driver is 1.56.1, the exact version in web-test/package.json, so the
  Nix browser revision matches the npm Playwright;
- a target-scoped wasm C toolchain: an unwrapped clang driven only for
  wasm32-unknown-unknown (CC_wasm32_unknown_unknown / AR_ / CFLAGS_), which fixes
  the zstd-to-x86 miscompile that left ZSTD_* undefined at the wasm link. Being
  target-scoped, native cargo in the same shell keeps host gcc with no wasm flags.

Proven end to end on NixOS/WSL: build-web.sh links a full 5.4 MiB wasm bundle and
`npm test` runs the real cockpit in Chromium (15/16 pass, 0 fail). CI stays on its
own working setup — this is a local-dev convenience, not a CI rewrite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@PhysShell, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 121a9224-f19a-4cb7-b2ef-ca35a3419989

📥 Commits

Reviewing files that changed from the base of the PR and between 130db8e and 6de1b9f.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • cockpit/web-test/README.md
  • flake.nix
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/curation-store-3c-b0-flake

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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: 6de1b9fac3

ℹ️ 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 flake.nix
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Generate dev shells for supported host systems

When a contributor's Nix system is anything other than x86_64-linux (for example aarch64-linux or Darwin), nix develop will look for devShells.<system>.default (as documented by the Nix manual), but this flake only emits devShells.x86_64-linux.default. That makes the documented local web-test shell unavailable on those hosts even though the toolchain is otherwise not inherently x86-only; please generate shells for the supported systems or document the shell as Linux x86_64-only.

Useful? React with 👍 / 👎.

@PhysShell
PhysShell merged commit 74e18db into main Jul 19, 2026
16 checks passed
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