Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #782 の playtest feedback を受けて、通常 UI の player-facing HP/HULL 表示を integer-only ポリシーに更新する"
change_kind: mixedParent Issue
none
Parent Goal Ref
- Goal: PR feat: add phase-aware HUD controls (#770) #782 の playtest feedback を受けて、通常 UI の HP/HULL 表示ポリシーを player-facing integer-only に更新する
- Desired Destination:
src/render/renderUtils.tsが normal UI の HP/HULL 表示 SSOT となり、0 < value < 1が<1/ 小数として出ない状態
Source
- PR comment: feat: add phase-aware HUD controls (#770) #782 (comment)
- cleanup worker request:
follow-up:squne121/loop-protocol:pr/782:3 - dedupe_key:
follow-up:squne121/loop-protocol:pr/782:3
Current Validated Scope
src/render/renderUtils.tsのformatCombatNumberは DOM HUD と Canvas の共有フォーマッタであり、現在は0 < value < 1を<1と表示するsrc/ui/HudController.tsの Hull 表示は共有フォーマッタ経由で player HP / maxHp を描画しているため、ポリシー変更は通常 UI に直接影響するtests/render/renderUtils.test.tsとtests/hud-controller.test.tsは現行の<1露出を期待しているため、新ポリシーに合わせた更新が必要docs/product/features/combat-core.mdのnumber_display_policyは現行の<1ポリシーを正本としているため、player-facing normal UI の契約更新が必要
Remaining Parent Gaps
- なし(本 Issue では player-facing HP/HULL の通常 UI 表示ポリシーのみを閉じる)
Outcome
通常 UI でプレイヤーに見える HP / HULL の表示が整数 bucket に統一され、0 < value < 1 でも <1 や小数ではなく整数のみで表現される。docs/product/features/combat-core.md、共有フォーマッタ実装、関連テストが一致している状態。
Decision
anchor comment (squne121, 2026-06-11) の BLOCKER 1-3 を受けて以下を決定する:
- formatCombatNumber のスコープ:
formatCombatNumberは DOM HUD と Canvas enemy HP label の共有フォーマッタ。normal play に表示される HP/HULL 系数値では、player Hull と enemy HP label の 両方 で<1/ 小数を禁止する。 0 < value < 1の出力:Math.ceil(value)を使い"1"を返す(正の有限数は最小でも1にバケットされるルールに統一)。- debug / exact inspection はこの formatter を使わず、raw value または別 formatter を使う。
In Scope
- player-facing normal UI の HP/HULL 表示を整数 bucket に統一する
0 < value < 1を<1ではなく整数 bucket に丸めるsrc/render/renderUtils.tsの共有ポリシーを normal UI 向けに更新するtests/render/renderUtils.test.tsとtests/hud-controller.test.tsを新方針に合わせて更新するtests/player-facing-hp-policy.test.tsを追加して、通常 UI では<1/ 小数が出ないことを回帰固定するdocs/product/features/combat-core.mdのnumber_display_policyを新しい player-facing 方針に更新する
Out of Scope
- 全面の UI redesign / レイアウト再構成
- pause/resume / debug surface / Claim reward の文言変更
- combat damage 計算や hp の内部モデル変更
- 新しい health bar / VFX / アニメーションの追加
- state / systems 層の責務変更
- この Issue は HP/HULL numeric policy の narrow fix であり、
LoopPhase/Telemetry/Claim rewardの通常 UI 露出解消は行わない(調査: combat UI information architecture と HP/HULL 表示ポリシーを正本化する #785 / [Deferred] 実装: 戦闘中ステータス(HULL/HP)を戦闘描画画面(Canvas)に集約表示する #727 rewrite または後続 Issue で対処)
Acceptance Criteria
- AC1:
pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts tests/hud-controller.test.tsが通り、通常 UI の HP/HULL 表示が<1や小数を出さないことが固定される - AC2:
docs/product/features/combat-core.mdのnumber_display_policyに player-facing integer-only policy が明記される - AC3:
src/render/renderUtils.tsの共有 formatter が normal UI で integer bucket を返す実装に更新される - AC4:
pnpm typecheckが通る - AC5:
pnpm lintが通る - AC6:
pnpm buildが通る - AC7:
formatCombatNumber(0.001),formatCombatNumber(0.5),formatCombatNumber(0.9999)はすべて"1"を返し、"<1"を返さない - AC8: HUD Hull 表示で
player.hp = 0.5のとき<1/ 小数を含まず1/<max>の integer-only bucket になる - AC9: enemy HP label も normal-play 表示として扱う場合、
enemyHp = 0.5が"<1"でなく"1"と描画される - AC10:
docs/product/features/combat-core.mdから旧0 < value < 1 -> "<1"正本を削除し、UI IA の normal/debug boundary と整合する - AC11: 実装: Player 向け HP / HULL 表示ポリシーを通常 UI に適用する #788 完了は HP/HULL numeric policy の narrow fix であり、
LoopPhase/Telemetry/Claim rewardの normal UI 露出解消は別 issue として残ることを明記する
Verification Commands
# AC1
$ pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts tests/hud-controller.test.ts
# AC2
$ rg -n "integer-only" docs/product/features/combat-core.md
# AC3
$ pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts tests/hud-controller.test.ts
# AC4
$ pnpm typecheck
# AC5
# preflight-scope: pr_review_only
$ pnpm lint
# AC6
$ pnpm build
# AC7
$ pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts
# AC8
$ pnpm test -- tests/player-facing-hp-policy.test.ts tests/hud-controller.test.ts
# AC9
$ pnpm test -- tests/player-facing-hp-policy.test.ts tests/hud-controller.test.ts
# AC10
$ rg -n "integer-only|1.*rationale" docs/product/features/combat-core.md
# AC11
# preflight-scope: pr_review_only
$ rg -n "narrow fix|LoopPhase|Telemetry|Claim reward" tests/player-facing-hp-policy.test.ts
$ rg -n "player-facing integer-only|narrow fix|HP.HULL numeric policy" docs/product/features/combat-core.mdAllowed Paths
src/render/renderUtils.tsdocs/product/features/combat-core.mdtests/render/renderUtils.test.tstests/hud-controller.test.tstests/player-facing-hp-policy.test.ts
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- player-facing normal UI に
<1/ 小数を消すには広い UI redesign が必要と判明した場合 - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Runtime Verification Applicability
decision: not_applicable
rationale: VC は pnpm test / typecheck / lint / build の静的コマンドのみで構成されており、ブラウザ実行・サーバー起動・プレイヤー操作を必要としない。
Required Skills
- TypeScript / TSC strict
- Vitest BDD
- DOM UI rendering
Product Spec Context
- product_spec_id: combat-core/number_display_policy
- requirement_id: REQ-788
- changed_requirement_ref: combat-core/number_display_policy
- source_task_id: T-788
- source_reference: "follow-up:squne121/loop-protocol:pr/782:3"
- diff_rationale: "PR feat: add phase-aware HUD controls (#770) #782 playtest feedback で 0 < value < 1 が '<1' として表示される挙動が問題化。anchor comment (squne121, 2026-06-11) の BLOCKER 1-3 を受け、通常 UI の HP/HULL 表示を integer-only bucket ポリシーに変更する。debug / exact inspection は別 formatter を使うことで regression を防ぐ。"
- changed_requirement_id: REQ-788
- affected_sections:
- docs/product/features/combat-core.md#number_display_policy
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 Jun 11, 2026
結論
Issue #788 は方向性は正しいです。ただし、現状のまま AI エージェントへ渡すと 「player HULL だけ直したつもりで、通常 UI 全体の数値表示ポリシーが半端に壊れる」 可能性があります。着手前に Issue 契約を少し修正すべきです。
特に重要なのは、
formatCombatNumberが DOM HUD と Canvas enemy HP label の共有フォーマッタ で、現在は0 < value < 1を"<1"にしています。実装もその通りです。 HUD 側も player Hull をこの共有 formatter で描画しているため、player HP が0.5のとき<1/8のような表示になります。参照した関連情報
Issue #788 自体にはコメントはありません。 発生源は PR #782 の playtest review です。PR #782 は merged 済みで、phase-aware HUD controls を追加した PR でした。([GitHub]1) ただしレビューコメントでは、UI が 1920×1080 相当で画面に収まらない、
Loop Phase/Telemetry/Claim reward/Debrief: reward pendingなど内部語彙が通常 UI に露出している、そして HULL 表示に<1が見える点が強く問題化されています。([GitHub]1)さらに後続の UI Information Architecture では、通常プレイ UI で
LoopPhase、Telemetry、Claim reward、fractional HP/HULL、<1を直接表示しないことが明文化されています。 同じ文書は、normal play UI の HP/HULL は fractional や<1ではなく integer-only bucket にする、と明記しています。BLOCKER 1: 「player-facing HP/HULL」だけではスコープが曖昧
Issue #788 は player HP/HULL の通常 UI 表示を対象にしていますが、現在の実装では
formatCombatNumberが player Hull と enemy HP label の両方で使われています。drawEnemyHpLabelもformatCombatNumber(enemyHp)を呼びます。 CanvasRenderer は非撃破 enemy ごとにdrawEnemyHpLabelを呼んでいます。つまり、
formatCombatNumberを変更すると enemy HP label も自動的に変わる。これはたぶん望ましいですが、Issue 本文ではそこが明示されていません。PR #782 の後続コメントでは「敵HPラベル由来だとしても、プレイヤーに見せる UI 要素として<1は避けたい」という趣旨が出ているため、通常 UI 全体に適用する方が整合します。([GitHub]1)修正提案: Issue #788 に次を明記してください。
BLOCKER 2:
0 < value < 1の出力が未定義Issue #788 は「integer bucket」と言っていますが、
0.5を何にするかが未定義です。ここを曖昧にすると、実装者が0、1、CRITICAL、空文字、ゲージ表示などに分岐できます。この narrow issue で安全なのは
0 < value < 1を"1"にする 方針です。理由は単純で、現行のvalue >= 1ではMath.ceilを使っており、Math.ceilは与えられた数以上の最小整数を返します。([MDNウェブドキュメント]2) つまり、有限の正数は最小でも1に bucket される、というルールに統一できます。推奨仕様:
CRITICALや visual gauge は上位 UI 設計としては良いですが、Issue #788 の Allowed Paths と Out of Scope では広すぎます。グラフィック表現は #785 / #727 rewrite 側に寄せるべきです。BLOCKER 3: docs の正本がまだ旧ポリシーを強く保持している
docs/product/features/combat-core.mdは現在も0 < value < 1の出力を"<1"と定義し、その rationale を「living unit を 0 と表示しないため」としています。 さらに表示セマンティクスでも0 < value < 1を"<1"と表示すると説明しています。ここを「player-facing だけ上書き」として曖昧に残すと、次の実装者が combat-core を見て
<1を復活させます。特に同じ文書の末尾には「future numeric labels should also useformatCombatNumber」とあり、古い<1ポリシーを将来 UI に拡散させる危険があります。修正提案: combat-core の
number_display_policyは、次のように変更すべきです。あわせて「debug / exact inspection は別 formatter または raw value を使う」と書いてください。
BLOCKER 4: 現在のテストは旧挙動を固定している
tests/render/renderUtils.test.tsはformatCombatNumber(0.5)が'<1'を返すことを期待しています。 これは Issue #788 の目的と正面衝突しています。また、PR #782 の差分では HUD の低 HP 表示テストが削られ、phase/action matrix 側のテストに寄っています。 現在の
tests/hud-controller.test.tsも button state や phase copy を中心に見ており、hp = 0.5の Hull 表示を固定していません。最低限追加すべきテスト:
HUD 側:
enemy label も通常プレイ表示として扱うなら、mock canvas の
fillText引数でenemyHp: 0.5が"1"になることを固定してください。BLOCKER 5: #788 の成功条件が「通常 UI の語彙境界」まで満たすように読めてしまう
UI IA では通常 UI に
LoopPhase、Telemetry、Claim rewardを直接出すことが forbidden とされています。 しかし現在のHudController.tsはLoop Phase、Telemetry、Claim rewardを DOM HUD に出しています。これは #788 の Out of Scope に近いので、#788 で直すべきではありません。ただし、#788 の完了時に「通常 UI が設計方針に完全準拠した」と誤認させてはいけません。#788 は HP/HULL numeric policy の narrow fix であって、normal/debug vocabulary boundary の全面解決ではありません。
Issue に追記すべき注意:
技術調査ベースの実装品質メモ
disabledbutton の no-op テストは妥当です。HTML の disabled control はクリックやフォーカスなどの browsing event を受けず、ユーザー操作不可になります。([MDNウェブドキュメント]3) ただしmain.ts側の phase guard は残すべきです。DOM disabled は UI ガードであって、domain guard の代替ではありません。role="status"/aria-live="polite"は、保存・ロード・報酬 claim のような advisory feedback には妥当です。status role は polite live region として扱われます。([MDNウェブドキュメント]4) ただし HP/HULL の毎フレーム変動を live region 化するのは避けるべきです。textContent使用は正しいです。innerHTMLは HTML injection 面のリスクがあり、テキスト表示にはtextContentが適切です。([MDNウェブドキュメント]5)推奨する Issue #788 の修正版 AC
現行 AC に加えて、以下を追加してください。
推奨判定
現状の Issue #788: 修正してから着手。
実装自体は小さいですが、契約が曖昧です。特に
0 < value < 1を"1"にするのか、enemy HP label も対象に含めるのか、debug exact value と normal UI bucket をどう分けるのかを明示しないと、AI エージェントが「テストは通るが設計正本とズレる」PR を出す可能性が高いです。squne121 commentedon Jun 11, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 11, 2026
ClaudeCode作業ログ
squne121 commentedon Jun 11, 2026
Contract Review: BLOCKED (2026-06-12T00:17:00Z)
不足項目
1. Product Spec Preflight: BLOCKED (PS001, PS004)
Allowed Paths に `docs/product/features/combat-core.md` が含まれるため Product Spec チェックが適用されます。
修正例:
Issue 本文に以下を追加してください。
2. VC Preflight: BLOCKED (AC5, AC11)
推奨アクション
`issue-refinement-loop` の起動を推奨します。上記の修正項目(PS001/PS004 の `## Product Spec Context` 追加、AC5 VC の preflight-scope 設定、AC11 VC 修正)を適用後、`issue-contract-review` を再実行してください。
```yaml
CONTRACT_REVIEW_RESULT_V1:
status: blocked
generated_at: "2026-06-12T00:17:00Z"
generated_by: issue-contract-review
issue_url: #788
checks:
template_compliance: pass
state_label: ok
allowed_paths_present: pass
vc_present: pass
stop_conditions_complete: pass
vc_preflight:
passed: false
vc_failed_as_expected: 2
vc_passed_unexpectedly: 1
vc_unrunnable: 0
vc_expected_pass: 7
vc_skipped: 0
classifications:
- ac: AC1
command: "pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts tests/hud-controller.test.ts"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC2
command: "rg -n "integer-only" docs/product/features/combat-core.md"
exit_code: 1
category: expected_baseline_fail
scope_class: baseline_fail_expected
confidence: high
decision: go
- ac: AC3
command: "pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts tests/hud-controller.test.ts"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC4
command: "pnpm typecheck"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC5
command: "pnpm lint"
exit_code: 1
category: regression_gate
scope_class: regression_gate
confidence: low
decision: blocked
evidence:
stderr_excerpt: ".claude/skills/.system/openai-docs/scripts/fetch-codex-manual.mjs: no-undef errors (untracked file, worktree 非伝播)"
- ac: AC6
command: "pnpm build"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC7
command: "pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC8
command: "pnpm test -- tests/player-facing-hp-policy.test.ts tests/hud-controller.test.ts"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC9
command: "pnpm test -- tests/player-facing-hp-policy.test.ts tests/hud-controller.test.ts"
exit_code: 0
category: regression_gate
scope_class: regression_gate
confidence: low
decision: go
- ac: AC10
command: "rg -n "integer-only|1.rationale" docs/product/features/combat-core.md"
exit_code: 1
category: expected_baseline_fail
scope_class: baseline_fail_expected
confidence: high
decision: go
- ac: AC11
command: "rg -n "narrow fix|LoopPhase|Telemetry|Claim reward" tests/player-facing-hp-policy.test.ts"
exit_code: 2
category: unknown
scope_class: baseline_fail_expected
confidence: low
decision: human_judgment
evidence:
stderr_excerpt: "rg: tests/player-facing-hp-policy.test.ts: No such file or directory"
- ac: AC11
command: "rg -n "non.goal|narrow" docs/product/features/combat-core.md"
exit_code: 0
category: unexpected_pass
scope_class: baseline_fail_expected
confidence: medium
decision: blocked
evidence:
stdout_excerpt: "M2 collision non-goals / narrow-phase の既存テキストにマッチ"
ac_verifiability: pass
product_spec_check:
applicability: applicable
decision: fail
triggers:
docs_product_allowed_paths: true
tasks_md_mentioned: false
specify_artifact_mentioned: false
generated_task_mentioned: false
product_spec_context_present: false
blocked_reasons:
- rule_id: PS001
source: allowed_paths
excerpt: "docs/product/* 更新ありかつ spec delta Issue リンク / Product Spec Context 欠落"
- rule_id: PS004
source: issue_body
excerpt: "diff_rationale / changed_requirement_id / affected_sections 欠落"
worktree_branch_collision: clear
next_action: propose_refinement_loop
blocked_reasons:
- "PS001: spec delta Issue 未リンク / Product Spec Context セクション欠落"
- "PS004: diff_rationale / changed_requirement_id / affected_sections 欠落"
- "VC AC5: pnpm lint regression_gate blocked (env pollution from .claude/skills/.system)"
- "VC AC11 VC2: unexpected_pass - regex too broad"
- "VC AC11 VC1: human_judgment - file not found (exit 2)"
warnings: []
```
squne121 commentedon Jun 11, 2026
Refinement Loop: human_escalation (max_iterations 到達)
max_iterations(3 回試行、残ブロッカーあり)残ブロッカー(iteration 2)
C12 チェックが
requirement_id/source_task_idのフォーマットを厳密に検証しており、プロジェクト固有の ID 形式が不一致:requirement_idcombat-core/number_display_policyREQ-\d{3,}(例:REQ-001)source_task_idfollow-up:squne121/loop-protocol:pr/782:3(T|TASK-)\d{3,}(例:T001)各 iteration の適用済み修正
## Product Spec Contextセクション追加、AC5 VC にpr_review_onlymarker、AC11 VC1 にpr_review_onlymarker、AC11 VC2 regex 絞り込みproduct_spec_id/requirement_id/source_task_idフィールド追加、AC11 VC2 の\|→|修正人間への判断依頼
以下のいずれかを選択してください:
選択肢 A:
## Product Spec Contextのrequirement_idとsource_task_idを C12 チェッカーが期待する形式に変更するrequirement_id: REQ-001(または対応するプロジェクト番号)source_task_id: T001(またはプロジェクト番号)選択肢 B: C12 チェックが本プロジェクトのフォーマット規約と合わない場合は
## Product Spec Contextセクションを削除し、PS001/PS004 の充足方法を別途検討する選択肢 C: max_iterations を増やして (
/impl-review-loop 788再実行) このまま続ける(ただし残ブロッカーの根本原因が format mismatch のため、追加修正が必要)squne121 commentedon Jun 11, 2026
Contract Snapshot (2026-06-11T18:27:40Z)
0 < value < 1でも<1や小数ではなく整数のみで表現される。docs/product/features/combat-core.md、共有フォーマッタ実装、関連テストが一致している状態。pnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.ts tests/hud-controller.test.tsrg -n "integer-only" docs/product/features/combat-core.mdpnpm typecheckpnpm lint(pr_review_only — PR レビュー時に検証)pnpm buildpnpm test -- tests/player-facing-hp-policy.test.ts tests/render/renderUtils.test.tspnpm test -- tests/player-facing-hp-policy.test.ts tests/hud-controller.test.tsrg -n "integer-only|1.*rationale" docs/product/features/combat-core.mdrg -n "player-facing integer-only|narrow fix|HP.HULL numeric policy" docs/product/features/combat-core.md+ (pr_review_only VC)src/render/renderUtils.tsdocs/product/features/combat-core.mdtests/render/renderUtils.test.tstests/hud-controller.test.tstests/player-facing-hp-policy.test.ts.claude/worktrees/issue-788-player-hp-hull-uiworktree-issue-788-player-hp-hull-uisqune121 commentedon Jun 11, 2026
implement-issue: 実装完了 (2026-06-11T18:39:21Z)
.claude/worktrees/issue-788-player-hp-hull-uiworktree-issue-788-player-hp-hull-uifeat: apply player-facing integer-only HP/HULL policy (#788) (#808)