FA-41341 / Listener lifecycle / Open access
An already aborted signal acquires a listener hook · case 01
An already aborted signal acquires a listener hook; the returned lifecycle plan violates the stated transition contract.
ROOT CAUSE
The attach decision in the abort-link listener model is computed as s['active'] and not s['hook'], losing a required lifecycle condition.
VERIFIED REPAIR
Compute the attach decision from the complete contract: s['active'] and not s['aborted'] and not s['hook'].
Unsuccessful approach: The partial repair uses not s['aborted'] and not s['hook']; a retained regression distinguishes it from the full transition.
Case contract
Plan linking a subscription to a cancellation signal. Already-aborted signals reject attachment, immediately dispose existing work, and deliver the reason exactly once. A fresh signal attaches one hook only while the subscription is active. Preserve independent signal and subscription ownership; no callback invocation is modeled. Inputs are finite state snapshots, including transitional and stale states; output fields are the exact independent actions/metadata defined by the corrected expression table. Numeric fixture capacities and counts vary with N. Field definitions, each independently computed from the input snapshot: attach = s['active'] and not s['aborted'] and not s['hook']; dispose = s['aborted'] and not s['disposed']; detach = s['hook'] and (s['aborted'] or not s['active']); reason = s['reason'] if s['aborted'] else None; clear_pending = 0 if s['aborted'] else s['pending']; release = s['owns'] and not s['borrowed'] and s['aborted']; notify = s['aborted'] and not s['notified']; accept = s['active'] and not s['disposed'] and not s['aborted']; refcount = max(0,s['refs']-int(s['hook'] and s['aborted'])); terminal = s['disposed'] or s['aborted']
Why this case matters
Observer implementations need to preserve this state while subscriptions enter, execute, and leave their lifecycle.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'attach': s['active'] and not s['hook'],
'dispose': s['aborted'] and not s['disposed'],
'detach': s['hook'] and (s['aborted'] or not s['active']),
'reason': s['reason'] if s['aborted'] else None,
'clear_pending': 0 if s['aborted'] else s['pending'],
'release': s['owns'] and not s['borrowed'] and s['aborted'],
'notify': s['aborted'] and not s['notified'],
'accept': s['active'] and not s['disposed'] and not s['aborted'],
'refcount': max(0,s['refs']-int(s['hook'] and s['aborted'])),
'terminal': s['disposed'] or s['aborted'],
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 2, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 2, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 1, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 2, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 2, 'release': False, 'notify': False, 'accept': False, 'refcount': 2, 'terminal': True}), ({'aborted': True, 'active': False, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': False, 'reason': None, 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': True, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': True, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 2, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 2, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 2, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 1, 'terminal': True})], 2: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 4, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': None, 'owns': False, 'pending': 4, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 4, 'notified': False, 'borrowed': True}, {'attach': True, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 4, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 4, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': True, 'notify': False, 'accept': False, 'refcount': 4, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 4, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 4, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 4, 'refs': 4, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 3, 'terminal': True})], 3: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 6, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 6, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 6, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 6, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 6, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 5, 'terminal': True})], 4: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 8, 'notified': True, 'borrowed': True}, {'attach': True, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 8, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': None, 'owns': False, 'pending': 8, 'refs': 0, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': True, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 8, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': None, 'owns': True, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 8, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 8, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 8, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 7, 'terminal': True})], 5: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 10, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 10, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 10, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 10, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 9, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 10, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 10, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 10, 'refs': 10, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 9, 'terminal': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), expected)
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 |
|---|---|---|---|
| transition 0 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': True, 'notify': False, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': True, 'notify': False, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 1 | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 2 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': None, 'refcount': 1, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': None, 'refcount': 1, 'release': False, 'terminal': True} | Passed |
| transition 3 | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': True, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': True, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': True} | Passed |
| transition 4 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 5 | {'accept': False, 'attach': True, 'clear_pending': 0, 'detach': False, 'dispose': True, 'notify': True, 'reason': None, 'refcount': 0, 'release': True, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': True, 'notify': True, 'reason': None, 'refcount': 0, 'release': True, 'terminal': True} | Failed |
| transition 6 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': False} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': False} | Passed |
| transition 7 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': False} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': False} | Passed |
| transition 8 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': False, 'reason': 'cancel', 'refcount': 1, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': False, 'reason': 'cancel', 'refcount': 1, 'release': False, 'terminal': True} | Passed |
SHA-256 / af169829397a1d9ced9e1705b7ba25b3f14ccf248daff46955a12b47b66bfa64
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'attach': not s['aborted'] and not s['hook'],
'dispose': s['aborted'] and not s['disposed'],
'detach': s['hook'] and (s['aborted'] or not s['active']),
'reason': s['reason'] if s['aborted'] else None,
'clear_pending': 0 if s['aborted'] else s['pending'],
'release': s['owns'] and not s['borrowed'] and s['aborted'],
'notify': s['aborted'] and not s['notified'],
'accept': s['active'] and not s['disposed'] and not s['aborted'],
'refcount': max(0,s['refs']-int(s['hook'] and s['aborted'])),
'terminal': s['disposed'] or s['aborted'],
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 2, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 2, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 1, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 2, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 2, 'release': False, 'notify': False, 'accept': False, 'refcount': 2, 'terminal': True}), ({'aborted': True, 'active': False, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': False, 'reason': None, 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': True, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': True, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 2, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 2, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 2, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 1, 'terminal': True})], 2: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 4, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': None, 'owns': False, 'pending': 4, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 4, 'notified': False, 'borrowed': True}, {'attach': True, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 4, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 4, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': True, 'notify': False, 'accept': False, 'refcount': 4, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 4, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 4, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 4, 'refs': 4, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 3, 'terminal': True})], 3: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 6, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 6, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 6, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 6, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 6, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 5, 'terminal': True})], 4: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 8, 'notified': True, 'borrowed': True}, {'attach': True, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 8, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': None, 'owns': False, 'pending': 8, 'refs': 0, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': True, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 8, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': None, 'owns': True, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 8, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 8, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 8, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 7, 'terminal': True})], 5: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 10, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 10, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 10, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 10, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 9, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 10, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 10, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 10, 'refs': 10, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 9, 'terminal': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), expected)
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 |
|---|---|---|---|
| transition 0 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': True, 'notify': False, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': True, 'notify': False, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 1 | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 2 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': None, 'refcount': 1, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': None, 'refcount': 1, 'release': False, 'terminal': True} | Passed |
| transition 3 | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': True, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': True, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': True} | Passed |
| transition 4 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 5 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': True, 'notify': True, 'reason': None, 'refcount': 0, 'release': True, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': True, 'notify': True, 'reason': None, 'refcount': 0, 'release': True, 'terminal': True} | Passed |
| transition 6 | {'accept': False, 'attach': True, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': False} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': False} | Failed |
| transition 7 | {'accept': False, 'attach': True, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': False} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': False} | Failed |
| transition 8 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': False, 'reason': 'cancel', 'refcount': 1, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': False, 'reason': 'cancel', 'refcount': 1, 'release': False, 'terminal': True} | Passed |
SHA-256 / 09a4cc978714d98d20f99f8aa4ebbfdbb7e646e348984184ce32e0e218579993
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'attach': s['active'] and not s['aborted'] and not s['hook'],
'dispose': s['aborted'] and not s['disposed'],
'detach': s['hook'] and (s['aborted'] or not s['active']),
'reason': s['reason'] if s['aborted'] else None,
'clear_pending': 0 if s['aborted'] else s['pending'],
'release': s['owns'] and not s['borrowed'] and s['aborted'],
'notify': s['aborted'] and not s['notified'],
'accept': s['active'] and not s['disposed'] and not s['aborted'],
'refcount': max(0,s['refs']-int(s['hook'] and s['aborted'])),
'terminal': s['disposed'] or s['aborted'],
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 2, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 2, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 1, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 2, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 2, 'release': False, 'notify': False, 'accept': False, 'refcount': 2, 'terminal': True}), ({'aborted': True, 'active': False, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': False, 'reason': None, 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': True, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': True, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 2, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 2, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 2, 'refs': 2, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 1, 'terminal': True})], 2: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 4, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': None, 'owns': False, 'pending': 4, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 4, 'notified': False, 'borrowed': True}, {'attach': True, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 4, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 4, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': True, 'notify': False, 'accept': False, 'refcount': 4, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 4, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 4, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 4, 'refs': 4, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 3, 'terminal': True})], 3: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 6, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 6, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 6, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 6, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 6, 'refs': 6, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 5, 'terminal': True})], 4: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 8, 'notified': True, 'borrowed': True}, {'attach': True, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 8, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': None, 'owns': False, 'pending': 8, 'refs': 0, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': True, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 8, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': None, 'owns': True, 'pending': 0, 'refs': 0, 'notified': True, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 8, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 8, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 8, 'refs': 8, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 7, 'terminal': True})], 5: [({'aborted': True, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 10, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': False, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': False, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 10, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': False, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 10, 'terminal': True}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': False, 'pending': 0, 'refs': 10, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': True, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': True, 'accept': False, 'refcount': 9, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': True, 'reason': None, 'owns': True, 'pending': 0, 'refs': 10, 'notified': False, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 10, 'terminal': True}), ({'aborted': False, 'active': False, 'hook': True, 'disposed': False, 'reason': 'cancel', 'owns': True, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': True, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': False, 'active': False, 'hook': False, 'disposed': False, 'reason': None, 'owns': False, 'pending': 0, 'refs': 0, 'notified': False, 'borrowed': False}, {'attach': False, 'dispose': False, 'detach': False, 'reason': None, 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 0, 'terminal': False}), ({'aborted': True, 'active': True, 'hook': True, 'disposed': True, 'reason': 'cancel', 'owns': True, 'pending': 10, 'refs': 10, 'notified': True, 'borrowed': True}, {'attach': False, 'dispose': False, 'detach': True, 'reason': 'cancel', 'clear_pending': 0, 'release': False, 'notify': False, 'accept': False, 'refcount': 9, 'terminal': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), expected)
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 |
|---|---|---|---|
| transition 0 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': True, 'notify': False, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': True, 'notify': False, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 1 | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 2 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': None, 'refcount': 1, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': None, 'refcount': 1, 'release': False, 'terminal': True} | Passed |
| transition 3 | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': True, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 2, 'detach': True, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': True} | Passed |
| transition 4 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': True, 'reason': 'cancel', 'refcount': 0, 'release': False, 'terminal': True} | Passed |
| transition 5 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': True, 'notify': True, 'reason': None, 'refcount': 0, 'release': True, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': True, 'notify': True, 'reason': None, 'refcount': 0, 'release': True, 'terminal': True} | Passed |
| transition 6 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': False} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 2, 'release': False, 'terminal': False} | Passed |
| transition 7 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': False} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': False, 'dispose': False, 'notify': False, 'reason': None, 'refcount': 0, 'release': False, 'terminal': False} | Passed |
| transition 8 | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': False, 'reason': 'cancel', 'refcount': 1, 'release': False, 'terminal': True} | {'accept': False, 'attach': False, 'clear_pending': 0, 'detach': True, 'dispose': False, 'notify': False, 'reason': 'cancel', 'refcount': 1, 'release': False, 'terminal': True} | Passed |
SHA-256 / 0fe56b01b12d0fdac4ef9f8107dd093d9cd600818d41d24ecb39ffad3623301f
Verification & scope
A deterministic, bounded, single-threaded transition planner. Returned plans model state changes; they do not implement a production event framework. 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:43:40.068212+00:00.
Case digest / 0f8599c2e3690c3938cea9bf055ef85b613847b5f9facc21354b2fbb846b1951