Skip to content

REQ-ACCEPTANCE-005 golden does not prove authoritative Phase-8 household settlement #657

Description

@andy-zen-dev

Goal

Make the permanent REQ-ACCEPTANCE-005 M4 golden sensitive to the authoritative Phase-8 household settlement transition, so its post-wage affordability claim is proven against live WorldState wallet/inventory mutation rather than only against ephemeral allocation and wage-settlement evidence.

Evidence

Concrete location: merged PR #655, implementation head 8a0fad4a52f9c6455f7afcdcc622672769b30403, src/simulation/acceptance-005-m4-golden-gate.test.ts, inside runGolden() from the householdIntentById / netWageByCohort construction through the spendByCohort affordability assertion.

The golden currently derives a household purchase entirely from result.context.marketAllocations: it matches the allocation back to a Cohort CONSUMPTION intent, computes spend = allocation.quantity * allocation.buyerGrossUnitPrice, accumulates positive purchase quantity/spend, and checks that value against tick-opening Cohort cash plus netWage read from result.context.wageSettlements. It never compares that allocation to the authoritative successor Cohort wallet or householdInventory, so the check proves that the ephemeral allocation/evidence is affordable, not that the canonical settlement mutation actually debited/credited those stocks.

The separation is material in the current composition. executeStatefulTick() validates TickContext invariants before calling the phase's WorldState transition. In the M4 runner, Phase 8 then applies applyMarketSettlementTransition(world, context) as a separate transition. Phase 9 deliberately calls planHouseholdConsumptionPhase9(... marketAllocations: []) because the integrated runner assumes Phase-8 purchases are already authoritative. Therefore the golden's allocation evidence and the authoritative stock mutation are two distinct boundaries.

Exact sensitivity observation: if the Phase-8 applyMarketSettlementTransition call is replaced by a no-op while the Phase-8 handler still emits the same allocations/context evidence, the golden's current household assertions still see positive householdPurchaseQuantity / householdSpend and the same openingCash + context netWage arithmetic. Phase 9 is passed an empty allocation list, so it does not independently re-project those purchases. The successor wallets/inventories can remain finite and non-negative, and the normalized hash will merely become a different deterministic hash; because the test compares two same-input runs to each other rather than to a fixed expected hash, that alone does not expose the missing settlement mutation. In other words, the acceptance test is not mechanically sensitive to bypassing the authoritative household settlement leg it claims to prove.

Governing contract: permanent REQ-ACCEPTANCE-005 requires that "household settlement respects actual post-wage cash". Issue #654 acceptance criterion 4 sharpened that to: household MAIN settlement must never spend beyond the authoritative post-Phase-5 wallet available to canonical settlement. marketSettlementTransition.ts likewise defines persistent truth after settlement as actor stock mutation, separate from MarketAllocation/transaction evidence.

PR #655's accepted exact head had all repository gates green (build-and-test, typescript, policy-guard, mergeability) and the current implementation ledger records REQ-ACCEPTANCE-005 as IMPLEMENTED at merge e8cdeee56fc968f6fb54ce44922720502c466806. This finding is therefore an acceptance-evidence false-negative, not a red-CI report and not a claim that the current settlement implementation itself is known to be wrong.

Scope

  • Strengthen the M4 golden so at least one positive household MAIN allocation is bound to the authoritative Phase-8 stock transition, not only to TickContext evidence.
  • For realized household purchases, prove the relevant Cohort's canonical householdInventory gain and settlement-currency wallet debit from an appropriate pre-/post-Phase-8 authoritative state boundary, with the debit consistent with buyer gross spend.
  • Prove the cash made available by Phase-5 wages through the authoritative wallet state used by Phase-8 settlement, rather than using context.wageSettlements as a substitute for persistence.
  • Preserve the existing positive purchase/spend requirement and per-cohort affordability check, but make them load-bearing against actual stock mutation.
  • Add a controlled sensitivity/negative regression: bypass or neutralize the authoritative Phase-8 settlement transition while leaving allocations intact; the acceptance proof must fail.
  • Reconcile docs/spec/implementation_status.csv evidence/status truthfully if the permanent requirement cannot remain IMPLEMENTED until this sensitivity is restored.

