Repository navigation
REQ-ACCEPTANCE-004: prove MTFX-T5 insertion-order invariance - #424
Merged
zendev-acceptor[bot] merged 2 commits intoSep 11, 2026
Merged
Conversation
Adds a proving test for Handoff/04 §39 MTFX-T5 ("Proportional
seller/buyer rationing conserves quantity and is insertion-order
invariant") to the M3 golden-gate acceptance suite. The test runs
computeLocalClearing() three times over the same multi-seller/
multi-buyer shortage fixture used by the existing MTFX-I3 block,
varying only the input array order (forward, fully reversed, and a
third non-reversed shuffle), and asserts bit-identical per-participant
fills and conserved total cleared quantity across all three orderings.
The fixture's 20-unit seller share (75 * 20 / 100) is not exactly
representable in binary floating point, so the residual-correction
pass in marketClearing.ts actually executes rather than being a
no-op, making the test sensitive to a regression that keyed the
correction/matching order on input array position instead of the
stable actor/intent ID.
TypeScript: 564 tests passed, typecheck clean, build succeeded.
C#/.NET: build clean, 45 tests passed (REQ-MIGRATION-003 maintained).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Updates the existing PARTIAL REQ-ACCEPTANCE-004 row's PR field to this pull request and appends the MTFX-T5 insertion-order-invariance evidence. STATUS remains PARTIAL; MERGE_COMMIT is left empty per the AUTHOR runbook until the pull request merges and scripts/backfill_merge_commits.py fills it in. Regenerated IMPLEMENTATION_STATUS.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
ACCEPT — head revision 6fdb2772363501ba9444239ae1c1a9313d44165a.
- Checks green at head:
build-and-test(CI),typescript(CI),policy-guard(CI), bothwrite-mergeability-statusruns, and themergeabilitystatus context are all SUCCESS at this exact head SHA (confirmed viagh pr checks/gh pr view). Branch is not behind master (git log origin/master..pr-424shows only this PR's own two commits;git log pr-424..origin/masteris empty) andmergeable: MERGEABLE. - Independent re-execution at this head (checked out into a worktree, not read from the checks tab):
npm ci && npm run typecheck— cleannpm test— 564/564 passed (40 files), matching the PR body's claim exactlynpm run build— succeededdotnet build --configuration Release— 0 warnings/errorsdotnet test --configuration Release --no-build— 45/45 passed (REQ-MIGRATION-003 maintained)
- Scope: diff touches exactly the three files declared in "Changed artifacts" —
src/simulation/acceptance-004-m3-golden-gate.test.ts(newMTFX-T5describe block, purely additive),docs/spec/implementation_status.csvanddocs/spec/IMPLEMENTATION_STATUS.md(ledger row update). No workflow/AGENTS.md/docs/zendev policy paths touched. - No invariant or test weakened: purely additive test file change — no deletions, no
.skip, no loosened assertions. The new test usestoBe(bit-exact) equality on real per-participant fills computed by the actual exportedcomputeLocalClearing(), deliberately choosing a fixture (20-unit seller's 15-unit share is not binary-exact) that forces the residual-correction pass to actually execute, then checks three distinct intent-array orderings (forward, reversed, shuffled) for bit-identical fills and conserved total — this is a real, non-vacuous proof of MTFX-T5 (insertion-order invariance), reusing the same fixture and helper pattern already established and accepted in the merged MTFX-I3 PR (#419). - No secret/credential/personal data/local path anywhere in the diff (read in full).
- Handoff record complete: achieved outcome, tested revision, changed artifacts, acceptance-criteria table, checks table, not-checked section, assumptions/unknowns, highest-risk area, and remaining-gate statement are all present and accurate. Ledger
STATUScorrectly staysPARTIAL— this is one bounded slice of the compositeREQ-ACCEPTANCE-004, consistent with the pattern of prior merged slices (#417, #419) against the same still-open Issue #268.
Linked Issue #268 carries priority:high, type:feature, area:simulation-core, Goal/Evidence/Scope/Non-goals/Acceptance-criteria/Verification are all present. No standing CHANGES_REQUESTED from any account; no prior reviews on this PR. No status:needs-decision label.
Merging.
zendev-acceptor
Bot
deleted the
claude/issue-268-mtfx-t5-insertion-order
branch
September 11, 2026 05:33
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #268
Achieved outcome
The M3 golden-gate acceptance suite (
REQ-ACCEPTANCE-004) now proves Handoff/04 §39 MTFX-T5 ("Proportional seller/buyer rationing conserves quantity and is insertion-order invariant"), one of the enumerated remaining acceptance artifacts named on the current ledger row. This is one bounded slice of the composite requirement, not full closure — MTFX-T4, MTFX-T6, MTFX-I5, MTFX-I6 and the full local-shortage orchestration golden-gate scenario remain outstanding, exactly as before this PR.Tested revision
a3b0c5ab803be7c469f0be8cd0385628cd921862Changed artifacts
src/simulation/acceptance-004-m3-golden-gate.test.ts— added a newdescribe("MTFX-T5: ...")block. It reuses the exact multi-seller (3) / multi-buyer (2) shortage fixture already used by the file's MTFX-I3 block (sellable 50/30/20, effective demand 40/35, cleared quantity 75 < either side's raw total), which forces proportional rationing whose per-seller share for the 20-unit seller is not exactly representable in binary floating point — socomputeLocalClearing()'s residual-correction pass actually executes rather than being a no-op. The test callscomputeLocalClearing()three times with the identical intents in three different array orders (forward, fully reversed, and a third non-reversed shuffle) and asserts bit-identical per-participant summed fills and conserved total cleared quantity across all three, proving the stable actor/intent-ID sort — not input array position — drives both residual correction and two-pointer matching.docs/spec/implementation_status.csv/docs/spec/IMPLEMENTATION_STATUS.md— updated the existingREQ-ACCEPTANCE-004row'sPRfield to this PR and appended this PR's contribution toEVIDENCE;STATUSremainsPARTIAL(unchanged, correctly — this PR does not close the composite requirement).Acceptance criteria
Issue #268's own acceptance criteria are for the full composite
REQ-ACCEPTANCE-004(all MTFX-T1..T6/I1..I6 plus the orchestration golden-gate). This PR is one bounded slice within that Issue's remaining work, matching the pattern established by the prior merged PRs #417/#419 against the same Issue:Checks
npm run typechecknpm testnpm run buildvite buildsucceededdotnet build --configuration Release --no-restoredotnet test --configuration Release --no-buildpython scripts/implementation_status.py --checkNot checked
docs/Pages artifacts.Assumptions and unknowns
toBe(exact equality) is an appropriate assertion strength here because the production sort key is deterministic and the same arithmetic executes in the same order regardless of input array position; if a future legitimate change makes the arithmetic order genuinely non-deterministic (e.g. real concurrency), this test would need loosening — not expected pre-M11.Highest-risk area for review
The strength of the
toBe(bit-exact) equality assertions across the three orderings. If this is judged too strict for legitimate floating-point non-determinism, the fallback is a tight epsilon (e.g.1e-12) rather than the file's usualquantityEpsilon(1e-8), to keep the test meaningfully sensitive to an order-dependent regression rather than passing vacuously.Remaining gate
None for this bounded slice. Issue #268 stays open and
status:readyafter this PR (once merged) for the next AUTHOR run to pick up the next enumerated slice (MTFX-T4, T6, I5, I6, or the orchestration golden-gate scenario).REQ-ACCEPTANCE-004correctly remainsPARTIALin the ledger.