fix(test): isolate test-run data from contributor history - #1473
Conversation
Fixes backnotprop#1455. Allocate and clean a process-owned temporary data directory in the test preload, and preserve explicit controlled-HOME fixture coverage.
Correction to my earlier rerun advice: the failure is now reproduced and fixed in
Minimal reproduction, confirmed on both macOS and Linux with Bun 1.3.14: bun test apps/opencode-plugin/plan-review-lifecycle.test.ts packages/server/annotate.test.tsBefore: the exact four CI failures. The correction resolves all seven plan/history path constructions at use time. A regression changes data-directory overrides after import and checks isolated writes/read visibility; it fails against the original code. No polling, sleeps, skipped tests, or weakened assertions were added. Verification: unprivileged Linux ordered three-file suite 83 pass, 0 fail; this branch's local full suite 4,298 pass, 910 skip, 0 fail, plus typecheck. Local full-suite environment uses a disposable HOME and the pinned Bun 1.3.14; upstream Actions verifies the Linux CI environment. Independent Standards and Spec reviews found no issues. Final upstream verification: all checks on the corrected head are green (publication-only jobs are intentionally skipped on PRs). Test workflow and Release build/smoke workflow both passed, including Linux/macOS/Windows binary smoke checks. No maintainer rerun is needed. |
Resolve plan and history paths from the active data-directory configuration instead of capturing a temporary test override at import time. This reproduces and fixes the four order-dependent annotate CI failures reported in backnotprop#1464; keep both successful persistence and failed-write draft recovery assertions intact.
|
Full adversarial review complete: revert-verification confirms both regression tests genuinely fail against the old code on their respective halves (per-call storage fix, and the preload sandbox), no consumer anywhere relied on the frozen-at-import behavior, the preload change is pure isolation with no masking, and the CI-equivalent full suite runs 4308 pass / 0 fail with typecheck clean. One non-blocking nit we'll sweep in a follow-up: the retained comment in ai-disabled.test.ts (~line 178) still cites the import-time capture this PR removes as the reason for the child process. Merging - and thank you: this plus bendrucker's independent convergence on the same root cause closed out our longest-standing CI flake. |
Fixes #1455.
Summary
PLANNOTATOR_DATA_DIRin the existing test preload, before store imports can capture a real user path. An inherited contributor data-directory setting cannot bypass isolation.Regression coverage
A real child
bun testexercises static store imports, plan/annotate/config writes, runtime-child inheritance, nested test-process isolation, afterAll writes, and owned-directory cleanup. Caller-owned directories remain untouched.Verification
CIunset).bun test: 4,297 passed, 910 skipped, 0 failed.bun run typecheckandgit diff --check: passed.No pending PR addressing this issue was found in the open-PR inventory or issue timeline before starting; the inventory was rechecked before publication.
CI correction (
fa3a8fbe)Resolved the import-order bug behind #1464: storage now resolves the active data directory for every plan/history read and write instead of retaining an early test's temporary override. Added a regression for changing that override after import; no sleeps, retries, or weakened assertions. The ordered OpenCode→annotate reproduction fails four tests before this fix and passes after it on both macOS and Linux. Unprivileged Linux verification: 83 pass, 0 fail. Latest local full suite: 4,298 pass, 910 skip, 0 fail; typecheck passes.