Repository navigation
Implement stable canonical entity/definition registries (REQ-CORE-003) - #73
Conversation
Verdict: REQUEST_CHANGES(Posted as a comment, not a formal review: GitHub refuses a same-account review on this PR.) Independent verification at head
Defect
This is incorrect. I counted Why it matters: What would satisfy it: recompute the denominator directly from No other defect found. The registry/definition code, its tests, and the |
REQUIREMENTS_REGISTRY.csv has 32 distinct REQ_ID data rows, not 31, per ACCEPTOR verdict on PR #73. Addresses REQUEST_CHANGES verdict: #73 (comment)
Verdict: ACCEPTIndependent verification at head
Prior defect, now fixedThe prior verdict's sole defect — No other defect found. Merging. |
…005) (#76) Adds assertValidRunOptions and assertValidScenarioDefinitionShape, covering the fail-fast, non-coercing slice of section 21's validation rules that is realizable today: RunOptions's own fields, and ScenarioDefinition's required top-level field shapes. Additive alongside assertNoBehavioralOverrides, which proves key-membership only. Sub-config bound checks and seed-content validation remain out of scope pending REQ-CONFIG-003 and the M3-M10 requirements that will give those placeholder types concrete fields. Also reconciles IMPLEMENTATION_STATUS.md's stale REQ-CORE-003 row: PR #73 (closing Issue #72) merged as 3b6f2eb since that row was written. Closes #74 Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Closes #72
Achieved outcome
Stable, ID-keyed canonical registries now exist for exactly the Milestone 1
registries bullet's entity list — Region, State, Currency, Clan,
PopulationCohort, ProductionUnit, LocalMarket, TransportLink — plus a
definitions registry, satisfying
REQ-CORE-003.buildWorldRegistrieswalks a
ScenarioDefinition's seed lists in their own declared order andallocates one
REQ-CORE-001typed ID per seed via the run'sIdAllocator,producing exactly the scenario-defined entity counts and IDs with no
duplicate/reused ID; a registry is legitimately empty when its seed list is
omitted or empty (e.g. no
TransportLinkyet, since transport is M5).buildDefinitionRegistryis a typed read-only view overDefinitionPack'sexisting
goods/recipes/eventDefinitions/metricDefinitionsfields,matching
CORE_SCHEMA_AND_LIFECYCLES.mdsection 6'sDefinitionRegistryshape exactly.
This pull request also reconciles
docs/spec/IMPLEMENTATION_STATUS.md'sstale
REQ-CONFIG-002row (PR #70 merged as005d0a553dbc685b8bf554ff0ae9d802a7ac04fdsince that row was last written,per
AUTHOR_RUNBOOK.mdsection 1) and recomputes the coverage denominatoragainst the current 31-row
REQUIREMENTS_REGISTRY.csv(previously stale at25, carried forward from an earlier
SPEC_CHANGELOG.mdrevision).Tested revision
464f963e47ad276d75cfbd9f259fab609c11c66f(branchclaude/issue-72-core-registries)Changed artifacts
src/domain/worldRegistries.ts—WorldRegistries,RegistryEntry,buildWorldRegistries. ID-keyed registry construction with no economic behavior.src/domain/worldRegistries.test.ts— exact scenario-defined counts; legitimate empty registries; correct id-kind prefix and no duplicate ID within/across registries; field-equivalent repeated genesis with a fresh allocator.src/domain/definitionRegistry.ts—DefinitionRegistry,buildDefinitionRegistry.src/domain/definitionRegistry.test.ts— definitions pass through unchanged, including the empty case.src/domain/index.ts— barrel-exports the new registry types/functions; updated module-area doc comment.docs/spec/IMPLEMENTATION_STATUS.md— flipsREQ-CONFIG-002toIMPLEMENTED(merge commit005d0a553dbc685b8bf554ff0ae9d802a7ac04fd, from already-merged PR Implement keyed deterministic RNG service (REQ-CONFIG-002) #70); adds a newREQ-CORE-003row asIN_PROGRESSnaming this Issue/branch and the proving tests; recomputes the denominator to 31 and the summary line to "9 of 31 requirements implemented; 1 in progress".No
TradeCraftSimulation/**orTradeCraftSimulation.Tests/**file was touched.Acceptance criteria
src/domain/worldRegistries.test.ts.src/domain/worldRegistries.test.ts.npm run typecheck,npm test, andnpm run buildpass.docs/spec/IMPLEMENTATION_STATUS.mdgains aREQ-CORE-003row (added here asIN_PROGRESS; becomesIMPLEMENTEDonly once this or a follow-up reconciliation pull request merges, per the legend).Checks
npm ci464f963e47ad276d75cfbd9f259fab609c11c66fnpm run typechecktsc --noEmitcleannpm testsrc/domain/worldRegistries.test.tsandsrc/domain/definitionRegistry.test.tsnpm run buildvite buildsucceededpython3 -m unittest discover -s scripts/testspython3 scripts/policy_guard.py --base masterpolicy-guard: passed over 6 changed file(s)dotnet build --configuration ReleaseTradeCraftSimulation/**orTradeCraftSimulation.Tests/**file changed; residual risk: none — this change cannot affect the legacy build.dotnet test --configuration ReleaseNot checked
CORE_SCHEMA_AND_LIFECYCLES.mdsection 5 (e.g.RegionState.controllerStateId,StateState.treasury) are not populated:ScenarioDefinition's*Seedtypes are still empty placeholder interfaces pendingREQ-CONFIG-003(baseline definition pack / scenario construction), which is an explicit Non-goal of Issue Implement stable canonical entity/definition registries (REQ-CORE-003) #72. Each registry entry today carries only its allocated ID plus whatever fields its seed type already declares (currently none);buildRegistry's{ ...seed, id }spread means no registry-building code needs to change once seed fields land.WorldGenesisLedgeror opening-stock reconciliation (REQ-CONFIG-004) and no RNG-driven bounded variation (REQ-CONFIG-002/003) — both explicit Non-goals.MonetaryAuthority,Bond,ShipmentandEventInstanceregistries are intentionally not built here: neither Issue Implement stable canonical entity/definition registries (REQ-CORE-003) #72's Scope nor document 11's Milestone 1 registries bullet lists them, even thoughCORE_SCHEMA_AND_LIFECYCLES.mdsection 5.8 definesMonetaryAuthorityState. Building them was judged out of this bounded unit's scope rather than an oversight.Assumptions and unknowns
AUTHOR_RUNBOOK.mdsection 4's "at most one directly listed dependency document" permits openingCORE_SCHEMA_AND_LIFECYCLES.md(document 01) alongside theFILE-named document 11, because document 11 itself directly names it ("Implement typed IDs and primitive value/domain types required by CORE_SCHEMA_AND_LIFECYCLES") under the Milestone 1 Implementation bullets — i.e. the requirement's own primary document names the dependency document, rather than the registry row'sDEPENDS_ONcolumn (which names requirement IDs, not documents). I did not open any further document.*Seedtypes are empty ({}) placeholders, the array index within each scenario seed list is the only available per-entity identity signal beforeREQ-CONFIG-003defines concrete seed fields; I used${entityKind}:${index}as the ID allocator'screationKey. This is scaffolding-only — no future requirement is bound to this exact creation-key string, since callers only ever observe the resulting allocated ID, not the creation key.docs/spec/mirror/REQUIREMENTS_REGISTRY.csv'sREQ-CORE-003row hasSTATUS=READY,PRIORITY=P0,DEPENDS_ON=REQ-CORE-001,REQ-CONFIG-001, both alreadyIMPLEMENTED(PR Implement canonical persistent typed IDs (REQ-CORE-001) #48 /58a0b49..., PR Implement the canonical configuration hierarchy (REQ-CONFIG-001) #67 /493da16e...).REQ-CORE-003or touchessrc/domain/worldRegistries.ts/src/domain/definitionRegistry.ts(checked viagh issue list/gh pr listandgit branch -abefore claiming).Highest-risk area for review
The
${entityKind}:${index}creation-key scheme inbuildRegistry(src/domain/worldRegistries.ts) is the one judgment call the specification does not spell out mechanically, since*Seedtypes carry no identity field yet — see Assumptions above. A reviewer should confirm that deferring all concrete per-entity schema fields toREQ-CONFIG-003(rather than trying to shape this registry's entries aroundCORE_SCHEMA_AND_LIFECYCLES.md's fullRegionState/StateState/etc. interfaces now) is the correct scope boundary, sinceREQ-CONFIG-003andREQ-CONFIG-004build directly on these registries.Remaining gate
None for this pull request's own scope.
REQ-CORE-003becomesIMPLEMENTEDinIMPLEMENTATION_STATUS.mdonly once this merges. Populating concrete per-entity schema fields (REQ-CONFIG-003), opening-stock reconciliation (REQ-CONFIG-004), and wiring the keyed RNG service into any bounded scenario variation remain separate, already-scoped requirements, consistent with Issue #72's Non-goals.