Repository navigation
REQ-CORE-004: Canonical tick orchestrator and 16-phase framework - #187
Merged
zendev-acceptor[bot] merged 2 commits intoSep 6, 2026
Merged
Conversation
Implement WorldState immutability, TickContext for ephemeral tick-scoped state, PendingTransitions with deterministic phase barriers, and a 16-phase orchestrator (phases 0-15) with no-op handlers in M2. Implementation: - TickContext carries tick number, current phase, RNG seed, and transaction records - PendingTransitions defines jurisdiction/policy/monetary changes queued for N+1+ - PhaseHandler type for pluggable phase logic (no-op in M2) - executeTick() runs phases 0-15 sequentially with trace proof - computeTickHash() provides deterministic replay hash for same seed/config/scenario - 25 comprehensive tests covering: - Phase order (phases 0-15 sequential, no phase 16) - 100+ tick no-op scenario with stable hashes - PendingTransitions barrier structure - Determinism across replayed identical ticks Acceptance criteria: ✓ WorldState defined and immutable during tick ✓ TickContext carries phase semantics ✓ Orchestrator executes exactly phases 0-15 in order ✓ Trace test proves sequential phases, no phase 16 ✓ PendingTransitions barrier prevents early mutation ✓ 100+ consecutive no-op ticks preserve all stocks (no-op scenario) ✓ Deterministic replay hash stable for identical inputs ✓ Phase-order and barrier tests included ✓ TypeScript: npm ci, typecheck, test (219 tests), build all pass ✓ C#/.NET: dotnet build, test (45 tests) remain green (REQ-MIGRATION-003) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Contributor
|
ACCEPT Verified on head revision 4fbcf58. Acceptance criteria:
Independent verification (this run):
No remaining gates. Closing #185 on merge. |
zendev-acceptor
Bot
deleted the
claude/issue-185-canonical-tick-orchestrator
branch
September 6, 2026 02:32
This was referenced Sep 6, 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.
Summary
Implement REQ-CORE-004: Canonical tick orchestrator and 16-phase framework for M2.
Implementation
Core types (tickOrchestrator.ts)
TickContextinterface with tick, phase, RNG seed, and transaction accumulationPendingTransitionsinterface for jurisdiction/policy/monetary changes queued for later activationPhaseHandlertype for pluggable phase logicinitializeTickContext(),executePhase(),executeTick()computeTickHash()for deterministic replay verificationnoOpPhaseHandlerfor M2 no-op executionTests (tickOrchestrator.test.ts)
All tests (25 total) passing.
Verification Status
✅ TypeScript
npm ci— dependencies installed (43 packages)npm run typecheck— clean, no errorsnpm test— 219 tests passed (22 test files)npm run build— produced dist/canonical.js (0.15 kB gzip)✅ C#/.NET (REQ-MIGRATION-003 requirement)
dotnet restore— restored successfullydotnet build --configuration Release --no-restore— succeeded, 0 warnings/errorsdotnet test --configuration Release --no-build— 45/45 tests passed✅ Acceptance criteria
Test Evidence
src/simulation/tickOrchestrator.test.ts— 25 tests, all passingChanged artifacts
docs/spec/implementation_status.csv— added REQ-CORE-004 rowdocs/spec/IMPLEMENTATION_STATUS.md— regenerated table (1 new row)src/simulation/index.ts— added exports for tickOrchestrator types and functionssrc/simulation/tickOrchestrator.ts— new file (177 LOC): core types and orchestratorsrc/simulation/tickOrchestrator.test.ts— new file (455 LOC): 25 comprehensive testsDecisions
Phase 0–15 names from CORE_SCHEMA_AND_LIFECYCLES.md section 10:
Implemented all 16 documented phase names in PHASE_NAMES constant. In M2, all handlers are no-op; economic behavior is added in M3–M15.
Deterministic RNG seeding (tick ^ seed):
TickContext derives rngSeed deterministically from world seed XOR tick number, ensuring same scenario/seed produces identical per-tick RNG state independent of execution order.
No-op handler structure:
noOpPhaseHandlerreturns context unchanged, proving the orchestrator works before implementing any economic logic. This keeps M2 scope strictly bounded.PendingTransitions as immutable readonly arrays:
Enforces barrier structurally in TypeScript; Phase handlers receive read-only context and cannot mutate pending transitions. Real enforcement (phase 14 only) is a future implementation detail.
Highest-risk area for review
Remaining gates
None. All acceptance criteria met. REQ-CORE-004 ready for M2 gate.
Closes #185
🤖 Generated with Claude Code