* fix(#969): make bug-969 hardening tests hermetic and move build tsbuildinfo out of shipped tree (regression from #996) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(#969): self-heal legacy bin-local tsbuildinfo and make sentinel test hermetic (adversarial-review follow-ups) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(changeset): set pr number to 1002 * docs(#1001): record DEFECT.SHARED-ARTIFACT-MUTATION-IN-CONCURRENT-TEST anti-pattern in CONTEXT.md --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Fix PR
Linked Issue
Fixes #1001
The linked issue carries the confirmed-bug label.
What was broken
next went red across the full-test matrix (macOS 22/24, Windows 22) and the ubuntu-24 coverage leg — Required tests failing, blocking all PRs from merging. Root-caused to 88e30d53 (PR #996, which closed #969). The commit immediately before it on next (d617735b) was green.
Root cause
#996 interacts badly with the concurrent node --test runner:
tests/bug-969-test-infra-flake-hardening.test.cjshad two tests thatfs.unlinkSyncthe real sharedgsd-core/bin/lib/core.cjs(and the real build tsbuildinfo) mid-run, restoring infinally. Files run concurrently, so any other test requiringcore.cjsin that window fails withCannot find module .../gsd-core/bin/lib/core.cjs— a real-race test (RULESET.TESTS.delete-bad-tests).tsBuildInfoFilewas placed atgsd-core/bin/tsconfig.build.tsbuildinfo— mutable build state inside thegsd-core/bin/tree that install tests copy recursively (fs.cpSync). A concurrent rebuild writing/unlinking it races the copy →copyfile ENOENT.
Reproduced locally on the first concurrent iteration of the bug-969 test + state.test.cjs + install.test.cjs.
The fix
- Hermetic tests:
ensureBuiltArtifacts()is nowensureBuiltArtifacts(overrides = {})(root/srcDir/outDir/tsBuildInfoPath/tsconfigPath overridable; production no-arg behavior unchanged). The bug-969 destructive tests (and the sentinel test) now build/delete/re-emit inside a throwaway temp TS project — they never touch realgsd-core/bin/lib. - Relocated build state:
tsconfig.build.tsbuildinfomoved to the repo root (gitignored), out of the copied/shipped tree.ensureBuiltArtifactsbest-effort-purges any stalegsd-core/bin/tsconfig.build.tsbuildinfoso persistent workspaces/mirrors self-heal.
Testing
- Regression reproduced on broken code (iter 1); 10× concurrent race check clean after the fix.
- Full unit suite through the modified runner: 4775 pass / 0 fail.
bug-969suite 6/6; eslint +lint-command-contractclean.- Independent codex adversarial review (findings — legacy-purge, sentinel hermeticity — folded in).
Checklist
- Linked issue carries
confirmed-bug - Branch
fix/1001-bug969-real-race - Conventional commits
- Changeset fragment (
type: Fixed) - Regression test made hermetic + fail-first reproduced