|
| 1 | +# CR-223 receipt assertion handoff |
| 2 | + |
| 3 | +Worktree: `~/.local/state/pineforge-top-core/lanes/core-cr223-receipts/wt` |
| 4 | +Branch: `core/cr223-receipts` |
| 5 | +Base: `7d79006208666dcd05c04e441316c37eb01b9c20` |
| 6 | + |
| 7 | +## Inventory recorded before fixture edits |
| 8 | + |
| 9 | +All locations in this inventory refer to the base above. The three requested |
| 10 | +fixtures were read in full. Searches covered the whole `tests/` and `scripts/` |
| 11 | +trees, including `receipts[`, `sorted(receipts)`, `== original`, HTTP receiver |
| 12 | +definitions, and comparisons/slices of `received`, `received_bytes`, `rows`, |
| 13 | +`attempts`, and `effects`. |
| 14 | + |
| 15 | +| Site | Existing comparison and disposition | |
| 16 | +| --- | --- | |
| 17 | +| `tests/native_live_service_e2e.py:41` | Collects `(Idempotency-Key, raw body)` receipts; body contains the service's `sequence`. | |
| 18 | +| `tests/native_live_service_e2e.py:296`, `:297`, `:299` | Four completed failures/four HTTP receipts; snapshots by sorting whole tuples. Replace snapshot with a unique sequence index retaining the complete tuple. | |
| 19 | +| `tests/native_live_service_e2e.py:310`, `:311`, `:313`, `:314` | Four selected/completed replays and eight total receipts; compares the replay phase with the original by sorting. Keep every count and compare complete sequence-indexed tuples. | |
| 20 | +| `tests/native_live_service_e2e.py:320` | Duplicate control request must leave four completed attempts. Preserve. | |
| 21 | +| `tests/native_live_service_e2e.py:322`, `:324`, `:326`, `:327` | `--from 4` selects one completion/nine total receipts; last receipt merely belongs to original. Compare the whole replay phase to the exact sequence-selected original subset. | |
| 22 | +| `tests/native_live_service_e2e.py:346`, `:348`, `:351` | No-op/restart must leave audit rows unchanged and nine receipts; offline replay produces ten. Preserve counts and audit equality. | |
| 23 | +| `tests/native_live_routing_e2e.py:158`, `:163`, `:166`, `:170` | Attempt history already selects the action by payload sequence, then checks that action's attempt/phase/backoff order. Preserve chronological checks within one action. | |
| 24 | +| `tests/native_live_routing_e2e.py:229`, `:236` | Journal/actions-follow output is a serial export ordered by ledger ordinal, not HTTP receipts. Preserve. | |
| 25 | +| `tests/native_live_routing_e2e.py:253`, `:265`, `:280`, `:331` | Target receipt counts, replay immutability, and four-way delivery barrier. Preserve all counts and the barrier. | |
| 26 | +| `tests/native_live_routing_e2e.py:347`, `:348`, `:351`, `:352`, `:374`, `:378`, `:379`, `:384`, `:391` | Retry/redelivery checks already filter by action sequence and compare bodies/keys; preserve those checks. | |
| 27 | +| `tests/native_live_routing_e2e.py:414`, `:415`, `:418`, `:419`, `:420`, `:423` | Keep-alive replay already compares exact bytes by idempotency key, with four unique deliveries and one completion per action. Preserve. | |
| 28 | +| `tests/native_live_routing_e2e.py:450`, `:476`, `:501`, `:523` | Sequence-filtered retry count, timeout/disconnect counts, and immutable ledger snapshots. Preserve. | |
| 29 | +| `tests/native_live_routing_e2e.py:557`, `:558`, `:560` | Crash recovery compares HTTP arrival sequence list to `[1,2,3,4]`. Compare unique sequence-indexed complete bodies to ledger payloads; keep four receipts and stored-state equality. | |
| 30 | +| `tests/native_live_equivalence_e2e.py:414`, `:415`, `:417` | Complete contiguous sequences and unique event IDs. Retain exact coverage and reject duplicate sequences before indexing. | |
| 31 | +| `tests/native_live_equivalence_e2e.py:424`, `:430`, `:432`, `:435` | Header/body identity, exact retry bytes, first-attempt arrival list, and complete effect/body equality. Preserve identity/bytes/coverage; key first attempts/effects by sequence. | |
| 32 | +| `tests/native_live_equivalence_e2e.py:438`, `:444`, `:445` | First-pass effects must arrive in order. Replace arrival-order assumptions with sequence-keyed payload/coverage assertions. | |
| 33 | +| `tests/native_live_equivalence_e2e.py:447`, `:451`, `:456`, `:459`, `:460` | Known redelivery selection and validated invocation boundaries. Keep boundaries; slices describe process phases, not submission sequence. | |
| 34 | +| `tests/native_live_equivalence_e2e.py:461`, `:463`, `:465`, `:467`, `:470`, `:474`, `:476`, `:478` | Redelivery attempts/effects and non-redelivered effects are compared by arrival order. Compare by sequence, preserving success provenance, selection, and exact payload equality. | |
| 35 | +| `tests/native_live_equivalence_e2e.py:485` | Ack-loss replay must have a successful attempt after the restart boundary. Preserve. | |
| 36 | +| `tests/native_live_equivalence_e2e.py:528`, `:529` | Chooses crash action by number of completed effects, not submission sequence. Withhold acknowledgement for the requested payload sequence instead. | |
| 37 | +| `tests/native_live_equivalence_e2e.py:710`, `:712`, `:719`, `:720`, `:723` | Full modeled action equality, fail-first count per event, and positional crash-effect lookup. Keep comparisons/counts; look up the crashed action by its sequence. | |
| 38 | +| `tests/native_live_e2e.py:28`, `:117`, `:118`, `:120`, `:123`, `:126`, `:131`, `:141`, `:149`, `:151`, `:224`, `:226`, `:244` | Existing helper already sorts specifically by sequence for complete payload comparisons. Retain sequence ordering and add duplicate rejection. | |
| 39 | +| `tests/native_live_e2e.py:159`, `:160`, `:162`, `:169`, `:170` | Failed-only replay compares receipt at append position four to position zero. Determine failed sequence from the ledger; compare the complete indexed replay phase and preserve counts/unique IDs. | |
| 40 | +| `tests/native_live_e2e.py:192`, `:194`, `:201` | Same positional failure in batch replay. Apply the same ledger-sequence selection, exact payload equality, and receipt count checks. | |
| 41 | +| `tests/native_live_startup_e2e.py:263`, `:268`, `:269` | Two failed receipts; assumes receipt zero is ledger event zero. Compare the entire raw-byte receipt set to ledger payloads by payload sequence. | |
| 42 | +| `tests/native_live_startup_e2e.py:275`, `:282`, `:283`, `:288` | Two initial/four total receipts; compares first receipt to replay position two and replay array to ledger array. Keep counts; compare complete raw payloads by sequence. | |
| 43 | +| `tests/native_live_startup_e2e.py:299`, `:303`, `:304` | Idle replay compares the same append-only receipt buffer to its snapshot plus exact ledger rows. This detects any added request, not relative arrival order; preserve. | |
| 44 | +| `tests/native_live_genuine_retry_e2e.py:43`, `:47`, `:50`, `:51` | Complete invocation-boundary checks and phase slices. Preserve; these are process boundaries, not submission positions. | |
| 45 | +| `tests/native_live_genuine_retry_e2e.py:52`, `:53`, `:55`, `:56`, `:59`, `:60`, `:64` | Requires phase/redelivery/first-pass arrival order and matches effects to successful attempts. Compare exact phase effects to new successful payloads by sequence, retaining boundaries and success provenance. | |
| 46 | +| `tests/native_live_genuine_retry_e2e.py:80`, `:82`, `:106`, `:107` | Full modeled action equality and exact fail-first multiplicity. Preserve. | |
| 47 | +| `tests/native_live_genuine_retry_e2e.py:94`, `:95`, `:96`, `:102` | Process cost receipts, ordered synchronously with launches and keyed additionally by command/PID. No service request sequence exists or is needed here; these are not delivery receipts. Preserve. | |
| 48 | +| `tests/native_live_tick_tape.py:390`, `:391`, `:400`, `:401` | Uses the shared equivalence receipt assertion and exact modeled actions/fail-first coverage. Inherits its sequence fix; preserve comparisons. | |
| 49 | +| `tests/test_native_live_equivalence_harness.py:85`, `:87`, `:97`, `:108`, `:118`, `:124`, `:126`, `:132`, `:135`, `:140`, `:149`, `:152`, `:158`, `:161`, `:169`, `:174`, `:187`, `:190`, `:200`, `:207`, `:209`, `:211` | Self-tests pin arrival-order rejections alongside bytes/keys/unique coverage/boundary/restart checks. Update order expectations to accept permutations and retain/add negative coverage for changed payloads, keys, sequences, counts, phase attribution, and replay. | |
| 50 | +| `tests/live_phase_a_migration.py:64`, `:65`, `:66`, `:74` | Already compares exact sequence population `[2,3,4]`, selects recovered sequence 2, and checks exact event ID/raw payload/count. Preserve. | |
| 51 | +| `tests/native_live_websocket_e2e.py:139`, `:142`, `:144`, `:145`, `:148`, `:169` | Every case requires zero or exactly one receipt. Singleton indexing follows the exact count, with no multi-request order assumption. Preserve finality assertions. | |
| 52 | +| `tests/native_live_chart_calendar_e2e.py:119`, `:133`, `:154`, `:168`, `:173`, `:174` | Calendar result summaries, not service request receipts; no receipt-array equality. Preserve. | |
| 53 | +| `tests/native_live_tick_oracle.py:125`, `:127`, `:130`, `:132` | Synchronous engine execution observations matched by order identity; not concurrent HTTP completion. Preserve. | |
| 54 | +| `tests/native_live_chart_input_e2e.py:231` | `== original` compares ledger file bytes. Not delivery receipts; preserve. | |
| 55 | + |
| 56 | +Other whole-tree literal hits are synchronous C++ event tapes or unrelated |
| 57 | +state assertions, not live service delivery receipts: |
| 58 | + |
| 59 | +- `tests/test_native_resting_replay_contract.cpp:1697`, `:1698` (one event). |
| 60 | +- `tests/test_native_execution_terms.cpp:811`, `:812`, `:1032`, `:1033`, |
| 61 | + `:1034`, `:1062`, `:1063`, `:1064`, `:1330`, `:1331`, `:1344`, `:1345`, |
| 62 | + `:1346`, `:1374`, `:1375`, `:1383`, `:1384`, `:1385`, `:1427`, `:1428`, |
| 63 | + `:1441`, `:1442`, `:1443`, `:1700`, `:1937`, `:1983` (native event order). |
| 64 | +- `tests/native_order_full_fold.hpp:557`, `:558`, `:559`, `:560` (state hashing). |
| 65 | +- `tests/test_native_definition_index.cpp:426` (last synchronous event). |
| 66 | +- `tests/test_native_group_keep_handle.cpp:831`, `:832`, `:896`, `:916`, |
| 67 | + `:1506` (counts and complete synchronous snapshots). |
| 68 | +- `tests/test_settlement_observation_boundary.cpp:438`, |
| 69 | + `tests/test_native_order_core.cpp:708`, `tests/test_market_admission_state.cpp:70`, |
| 70 | + `tests/test_pending_placement_receipts.cpp:105`, and twin-parity inventory |
| 71 | + mirrors (`tests/twin_parity_base.json:18072`, `:20857`, `:27346`; |
| 72 | + `tests/twin_parity_ledger.md:157`, `:263`, `:464`) compare engine state/handles. |
| 73 | +- `scripts/` has ABI/compiler/process/CI receipt dictionaries and source-checker |
| 74 | + rows, but no additional concurrent HTTP delivery receipt-array comparisons. |
| 75 | + HTTP receiver search also inspected `tests/checked_settings_e2e.py:17`, `:48`, |
| 76 | + `:88` and `tests/strategy_capabilities_e2e.py:18`, `:71`, `:78`, `:89`. |
| 77 | + These collect only request-path markers and assert absence/presence, with no |
| 78 | + positional receipt comparison. They have no service sequence in their marker |
| 79 | + arrays; no sequence is needed for their existing absence/presence assertions. |
| 80 | + |
| 81 | +No affected HTTP fixture lacks a service sequence: each raw delivery body has |
| 82 | +`sequence`. No synthetic replacement sequence is needed. |
| 83 | + |
| 84 | +## Execution constraints |
| 85 | + |
| 86 | +No tests, builds, preflight, corpus, or benchmarks may run on this Mac, per the |
| 87 | +explicit task brief. Verification is pending supervisor lab proof on the exact |
| 88 | +committed tree; no runtime PASS is claimed. Production and runner files are |
| 89 | +outside scope. `REPORT.md` and `DONE` are the explicitly requested handoff files. |
| 90 | + |
| 91 | +## Implementation and assertion strength |
| 92 | + |
| 93 | +Implementation HEAD: `f6a72083b5b9a44b13c0549ae59faece8b5b81dd` |
| 94 | +(`test(live): match delivery receipts by request sequence`). The following |
| 95 | +handoff commit adds only this report and `DONE`; its exact HEAD is supplied in |
| 96 | +the executor's final response. Supervisor proof must use that final HEAD. |
| 97 | + |
| 98 | +- `tests/native_live_receipts.py:4` builds a sequence index of complete receipts |
| 99 | + and raises on duplicates before any dictionary overwrite can hide a receipt. |
| 100 | + It never derives a sequence from append position. |
| 101 | +- Service redelivery (`tests/native_live_service_e2e.py:302`, `:319`, `:335`, |
| 102 | + `:360`) compares the entire idempotency-key/raw-body tuple by sequence. |
| 103 | + Counts remain four failures, four selected/completed full replays, eight |
| 104 | + receipts, one selected/completed `--from` replay, nine receipts, and ten |
| 105 | + after offline replay. Duplicate-control/audit/restart checks remain. The |
| 106 | + original membership assertion for selected redelivery is strengthened to |
| 107 | + equality against precisely the original sequences at or above `--from`. |
| 108 | +- Basic live retry (`tests/native_live_e2e.py:168`, `:177`, `:206`, `:215`) |
| 109 | + obtains the failed request's sequence from the actual ledger. It compares |
| 110 | + the complete replay receipt to that exact original payload, keeping four |
| 111 | + initial receipts/four unique event IDs and explicitly requiring five after |
| 112 | + each one-request replay. The existing sequence ordering helper now also |
| 113 | + rejects duplicates. |
| 114 | +- Startup (`tests/native_live_startup_e2e.py:271`, `:287`, `:293`) compares |
| 115 | + complete raw UTF-8 payloads to ledger payloads by sequence in both phases. |
| 116 | + It keeps the two/four receipt counts, attempt counts, identities, physical |
| 117 | + action/trade assertions, and idle replay immutability. Raw equality now |
| 118 | + covers both original failed payloads instead of only the first arrival. |
| 119 | +- Routing recovery (`tests/native_live_routing_e2e.py:558`) still requires four |
| 120 | + receipts with sequences 1 through 4 and unchanged ledger snapshots, and |
| 121 | + additionally requires exact raw-body equality to all pre-crash ledger |
| 122 | + payloads by sequence. Existing sequence-filtered retry and key/body checks, |
| 123 | + the concurrency barrier, and attempt/backoff chronology are unchanged. |
| 124 | +- Equivalence (`tests/native_live_equivalence_e2e.py:416`) keeps contiguous |
| 125 | + complete sequences, unique event IDs, every header/idempotency check, exact |
| 126 | + retry bytes, and full effect-versus-delivery payload equality. First attempts |
| 127 | + and effects must have equal sequence populations and equal complete payloads. |
| 128 | + Canonical engine comparison order is obtained by looking up those sequences. |
| 129 | + Redelivery retains known-event and invocation-boundary checks, compares each |
| 130 | + phase's entire new-effect map to new successful attempt payloads, and requires |
| 131 | + the final invocation to replay the full selected sequence population. |
| 132 | +- The equivalence crash gate (`tests/native_live_equivalence_e2e.py:532`) |
| 133 | + withholds acknowledgement for `restart_action`'s actual payload sequence. |
| 134 | + Its post-restart successful replay check (`:726`) looks up that same sequence, |
| 135 | + regardless of how many later submissions completed before it. |
| 136 | +- Genuine retry (`tests/native_live_genuine_retry_e2e.py:42`) validates all |
| 137 | + invocation boundaries first, then compares each complete phase effect map |
| 138 | + to precisely the new successful payloads keyed by sequence. It also applies |
| 139 | + the shared complete-population/body/key checks before comparing phases. |
| 140 | + Modeled actions, hashes, fail-first multiplicity, and process/PID receipts |
| 141 | + remain checked. The tick-tape caller inherits the same shared receipt fix; |
| 142 | + its delivery-policy metadata now accurately states eight requests in flight. |
| 143 | +- Harness self-tests (`tests/test_native_live_equivalence_harness.py:102`) |
| 144 | + accept arrival permutations while retaining full expected payload equality. |
| 145 | + Existing negative coverage for bytes, keys, unique/count-complete effects, |
| 146 | + boundaries, and post-restart success remains. Added negative cases cover |
| 147 | + missing final selections, sequence gaps/aliases, missing first attempts, |
| 148 | + duplicate event IDs, changed effects, and effects attributed to the wrong |
| 149 | + invocation. These tests were edited and reviewed, not executed on this Mac. |
| 150 | + |
| 151 | +Remaining receipt slices delimit fully counted process/delivery phases: |
| 152 | +`receipts[4:]`, `[8:]`, `[9:]`, `received[4:]`, `received_bytes[2:]`, and the |
| 153 | +recorded invocation boundaries. They never select the first N submissions or |
| 154 | +the crash request. Every comparison within a phase is keyed by service sequence. |
| 155 | + |
| 156 | +## Concurrency and scope notes |
| 157 | + |
| 158 | +The base had `max_in_flight=2` in the service fixture and `1` in the shared |
| 159 | +equivalence receiver. Both are now **8**. Existing routing concurrency/isolation |
| 160 | +settings remain **8**. No concurrency limit was lowered and no equality was |
| 161 | +replaced by membership. |
| 162 | + |
| 163 | +Three routing scenarios already used `1` at base lines 407, 529, and 583: |
| 164 | +keep-alive connection reuse, a crash with exactly one started/uncompleted |
| 165 | +attempt, and fatal-drain one-request accounting. Those settings and their |
| 166 | +existing assertions are unchanged. The CR-223 fix does not serialize any |
| 167 | +concurrent scenario to obtain a pass. |
| 168 | + |
| 169 | +All implementation edits are Python fixtures/helpers under `tests/`. No |
| 170 | +production, runner, C++, header, build, or benchmark file was changed. No new |
| 171 | +dependency, generated sequence, disabled row, placeholder, push, or PR was added. |
| 172 | +There was no need for a runner change. `REPORT.md` and `DONE` are the requested |
| 173 | +handoff artifacts. No unresolved implementation question remains; execution |
| 174 | +and proof are pending the supervisor. |
| 175 | + |
| 176 | +## Review and verification handoff |
| 177 | + |
| 178 | +The service, routing, and equivalence fixtures were re-read in full after edits. |
| 179 | +The additional basic-live, startup, and genuine-retry fixtures and the shared |
| 180 | +helper were re-read after edits; the modified tick-tape caller and harness |
| 181 | +checks were also re-read. The full fixture diff was reviewed against the |
| 182 | +inventory and the original assertions. |
| 183 | + |
| 184 | +Mechanical source review only: |
| 185 | + |
| 186 | +- `git diff --check`: exit 0, no output. |
| 187 | +- `git diff --cached --check` before the implementation commit: exit 0, no output. |
| 188 | +- Repeated whole-tree grep: remaining positional live hits are the documented |
| 189 | + singleton WebSocket assertions, completed-phase slices, and synchronous |
| 190 | + process receipts; no remaining multi-request completion-position comparison |
| 191 | + was found. |
| 192 | +- Unit tests, preflight, profiles, corpus, benchmarks: **NOT RUN**, as explicitly |
| 193 | + instructed for this Mac. There are no local test/build/benchmark log paths or |
| 194 | + verification summary lines to report. No unit/corpus/parity PASS is claimed. |
| 195 | +- The supervisor must run lab proof on the exact final committed tree and |
| 196 | + obtain the required maintainer verification/parity statuses. |
| 197 | + |
| 198 | +`git diff --stat 7d79006208666dcd05c04e441316c37eb01b9c20..f6a72083b5b9a44b13c0549ae59faece8b5b81dd`: |
| 199 | + |
| 200 | +```text |
| 201 | + tests/native_live_e2e.py | 24 ++++-- |
| 202 | + tests/native_live_equivalence_e2e.py | 82 +++++++++--------- |
| 203 | + tests/native_live_genuine_retry_e2e.py | 36 ++++---- |
| 204 | + tests/native_live_receipts.py | 12 +++ |
| 205 | + tests/native_live_routing_e2e.py | 9 +- |
| 206 | + tests/native_live_service_e2e.py | 21 +++-- |
| 207 | + tests/native_live_startup_e2e.py | 13 ++- |
| 208 | + tests/native_live_tick_tape.py | 2 +- |
| 209 | + tests/test_native_live_equivalence_harness.py | 118 ++++++++++++++++++-------- |
| 210 | + 9 files changed, 210 insertions(+), 107 deletions(-) |
| 211 | +``` |
0 commit comments