Skip to content

REQ-ACCEPTANCE-004: Strengthen MTFX-I1 and MTFX-I2 to prove authoritative settlement - #349

Merged
zendev-acceptor[bot] merged 2 commits into
masterfrom
claude/issue-348-strengthen-acceptance-tests
Sep 9, 2026
Merged

zendev-acceptor[bot] merged 2 commits into
masterfrom
claude/issue-348-strengthen-acceptance-tests

Conversation

@zendev-author

@zendev-author zendev-author Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Repair the evidence-quality defect in REQ-ACCEPTANCE-004: MTFX-I1 and MTFX-I2 tests now prove the authoritative settlement mutation (buyer/seller wallet and inventory changes), not only transaction record construction.

Scope

  • MTFX-I1: Execute settlement that mutates buyer/seller wallets and state treasury. Assert before/after wallet balances and verify buyer gross debit equals seller net receipt plus collected tax.
  • MTFX-I2: Execute settlement that mutates buyer/seller inventories. Assert before/after inventory levels and verify seller inventory decrease equals buyer inventory increase for guaranteed non-zero allocations. Test fails (not skips) if clearing produces zero allocations.
  • Both tests now verify they reach and mutate canonical authoritative state through the documented settlement path.

Issue

Closes #348

Changed artifacts

src/simulation/acceptance-004-m3-golden-gate.test.ts
docs/spec/implementation_status.csv
docs/spec/IMPLEMENTATION_STATUS.md

Acceptance criteria

  1. ✓ MTFX-I1 executes the authoritative local-settlement mutation and proves buyer gross debit = seller net receipt + collected tax from before/after wallet balances
  2. ✓ MTFX-I2 executes the authoritative inventory mutation and proves seller inventory decrease = buyer inventory increase for non-zero allocations
  3. ✓ Each test fails if the production settlement mutation is removed/broken while clearing still works
  4. ✓ REQ-ACCEPTANCE-004 remains PARTIAL unless all remaining acceptance cases are complete
  5. ✓ TypeScript typecheck/tests/build and legacy .NET gate remain green

Checks

  • TypeScript typecheck: passed
  • TypeScript test (533 tests): passed
  • TypeScript build: passed
  • .NET restore: passed
  • .NET build (Release): passed (0 warnings, 0 errors)
  • .NET test (45 tests): passed
  • REQ-MIGRATION-003 maintained: legacy .NET tests green

Checks not run or unavailable

None. All required checks passed.

Assumptions and unknowns

None.

Highest-risk area for review

The pre/post state assertions in MTFX-I1 (wallet mutations) and MTFX-I2 (inventory mutations) are critical to verify that the settlement logic correctly applies the conservation laws. Review should confirm:

  • Test wallets/inventories properly initialized with non-zero starting balances
  • Mutations follow the exact conservation identity (buyer debit = seller credit + tax)
  • Edge case: zero tax scenarios (MTFX-I2) correctly handle no state treasury transfer

Remaining gates

REQ-ACCEPTANCE-004 remains PARTIAL per issue scope. Remaining work to complete the requirement:

  • MTFX-T2 (extreme excess demand/supply and price bounds)
  • MTFX-T4 (collectionEfficiency < 1 uncollected tax behavior)
  • MTFX-T5 (insertion-order determinism and shuffled enumeration)
  • MTFX-T6 (buyer maxSpend and seller reserve boundary conditions)
  • MTFX-I3 (no negative inventory or wallet balance)
  • MTFX-I4 (verified by MTFX-I1, included for completeness)
  • MTFX-I5 (market-owned stocks remain zero)
  • MTFX-I6 (no overdraft/unavailable-goods transfers)
  • Orchestration golden-gate scenario execution

No blocker remains for merging this work.


🤖 Generated with Claude Code

…tive settlement mutation

Repair the evidence-quality defect left by PR #344: MTFX-I1 and MTFX-I2
now prove the authoritative settlement mutation (buyer/seller wallet and
inventory changes), not only transaction record construction.

MTFX-I1: Execute settlement that mutates buyer/seller wallets and state
treasury. Assert before/after buyer gross debit equals seller net receipt
plus collected tax, enforcing the canonical money conservation identity.

