FAILURE MAP
← Case archive

FA-1226 / Workflow orchestration / Open access

Replay durable workflow history: Replayed code emits a different command kind than history · case 01

The workflow replay operation is admitted even though replayed code emits a different command kind than history.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The admission path omits the command type invariant while validating the other operation preconditions.

VERIFIED REPAIR

Require r['command_type'][0] == r['command_type'][1] together with every other stated precondition before accepting the operation.

Unsuccessful approach: Adding the command type check repairs the reported defect, but replacing the adjacent command order check loses that independent invariant.

Case contract

Return a Boolean admission decision for replay durable workflow history. The record r must satisfy all of: r['command_type'][0] == r['command_type'][1]; r['command_order'][0] == r['command_order'][1]; r['version_marker'][0] in r['version_marker'][1]; r['random_recorded'] is True; r['history_contiguous'] == list(range(len(r['history_contiguous']))). Extra tracing fields are ignored; validation does not mutate the record.

Why this case matters

A deterministic local contract for workflow orchestration. Each negative fixture violates exactly one invariant. No transport timing, persistence, cryptographic verification, or full protocol implementation is claimed.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['command_order'][0] == r['command_order'][1]) and (r['version_marker'][0] in r['version_marker'][1]) and (r['random_recorded'] is True) and (r['history_contiguous'] == list(range(len(r['history_contiguous']))))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'command_type': ['timer', 'timer'], 'command_order': [['a', 'b'], ['a', 'b']], 'version_marker': [2, [1, 2]], 'random_recorded': True, 'history_contiguous': [0, 1, 2]}
check('valid operation', solve(r), True)
check('Replayed code emits a different command kind than history', solve(dict(r, **{'command_type': ['activity', 'timer']})), False)
check('Replayed commands reverse the recorded causal order', solve(dict(r, **{'command_order': [['b', 'a'], ['a', 'b']]})), False)
check('Code executes a branch not selected by the recorded marker', solve(dict(r, **{'version_marker': [3, [1, 2]]})), False)
check('Replay consumes an unrecorded nondeterministic random value', solve(dict(r, **{'random_recorded': False})), False)
check('Replay silently skips a missing history event', solve(dict(r, **{'history_contiguous': [0, 2, 3]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'command_type': ['activity', 'timer'], 'command_order': [['b', 'a'], ['a', 'b']], 'version_marker': [3, [1, 2]], 'random_recorded': False, 'history_contiguous': [0, 2, 3]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
valid operationTrueTruePassed
Replayed code emits a different command kind than historyTrueFalseFailed
Replayed commands reverse the recorded causal orderFalseFalsePassed
Code executes a branch not selected by the recorded markerFalseFalsePassed
Replay consumes an unrecorded nondeterministic random valueFalseFalsePassed
Replay silently skips a missing history eventFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / e7098b5d28652546a4ba258dc1d4173bad1c4c904401b228c0b30872fe07f1d8

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['command_type'][0] == r['command_type'][1]) and (r['version_marker'][0] in r['version_marker'][1]) and (r['random_recorded'] is True) and (r['history_contiguous'] == list(range(len(r['history_contiguous']))))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'command_type': ['timer', 'timer'], 'command_order': [['a', 'b'], ['a', 'b']], 'version_marker': [2, [1, 2]], 'random_recorded': True, 'history_contiguous': [0, 1, 2]}
check('valid operation', solve(r), True)
check('Replayed code emits a different command kind than history', solve(dict(r, **{'command_type': ['activity', 'timer']})), False)
check('Replayed commands reverse the recorded causal order', solve(dict(r, **{'command_order': [['b', 'a'], ['a', 'b']]})), False)
check('Code executes a branch not selected by the recorded marker', solve(dict(r, **{'version_marker': [3, [1, 2]]})), False)
check('Replay consumes an unrecorded nondeterministic random value', solve(dict(r, **{'random_recorded': False})), False)
check('Replay silently skips a missing history event', solve(dict(r, **{'history_contiguous': [0, 2, 3]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'command_type': ['activity', 'timer'], 'command_order': [['b', 'a'], ['a', 'b']], 'version_marker': [3, [1, 2]], 'random_recorded': False, 'history_contiguous': [0, 2, 3]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
valid operationTrueTruePassed
Replayed code emits a different command kind than historyFalseFalsePassed
Replayed commands reverse the recorded causal orderTrueFalseFailed
Code executes a branch not selected by the recorded markerFalseFalsePassed
Replay consumes an unrecorded nondeterministic random valueFalseFalsePassed
Replay silently skips a missing history eventFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 4ad3be5cb65beafc0bb47a23809187898c54fde4e20516a870be1cc6af956c62

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['command_type'][0] == r['command_type'][1]) and (r['command_order'][0] == r['command_order'][1]) and (r['version_marker'][0] in r['version_marker'][1]) and (r['random_recorded'] is True) and (r['history_contiguous'] == list(range(len(r['history_contiguous']))))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'command_type': ['timer', 'timer'], 'command_order': [['a', 'b'], ['a', 'b']], 'version_marker': [2, [1, 2]], 'random_recorded': True, 'history_contiguous': [0, 1, 2]}
check('valid operation', solve(r), True)
check('Replayed code emits a different command kind than history', solve(dict(r, **{'command_type': ['activity', 'timer']})), False)
check('Replayed commands reverse the recorded causal order', solve(dict(r, **{'command_order': [['b', 'a'], ['a', 'b']]})), False)
check('Code executes a branch not selected by the recorded marker', solve(dict(r, **{'version_marker': [3, [1, 2]]})), False)
check('Replay consumes an unrecorded nondeterministic random value', solve(dict(r, **{'random_recorded': False})), False)
check('Replay silently skips a missing history event', solve(dict(r, **{'history_contiguous': [0, 2, 3]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'command_type': ['activity', 'timer'], 'command_order': [['b', 'a'], ['a', 'b']], 'version_marker': [3, [1, 2]], 'random_recorded': False, 'history_contiguous': [0, 2, 3]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
valid operationTrueTruePassed
Replayed code emits a different command kind than historyFalseFalsePassed
Replayed commands reverse the recorded causal orderFalseFalsePassed
Code executes a branch not selected by the recorded markerFalseFalsePassed
Replay consumes an unrecorded nondeterministic random valueFalseFalsePassed
Replay silently skips a missing history eventFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / a4af76672b3655f0e41c6196a5b9d72d57e3863cecf4e51a457754e1c9ec4467

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:00.055801+00:00.

Case digest / 87dd7a68ee33dba3a9febc61274f3e1dad1e4217c82fb9d0baa0f855c74d35be