Skip to content

Implement REQ-CORE-005: PendingTransitions for future policy/jurisdiction/lifecycle effects - #247

Merged
zendev-acceptor[bot] merged 3 commits into
masterfrom
claude/issue-188-core-005-pendingtransitions
Sep 7, 2026
Merged

zendev-acceptor[bot] merged 3 commits into
masterfrom
claude/issue-188-core-005-pendingtransitions

Conversation

@zendev-author

@zendev-author zendev-author Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements the PendingTransitions contract to ensure Phase-14 decisions cannot mutate current-tick authoritative state. Changes are queued with activateTick = N+1 and only become effective at their designated tick, providing deterministic causality per CORE_SCHEMA_AND_LIFECYCLES.md section 9.

Changed artifacts

  • src/simulation/pendingTransitions.ts (new)
  • src/simulation/pendingTransitions.test.ts (new)
  • src/simulation/worldState.ts
  • src/simulation/tickOrchestrator.ts
  • src/simulation/index.ts
  • src/simulation/acceptance-002-replay-determinism.test.ts
  • src/simulation/tickOrchestrator.test.ts
  • src/diagnostics/m2Preview.ts
  • docs/spec/IMPLEMENTATION_STATUS.md
  • docs/spec/implementation_status.csv

Acceptance criteria

  • ✅ PendingTransitions interface defines jurisdictionChanges, stateCreations, policyChanges, and monetaryPolicyChanges
  • ✅ Helper functions manage transitions immutably (createEmptyPendingTransitions, addJurisdictionChange, getActiveTransitionsAtTick, removeActivatedTransitions)
  • ✅ Transitions only become active at their designated activateTick (CORE-T7: Phase-14 jurisdiction change becomes economic only in N+1)
  • ✅ WorldState includes pendingTransitions field initialized as empty
  • ✅ 17 new tests covering all transition types, immutability, and N+1 deterministic causality

Checks

  • typecheck: passed
  • test: 304 tests passed (17 new for PendingTransitions)
  • build: succeeded

Assumptions and unknowns

  • Activation logic at Phase-1 is deferred to M3+ when political/economic mechanisms are implemented
  • The stateCreations array is included per the specification but not yet used at M2

Highest-risk area

Type consolidation: PendingTransitions was previously defined in tickOrchestrator.ts; moved to worldState.ts and updated all imports. All builds and tests green.

Remaining gates

None. REQ-CORE-005 implementation complete. Closes #188.

Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com

github-actions Bot and others added 2 commits September 7, 2026 07:49
…tion/lifecycle effects

Implements the PendingTransitions contract to ensure Phase-14 decisions cannot mutate current-tick authoritative state. Changes are queued with activateTick = N+1 and only become effective at their designated tick, providing deterministic causality per CORE_SCHEMA_AND_LIFECYCLES.md section 9.

