fix: resolve cold-base tooling and --spec-ref in the right contexts#311
Merged
Conversation
🗺️ StyleProof report📊 View the side-by-side visual report →A navigable affordance was removed without acknowledgement — repair or acknowledge it; visual approval cannot clear this failure. |
…ts (#300) Two resolution bugs in the cold base path: PATH: env.PATH was built once from the consumer head's node_modules/.bin, so the base capture ran the head's Playwright CLI against the base worktree's @playwright/test library — a version-mixing failure on exactly the PRs that bump rendering dependencies, silently degrading them to a bare baseline. Base-side spawns (playwright install + base capture) now prepend the cold-base worktree's own node_modules/.bin. --spec-ref: symbolic refs were resolved inside the detached base worktree, where HEAD IS --base (--spec-ref HEAD silently overlaid the base's own spec) and FETCH_HEAD/MERGE_HEAD are per-worktree pseudo-refs that don't resolve at all. The ref now resolves to a SHA in the consumer checkout before any worktree is entered; unresolvable refs fail loudly up front. Closes #300 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BenSheridanEdwards
force-pushed
the
fix/300-cold-base-resolution
branch
from
July 18, 2026 15:47
6ac797d to
392f74f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why does this feature exist?
The cold base path — the expensive branch styleproof-ci takes when no compatible base bundle exists — resolved two different things in the wrong context, and both failure modes hit hardest on exactly the PRs the gate exists to protect: dependency bumps and spec migrations. This is the second PR from the open-issues triage (the trust-path batch is #310) and closes #300.
What changed?
env.PATHwas built once from the consumer head'snode_modules/.bin, soplaywright installand the Playwright CLI spawned during the base capture came from the head's install while the worktree's config and tests resolved@playwright/testfrom the worktree's own freshly-installed dependencies. A PR bumping@playwright/test1.44→1.48 with a base miss got the head's 1.48 CLI loading the worktree's 1.44test()— "did not expect test() to be called here" — failing the base capture and silently degrading to a bare baseline on precisely the PRs that change rendering dependencies.binFirstPath(cwd)now prepends the spawn cwd's ownnode_modules/.binforplaywright installand the base capture; head-side spawns keep resolving from the consumer install.--spec-ref: symbolic refs resolve in the consumer checkout, before any worktree. Ref validation andgit showran inside the detached base worktree, whereHEADis--base(so--spec-ref HEADsilently overlaid the base's own spec — a no-op defeating the flag) andFETCH_HEAD/MERGE_HEADare per-worktree pseudo-refs that don't resolve at all (a spurious exit 2 for a ref that's valid where the user typed it). A newresolveSpecRefToSharesolves the ref to a commit SHA in the consumer checkout up front — the SHA then resolves everywhere, since worktrees share one object store — and an unresolvable ref fails loudly even on runs where the base restore would have hit.Behavioural Proof (with video and screenshots)
Not applicable — CI driver plumbing with no rendered surface. Both behaviours are pinned executably in one integration fixture:
--spec-ref HEADon a cold run must capture the head's spec bytes on the base side (before the fix it captured the base's own), the run log must show the ref resolving to the head SHA in the consumer checkout, and marker files prove the base capture executed the worktree-installedplaywrightwhile the head capture executed the consumer's. A unit test pinsresolveSpecRefToShaforHEAD, a branch name, an explicit SHA, and an unresolvable ref.Verification Summary
npm test— 580/580 pass (2 new tests; no existing pins changed).node --test test/ci-cli.test.mjs— 22/22, including the pre-existing overlay, overlay-restore-on-failure, and invalid-ref tests, all unchanged and green against the new resolution order.Closes #300.
🤖 Generated with Claude Code