Skip to content

test(temporal): record cross-version replay histories for every runner path - #134

Open
dawidaksamski wants to merge 1 commit into
mainfrom
feat/WB-629-cross-version-replay-histories
Open

test(temporal): record cross-version replay histories for every runner path#134
dawidaksamski wants to merge 1 commit into
mainfrom
feat/WB-629-cross-version-replay-histories

Conversation

@dawidaksamski

Copy link
Copy Markdown
Contributor

Cross-version replay histories for @workflowbuilder/temporal

Completes the replay guard WB-527 started. A published version of this package must replay an Event History recorded by an older one, since a run can wait in history across several deploys. Until now only the happy path had a committed history, and it was replayed through the singular call, so one broken history would have hidden the rest.

What changed

  • Three new recorded histories under packages/temporal/test/replay/histories/, one per remaining path through the sandbox code:
    • v0-fail-policy.json: a node failing under the default fail policy, wave finishes, join never reached, Workflow Execution fails.
    • v0-incomplete-branch.json: a node names a port with no edge, downstream skipped as branch_not_taken, run closes incomplete.
    • v0-cancel-mid-run.json: cancel while an activity is in flight, non-cancellable cleanup emits execution_cancelled, Workflow Execution closes as Canceled.
  • Scenarios are data. test/fixtures/replay-scenarios.ts declares all four graphs next to their expected terminal state, Temporal close event and scheduled-activity counts. The old graph.ts fixture is split: the recording store moved to recording-store.ts, the graph moved into the table.
  • Cross-version test uses Worker.runReplayHistories. Every committed file replays in one pass and each broken one is named. The test also checks coverage both ways: every scenario has a recording, every recording belongs to a scenario. The version prefix is free so later <version>- files sit next to the v0- ones.
  • Scoped recording. UPDATE_REPLAY_HISTORIES=<scenario> records one scenario; =1 re-records all. Unknown names fail at load. Before this, adding a scenario would silently re-baseline the others.
  • README: scenario table, recording instructions, what happens to v0- at the first release, and the secrets note for the live-run route.

Deviations from the ticket

Histories were recorded from the test harness (in-memory Temporal via @temporalio/testing) rather than by walking flows through the UI. This is deterministic, re-recordable by command, and the inputs carry empty variables/global bags, so the secrets review the ticket warns about does not apply. v0-parallel-wave.json is byte-identical to main.

Verification

  • Package suite green (94 tests). ESLint, Prettier, tsc and knip clean for the package.
  • Adversarial check: one extra emitEvent in graph-runner.ts turns all four committed histories red in a single assertion naming each file, and trips the per-scenario activity-count pins. Reverted.
  • A stray .DS_Store or a v9- copy passes the guard; an orphan v0-unknown.json fails it.
  • Expected noise: the cancel scenario logs one Temporal core warning, "Activity not found on completion", because the released activity reports to an already-closed run. Documented in the fixture and README.

No changeset: the package is unpublished. Nothing under packages/temporal/src changed.

…r path

Adds the fail-policy, incomplete-branch and cancel-mid-run scenarios next to
parallel-wave, recorded from the harness rather than the UI so the inputs carry
no secrets. The committed files replay through Worker.runReplayHistories, so one
broken history no longer hides the rest, and UPDATE_REPLAY_HISTORIES now takes a
scenario name so adding one does not re-baseline the others.
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.

2 participants