Changes:
- Added PendingTransitions interface to WorldState with jurisdictionChanges, stateCreations, policyChanges, and monetaryPolicyChanges arrays
- Created pendingTransitions.ts module with helper functions (createEmptyPendingTransitions, addJurisdictionChange, getActiveTransitionsAtTick, etc.)
- Implemented 17 comprehensive tests in pendingTransitions.test.ts including CORE-T7 validation (N+1 changes don't affect tick N)
- Added pendingTransitions field to WorldState initialization in buildInitialWorld()
- Updated tickOrchestrator.ts to import PendingTransitions from worldState instead of duplicating definition
- Updated all test fixtures to include stateCreations field

Verification:
- npm run typecheck: passed
- npm test: 304 tests passed (17 new PendingTransitions tests)
- npm run build: succeeded

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

@zendev-acceptor zendev-acceptor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES

Gate: Incomplete handoff record (docs/spec files undeclared)

The scope-guard check (required) identified 2 changed files not listed in the PR body's "Changed artifacts" section:

  • docs/spec/IMPLEMENTATION_STATUS.md
  • docs/spec/implementation_status.csv

Per ACCEPTOR runbook section 2:

the pull request body does not contain the full handoff record

What satisfies this:
Add both files to the "Changed artifacts" section in the PR body, listed exactly as git names them. If either file should not be part of this PR, drop the change from the commit.

Head revision judged: 495c101

The conflict was confined to docs/spec/implementation_status.csv and the
document generated from it. Rows were merged by requirement identifier, each
taken from the side that changed it, and the document was regenerated rather
than merged. No product file was touched. See scripts/resolve_ledger_conflicts.py.
@zendev-acceptor

Copy link
Copy Markdown
Contributor

ACCEPT

Head revision judged: 9ce54f6

Verification summary

1. All required checks green at head revision:

  • ✅ build-and-test: PASSED
  • ✅ typescript: PASSED
  • ✅ policy-guard: PASSED
  • ✅ mergeability: PASSED (merges cleanly)
  • Independent verification (both runtimes):
    • TypeScript: npm ci, npm typecheck, npm test (339/339 passed), npm build all succeeded
    • .NET: dotnet restore, dotnet build Release, dotnet test Release (45/45 passed)

2. All acceptance criteria met with evidence:

  • ✅ PendingTransitions interface defined and immutable in worldState.ts (lines 53-75)
  • ✅ All four arrays initialized and typed: jurisdictionChanges, stateCreations, policyChanges, monetaryPolicyChanges
  • ✅ Unit tests prove N+1 causality (pendingTransitions.test.ts, CORE-T7 test suite lines 135-191)
    • Changes queued with activateTick = N+1 are NOT active at tick N
    • Changes are active ONLY at their designated activateTick
  • ✅ Immutable transitions via helper functions (addJurisdictionChange, addPolicyChange, addMonetaryPolicyChange, addStateCreation)
  • ✅ getActiveTransitionsAtTick filters by exact tick match, maintaining insertion order
  • ✅ WorldState.pendingTransitions initialized empty at genesis

3. Diff confined to declared scope:

  • All 10 changed files listed in PR body "Changed artifacts"
  • No files outside scope touched
  • No policy/workflows mixed with product code

4. No invariant or test weakening:

  • 17 new PendingTransitions tests added (17 in test file)
  • No tests deleted or disabled
  • Stock/money conservation invariants untouched
  • Legacy .NET: 45/45 tests pass (REQ-MIGRATION-003 maintained)

5. No secrets, credentials, or personal data in diff

6. Handoff record complete:

REQ-CORE-005 implementation ready for merge.

@zendev-acceptor
zendev-acceptor Bot merged commit a692ae3 into master Sep 7, 2026
6 checks passed
@zendev-acceptor
zendev-acceptor Bot deleted the claude/issue-188-core-005-pendingtransitions branch September 7, 2026 14:34
drevendev added a commit that referenced this pull request Sep 7, 2026
master has been red since 22:55:17Z. Two type errors, both integration tails of #208,
whose branch was opened 36 hours before it merged:

- WorldState gained `pendingTransitions` in #247 (REQ-CORE-005), and the temporary
  WorldState this reconciliation builds predates it. It gets the same empty value the
  real WorldState is built with fifty lines below: genesis queues no transition, and
  reconciliation reads stocks, never the queue.
- `minimumPrice` and `maximumPrice` are real fields, but they belong to the pricing
  config in marketPricing.ts, not to MarketConfig in simulationConfig.ts, which #250
  reshaped. Nothing reads them where the test put them, so they go.

The underlying cause is not in this diff: branch protection runs with strict: false, so
a branch whose own checks are green merges into a base it may no longer fit. That is a
deliberate setting — requiring every branch to be current would serialize the queue —
and the cost of it is exactly this, once, at a manual merge of a very old branch.

Co-authored-by: Claude Opus 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-CORE-005: PendingTransitions for future policy/jurisdiction/lifecycle effects

0 participants