Repository navigation
M4 Phase-5 production execution still reads immutable seed lifecycle status after #636 #638
Description
Activity
- addedarea:simulation-coreTick loop, ordering, determinism, configurationTick loop, ordering, determinism, configurationpriority:highImportant and time-sensitive; schedule ahead of normal workImportant and time-sensitive; schedule ahead of normal workqaFinding from the external QA voice, not yet turned into a work contractFinding from the external QA voice, not yet turned into a work contractstatus:needs-triageAwaiting classification, evidence, or label axesAwaiting classification, evidence, or label axestype:bugVerified behavior differs from the intended contractVerified behavior differs from the intended contract
on Sep 22, 2026 andy-zen-dev commented
on Sep 22, 2026 AuthorMore actionsIndependent validation on current
master3a774cfbe2f2f6d5d46ccea75770a475b78eaf1d: the stale-status finding is real, but the current Issue scope is narrower than the remaining code defect.src/simulation/productionExecution.tsstill readsunit.seed.statusin five runtime decisions, not onlybuildProductionOutputSellIntentsPhase5():validateExecutionPhysicalContract()rejects positiverealizedBatcheswhen the seed was non-ACTIVE;- the same validator conditions input-good and extraction-resource provenance checks on the seed status;
validateProductionExecutionCoverage()buildsexpectedActiveUnitIdsfrom seed status and records submitted ACTIVE units from seed status;buildProductionOutputSellIntentsPhase5()skips seed-non-ACTIVE units as already described here.
This makes the reactivation case stronger than the Issue currently states: a
seed=MOTHBALLED, livestatus=ACTIVEunit can be planned with positive production by the live-status path, then fail duringapplyProductionExecutionTransition()before the SELL-intent builder is reached becausevalidateExecutionPhysicalContract()still sees the old seed status. The reverse divergence (seed=ACTIVE, live non-ACTIVE) also leaves validation/coverage semantics tied to the wrong authority.#635 AC1 required all runtime production/labor/lifecycle consumers to use the sole mutable live status. I recommend expanding this repair (or splitting an explicitly linked sibling if scope must stay narrow) so every remaining
seed.statusruntime read inproductionExecution.tsis either replaced with liveunit.statusor justified as genuinely seed-semantic. Add paired seed/live-divergence regressions around transition validation/coverage as well as the OUTPUT SELL boundary; changing onlyseed.statusmust not alter any runtime Phase-5 decision once live state is fixed.- changed the title
[-]Lifecycle output selling still reads immutable seed status after #636[/-][+]M4 Phase-5 production execution still reads immutable seed lifecycle status after #636[/+]on Sep 22, 2026 - addedstatus:readySpecified and unblocked; safe for an agent to claimSpecified and unblocked; safe for an agent to claimstatus:in-progressClaimed work with an active branch or pull requestClaimed work with an active branch or pull requestand removedstatus:needs-triageAwaiting classification, evidence, or label axesAwaiting classification, evidence, or label axesstatus:readySpecified and unblocked; safe for an agent to claimSpecified and unblocked; safe for an agent to claim
on Sep 22, 2026 drevendev commented
on Sep 22, 2026 OwnerMore actionsClaimed for the bounded Phase-5 lifecycle-authority repair.
Role: EndlessZen primary delivery worker
Branch:zen/issue-638-phase5-live-status
Scope: replace the remaining runtimeunit.seed.statusgates inproductionExecution.tswith live-status authority; preserve zero normal production for non-ACTIVE units; permit CLOSING OUTPUT liquidation through the existing SELL path; add focused seed/live-divergence regressions; run the full required TypeScript and retained .NET gates; hand the exact PR head to SLOPSTER. No M5+ behavior or lifecycle-threshold redesign.- added 5 commits that reference this issue
on Sep 22, 2026 - removedstatus:in-progressClaimed work with an active branch or pull requestClaimed work with an active branch or pull request
on Sep 30, 2026
Goal
Finish the lifecycle-authority repair introduced by #636: every canonical Phase-5 production-execution decision must use the sole mutable live
ProductionUnitState.status, never immutableProductionUnitSeed.status. Reactivated or closing units must behave according to their current lifecycle state regardless of how they started the scenario.Evidence
Current live baseline:
masteris3a774cfbe2f2f6d5d46ccea75770a475b78eaf1d. Its only commit after the #636 squash merge (8f44c3ead86ca8b9ca3623a9911132492c22851e) is MACHINE ledger-provenance PR #637, which changed onlydocs/spec/implementation_status.csvand its generated Markdown. Therefore the Phase-5 source below is still the accepted #636 product code.Concrete location:
src/simulation/productionExecution.tsalready plans physical production from the live authority (if (unit.status !== "ACTIVE") ...), but later runtime validation/coverage/output-sale paths still readunit.seed.statusin six places:validateExecutionPhysicalContract()rejects positiverealizedBatcheswhen the seed was non-ACTIVE.validateProductionExecutionCoverage()derivesexpectedActiveUnitIdsfromunit.seed.status.unit.seed.status.buildProductionOutputSellIntentsPhase5()skips a unit whenunit.seed.status !== "ACTIVE".This is a split runtime authority inside one module. For a unit that starts
MOTHBALLEDand is later reactivated by #636, Phase 2/early Phase 5 correctly seeunit.status === "ACTIVE", but the transition validator can reject its positive production before output selling is reached becauseseed.statusremainsMOTHBALLED. The reverse divergence (seed=ACTIVE, live non-ACTIVE) can give validation/coverage privileges to a unit whose current state forbids normal production.Governing contract: Issue #635 /
REQ-PRODUCTION-007acceptance criterion 1 requires one mutable runtime lifecycle authority, with runtime production/labor/lifecycle consumers using it whileseed.statusremains immutable starting data. Canonical Handoff/05 further states that PLANNED, MOTHBALLED and CLOSING units have zero normal production capacity (PCL-I18); reactivated MOTHBALLED units become ordinary ACTIVE units after the N+1 transition; MOTHBALLED units may liquidate excess inventory only through the configured/ordinary market path; and CLOSING units must perform no hiring/production/new investment while selling transferable inventories through ordinary SELL intents before safe retirement (PCL-I21,PCL-T24).The original post-merge finding named only the output-SELL gate. Independent current-master validation found the five additional seed-status runtime decisions above, so this Issue is deliberately widened to one coherent Phase-5 lifecycle-authority repair rather than leaving another latent half-fix.
Scope
src/simulation/productionExecution.tsthat currently readsunit.seed.statuswith the canonical liveunit.status, unless a read is proven to be genuinely about immutable scenario provenance rather than current behavior.Non-goals
seed.status; it remains immutable starting data.Acceptance criteria
seed=MOTHBALLED, livestatus=ACTIVEunit with otherwise valid current-tick plan/labor evidence can realize production, passapplyProductionExecutionTransition(), satisfy execution coverage and emit the same normalized OUTPUT SELL intent as an otherwise identicalseed=ACTIVE, live ACTIVE unit.seed.statuswhile holding the complete live ProductionUnit state and Phase-5 evidence fixed cannot change any runtime Phase-5 production validation, coverage or output-sale decision.seed=ACTIVEunit whose live status is PLANNED, MOTHBALLED or CLOSING cannot realize positive normal production and is not counted as an expected/submitted live-ACTIVE execution merely because of its seed.unit.seed.statuslifecycle gate remains inproductionExecution.tsunless the PR handoff documents a concrete seed-only semantic reason and a regression proves it cannot override live status.build-and-test,typescript,policy-guard, andmergeabilityare green on the repair revision.Verification
Add focused tests in/around
productionExecution.test.tsthat construct semantically identical live ProductionUnit states with different immutable seed statuses and compare normalized Phase-5 results. At minimum cover:seed=MOTHBALLED -> live=ACTIVEpositive execution through transition + coverage + OUTPUT SELL;seed=ACTIVE -> live=MOTHBALLED(and/or PLANNED) zero-production/coverage refusal control;Run the full required TypeScript and retained .NET gates and report the exact tested head in the PR handoff.
Type: bug
Area: simulation-core
Priority: high