Spaces:
Paused
Paused
Commit History
-
Tier 1, step 2: make the type layer real (D1, D2, D4)
Claude +1: Claude Opus 5Unverified signatureengine/types.js had drifted from the shapes it claims to model. A tsc probe against the seven typedefs returned 20 errors and zero on the control fields: State.popCap, State.playerAi AiState.strategy, AiState.lastThreatAt Galaxy.lanes, Galaxy.laneSeq GalaxySettings.startId, GalaxySettings.popCap Diplomacy.provokedAt/goodwill/request/lastFavorBucket Order.tx/ty/explore/patrol Archetype.wantsRefinery/turretCount/maxBarracks/garrison State.playerAi is the central field of the self-play feature, left undeclared by the very commit that added it. The drift was invisible because every factory assigns to a const before returning, so TypeScript never runs an excess-property check — and it actively BLOCKED adoption: annotating one function in engine/supply.js with @param {State} produced three errors in correct code, which teaches contributors to distrust the checker. All 20 now resolve; typecheck stays clean. Added a Lane typedef (createLane's real shape) and declared the lazil…6db3533
-
Add JSDoc typedefs + // @ts-check for the core sim shapes (no build step)
Claude +1: Claude Opus 4.8Unverified signatureAddress the top architectural-review finding — an untyped mutable `state` bag threaded through ~360 functions, where a mistyped or renamed field reads undefined silently and the same-seed determinism test can't see it. Now that class of bug is a check-time error. Zero runtime cost and no build step: the shipped code stays plain ES modules. - engine/types.js: JSDoc @typedefs for the core shapes (State, Unit, Building, Player, AiState, Resources, Cargo, Order, ResourceNode, GameMap, Fog, Market, Diplomacy, Galaxy, …). No runtime code, never imported — global typedefs the checker and any editor's TS language service resolve project-wide. - jsconfig.json + `npm run typecheck` (tsc, noEmit): checking is OPT-IN per file via a `// @ts-check` pragma, so coverage grows file-by-file. Editors check the annotated files live with no install; the script needs a tsc available. - Enabled + annotated on the core data + hot path: state.js (the factories bind the types to the real objects), …e3658fa