Skip to content

archive-phase9.test.ts global replay harness loops on unrelated production history, blocks local test runs (4MB bundle re-emit) #304

Description

@JRedeker

Summary

Running src/tools/change.archive-phase9.test.ts locally hangs/timeouts because the file's global setup spins up Temporal TestWorkflowEnvironment instances replaying unrelated production workflow histories, re-emitting the 4 MB workflow bundle (workflow-bundle-f32a68c241d307c4cd4e.js) every ~2 s. Targeted runs never reach the requested tests.

Reproduction (2026-07-23, worktree change/fixDurableProofFallback)

Three attempts, all timed out:

Run Command Timeout Result
tr_mrxm29gu pnpm test -- src/tools/change.archive-phase9.test.ts 180s timed_out
tr_mrxn9kis … -t "shipped reconciliation" 150s timed_out
tr_mrxnfsyf … -t "shipped reconciliation" --maxWorkers=1 --pool=forks --poolOptions.forks.singleFork=true 240s timed_out

Diagnostics in every run show the same loop:

[INFO] asset workflow-bundle-f32a68c241d307c4cd4e.js 4.08 MiB [emitted]   (repeated every ~2s)
taskQueue: 'cutover-replay:refineTestEvidencePolicy poisoned production history-11'
state: DRAINING → DRAINED → STOPPED
Preparing worktree (new branch 'change/test')

The replay targets refineTestEvidencePolicy — a different change — not the tests selected by -t. The -t name filter does not help because the cost is in global beforeAll/setup, not the individual tests. Pre-building the worker bundle (pnpm run build:worker) did not help — the test env re-bundles workflows itself.

Impact

  • Local TDD iteration on any archive-gate change is effectively impossible via pnpm test; engineers must trust CI or prior recorded runs.
  • The same tests pass in CI / other sessions (recorded 60/60 green here), so this is a local-harness issue, not a code regression.

Expected

  • The replay harness should not loop on unrelated production histories during a targeted run.
  • -t filtering should avoid the heavy global replay setup, or the replay setup should be scoped per-test rather than global.
  • Investigate whether this file belongs in the .itest.ts sequential project (per AGENTS.md, heavy Temporal tests belong there with fileParallelism: false), since it is currently .test.ts (parallel unit project).

Related

  • Discovered while completing fixDurableProofFallback (code verified green via CI/recorded runs + AC5 empirical proof, not local re-run).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions