Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Milestone
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "src/data/weapons.ts と src/data/units.ts の空 catalog を実体化し、後続 consumer Issue が参照可能な最小 armament seed を追加する"
change_kind: dataParent Issue
none(単独改善)
Parent Goal Ref
- Goal:
src/data/weapons.tsとsrc/data/units.tsを空配列のまま放置せず、後続 consumer が参照可能な最小 catalog seed を追加する - Desired Destination: N/A(単独改善 Issue のため)
Current Validated Scope
src/data/weapons.tsの schema をidではなくreadonly definitionIdに統一し、player_weapon_basicを最小 1 件追加するsrc/data/units.tsの schema をidではなくreadonly definitionIdに統一し、ally_basicを最小 1 件追加する- 両 catalog は
src/data/enemies.tsと同じas const satisfies readonly ...[]パターンに揃える src/data/CLAUDE.mdの不変条件に従い、純粋データ列挙のみとし、helper 関数や制御フローを持ち込まないunits.tsのally_basicは既存createDefaultAllyState(1)と矛盾しない archetype 値に限定するweapons.tsはdocs/product/features/upgrade.mdと衝突しない最小 schema に留め、damageの authority をprogress.weaponPowerから奪わない
Remaining Parent Gaps
なし(単独改善 Issue のため)
Outcome
src/data/weapons.ts と src/data/units.ts が空 catalog ではなくなり、definitionId ベースの readonly catalog seed として後続 consumer Issue が参照可能な最小データが追加され、pnpm typecheck / pnpm lint / pnpm test / pnpm build が PASS した PR がマージされた状態。
In Scope
src/data/weapons.tsでWeaponDefinitionをreadonly definitionIdベースへ更新し、player_weapon_basicを追加するsrc/data/units.tsでUnitDefinitionをreadonly definitionIdベースへ更新し、ally_basicを追加するweaponDefinitions/unitDefinitionsをas const satisfies readonly ...[]に変更するally_basicの radius / speed / behavior に相当する catalog 値を、既存createDefaultAllyState(1)と矛盾しない範囲に揃えるWeaponDefinitionはprogress.weaponPowerと authority conflict を起こさない最小 field に限定する
Out of Scope
weaponDefinitions/unitDefinitionsを runtime で参照する system 側の実装GameState.ts/SortieSystem.tsなど Allowed Paths 外の runtime hardcode の置換docs/product/features/upgrade.mdの仕様変更、および upgrade apply / resource debit / persistence 連携の実装progress.weaponPowerと別 authority になる固定damageschema の導入- バランス調整、および
src/data/enemies.tsの変更
Acceptance Criteria
- AC1:
src/data/weapons.tsのWeaponDefinitionがreadonly definitionId: stringを持つ - AC2:
src/data/weapons.tsにdefinitionId: 'player_weapon_basic'を持つ readonly catalog entry があり、as const satisfies readonly WeaponDefinition[]を使っている - AC3:
src/data/units.tsのUnitDefinitionがreadonly definitionId: stringを持つ - AC4:
src/data/units.tsにdefinitionId: 'ally_basic'を持つ readonly catalog entry があり、as const satisfies readonly UnitDefinition[]を使っている - AC5:
ally_basicの catalog 値は既存createDefaultAllyState(1)と矛盾しない archetype 範囲(faction: 'ally'、role: 'ally_basic'、radius: 12、speedPxPerSec: 140、initialBehaviorState: 'inactive'、defaultTargetingPolicy: 'nearest_hostile')に限定されている - AC6:
src/data/weapons.tsの catalog schema はownerFaction/fireCooldownMs/projectileRadius/projectileSpeedPxPerSec/projectileLifetimeMsを含む最小 readonly data shape である - AC7:
pnpm typecheckが PASS する - AC8:
pnpm lintが PASS する - AC9:
pnpm testが PASS する - AC10:
pnpm buildが PASS する
Verification Commands
# AC1
$ rg -n "readonly definitionId: string" src/data/weapons.ts
# AC2
$ rg -n "definitionId: 'player_weapon_basic'" src/data/weapons.ts
# AC3
$ rg -n "readonly definitionId: string" src/data/units.ts
# AC4
$ rg -n "definitionId: 'ally_basic'" src/data/units.ts
# AC5
$ rg -F -n "faction: 'ally'" src/data/units.ts
$ rg -F -n "role: 'ally_basic'" src/data/units.ts
$ rg -F -n "radius: 12" src/data/units.ts
$ rg -F -n "speedPxPerSec: 140" src/data/units.ts
$ rg -F -n "initialBehaviorState: 'inactive'" src/data/units.ts
$ rg -F -n "defaultTargetingPolicy: 'nearest_hostile'" src/data/units.ts
# AC6
$ rg -F -n "ownerFaction: 'player'" src/data/weapons.ts
$ rg -F -n "fireCooldownMs:" src/data/weapons.ts
$ rg -F -n "projectileRadius:" src/data/weapons.ts
$ rg -F -n "projectileSpeedPxPerSec:" src/data/weapons.ts
$ rg -F -n "projectileLifetimeMs:" src/data/weapons.ts
# AC7
$ pnpm typecheck
# AC8
$ pnpm lint
# AC9
$ pnpm test
# AC10
$ pnpm buildAllowed Paths
- src/data/weapons.ts
- src/data/units.ts
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue は
src/data配下の静的 catalog seed 追加に限定され、runtime consumer 接続・playtest・preview 配布の動作検証は別 Issue の責務である
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
ally_basicを既存createDefaultAllyState(1)と異なる runtime authority にしたいと判明した場合WeaponDefinitionに固定damagefield などprogress.weaponPowerと衝突する authority を導入する必要があると判明した場合
Notes for Reviewer
src/data/enemies.ts の readonly catalog pattern を参照パターンとする。ただし weapons.ts は docs/product/features/upgrade.md の target: progress.weaponPower と衝突しない最小 schema に留め、固定 damage field を導入しない。units.ts は runtime spawn schedule ではなく archetype catalog として扱い、createDefaultAllyState(1) の既存値と矛盾しない最小 seed を置く。
Required Skills
- TypeScript
Scope Delta(任意)
N/A
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jul 1, 2026
判定
REQUEST_CHANGES 相当。 #1175 の目的自体は妥当です。
src/data/weapons.tsとsrc/data/units.tsは現状id: stringだけの interface と空配列で、Issue が指摘する「catalog が実体化されていない」状態は事実です。#1175 自体にコメントはありません。ただし、この Issue contract は そのまま実装投入すると false green になりやすいです。特に、現在の AC は
definitionIdの grep だけで配列が空でも通り得ること、idとdefinitionIdの schema 不一致、既存 runtime がweaponDefinitions/unitDefinitionsを一切参照していないこと、そして #1170 / #1237 によりupgrade.mdが既に存在しているため #1175 の Out of Scope が古くなっていることが問題です。#1175 はweapons.ts/units.tsに最低 1 件追加し、enemies.tsのas const satisfies readonly EnemyDefinition[]パターンに倣うことを要求していますが、現在のenemies.tsはreadonly definitionIdと数値 field を持つ readonly catalog です。P0: 実装前に Issue contract を修正すべき点
1.
upgrade.md が未作成という前提が古い#1175 の Out of Scope は「upgrade spec との連携(docs/product/features/upgrade.md が未作成のため)」としていますが、現在は
docs/product/features/upgrade.mdが存在し、doc_id: feature-upgrade、related_issue: "#1170"、parent_issue: "#1176"を持っています。さらにUpgradeDefinitionschema としてcurrency: resources/cost/target: progress.weaponPowerを固定しています。修正案は、「upgrade spec が未作成だから連携しない」ではなく、次のようにすべきです。
特に
ProjectileState.damageは「fire 時点のstate.progress.weaponPowersnapshot」として定義済みなので、#1175 で安易にWeaponDefinition.damageを追加すると、damage の正本がprogress.weaponPowerとweapons.tsに分裂します。2.
idとdefinitionIdの schema 不一致を放置している現状の
weapons.ts/units.tsはid: stringです。一方、#1175 の verification はdefinitionIdを grep し、参照パターンであるenemies.tsもreadonly definitionIdを使っています。ここは実装者判断にせず、Issue 側で明示すべきです。
さらに、
export const weaponDefinitions: WeaponDefinition[] = []のような widening する配列型指定ではなく、repo 既存 pattern と TypeScript のas const satisfiesを使うべきです。TypeScript 公式 docs でも、satisfiesは式の具体的な型情報を保ちながら target type への適合を検証する目的の機能です。またas constは literal widening を抑え、object property を readonly、array literal を readonly tuple にします。([typescriptlang.org]1) ([typescriptlang.org]2)3. AC が false green を許す
現在の AC1 / AC2 は
rg -n "definitionId" src/data/weapons.tsとsrc/data/units.tsです。これは interface にdefinitionIdを追加しただけで、catalog 配列が空のままでも通ります。Issue の Outcome は「空配列でなくなること」なので、AC は literal entry を直接検証すべきです。最低限、以下に差し替えるべきです。
src/data/CLAUDE.mdはsrc/dataを「ロジック禁止・純粋データ列挙のみ」「1 ファイル 1 ドメイン」と定めています。Issue の VC にこの不変条件を入れないと、後続実装で helper function や derivation logic が混入しても検出できません。4. 「data-driven armament を参照できる」は現状では過大表現
検索上、
weaponDefinitionsはsrc/data/weapons.ts以外に参照がありません。unitDefinitionsもsrc/data/units.ts以外に参照がありません。つまり #1175 だけでは runtime が data-driven になるわけではなく、単に future consumer 向けの catalog seed を作るだけです。一方、enemy 側は
EnemySpawnSystemがenemyDefinitionsを import し、definitionIdで検索してEnemyStateへ値をコピーしています。これが「data-driven catalog を runtime が消費している」実例です。weapons / units にはこの consumer がまだありません。したがって Outcome はこう直すべきです。
5.
unitDefinitionsは既存 hardcoded ally と二重 SSOT になり得るGameState.tsには既にcreateDefaultAllyState(1)があり、ally_basicの role / faction / behavior / targeting / radius / speed / spawn position を hardcode しています。SortieSystem.resetCombatRuntime()は sortie 開始時にstate.allies = [createDefaultAllyState(1)]を直接設定します。#1175 で
ally_basicを別値で定義すると、即座にGameState.tsとsrc/data/units.tsが矛盾します。Allowed Paths がsrc/data/weapons.ts/src/data/units.tsのみなので、runtime 側を直すこともテストを追加することもできません。したがって #1175 では、少なくとも既存 hardcoded defaults と同じ値を catalog に写すべきです。異なる値にするなら、#1175 の Stop Condition に該当します。6.
WeaponDefinitionのdamageは特に危険#1175 の Notes は
damage / speed / radius等の field 設計に触れていますが、damage は軽く扱うべきではありません。現在の upgrade spec はprogress.weaponPowerを M4 最小 target とし、purchase はvalidate → debit → apply → snapshot、保存成功後のみ commit、次 sortie 反映、既存 projectile への retroactive 適用なしと定義しています。したがって、#1175 で
damage: 1のような固定値を WeaponDefinition に入れると、後続の upgrade apply pipeline が「weapon catalog の damage を変更するのか」「progress.weaponPower を参照するのか」で割れます。安全な選択肢はどちらかです。
または、
A の方がより保守的です。B は future consumer に意図を伝えますが、data catalog に progression path string を入れる設計なので、採用するなら Issue に明記すべきです。
推奨する最小 schema 方針
src/data/weapons.tsdamageを固定値にしない。fireCooldownMsは既存player.weaponIntervalMs = 280と整合させる。projectile speed / lifetime / radius は既存 runtime 定数があるならそれを写し、なければ #1175 で勝手に balance 決定しない。movement-projectile.mdではfire_cooldown_msは既存weaponIntervalMs = 280を暫定採用していますが、projectile speed / lifetime は当初 TBD とされていました。推奨形は次です。
未確認値を新規に決める必要があるなら、それは #1175 の「バランス調整は別 Issue」に反します。
src/data/units.tsunits.tsは spawn schedule ではなく unit archetype catalog として扱うべきです。x/yを入れると「unit 定義」と「sortie 初期配置」が混ざります。既存createDefaultAllyState()との互換を保つなら、spawn-independent な archetype field に限定するのが安全です。これは
GameState.tsの既存createDefaultAllyState()と矛盾しません。配布物・Web 実装観点での注意
#1175 単体は localStorage や preview 配布を触りません。ただし M4 の upgrade loop に接続されると、保存・preview・E2E key 分離が関係します。
persistence.mdは HTTP origin 前提、file://非保証、production / PR preview / E2E の storage key matrix、production key を preview / E2E で clear しない方針を定義済みです。この方針は外部仕様とも整合します。MDN は
localStorageを origin ごとの保存と説明し、file:の挙動は保証されないとしています。WHATWG HTML は Web Storage について、複数 agent 間の locking は想定できず、setItem()は保存不能時にQuotaExceededErrorを投げ得るとしています。([MDNウェブドキュメント]3) ([html.spec.whatwg.org]4)また、Vite の
import.meta.envは build 時に静的置換され、client に露出する env はVITE_prefix 付きです。Vite 公式 docs はVITE_*に secret を入れないよう明記しています。#1175 で env は触らないとしても、後続の PR preview / upgrade persistence 実装で catalog ID や storage namespace を混同しないよう、VITE_LOOP_STORAGE_NAMESPACEは非秘密の build-time namespace として扱うべきです。([vitejs]5)UI 露出も同様です。unit / weapon catalog の
definitionIdを normal UI にそのまま出すべきではありません。unit-operations SSOT は DOM HUD を authoritative / focusable surface とし、Canvas は non-authoritative visual cue、raw enum / raw state は debug 限定としています。MDN も canvas 単体では描画物の semantic information を accessibility tools に露出しないため、canvas のみへ依存しない設計を求めています。 ([MDNウェブドキュメント]6)GitHub に貼るレビュー案
Recommended direction
as const satisfies readonly ...[], matchingenemies.ts.src/datapure data only.units.tsas unit archetype catalog, not spawn schedule.damageauthority withprogress.weaponPowerunless a separate schema issue explicitly changes that.squne121 commentedon Jul 1, 2026
Contract Review
squne121 commentedon Jul 1, 2026
Refinement Loop: Approved
Issue #1175 の anchor comment
#issuecomment-4853952978を一次ソースとして contract を更新し、deterministic review と contract review の両方でgo/approveを確認しました。approvedfix(data): align weapon seed with runtime defaults (#1175)
feat(data): bootstrap armament catalogs (#1263)