Non-goals

  • No change to local clearing, prices, tax arithmetic, wallet/inventory ownership, settlement formulas, Phase ordering, or household demand formulas merely to satisfy the test.
  • No second shopping or settlement path.
  • No M5+ trade/FX, M6 institutions, later milestone behavior, or specification reinterpretation.
  • No edit under docs/spec/mirror/**.
  • Do not replace the existing allocation-level checks; bind them to authoritative stock outcomes.

Acceptance criteria

  1. A non-zero household MAIN allocation in the 240-tick golden is proven to produce the corresponding authoritative Cohort householdInventory increase and settlement-currency wallet decrease through the canonical Phase-8 settlement transition.
  2. The buyer wallet debit equals the realized gross household spend within the canonical tolerance, and the affordability proof reads the authoritative post-Phase-5 cash state that Phase 8 actually preflights.
  3. Seller-side authoritative goods/cash mutation for the same load-bearing allocation is either directly reconciled in this golden or already covered by an explicitly linked canonical settlement invariant; no allocation-only proxy is treated as persistence evidence.
  4. A controlled version of the golden with Phase-8 authoritative settlement bypassed/neutralized while allocations remain present fails mechanically.
  5. Existing 240-tick phase/reconciliation, production bounds, extraction, payroll arithmetic, real-goods capital, lifecycle-hash sensitivity, non-negative/finite stock and same-input determinism assertions remain green.
  6. docs/spec/implementation_status.csv describes only evidence the repaired golden mechanically proves, and repository-required build-and-test, typescript, policy-guard, and mergeability gates are green on the repair revision.

Verification

Extend the focused REQ-ACCEPTANCE-005 golden with authoritative pre-/post-settlement stock observations or the smallest equivalent integration seam. First demonstrate the new assertion fails when Phase-8 stock application is deliberately bypassed while allocations are left intact; restore the canonical transition and prove the same fixture passes with non-zero household purchase quantity/spend and exact stock deltas. Then run the full TypeScript suite/build, retained .NET suite, policy/generated-status checks, and exact-head mergeability.

Type: bug
Area: simulation-core
Priority: high

Activity

  1. added
    area:simulation-coreTick loop, ordering, determinism, configuration
    priority:highImportant and time-sensitive; schedule ahead of normal work
    qaFinding from the external QA voice, not yet turned into a work contract
    status:needs-triageAwaiting classification, evidence, or label axes
    type:bugVerified behavior differs from the intended contract
    on Sep 23, 2026
  2. added
    status:readySpecified and unblocked; safe for an agent to claim
    and removed
    status:needs-triageAwaiting classification, evidence, or label axes
    on Sep 23, 2026
  3. drevendev commented on Sep 23, 2026

    @drevendev
    Owner

    EndlessZen triage decision — confirmed, ready

    REQ-ACCEPTANCE-005's current merged golden has a real evidence-sensitivity gap.

    Fresh inspection of src/simulation/acceptance-005-m4-golden-gate.test.ts confirms the household affordability assertion derives spend from result.context.marketAllocations and available wage cash from result.context.wageSettlements; it does not bind that positive allocation to the authoritative post-Phase-8 Cohort wallet/inventory mutation. Fresh inspection of m4ClosedEconomyOrchestrator.ts confirms Phase 8 applies applyMarketSettlementTransition(world, context) as a separate state transition, while the Phase-9 wrapper deliberately passes marketAllocations: [] because Phase-8 purchases are assumed already authoritative. marketSettlementTransition.ts explicitly defines persistent settlement truth as actor-stock mutation and applies Cohort household-inventory and wallet deltas there.

    This is therefore a valid false-negative in the acceptance proof, not merely a wording concern and not evidence that the current settlement implementation itself is wrong. It is also directly material to the permanent Gate-M4 acceptance clause that household settlement respect actual post-wage cash.

    Decision for the next bounded IMPLEMENT unit:

    • keep the existing allocation-level checks;
    • add the smallest observation/test seam needed to capture authoritative pre-Phase-8/post-Phase-8 state for a load-bearing household MAIN allocation;
    • prove Cohort inventory gain and settlement-currency wallet debit against realized gross spend and the authoritative post-Phase-5 cash available to Phase 8;
    • add a controlled negative/sensitivity regression where Phase-8 stock application is bypassed but allocation evidence remains, and require the acceptance proof to fail;
    • preserve all existing 240-tick accounting/determinism/lifecycle/capital/extraction assertions;
    • do not alter economics, phase order, M5+ behavior, or docs/spec/mirror/**.

    Promoted from status:needs-triage to status:ready. Until this repair earns exact-head evidence and is integrated, M4 should not be treated as truthfully closed even though the merged ledger still records the previously accepted REQ-ACCEPTANCE-005 evidence.

  4. added
    status:in-progressClaimed work with an active branch or pull request
    and removed
    status:readySpecified and unblocked; safe for an agent to claim
    on Sep 23, 2026
  5. drevendev commented on Sep 23, 2026

    @drevendev
    Owner

    EndlessZen claim — IMPLEMENT

    Claiming Issue #657 as the single bounded M4 unit on branch zen/issue-657-phase8-settlement-evidence.

    Scope for this revision: make the existing REQ-ACCEPTANCE-005 golden observe the authoritative post-Phase-5 / post-Phase-8 state boundary, bind positive household MAIN allocations to Cohort wallet/inventory deltas (and the seller-side stock/cash legs), and add a controlled bypass/neutralization negative control without changing economics or pulling M5+ behavior forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:simulation-coreTick loop, ordering, determinism, configurationpriority:highImportant and time-sensitive; schedule ahead of normal workqaFinding from the external QA voice, not yet turned into a work contracttype:bugVerified behavior differs from the intended contract

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions