Before deploying a changed Temporal Workflow Definition to workers that may pick up existing runs, replay the histories those workers could inherit. Freeze the expected history list before running the test. Hold the rollout if a required history fails, cannot be opened, or never reaches a branch that needs coverage. Run a separate execution test for changes to the model, prompt, Activity, or destination contract.
TL;DR Capture the original worker revision and a representative history for each changed path. Replay them against the original definition, a deliberately incompatible test definition, and the candidate. Proceed only when the baseline passes, the incompatible control fails on the intended history, and every required candidate result is present. If a branch lacks a usable history, recover a fixture or prove that the new workers cannot receive its runs.
Key decision facts
| Question | What settles it |
|---|---|
| Will the new worker see written history? | The actual deployment routing and the population of open executions |
| Which histories are required? | Existing runs that can reach the candidate plus histories that cross the changed command boundary |
| What proves the test is sensitive? | The correct original definition passes while a controlled command change fails at the intended event |
| What if the runner cannot open a fixture? | Keep the fixture in the denominator and the affected release path on hold |
| What evidence does the replay pass provide? | Command compatibility with the supplied histories under the tested definitions and configuration |
| What still needs an execution test? | New Activity behavior, live inputs, external effects, and routing decisions after recorded history ends |
Locate the change that matters to existing history
Temporal Workflow code can execute more than once over the lifetime of an execution. The replay mechanism checks commands the running definition generates against events that already exist in the history. A worker may have to replay after losing its cached state. In a busy staging environment, warm workers can give the impression that a deployment works even if the candidate has never reconstructed progress from history. Begin with a history replay test that exercises the new code directly. Temporal Workflow Execution overview
Review the diff from the point of view of each Workflow Definition. Write down where the code first schedules an Activity, starts a timer, creates a child Workflow, or waits for a message that later drives one of those commands. Look for changed ordering and different branches around those commands. A helper renamed in source requires a different level of investigation from moving the review deadline ahead of classification. Follow the actual call path from the definition to the command. If a shared helper feeds several Workflow Types, record each type that uses it, along with the history events that show the helper's effects.
A useful review starts with observations a second engineer can verify. In a document review workflow, a classifier finishes with a review disposition. If the result requires human review, the workflow starts a deadline timer. If an approval message arrives in time, the workflow cancels or leaves the wait according to its existing implementation and continues. Depending on the change, the test might need a history that has scheduled the timer, a history that has seen a message, and a history that has already scheduled the final Activity. These histories test different points, even though a customer calls all of them the same “review” path.
A source diff also helps bound a replay test's value. If the workflow continues to make the same recorded commands but an OCR Activity now returns a different result shape, histories with already recorded successful Activity results can exercise the workflow's handling of those old results. To find out how the candidate handles the new result, run the changed Activity in an integration test or start a fresh execution that can produce it. If an existing execution has not reached that command, include a prospective fixture that drives it forward under the candidate and check the concrete disposition that the new behavior produces. Temporal Python testing guide
Treat each change as a claim about a recipient. “The candidate handles old reviewer waits” means that a particular candidate revision can replay histories with old reviewer waits and that eligible existing runs may resume under the intended routing. It leaves other questions open. “The workflow upgrades safely” makes a broader claim about this and additional facts, including data compatibility, fresh paths, Activity rollouts, and destination effects. Break the broader claim into observations before deciding how much coverage the release needs.
Build a history inventory around branches, events, and versions
List which Workflow Types the candidate registers. Ask the deployment owner which previous worker versions may have produced the histories it receives. Then ask the application owner which branches create materially different side effects or waits. Keep the answers next to the exact task queue and routing policy used in the deployment. A type name by itself can be too broad if separate queues or deployments serve different customer populations. A worker image tag by itself can be too narrow if several revisions have contributed commands to an execution over time.
For each changed path, choose the latest event a fixture needs to contain. If you change the command generated after a particular message, a history that ends while still waiting for that message cannot answer the question. A recent history may nevertheless be useful as an explicit boundary control. Its stated purpose would be to confirm that the candidate can replay the common prefix. Another frozen history should extend beyond the changed command so that a result can settle the compatibility question. The useful distinction is whether the history reached the event, regardless of how recently someone exported it.
A practical inventory distinguishes branch, boundary, and provenance. Record the application's notion of branch, such as reviewer deferral or straight-through acceptance. Record the relevant event type and event identifier from the history. Record the environment, workflow and run identifiers, associated original worker revision, export time, history digest, and fixture format. If the originating revision is uncertain, mark it uncertain. Establish provenance through a controlled fixture generated on a known revision when the historical attribution is material to the release.
Consider a team that randomly exports ten cases from a queue where nearly everything auto-accepts. Its list can include ten valid, useful histories while missing every manual review timer. Ordering those cases by recency does not improve representation of the timer path. Build the first selection around observed differences in commands and state. Use a supplemental recent sample to challenge the inventory. If that sample reveals a previously unknown branch, add it before using the expected list to judge the candidate. Keep superseded lists so someone can see which coverage assumption changed.
Prefer purpose-built histories generated using test data when a production export is unnecessary. Histories can carry Workflow input, message data, and recorded Activity results. Use inspection, retention, and access policies appropriate to those contents. A readable action log or scrubbed summary can help an engineer locate a branch, but a summary cannot stand in for the actual events passed to the replayer. If you transform a fixture under an approved process, give it its own identity and digest. Replay it with the original definition before using it to judge the candidate. Temporal Python testing guide
A worksheet for the first inventory
| Field | Example entry | Why keep it |
|---|---|---|
| Fixture and branch | Review timer still open | Identifies the scenario in language used by the application owner |
| Evidence that it crosses the boundary | Classifier completed and deadline timer recorded | Verifies that the altered code can be exercised |
| Source and artifact | Staging namespace, exact run, original revision, digest | Allows another operator to reconstruct the test input |
| Definition | Registered review Workflow Type | Prevents a test from substituting a different implementation |
| Destination of candidate work | Same queue and version eligibility as the pending release | Explains why the scenario can affect this rollout |
| Requirement | Required while review waits can reach the candidate | Removes ambiguity when a fixture cannot be read |
| Owner on failure | Release engineer with access to the workflow and history source | Makes recovery actionable |
Fill out one row for the smallest high-impact example before trying to capture an entire queue. Read its events alongside the original source code. Confirm whether the feature under change ran, whether it ran more than once, and whether the history proves the observed branch itself or only a prerequisite. It is common for a history to contain several reminders, so name the exact reminder occurrence used for a claim. This gives reviewers a smaller search space if replay fails.
Group identical command paths where you have evidence that distinctions are immaterial. Two customers may receive identical command sequences while their review deadlines and allocated models differ. Both can test data interpretation if their recorded payloads are different. If the deployment affects a shared codec used for those payloads, include the historical formats even when the command path itself is identical. Record why a group needs one or several fixtures so the case set can change when a future release changes the premise.
Preserve an immutable, replayable input
Choose an export method documented for your environment and SDK. The Temporal Python testing documentation shows history replay with the SDK's replayer and a history obtained from a workflow handle. For a release gate, keep the exact exported history used for each comparison. A handle without a pinned Run ID may identify the workflow chain rather than the run you intended to test, and a still-open execution can gain events between reads. Look up the desired Run ID explicitly, record the last observed event, and freeze the exported bytes. Use the same snapshot in the original and candidate comparisons. Temporal Python testing guide
Record an expected digest where the test worker can check it. Compute it over the bytes the worker reads. Packaging and transfer paths often change independently of Workflow code. A report that identifies fixture “review-wait” in both runs does not establish that both worked over the same bytes. A digest and expected event boundary help distinguish a real code difference from a broken input handoff. Return a clear error if a file is absent, empty, truncated, dissociated from its manifest, or parsed as a different Workflow Type.
Do not fetch a new copy of an open run to repair one replay row while continuing to compare against the earlier bytes in the other rows. Save the new history as a separate fixture, examine its boundary, and run the relevant comparisons against the new bytes. If its appended events exercise a useful additional branch, retain both fixtures. Their relationship can be valuable, because a pass on the prefix and failure after the append narrow the area of source code to inspect.
Consider who can re-run the test. An engineer may remember that a staging instance was created using an old model result codec, while a successor only sees the history archive. Record the test harness version, relevant SDK and dependencies, Workflow Definitions registered for replay, and approved codec configuration. Evidence of what version ran can come from an image digest, lockfile fingerprint, or build manifest. Where replay depends on software installed outside the application image, capture that version too. A discrepancy can otherwise be attributed to the wrong release change.
Be explicit about harness identity. The candidate build should be the one going to the eligible workers, or the organization should be able to explain which input substitutions the harness makes and verify that they cannot change the claimed command behavior. Reusing a fixture package across multiple application releases is reasonable when it still exercises every required path. Reusing a previously green report is insufficient if the definitions, SDK, conversion, routing, or expected fixture list changed.
Run three comparisons before signing a release
Start by replaying the required histories against the original Workflow Definitions. A clean baseline demonstrates the runner can map those fixtures to the intended code and process them under the listed configuration. If a baseline fails, diagnose the history identity, registered type, branch, library compatibility, and payload conversion before interpreting the candidate. The logical comparison is between two definitions processing the same eligible input. A broken baseline removes the comparison that would localize a candidate failure.
Next, introduce a small change in isolated test code that the replay check should detect. Pick a fixture where you know the original definition scheduled a review timer. In the controlled test definition, schedule a review-notification Activity at the point where the original recorded the timer. Keep every preceding step stable. The expected mismatch is at the timer boundary. Use a separate harmless test process or package and keep the controlled definition out of worker artifacts. This check examines whether the release test can detect an incompatible change. Temporal Workflow Execution overview
A control that fails during fixture load has not served the purpose of a command-level sensitivity check. Verify that the controlled definition loaded the correct history, registered the intended type, and reached the same prefix as the original. Look at the reproducible mismatch and its underlying event. If the control passes, inspect whether the altered body was really selected and whether the fixture extends across the timer. A documented negative control has both an observed rejection and an explanation tied to the thing the release gate needs to catch.
Finally, run the candidate against every required fixture, including histories from eligible previous worker revisions. Write down success or failure per history. Include a clear state for a fixture that never started, an unknown outcome after a runner interruption, and a fixture excluded with evidence that its historical runs cannot reach the candidate. These distinctions matter when a test system shows green after finishing only the shard that returned results. Reconcile expected and observed lists before using any aggregate to justify promotion.
A staged release with a controlled mismatch
Suppose a catalog team changes its document review path. In the original definition, the classifier runs first. A successful automatic classification goes directly to a final storage Activity. A classification that needs a reviewer starts a deadline timer and waits for approval or expiry. The proposed release adds a notification and changes part of the approval path. The team identifies four required testing boundaries before it exports any histories.
| Fixture | Boundary frozen in the history | Release question answered |
|---|---|---|
| Auto route | Final storage Activity scheduled after automatic approval | Does the common fast path replay under the candidate? |
| Open review | Deadline timer started after classification | Can a pending deadline be reconstructed? |
| Manual approval | Approval arrived and the following completion path began | Does the candidate consume an already recorded approval and retain the next historical command? |
| Expired review | Timer fired and routing to the exception Activity began | Can old timed-out work still progress under the new code? |
All values in this example are illustrative. The original passes all four histories. The deliberately changed test definition fails on Open review at the timer check. The first candidate passes Auto route and Expired review, fails Open review, and does not run Manual approval because that export was truncated during transfer. The release result is two candidate passes out of four required histories, one compatibility failure, and one unavailable input. Running a retry only on the two already successful cases would add confidence in those two paths while leaving the authorization decision exactly where it was.
The useful next step splits by root cause. For Open review, keep the frozen history and identify the changed command. For Manual approval, recover the exact export from its authorized source, or generate a fresh staged case on the original revision with a complete approval boundary. The second action is an evidence repair, so compare the recovered artifact against the original definition before judging the candidate. Keep the two defects separate in the report. A team that records both as “two tests to rerun” will have trouble assigning the work and understanding what new evidence can close each issue.
Assume the developers choose an approach that lets already recorded timers replay through a compatible path. They want to retain the new notification for a path that can actually begin it under the rollout design. They preserve the original fixture set, add a fresh workflow scenario that should exercise the new notification, and run both. Replay verifies that the existing command history matches where required. Staging execution observes that the notification reaches the designated synthetic destination and the customer-facing status is correct. Neither is a substitute for the other. The release packet should contain the result of each claim.
Before reporting success, check the event position on the repaired Manual approval fixture. A file downloaded cleanly can still end before the approval message. In that case the original and candidate may both pass while neither exercised what the inventory says was tested. Confirm the new artifact's identity, the prerequisite events, and the relevant later event. Update the fixture digest and keep the reason for the replacement next to the requirement. Readers should be able to distinguish a verified recovery of qualified evidence from simply reducing the expected test set.
A sensible final report might list four of four required histories replayed, one isolated known bad definition rejected at the timer, and one separate staged execution reaching the notification destination. That is still a bounded example. It supplies results for the frozen branches of the release. A new team reading the report would need the actual inputs, events, evaluator revision, and routing state to reproduce the decision. Treat these synthetic numbers as a model for reporting, rather than a benchmark for the number of histories every release requires.
Interpret failures before changing the candidate
Start by finding the earliest observation in the replay run that differs from its expected value. When the input digest differs, the candidate has not yet been evaluated against the named fixture. When the registered type differs, verify the test runner's binding first. When both are correct and the runner emits a mismatch at a command boundary, compare the recorded event with the command expected from the current and previous source. Keep those diagnoses distinct so a read problem does not cause a speculative code change.
| What you observe | Next action | When the hold can be lifted |
|---|---|---|
| Original and candidate both fail before a known command | Check history identity, serialization, and the harness environment | Known original passes the exact recovered fixture |
| Original passes and candidate fails at a recorded command | Inspect the first mismatch and examine whether old runs can route to the candidate | Compatible path passes, or the affected runs are proved unable to route there |
| Candidate passes a short history that ends before the changed branch | Record the path as unverified and obtain a history that crosses the change | The properly scoped history passes or an evidenced routing exclusion applies |
| Controlled incompatible definition passes | Confirm the expected test definition, event boundary, and asserted failure | The negative control rejects the intended command mismatch |
| Runner terminates before a fixture reports any result | Reconcile test output and exact inputs, then rerun the unresolved fixture | A definitive result is present for the original logical fixture |
| Candidate passes all replay cases but a staged Activity commits an unexpected result | Investigate the Activity or destination contract separately | The destination readback also satisfies its release criterion |
A first mismatch can produce a long stack trace. Expose a concise summary alongside the full diagnostic. An operator should be able to see the candidate revision, replay fixture, Workflow Type, event position, producing revision if known, and which expectation changed. If the replayer reports a category your harness cannot interpret, mark that row unresolved and retain the raw test evidence behind it. Refusing to declare compatibility while the first meaningful difference is unknown gives the team a focused next step.
Verify the same instrument on a stable path after a runner change. If you update the SDK and the candidate Workflow Definition together, a rollback of the workflow can leave the SDK difference in place. Keep a comparison that holds the SDK constant where practical, alongside one tested under the exact release environment. A previous definition passing with the previous SDK plus a candidate failing with the new SDK supplies evidence about the combined change. It leaves the individual contribution uncertain. An additional matched comparison can isolate whether the error comes from workflow logic, dependencies, or data decoding.
Treat repeat runs according to what they can prove. An internal crash before any replay result might call for a bounded retry of the same fixture. A reproducible command mismatch under the same input calls for a compatible change or a different routing decision. If failure disappears across identical signatures without explanation, mark the evidence unstable and look for missing inputs such as unavailable codecs, differing test images, or nonrepeatable application logic. A fresh green aggregate cannot explain what happened to the earlier failing row. Keep the earlier observation and record the discriminator that settled it.
Choose what should happen to the old executions
If the candidate breaks a required history, first decide whether the old executions need to run on it at all. When they do, develop a compatible path and test it with the same frozen history. Temporal's SDK-specific versioning guidance discusses ways to evolve Workflow code. The choice depends on the SDK and the deployment architecture. Follow the documented versioning semantics for the exact worker configuration you intend to use. Temporal Python workflow versioning
Routing can change the required fixture set for a specific rollout. To claim a deliberate exclusion, show that old runs remain eligible for the original compatible workers and cannot be picked up by the incompatible worker. Inspect the actual production routing policy and relevant run cohorts. Test with an existing run in staging under representative routing conditions. If an operator can later change the routing in a way that exposes these histories, write that restriction into the release plan and identify who can authorize the change. Temporal Worker Versioning
A release that directs new work to a new path while preserving old runs can reduce the immediate compatibility burden. It adds an operational burden. Old workers need enough capacity to serve their assigned runs, and the team needs a way to see how many remain, what significant waits they have, and which policy keeps them routed correctly. A run waiting for manual approval for several weeks can outlive the team's expectation that the old release disappears overnight. Keep old-worker retirement as a separate outcome, with its own evidence.
If the recommended change is a compatibility mechanism in the Workflow Definition, capture at least one history from before and one execution that records the relevant new path. A future removal of support for the older path needs evidence about old histories still in circulation. A test today cannot decide when future exposure ends. Maintain a small inventory of compatibility decisions and the condition that will allow each path to be retired. If a long-running run can roll into a fresh history, consider that technique separately and verify its state handoff before using it to reduce exposure to old commands. Sincllm on rolling a workflow into a fresh history
Do not infer the rollback from the forward rollout. If the candidate writes commands that the prior definition cannot replay, moving its newly advanced runs back to the prior worker can fail. State which runs have new histories, which runs have advanced under the new definition, and which worker can receive each of them after rollback. Test the rollback direction where the deployment plan depends on it. When the old definition cannot receive newly advanced histories, the recovery plan may preserve a compatible worker for those runs while shifting only eligible new or untouched work back.
Put the release evidence where another operator can read it
A useful handoff starts with a release revision and a precise question. “Can worker image Mercury receive active review Workflow Executions from deployment Cedar?” can be checked from worker identity, eligible routes, and histories. A reviewer can see if the question shifts across the documents. Record the expected branch set, the reason each branch matters, and the specific routing and worker conditions under which the answer remains valid.
Preserve a compact result for each required input. Include fixture digest, observed boundary, original outcome, controlled mismatch outcome where applicable, candidate outcome, and exact diagnostic or result reference. The negative control may be relevant to one command family even if dozens of fixtures exercise other paths. For a major runner change, choose more than one representative control when failures could arise in different mechanisms, such as command matching and payload decoding. Use the number and type that match your release claims.
Ask the deployment operator to read back the configuration prepared for promotion. Compare the worker artifact identity and routing against the tested plan before increasing eligibility. During an authorized rollout, observe whether candidate workers actually receive the intended category of executions. If the production cohort differs from what was tested, stop and reconcile the affected exposure. A larger fraction of workers successfully polling a queue does not establish that the specific historically risky Workflows resumed safely.
One handoff for a timer change could ask the on-call engineer to verify a designated old run resumes under the planned worker and reaches a subsequent expected state after a benign test event. Mark the environment and the effect scope. Confirm any consequential destination action separately. Review the route and worker from independent evidence of which worker processed the task if your tooling provides it. The important observation is the run's actual progression through the intended path, not a generic absence of alerts after deployment.
If the owner approves an exclusion, record its expiration condition and the exact evidence that supports it. For example, a distinct Task Queue for an isolated new workflow implementation can be a meaningful exclusion only if relevant producers continue to use the intended queues and existing executions remain directed appropriately. Treat a renamed queue in a configuration file as a hypothesis about the deployment until running configuration and routing are inspected. Require approval for the connected rollout change itself under the team's ordinary deployment controls.
Release checklist
- Freeze the candidate image or package and confirm it registers all Workflow Types required for the eligible cohort.
- Inventory changed command paths and identify the exact recorded event needed to test each path.
- Confirm the route for each previous worker version or execution cohort that might reach the candidate.
- Verify history bytes, Run ID, event boundary, and secure handling before replay.
- Run the original definition and diagnose any setup problem before comparing candidate behavior.
- Reject a deliberately incompatible command change at the expected boundary in an isolated harness.
- Reconcile required history IDs with reported results. A skipped, missing, or unresolved required row holds its release path.
- Run independent execution tests for new Activity behavior, fresh branches, and destination effects that replay cannot demonstrate.
- Test the rollback direction wherever earlier code would receive executions that have advanced under the candidate.
- Give the release operator the exact version, configuration, accepted evidence, and stop condition.
Start with one release that changes a known command boundary and one fixture that proves the gate is sensitive. Use the same inventory structure on the next release, then add a new independent fixture chosen from an actual path the baseline inventory missed. This is a useful way to learn whether the process generalizes across changes in Workflow Types, SDK versions, and worker routes. If the receiving release has different assumptions, adjust the inventory before treating the earlier procedure as a reusable approval.
Separate a routing failure from a replay failure in canary
Give the canary an expected cohort before activating it. For the calendar review example, record one older run waiting on approval and one fresh run created under the candidate route. If the older run remains on its designated compatible worker while the fresh run reaches the candidate, this is evidence that the two entry paths behave as planned. It leaves the behavior of any excluded route open. If the older run unexpectedly reaches the candidate, reduce exposure through the approved release control and inspect the actual route. Passing the replay fixture may preserve compatibility in this example, but it cannot make an unintended routing change part of the original release approval.
The other failure is an eligible run reaching the intended candidate and failing its next Workflow Task. Match its run and event position with the frozen fixtures. If its history contains a boundary the tests did not require, add a representative case and reassess the hold. If the same boundary already passed, check whether the production worker loaded the tested artifact, accepted the same payload format, and used the expected SDK configuration. These observations tell the operator whether to revise the test inventory, the packaging, or the rollout itself.
Give every held history a named owner and an observable condition for resuming the rollout. For an unavailable history, the next decision record should contain either a successful replay of the required path or a verified routing restriction that keeps that path off the candidate. Until then, carry the hold in the release summary even if other branches are green.
FAQ
Can I replay closed histories only?
Closed histories can demonstrate useful completed paths and are often convenient to freeze. An open history can be more representative if the rollout will pick up runs that are waiting on a timer or a message. Select whichever inputs reach the relevant boundary and match the exposure. Include both kinds when the release risk spans open waits and already recorded downstream commands.
Will the replayer execute my new model or issue new external requests?
Recorded Workflow history supplies prior outcomes such as an Activity result. API or model behavior performed by Activity code needs an execution test that actually invokes the changed component. For a model and prompt evaluation, run the separate controlled comparison against identical authorized inputs and verify any external effects in a test environment. Sincllm on isolating model regressions
What if the old worker revision is unavailable?
Separate the ability to test candidate replay from the ability to explain a difference relative to the original. A candidate can still be tried against a frozen representative history. If the original cannot be run, the usual matched baseline evidence is missing. Recover a reproducibly built version, find a stable comparable reference with explained scope, or keep the release decision open for the path that depends on the missing comparison. A plan that excludes affected runs needs its own routing proof.
How many histories do I need?
Start from the changed branches and exposure, then add the minimum examples that can distinguish their important behaviors and data formats. One history may cross several boundaries. Many similar histories may cover one. Report both required paths and actual fixture counts, and say how you selected them. The choice is about sensitivity to release failures in your system, rather than reaching a universal number.
Is an automated green report enough to promote?
Check that its expected set matches the freeze, failures could not be silently skipped, and the actual artifact and routing match what the report tested. A meaningful green report shows the original passed, the intentionally incompatible control failed for the intended reason, and the candidate met each applicable criterion. Where the release adds new behavior, carry its integration evidence beside the replay output.
When does a replay result expire?
Re-evaluate when the candidate definition or dependency changes, the relevant routing exposure changes, the expected history set changes, or the harness compatibility assumptions change. A time-based policy can also require fresh verification before a delayed rollout, especially where new old-version histories are still being produced. Preserve the previous result as evidence of the state it evaluated.
sinc-LLM