Skip to content

fix(test): isolate test-run data from contributor history - #1473

Merged
backnotprop merged 2 commits into
backnotprop:mainfrom
FNDEVVE:fix/test-data-sandbox
Sep 7, 2026
Merged

fix(test): isolate test-run data from contributor history#1473
backnotprop merged 2 commits into
backnotprop:mainfrom
FNDEVVE:fix/test-data-sandbox

Conversation

@FNDEVVE

@FNDEVVE FNDEVVE commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Fixes #1455.

Summary

  • Allocate a fresh process-owned PLANNOTATOR_DATA_DIR in the existing test preload, before store imports can capture a real user path. An inherited contributor data-directory setting cannot bypass isolation.
  • Clean only that captured temporary directory in Bun's global test teardown; preserve archive-off defaults and deliberate test-body overrides.
  • Adapt controlled-HOME prompt/hook fixtures and the nested disabled-AI test to the new isolation contract. No production storage behavior changes.

Regression coverage

A real child bun test exercises 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

  • Repository-pinned Bun 1.3.14, disposable HOME, local macOS environment (CI unset).
  • Focused data-dir, prompts, improvement-hooks, and disabled-AI tests: 33 passed.
  • Full bun test: 4,297 passed, 910 skipped, 0 failed.
  • bun run typecheck and git diff --check: passed.
  • Independent Standards and Spec reviews completed, including fixture follow-up changes.

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.

Fixes backnotprop#1455. Allocate and clean a process-owned temporary data directory in the test preload, and preserve explicit controlled-HOME fixture coverage.
@FNDEVVE

FNDEVVE commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

This was generated by AI during triage.

Correction to my earlier rerun advice: the failure is now reproduced and fixed in fa3a8fbe. It is deterministic import-order contamination, not a permission/timing issue requiring a maintainer rerun.

packages/shared/storage.ts captured PLANNOTATOR_DATA_DIR at import time. An earlier OpenCode lifecycle test imported storage under a temporary override; after that test restored the environment, storage still wrote to the old directory while annotate fixtures used the current one. This explains all four failures in #1464, including the bypassed failure fixtures and missing submission records.

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.ts

Before: 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.
@backnotprop

Copy link
Copy Markdown
Owner

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.

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.

Test suite writes plan/annotate history into the real ~/.plannotator/history

2 participants