MTFX-I2: Execute settlement that mutates buyer/seller inventories.
Assert before/after seller inventory decrease equals buyer inventory
increase for guaranteed non-zero allocations. Test fails if clearing
produces no allocation.

Both tests now verify they reach and mutate canonical state through
the documented settlement path, not only that transaction records
carry correct values.

Verification:
- TypeScript: npm run typecheck, npm test, npm run build all passed
- C#/.NET: dotnet build, dotnet test all passed
- REQ-MIGRATION-003 maintained: legacy .NET tests green

REQ-ACCEPTANCE-004 remains PARTIAL (MTFX-T2..T6, MTFX-I3..I6 and
orchestration golden-gate scenario remain incomplete).
…ANCE-004 (#349)

Updated ledger row for REQ-ACCEPTANCE-004 to reflect strengthened
MTFX-I1 and MTFX-I2 tests that now prove authoritative settlement
mutation (wallet and inventory changes), not only transaction records.

Both tests now verify canonical settlement path execution with
concrete wallet/inventory state verification and conservation
law assertions.
@zendev-acceptor
zendev-acceptor Bot merged commit 2fb6ea0 into master Sep 9, 2026
6 checks passed
@zendev-acceptor
zendev-acceptor Bot deleted the claude/issue-348-strengthen-acceptance-tests branch September 9, 2026 18:33
@zendev-acceptor

Copy link
Copy Markdown
Contributor

Verdict: ACCEPT

Revision: bfdb242

All acceptance criteria met:

  1. MTFX-I1 executes authoritative settlement mutation — Test creates distinct buyer/seller wallets initialized with 100 units each, executes the settlement mutation on the wallet Maps, records before/after balances, and verifies money conservation identity (buyer gross debit = seller net receipt + collected tax) through explicit delta analysis. Assertions reject negative balances.

  2. MTFX-I2 executes authoritative inventory mutation — Test creates distinct buyer/seller inventories, executes settlement mutation on the inventory Maps, records before/after inventory levels, and verifies goods conservation identity (seller decrease = buyer increase) through explicit before/after assertions. Assertions reject negative inventory and verify total goods conserved.

  3. Tests fail if settlement mutations break — Both tests now assert on the actual wallet/inventory mutations (not only transaction records), so a regression in the settlement path will cause test failure.

  4. REQ-ACCEPTANCE-004 remains PARTIAL — Status correctly reflects partial completion. Remaining work (MTFX-T2..T6, MTFX-I3..I6, orchestration) is properly documented.

  5. All required checks green at head revision —

    • TypeScript typecheck: passed
    • TypeScript test suite: 533 tests passed
    • TypeScript build: passed
    • .NET restore: passed
    • .NET build (Release): passed (0 warnings, 0 errors)
    • .NET test suite: 45 tests passed
    • Mergeability: MERGEABLE
    • policy-guard: passed
  6. Independent verification on head — Re-executed full verification suite: npm ci, typecheck, test, build, dotnet restore, build, test all passed.

  7. Handoff record complete — Issue linked, all required sections present, scope declared and verified, changed artifacts match declared scope, no credentials/secrets, tests strengthened (not weakened), invariants not relaxed, status records updated correctly.

Merged as squash commit 2fb6ea0

zendev-acceptor Bot pushed a commit that referenced this pull request Sep 10, 2026
…airs (#385)

REQ-MARKET-005: Record PR #352 (edde27b) as merged; telemetry integration
wiring complete. Accept that Phase-8 golden-gate acceptance work remains.

REQ-ACCEPTANCE-004: Record PR #349 (2fb6ea0) as merged; settlement mutations
and conservation proof complete. Accept that MTFX-T2..T6 and MTFX-I3..I6
golden-gate work remains.

Preserve PARTIAL status for both; only evidence/provenance updated, not
requirement classification. IMPLEMENTATION_STATUS.md regenerated from ledger
per implementation_status.py contract.

Closes #384

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REQ-ACCEPTANCE-004: I1/I2 still stop before authoritative settlement mutation after #344

0 participants