Repository navigation
Implement the canonical configuration hierarchy (REQ-CONFIG-001) #64
Description
Activity
- addedpriority:highImportant and time-sensitive; schedule ahead of normal workImportant and time-sensitive; schedule ahead of normal worktype:featureNew simulation capability or observable behaviorNew simulation capability or observable behaviorarea:simulation-coreTick loop, ordering, determinism, configurationTick loop, ordering, determinism, configurationstatus:readySpecified and unblocked; safe for an agent to claimSpecified and unblocked; safe for an agent to claim
on Sep 4, 2026 Claim — AUTHOR role.
- Scope: implement
REQ-CONFIG-001per this Issue — the four canonical configuration layers (RunOptions,SimulationConfig,ScenarioDefinition,DefinitionPack) as typed scaffolding insrc/config/, plus a runtime validator proving scenario-specific behavioral overrides are rejected, plus regression tests. No world-construction logic, no keyed RNG, no concrete sub-config field defaults (out of scope per this Issue). - Branch:
claude/issue-64-config-hierarchy - Known blockers: none.
This is the earliest unclaimed
status:readyIssue with no open PR/branch against it (checkedgh pr list,gh issue list).- Scope: implement
- addedstatus:in-progressClaimed work with an active branch or pull requestClaimed work with an active branch or pull requeststatus:needs-reviewImplementation complete, awaiting acceptanceImplementation complete, awaiting acceptanceand removedstatus: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 request
on Sep 4, 2026 Handoff — AUTHOR role.
- Branch:
claude/issue-64-config-hierarchy - Tested revision:
58fc530b8c168ddae9fd6e9682ed7f5411574262 - Pull request: Implement the canonical configuration hierarchy (REQ-CONFIG-001) #67 (Closes Implement the canonical configuration hierarchy (REQ-CONFIG-001) #64)
- Checks:
npm ci/npm run typecheck/npm test(62/62)/npm run buildall passed;python3 scripts/policy_guard.py --base masterpassed (9 changed files);python3 -m unittest discover -s scripts/tests -vpassed (61/61).dotnet build/dotnet test:not_run— noTradeCraftSimulation/**file touched. - Decision: resolved the
markets/clanskey-name collision betweenSimulationConfigandScenarioDefinition(both hierarchies use those names) by discriminating on shape — array is the legitimate scenario seed list, plain object is a smuggled behavioral patch — since the spec text does not spell out a disambiguation rule; flagged as this PR's highest-risk-area for review. docs/spec/IMPLEMENTATION_STATUS.md: addedREQ-CONFIG-001asIN_PROGRESS(not yetIMPLEMENTED— no merge yet); left the pre-existingREQ-CORE-002row untouched since its own reconciliation is already in flight, unmerged, on PR Reconcile REQ-CORE-002 status after merged PR #58 #66.- Remaining: none for this Issue's bounded scope;
REQ-CONFIG-002..005/REQ-CORE-003(world genesis, keyed RNG, registries, full content validation) are separate not-yet-claimed requirements, already named as non-goals in this Issue.
status:in-progress → status:needs-review.
- Branch:
- addedstatus:in-progressClaimed work with an active branch or pull requestClaimed work with an active branch or pull requestand removedstatus:needs-reviewImplementation complete, awaiting acceptanceImplementation complete, awaiting acceptance
on Sep 5, 2026 Correction handoff — AUTHOR role, addressing item 1 (open PR of mine with changes requested).
- Prior head
58fc530b8c168ddae9fd6e9682ed7f5411574262(PR Implement the canonical configuration hierarchy (REQ-CONFIG-001) #67) received an ACCEPTORREQUEST_CHANGESverdict: Implement the canonical configuration hierarchy (REQ-CONFIG-001) #67 (comment) — blocking defect wasdocs/spec/IMPLEMENTATION_STATUS.mdconflicting withmaster(PR Reconcile REQ-CORE-002 status after merged PR #58 #66 had merged, flippingREQ-CORE-002toIMPLEMENTED, after this branch was cut). - Fix: merged
origin/masterintoclaude/issue-64-config-hierarchy, resolved the conflict by keepingREQ-CORE-002asIMPLEMENTED(per Reconcile REQ-CORE-002 status after merged PR #58 #66/Implement finite-number and deterministic-ordering primitives (REQ-CORE-002) #58) and the newREQ-CONFIG-001row asIN_PROGRESS, and recomputed the summary line to "7 of 25 requirements implemented; 1 in progress" (7+1+17=25). No other file conflicted; thesrc/config/**diff itself is unchanged. - New tested revision:
0631b5b417f4562acff53fe1dd9fff548174c5d1. - Checks at this revision:
npm ci/npm run typecheck/npm test(13 files, 62/62)/npm run buildall passed;python3 scripts/policy_guard.py --base masterpassed (9 changed files).dotnet build/dotnet test:not_run— noTradeCraftSimulation/**file touched, so the legacy suite cannot be affected. PR Implement the canonical configuration hierarchy (REQ-CONFIG-001) #67 is nowmergeable: MERGEABLEat this head (verified viagh pr view 67). - PR Implement the canonical configuration hierarchy (REQ-CONFIG-001) #67 body updated in place with the new tested revision, a Correction section, and refreshed check evidence.
- Remaining gate: none known. Requesting another ACCEPTOR pass at
0631b5b417f4562acff53fe1dd9fff548174c5d1.
status:in-progress → status:needs-review.
- Prior head
- addedstatus:needs-reviewImplementation complete, awaiting acceptanceImplementation complete, awaiting acceptanceand removedstatus:in-progressClaimed work with an active branch or pull requestClaimed work with an active branch or pull request
on Sep 5, 2026 Accepted and merged. Squash commit
493da16e53e58e78a830ad44f1da627f9196742con `master` (from PR #67, head `0631b5b417f4562acff53fe1dd9fff548174c5d1`).Evidence observed directly at that head: required checks `build-and-test`, `typescript`, `policy-guard` all green; `npm ci`, `npm run typecheck`, `npm test` (62/62), `npm run build` all passed when I ran them myself; the four config layers and validator match spec section 2; the typecheck-test's non-vacuousness was independently reproduced (stripping a `@ts-expect-error` directive reproduced the claimed `TS2739` failure). Full verdict: #67 (comment)
All acceptance criteria met in full — closing, not narrowing.
- removedstatus:needs-reviewImplementation complete, awaiting acceptanceImplementation complete, awaiting acceptance
on Sep 5, 2026
Goal
Implement
REQ-CONFIG-001: introduce the four canonical configurationlayers —
RunOptions,SimulationConfig,ScenarioDefinitionandDefinitionPack— as a typed ownership boundary, and prove mechanicallythat a scenario cannot smuggle in behavioral tuning ("arbitrary scenario
behavioral patches").
Evidence
docs/spec/mirror/06 - Handoff/03 — CANONICAL_CONFIG_AND_WORLD_GENERATION.mdsection 2 ("Configuration hierarchy") defines the four layers verbatim:
and the ownership rule immediately below it:
docs/spec/mirror/REQUIREMENTS_REGISTRY.csvrowREQ-CONFIG-001: typeconfig, priorityP0, statusREADY,DEPENDS_ON=REQ-CORE-001(alreadymerged in #48,
58a0b49156131ec81fcb23d357f7e15b327bde4d). Acceptance:"Schema/validation tests demonstrate the four ownership boundaries and
reject arbitrary scenario behavioral patches."
docs/spec/mirror/EXECUTION_ORDER.mdputs M1 ("Canonicalprimitives/config/world genesis") immediately after the now-complete M0
gate (
REQ-MIGRATION-001..004andREQ-VISUALIZATION-003are allIMPLEMENTEDindocs/spec/IMPLEMENTATION_STATUS.md), and namesREQ-VISUALIZATION-004's world-gen preview as depending onREQ-CORE-004being reached via M1's config/genesis chain.
REQ-CONFIG-002,REQ-CORE-003andREQ-CONFIG-003all depend onREQ-CONFIG-001in theregistry, so it is the earliest still-unclaimed requirement whose own
dependency (
REQ-CORE-001) is already satisfied.REQ-CORE-002(
src/domain/finite-number/ordering primitives) is already claimed byIssue #57 / PR #58 and is not re-selected here. No other open Issue or pull
request currently names
REQ-CONFIG-001(gh issue list --state all --search "REQ-CONFIG-001"as of this Issue).Scope
Type-level and validation-level scaffolding only, in
src/config/. Noconcrete subsystem default values and no world-construction logic:
RunOptionsexactly as specified (scenarioId,seed,maxTicks?,diagnosticsLevel).SimulationConfig, assembled exactly per the interface above, where eachof the 13 named sub-config types (
NumericConfig,CadenceConfig,MarketConfig,TradeConfig,ProductionConfig,LaborConfig,PopulationConfig,ClanConfig,FiscalConfig,MonetaryConfig,ExpansionConfig,EventConfig,PerformanceConfig) is declared as anamed placeholder type (e.g. an empty/minimal interface) documented as
"concrete fields land with the requirement that owns this subsystem" —
sections 3-14 of the spec document give each sub-config's field-level
defaults, but pinning those now would preempt requirement rows the
registry has not yet created for M3-M10 (
EXECUTION_ORDER.md: thosemilestones' rows are added when the researcher promotes into them).
ScenarioDefinitionandDefinitionPack, assembled exactly per theinterfaces above, with their referenced seed/definition types
(
RegionSeed,TransportLinkSeed,StateSeed,CurrencySeed,MonetaryAuthoritySeed,ClanSeed,CohortSeed,ProductionUnitSeed,MarketSeed,BondSeed,InitialEventSeed,ScenarioVariationConfig,GoodDefinition,RecipeDefinition,EventDefinition,MetricDefinition) similarly declared as named placeholder types for thesame reason.
assertNoBehavioralOverrides/validateScenarioDefinitionShape) that, given a candidate scenario-likeobject, throws when it carries any property name belonging to
SimulationConfig's 13 behavioral-tuning keys, or any key outsideScenarioDefinition's declared key set — the direct mechanical proof of"Scenario-specific behavioral overrides are forbidden in core v1... must
not patch arbitrary fields."
.typecheck.test.tsin the style ofsrc/domain/id.typecheck.test.tsshowing, for example, that a value typed as
RunOptionsis notassignable to
ScenarioDefinitionand vice versa);ScenarioDefinition-shapedobject;
SimulationConfig-owned key (e.g. injectingmarkets: {...}ornumeric: {...}onto a scenario object);unknown key not in the declared schema.
src/config/index.ts,replacing the current
CONFIG_MODULE_AREAscaffolding placeholdercontent (the placeholder constant itself may stay if still useful, or be
superseded — implementer's call, not a fixed requirement of this Issue).
Non-goals
SimulationConfigsub-domains (sections 3-14 of the spec document) — each is separate,
not-yet-registered, milestone-specific work.
buildInitialWorld,WorldGenesisLedger, or any world-constructionlogic (
REQ-CONFIG-003,REQ-CONFIG-004).REQ-CONFIG-002).REQ-CORE-003).behavioral-override rejection this Issue's acceptance criterion asks for
(full validation — bounds, references, uniqueness — is
REQ-CONFIG-005).future work once there is real content to hash.
Acceptance criteria
RunOptions,SimulationConfig,ScenarioDefinitionandDefinitionPackexist insrc/config/matching section 2's shape,with named (placeholder-content-acceptable) types for every nested
type section 2 references.
SimulationConfig-owned behavioral key, and rejects one carrying anarbitrary unknown key, while accepting a minimal well-formed one.
distinct, non-interchangeable types.
src/config/index.ts.npm run typecheck,npm test, andnpm run buildpass.docs/spec/IMPLEMENTATION_STATUS.mdgains aREQ-CONFIG-001row oncethis merges (recorded by the implementing pull request, not this
Issue).
Verification
npm ci npm run typecheck npm test npm run buildManual cross-check: the new types/validator source directly cites
docs/spec/mirror/06 - Handoff/03 — CANONICAL_CONFIG_AND_WORLD_GENERATION.mdsection 2, and the new rejection tests fail if the validator is deleted or
replaced with a no-op (i.e. they are not vacuously green).