FA-42745 / Listener lifecycle / Member archive
Composite teardown runs resources in forward acquisition order · case 05
Composite teardown runs resources in forward acquisition order; the returned lifecycle plan violates the stated transition contract.
Case contract
Plan a subscription composite teardown stack. Disposers are [id,already_run] entries and run in reverse acquisition order. Duplicate disposer IDs run at most once, keeping the latest acquisition position. Disposers added after closure run immediately. Teardown failures accumulate without suppressing later cleanup. Ownership transfer removes the transferred disposer from this stack without executing it. The current disposal wave finishes in its existing order; disposers added reentrantly form a subsequent wave in reverse acquisition order. Relinquishing a scope severs only capture references to that exact owner; unrelated receiver captures survive. The already-run projection groups aliases by disposer identity: any completed alias marks the identity completed, preserving first identity order. 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: order = list(dict.fromkeys(r[0] for r in reversed(s['stack']) if not r[1] and r[0]!=s['transfer'])); immediate = [s['added']] if s['closed'] and s['added'] is not None else []; store_added = [s['added']] if not s['closed'] and s['added'] is not None else []; transferred = [r[0] for r in s['stack'] if r[0]==s['transfer']]; retained = [r for r in s['stack'] if r[0]!=s['transfer']]; already_run = [k for k in dict.fromkeys(r[0] for r in s['stack']) if any(r[0]==k and r[1] for r in s['stack'])]; errors = list(s['errors']); reentrant = list(s['wave_remaining'])+list(reversed(s['added_during'])); owner = s['new_owner'] if s['transfer'] is not None else s['owner']; pending = [[r[0],None if r[1]==s['relinquished_owner'] else r[1]] for r in s['captures']]
Why this case matters
Observer implementations need to preserve this state while subscriptions enter, execute, and leave their lifecycle.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| transition 1 | {"already_run": ["b"], "errors": [], "immediate": ["new"], "order": ["a", "c"], "owner": "scope", "pending": [["a", null], ["b", "other"]], "reentrant": ["a", "y", "x"], "retained": [["a", false], ["b", true], ["a", false], ["c", false]], "store_added": [], "transferred": []} | {"already_run": ["b"], "errors": [], "immediate": ["new"], "order": ["c", "a"], "owner": "scope", "pending": [["a", null], ["b", "other"]], "reentrant": ["a", "y", "x"], "retained": [["a", false], ["b", true], ["a", false], ["c", false]], "store_added": [], "transferred": []} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