FA-1146 / Workflow orchestration / Open access
Accept a durable activity completion: A duplicate activity completion schedules downstream work twice · case 01
The activity completion operation is admitted even though a duplicate activity completion schedules downstream work twice.
ROOT CAUSE
The admission path omits the completion pending invariant while validating the other operation preconditions.
VERIFIED REPAIR
Require r['completion_pending'] == 'pending' together with every other stated precondition before accepting the operation.
Unsuccessful approach: Adding the completion pending check repairs the reported defect, but replacing the adjacent run identity check loses that independent invariant.
Case contract
Return a Boolean admission decision for accept a durable activity completion. The record r must satisfy all of: r['run_identity'][0] == r['run_identity'][1]; r['activity_attempt'][0] == r['activity_attempt'][1]; r['activity_scheduled'][0] in r['activity_scheduled'][1]; set(r['result_schema'][0]) <= set(r['result_schema'][1]); r['completion_pending'] == 'pending'. 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['run_identity'][0] == r['run_identity'][1]) and (r['activity_attempt'][0] == r['activity_attempt'][1]) and (r['activity_scheduled'][0] in r['activity_scheduled'][1]) and (set(r['result_schema'][0]) <= set(r['result_schema'][1]))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'run_identity': ['r2', 'r2'], 'activity_attempt': [3, 3], 'activity_scheduled': ['a', ['a', 'b']], 'result_schema': [['receipt'], ['receipt']], 'completion_pending': 'pending'}
check('valid operation', solve(r), True)
check('A completion from a previous workflow run is accepted', solve(dict(r, **{'run_identity': ['r1', 'r2']})), False)
check('A timed-out activity attempt overwrites its successor', solve(dict(r, **{'activity_attempt': [2, 3]})), False)
check('An unsolicited completion invents an unscheduled activity', solve(dict(r, **{'activity_scheduled': ['c', ['a', 'b']]})), False)
check('An incompatible activity result enters durable history', solve(dict(r, **{'result_schema': [['receipt'], ['error']]})), False)
check('A duplicate activity completion schedules downstream work twice', solve(dict(r, **{'completion_pending': 'completed'})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'run_identity': ['r1', 'r2'], 'activity_attempt': [2, 3], 'activity_scheduled': ['c', ['a', 'b']], 'result_schema': [['receipt'], ['error']], 'completion_pending': 'completed'}
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| A completion from a previous workflow run is accepted | False | False | Passed |
| A timed-out activity attempt overwrites its successor | False | False | Passed |
| An unsolicited completion invents an unscheduled activity | False | False | Passed |
| An incompatible activity result enters durable history | False | False | Passed |
| A duplicate activity completion schedules downstream work twice | True | False | Failed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / 7fe30ff76222eeb11727f94a1c519773bc158af18f096200eb0269db38a3b65b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['activity_attempt'][0] == r['activity_attempt'][1]) and (r['activity_scheduled'][0] in r['activity_scheduled'][1]) and (set(r['result_schema'][0]) <= set(r['result_schema'][1])) and (r['completion_pending'] == 'pending')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'run_identity': ['r2', 'r2'], 'activity_attempt': [3, 3], 'activity_scheduled': ['a', ['a', 'b']], 'result_schema': [['receipt'], ['receipt']], 'completion_pending': 'pending'}
check('valid operation', solve(r), True)
check('A completion from a previous workflow run is accepted', solve(dict(r, **{'run_identity': ['r1', 'r2']})), False)
check('A timed-out activity attempt overwrites its successor', solve(dict(r, **{'activity_attempt': [2, 3]})), False)
check('An unsolicited completion invents an unscheduled activity', solve(dict(r, **{'activity_scheduled': ['c', ['a', 'b']]})), False)
check('An incompatible activity result enters durable history', solve(dict(r, **{'result_schema': [['receipt'], ['error']]})), False)
check('A duplicate activity completion schedules downstream work twice', solve(dict(r, **{'completion_pending': 'completed'})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'run_identity': ['r1', 'r2'], 'activity_attempt': [2, 3], 'activity_scheduled': ['c', ['a', 'b']], 'result_schema': [['receipt'], ['error']], 'completion_pending': 'completed'}
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| A completion from a previous workflow run is accepted | True | False | Failed |
| A timed-out activity attempt overwrites its successor | False | False | Passed |
| An unsolicited completion invents an unscheduled activity | False | False | Passed |
| An incompatible activity result enters durable history | False | False | Passed |
| A duplicate activity completion schedules downstream work twice | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / 8464a8becff3db8695f66b366163d6b63aa0309ce0944b8be7d914eb24ba64e3
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['run_identity'][0] == r['run_identity'][1]) and (r['activity_attempt'][0] == r['activity_attempt'][1]) and (r['activity_scheduled'][0] in r['activity_scheduled'][1]) and (set(r['result_schema'][0]) <= set(r['result_schema'][1])) and (r['completion_pending'] == 'pending')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'run_identity': ['r2', 'r2'], 'activity_attempt': [3, 3], 'activity_scheduled': ['a', ['a', 'b']], 'result_schema': [['receipt'], ['receipt']], 'completion_pending': 'pending'}
check('valid operation', solve(r), True)
check('A completion from a previous workflow run is accepted', solve(dict(r, **{'run_identity': ['r1', 'r2']})), False)
check('A timed-out activity attempt overwrites its successor', solve(dict(r, **{'activity_attempt': [2, 3]})), False)
check('An unsolicited completion invents an unscheduled activity', solve(dict(r, **{'activity_scheduled': ['c', ['a', 'b']]})), False)
check('An incompatible activity result enters durable history', solve(dict(r, **{'result_schema': [['receipt'], ['error']]})), False)
check('A duplicate activity completion schedules downstream work twice', solve(dict(r, **{'completion_pending': 'completed'})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'run_identity': ['r1', 'r2'], 'activity_attempt': [2, 3], 'activity_scheduled': ['c', ['a', 'b']], 'result_schema': [['receipt'], ['error']], 'completion_pending': 'completed'}
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| A completion from a previous workflow run is accepted | False | False | Passed |
| A timed-out activity attempt overwrites its successor | False | False | Passed |
| An unsolicited completion invents an unscheduled activity | False | False | Passed |
| An incompatible activity result enters durable history | False | False | Passed |
| A duplicate activity completion schedules downstream work twice | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / c39ba7de8344a2e46d65b9212399f6a99908626f6f026316dea695596c517697
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:36:59.228423+00:00.
Case digest / 25194abbff89007c00fce2ecbd751c8ff5f894053febbf53130cf2b6fcee49f6