ReviewOS

home-lang/home

Preserve semver JSON formatting in text lockfiles

#560
Closed chris opened this 9 days ago ·
9 days ago

Context

After #559 lets unchanged bake/dev/request-cookies.test.ts finish its experimental React dependency resolution, Home writes malformed npm package resolutions into bun.lock:

"react": [""react"@0.0.0-experimental-2dc7da79-20260828", ...]

The harness's next unchanged bun install rejects every affected entry, ignores the lockfile, and installs an incompatible fallback React graph. Bake then cannot resolve react/jsx-dev-runtime or react-dom/client.

Pinned Bun source: 4982b91e3702094330f3be3883354c52b8c01323.

Root cause

packages/runtime/src/semver/shim.zig discards the caller's JSON formatter options and always uses defaults. Semver.String.fmtJson(..., .{ .quote = false }) therefore emits surrounding quotes inside the lockfile string that already owns its quotes.

Acceptance criteria

  • Preserve formatJSONStringUTF8 options through the semver shim.
  • Add focused coverage for quoted and pre-quoted semver strings.
  • A newly generated experimental React bun.lock parses on the next native install.
  • Unchanged request-cookies.test.ts advances to its next independent boundary or passes 2/2.
  • Keep #555 and #66 updated with exact results.

Tracked by #555 and #66. Discovered after #559.

9 days ago

Fixed and pushed to main in bc40db083d97f9fac07758a816a37212c177158e (fix(runtime): preserve semver JSON options).

The semver shim now preserves .quote = false when forwarding JSON formatter options. Added focused coverage for quoted and pre-quoted output.

Verified:

  • generated npm entries are valid, e.g. ["react@0.0.0-experimental-2dc7da79-20260828", ...];
  • a second strict native home install --linker=hoisted parses and reuses the generated lockfile with no changes;
  • JSC-enabled home_rt: 1,813 passed, 19 skipped, 0 failed;
  • JSC-enabled and disabled debug builds pass;
  • Pickier passes on the changed Zig file.

The unchanged Bake cookie file now starts its dev servers and reaches independent resolver panic #561. Closing this issue as complete.

Sign in to comment on this issue.