Skip to content

ci(#507): add check_input_command_schema.py to python-test job - #510

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-507-scripts-check-input-command-schema-py-py
May 30, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-507-scripts-check-input-command-schema-py-py

Conversation

@squne121

@squne121 squne121 commented May 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • .github/workflows/ci.yml の python-test job に scripts/check_input_command_schema.py 実行ステップを追加
  • scripts/check_input_command_schema.py の docstring を修正(src/input/InputMapper.ts を parse しているように誤解させない表現に)

スクリプトファイルについて

scripts/check_input_command_schema.py は PR #506 で実装されたが、origin/main には未マージのため本 PR で新規追加として含まれる。ロジックは PR #506 での実装と同一(docstring のみ修正)。Issue #507 の Allowed Paths で「docstring のみ修正可」と記載されていたが、ファイルが origin/main 未存在のため新規追加として扱う必要があった。

Closes #507

Safety Claim Matrix

Change Safety Assessment Reason
.github/workflows/ci.yml への step 追加 Safe python-test job に既存スクリプトを実行する read-only ステップを追加するのみ。失敗時は非 0 exit で CI が fail する(意図通り)。continue-on-error: true なし
scripts/check_input_command_schema.py Safe docs/product/game-logic.md を読んで token を確認する read-only スクリプト。ファイル書き込みなし。sys.exit のみ使用

Contract Snapshot

#507 (comment)

Verification Results

Command Result
AC1: grep ci.yml PASS
AC2: docstring 確認(pr_review_only) "does not parse src/input/InputMapper.ts" で明示
AC3: uv run --locked python scripts/check_input_command_schema.py exit 0 PASS
pnpm typecheck PASS
pnpm lint PASS
pnpm test 199/199 PASS
pnpm build PASS

AC4(CI green)は PR マージ後の CI run で確認。

🤖 Generated with Claude Code

squne121 and others added 2 commits May 30, 2026 18:16
Script was created during #461 contract review and excluded from PR #506.
Added to version control ahead of CI integration in #507.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add `uv run --locked python scripts/check_input_command_schema.py` step
to the python-test CI job so that docs/product/game-logic.md InputCommand
regressions are detected automatically. Also fix the script docstring to
clarify it validates the documented token set rather than parsing
src/input/InputMapper.ts.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@squne121
squne121 force-pushed the worktree-issue-507-scripts-check-input-command-schema-py-py branch from f4a61eb to 1282e2f Compare May 30, 2026 09:16

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=BLOCKED(CI checks in_progress: python-test, e2e)

Evidence Check

  • AC coverage: AC1/AC2/AC3 は PR 本文に自己申告あり。AC4(CI green)は未確認(python-test in_progress)
  • Allowed Paths: .github/workflows/ci.yml は Issue Allowed Paths 内。scripts/check_input_command_schema.py は origin/main 非存在のため PR diff では ADDED(34 lines logic + 2 lines docstring 修正)として現れる — Issue の "docstring のみ修正可" との齟齬あり(詳細は Blockers 参照)
  • CI Verification: python-test / e2e が in_progress。TEST_VERDICT_MACHINE コメントなし。CI_CHECK_RUN_SCOPED 証跡なし。
  • 検証コマンド結果: PR 本文に自己申告あり(PR_BODY_SELF_REPORT のみ)

Blockers

  1. CI 証跡なし(pending): mergeStateStatus=BLOCKED、python-test・e2e が in_progress。TEST_VERDICT_MACHINE コメントが存在しない。PR_BODY_SELF_REPORT のみでは APPROVE 不可(PR_BODY_SELF_REPORT_ONLY_APPROVE_PROHIBITED)。CI 完了後に再レビュー依頼。

  2. Safety Claim Matrix 欠如: .github/workflows/ci.yml の変更は safety-sensitive path (.github/workflows/**) に該当する。PR 本文に ## Safety Claim Matrix セクションが存在しない(APPROVE 禁止)。workflows の変更は最小限(1 step 追加)で安全性上の懸念は低いが、skill の判定ルール上必須。

  3. Allowed Paths 逸脱の可能性: Issue #507 の Allowed Paths は scripts/check_input_command_schema.py について "docstring のみ修正可" と定義している。しかし origin/main には同ファイルが存在しないため、PR diff では 34 lines のロジックを含む新規ファイルとして現れる。Issue background では "commit 9463f37 にて main に追加済み" と説明しているが、当該コミットは origin/main に未マージ。PR が chore commit 37ce8a3 を取り込んでいるのはその workaround と見られるが、Allowed Paths 定義との整合性が未確認。chore commit が origin/main にマージ済みか、または PR 本文で経緯の説明と Allowed Paths からの明示的な除外・注記が必要。

Non-blockers

  • なし

LOOP_VERDICT

verdict: REQUEST_CHANGES
confidence: high
blockers:
  - ci_pending_no_test_verdict_machine
  - safety_claim_matrix_missing
  - allowed_paths_ambiguity_script_added_not_docstring_only
warnings: []
mergeable: MERGEABLE
mergeStateStatus: BLOCKED
reviewed_head_sha: 1282e2ff2d0ae37b91a280c23c9d7cb4c605caac
recommendations: []
follow_up_issue_requests: []

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=CLEAN

Evidence Check

  • AC coverage: AC1 PASS(python-test job step 9 "Check InputCommand docs schema" が CI run 26680175257 で conclusion=success)、AC2 PASS(docstring に "does not parse src/input/InputMapper.ts" を明示)、AC3 PASS(CI run で exit 0 確認、runtime_only)、AC4 PASS(CI run 26680175257 python-test job conclusion=success、head_sha=1282e2ff2d0ae37b91a280c23c9d7cb4c605caac 一致)
  • Allowed Paths: 遵守(.github/workflows/ci.yml、scripts/check_input_command_schema.py の 2 ファイルのみ。scripts/ の新規追加は Issue 本文で origin/main 未存在のため新規追加として扱う旨を説明済み)
  • CI Verification: CI_CHECK_RUN_SCOPED 条件を満たす。run 26680175257 / workflow=ci / job=python-test / step 9 "Check InputCommand docs schema" / conclusion=success / head_sha=1282e2ff2d0ae37b91a280c23c9d7cb4c605caac(PR head SHA と一致)。TEST_VERDICT_MACHINE コメントなし(#88 pending 状態)だが CI_CHECK_RUN_SCOPED が全条件を満たすため補助証跡として有効
  • Schema Change Applicability: CI yaml と docstring のみ変更。consumer 境界をまたぐ contract 変更なし(not_schema_change)
  • Safety Claim Gate: .github/workflows/ci.yml 変更を含むため safety-sensitive。PR 本文に Safety Claim Matrix セクションが存在し、両変更について bounded claim が記載されている。Not controlled 列は非空だが無限定の "safe" 主張なし(行レベルで根拠付き)

Blockers

  • なし

Non-blockers

  • なし

LOOP_VERDICT

verdict: APPROVE
confidence: high
blockers: []
warnings: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 1282e2ff2d0ae37b91a280c23c9d7cb4c605caac
recommendations: []
follow_up_issue_requests: []

@squne121
squne121 marked this pull request as ready for review May 30, 2026 09:24
@squne121

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST_CHANGES

このPRは そのままマージ不可。理由は「CIステップ追加」自体ではなく、PR #510 が前提にしている docs 修正が main に入っていない可能性が高いためです。

Blockers

B1. PR #510 は #506 / #461 の成果に依存しているが、main 側ではまだ drift が残っている

Issue #507 は、docs/product/game-logic.md の InputCommand code block と実装 schema の drift を CI で検出することを目的にしています。背景にも、PR #506 で docs を move / aim / fire に整合し、scripts/check_input_command_schema.py を作ったが CI 未接続だった、と書かれています。([GitHub]1)

しかし PR #510 の Files changed は .github/workflows/ci.yml と scripts/check_input_command_schema.py の2ファイルだけです。CI step は追加されていますが、docs 本体の修正はこのPR差分に含まれていません。([GitHub]2)

現時点で raw main の docs/product/game-logic.md はまだ MoveIntent / AimIntent / FireIntent / IssueAllyCommandIntent / PauseIntent を含む古い InputCommand 例示のままです。一方、src/input/InputMapper.ts の実装は move / aim / fire の3分岐です。([GitHub]3)

つまり、PR #510 を単体で main に入れると、追加された CI が main の既存 docs に対して即 fail する構造に見えます。PR #510 のCIが green なのは、PR head 側では game-logic.md が修正済み状態だからです。([GitHub]4)

修正要求:

  1. 先に PR docs(#461): align InputCommand example with InputMapper.ts schema #506 / docs(game-logic): InputCommand 例示を src/input/InputMapper.ts の実 command schema に整合させる #461 の docs 修正を main に入れる。
  2. その後、PR ci(#507): add check_input_command_schema.py to python-test job #510 を main 最新へ rebase / update branch して、差分が本当に CI 接続だけになることを確認する。
  3. または PR ci(#507): add check_input_command_schema.py to python-test job #510 に docs/product/game-logic.md の整合修正も明示的に含め、Issue 実装: scripts/check_input_command_schema.py を python-test CI job に組み込む #507 の Allowed Paths を更新する。

このまま「CI green だからOK」と判断するのは危険です。


B2. Issue #507 の Allowed Paths と実差分の説明がまだ弱い

Issue #507 の Allowed Paths では、.github/workflows/ci.yml は CI step 追加のみ、scripts/check_input_command_schema.py は docstring のみ修正可。ロジック変更は Out of Scope と定義されています。([GitHub]1)

しかし PR #510 の first commit は scripts/check_input_command_schema.py を 34行の新規ファイルとして追加しています。コミット説明では「#461 contract review 中に作成され、#506 から除外された」と説明されています。([GitHub]5)

これは実務上は理解できますが、契約レビューとしては “docstring のみ” ではない。PR本文の説明だけでなく、Issue #507 側に「origin/main に存在しないため、既レビュー済みスクリプトの新規追跡を許容する」と明記しないと、Allowed Paths の意味が崩れます。

修正要求:


B3. GitHub UI が hidden / bidirectional Unicode 警告を出している

PR files view で、変更ファイルに対して “hidden or bidirectional Unicode text” 警告が表示されています。少なくとも .github/workflows/ci.yml と scripts/check_input_command_schema.py の表示領域で警告が確認できます。([GitHub]2)

CI workflow と実行スクリプトは safety-sensitive です。GitHub Actions では GITHUB_TOKEN の権限は最小化すべきで、workflow 上の action / script には権限境界が発生します。([GitHub Docs]6) また checkout 側も token が local git config に残る仕様があるため、persist-credentials: false を使う判断自体は良いです。([GitHub]7)

ただし、hidden / bidi 警告が出ている状態で workflow / script を通すのはレビュー上許容しにくいです。見た目と実際の解釈がズレる余地があるためです。

修正要求:

  • GitHub の “Show hidden characters” で実体を確認する。
  • 意図しない bidi control / zero-width 文字があれば削除する。
  • 問題ない文字なら、PR コメントに検査結果を残す。例: python - <<'PY' ... unicodedata ... PY で control / bidi class を列挙。

Non-blockers / quality issues

N1. Path.read_text() は encoding を明示した方がよい

スクリプトは Path("docs/product/game-logic.md").read_text() を使っています。Python の Path.read_text() は encoding=None がデフォルトで、open() と同じ意味のオプションです。([Python documentation]8)

CI は Ubuntu なので実害は低いですが、対象ファイルも regex も日本語を含みます。ローカル実行・将来の runner 差異を考えると、次のように固定すべきです。

s = Path("docs/product/game-logic.md").read_text(encoding="utf-8")

N2. regex が ## 入力 / Input セクションに厳密に閉じていない

現在の抽出は次の形です。

re.search(r"## 入力 / Input.*?```typescript\n(.*?)```", s, re.S)

re.S / DOTALL は . が改行も含めて任意文字にマッチする挙動です。([Python documentation]9) そのため、将来 ## 入力 / Input 直下から TypeScript block が消えた場合、後続セクションの最初の TypeScript block を拾う可能性があります。

今は fail 側に倒れやすいので致命傷ではありませんが、回帰ゲートとしては section boundary を入れた方が堅いです。

例:

section = re.search(r"^## 入力 / Input\b(?P<body>.*?)(?=^## |\Z)", s, re.S | re.M)

N3. token ベース検査なので schema drift の検出力は限定的

TypeScript の discriminated union は、共通フィールドに literal 型を持たせて union member を区別する設計です。([TypeScript]10) 今回の script はその literal / field name の最低限の drift を検出するだけで、TypeScript AST や InputMapper.ts との実比較はしていません。

Issue #507 では AST 化は Out of Scope なので今回は許容。ただし、今後 InputCommand が再変更されるなら follow-up で「docs block と src/input/InputMapper.ts の AST / text slice 比較」へ上げるべきです。


良い点

  • python-test job に uv run --locked python scripts/check_input_command_schema.py を追加しており、Issue 実装: scripts/check_input_command_schema.py を python-test CI job に組み込む #507 の AC1 には合っています。([GitHub]2)
  • CI run は成功しており、typecheck / lint / test / build / e2e / python-test が通っています。([GitHub]11)
  • workflow 全体は permissions: contents: read で、GitHub Actions の最小権限原則に沿っています。([GitHub]12)
  • uv の GitHub Actions 利用は公式 docs でも astral-sh/setup-uv、uv sync、uv run の形が案内されています。([Astral Docs]13)

貼り付け用レビューコメント

## Verdict: REQUEST_CHANGES

### Blockers

1. **PR #510 depends on #506/#461 docs alignment but does not include the docs fix.**
   The PR diff only changes `.github/workflows/ci.yml` and `scripts/check_input_command_schema.py`. However, current `main` still appears to contain the stale `InputCommand` block with `MoveIntent` / `AimIntent` / `FireIntent` / `IssueAllyCommandIntent` / `PauseIntent`, while `src/input/InputMapper.ts` uses `move` / `aim` / `fire`.
   If #510 is merged without #506/#461 being merged first, the newly added CI check may fail immediately on main.
   Please merge the docs alignment first, or include the docs alignment in this PR and update the Issue #507 scope.

2. **Allowed Paths ambiguity.**
   Issue #507 says `scripts/check_input_command_schema.py` is docstring-only, but this PR adds the script as a new 34-line file. The PR body explains the history, but the issue contract should be amended to explicitly allow tracking the previously created script because it is absent from origin/main.

3. **Hidden / bidirectional Unicode warning.**
   GitHub flags the changed files as containing hidden or bidirectional Unicode text. Since this PR changes a workflow and a CI-executed script, please inspect with “Show hidden characters” or an equivalent Unicode-control scan, remove unintended characters, and leave evidence in the PR.

### Non-blockers

- Add `encoding="utf-8"` to `Path.read_text()`.
- Bound the regex to the `## 入力 / Input` section instead of searching until the next TypeScript block anywhere later in the document.
- Consider a follow-up to compare against `src/input/InputMapper.ts` directly rather than relying on token checks.

Current verdict: REQUEST_CHANGES.

@squne121

Copy link
Copy Markdown
Owner Author

Response to REQUEST_CHANGES

B1 について: main の docs は既に更新済み

ご指摘ありがとうございます。調査の結果、B1 の前提は現在の状況と相違があります。

origin/main の docs/product/game-logic.md は commit 507f5e5(PR #506 のマージ)によって既に move/aim/fire に更新されています:

```bash
$ git show origin/main:docs/product/game-logic.md | grep -A 10 '## 入力 / Input'

出力: type: 'move'; axisX ... / type: 'aim' ... / type: 'fire'

```

古い token(MoveIntent/AimIntent/FireIntent 等)は main に残っていません:
```bash
$ grep -c "MoveIntent|AimIntent|FireIntent" docs/product/game-logic.md
0 # no stale tokens
```

scripts/check_input_command_schema.py を main の docs に対して実行しても exit 0 です。PR #510 を main にマージしても CI は fail しません。


B2 について: Allowed Paths と実差分の乖離 → Issue に scope amendment を追加

Issue #507 の Allowed Paths「docstring のみ修正可」は、スクリプトが origin/main に存在する前提で書かれていました。実際には origin/main に存在しないため、本 PR では新規追加として含まれています。

Issue #507 に scope amendment コメントを追加します。


B3 について: Unicode 調査結果

対象ファイルの双方向 Unicode control / zero-width 文字を検査しました。

```python

python3 で unicodedata.bidirectional を全文字に対してチェック

結果: .github/workflows/ci.yml: 0 suspicious chars

scripts/check_input_command_schema.py: 0 suspicious chars

```

意図しない bidi control 文字・zero-width 文字は含まれていません。GitHub UI の警告は誤検出または別の原因と考えられます。


N1/N2 の修正(非ブロッカー)

N1(encoding="utf-8" 追加)と N2(regex の section boundary 強化)を合わせてコミットします。

…ommand_schema.py

N1: read_text() now uses encoding="utf-8" explicitly.
N2: Regex is now anchored to ## 入力 / Input section to avoid picking up
    TypeScript blocks from later sections.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=BEHIND
  • BEHIND is not a blocker per SKILL.md. Routing signal: update_branch.

Evidence Check

  • AC coverage: All 4 ACs satisfied.
    • AC1: ci.yml diff shows uv run --locked python scripts/check_input_command_schema.py step added to python-test job. CI step "Check InputCommand docs schema" ran and passed.
    • AC2 (pr_review_only): docstring reads "It does not parse src/input/InputMapper.ts." — no misrepresentation.
    • AC3 (runtime_only): CI "Check InputCommand docs schema" step conclusion=success on head SHA bd725ff.
    • AC4 (runtime_only): python-test job conclusion=success in CI run 26680952389 on same head SHA.
  • Allowed Paths: Changed files are .github/workflows/ci.yml and scripts/check_input_command_schema.py. Both are in Allowed Paths. Scope amendment comment (#507 (comment)) authorizes new-file addition for the script.
  • CI Verification (CI_CHECK_RUN_SCOPED): CI run 26680952389, head SHA bd725ff matches PR headRefOid. All jobs pass. python-test job step "Check InputCommand docs schema" conclusion=success. CI_CHECK_RUN_SCOPED conditions satisfied.
  • Scope: No extra files changed.
  • Safety Claim Gate: .github/workflows/ci.yml triggers safety-sensitive check. PR has a Safety Claim Matrix with bounded claims ("read-only step", "file write なし"). No overclaim detected.
  • Schema Change Applicability: not_schema_change. Changes are ci.yml step addition and Python script — no consumer-boundary schema contract touched.

Blockers

なし

Non-blockers

なし

LOOP_VERDICT

verdict: APPROVE
confidence: high
blockers: []
warnings: []
mergeable: MERGEABLE
mergeStateStatus: BEHIND
reviewed_head_sha: bd725ff51b7753395bd3b43de2d270fd4df9293b
recommendations: [update_branch]
follow_up_issue_requests: []

@squne121
squne121 merged commit 6a34d9e into main May 30, 2026
7 checks passed
@squne121
squne121 deleted the worktree-issue-507-scripts-check-input-command-schema-py-py branch May 30, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: scripts/check_input_command_schema.py を python-test CI job に組み込む

1 participant