Skip to content

実装: .claude/scripts の E501 cleanup(既存 *.py の行分割のみ・#1138 Child 2) #1149

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1138"
goal_ref: ".claude/scripts の既存 *.py の E501 を、行分割のみ(base↔head AST 同値・コメント/文字列値/shebang/encoding/file mode 不変・suppression 禁止)で 0 件にし、guard verify-diff と hardened ruff を out-of-band(PR base/head の immutable SHA)で機械検証する"
change_kind: code

Parent Issue

#1138

Parent Goal Ref

  • Goal: .claude/scripts / scripts / schemas / .claude/skills の E501 を AST 同値性・テスト保全・suppression 禁止を保証しながら 0 件にし、最終的に CI Ruff gate を --select E,F --ignore E402 へ移行する(E501 (line-too-long) の段階導入 — line-length=120 基準で残 343 件を cleanup #1138)
  • Desired Destination: 全領域 E501=0 + CI global gate 有効(parent scope。本 Issue は .claude/scripts の 既存 2 ファイルのみ を write-capable に扱う)

Current Validated Scope

  • .claude/scripts/check_secret_policy.py の E501 1 件(行 125: 149>120)を行分割で解消
  • .claude/scripts/check_session_recording_policy.py の E501 3 件(行 120/190/249)を行分割で解消
  • 検証は PR に新規ファイルを追加せず、reviewer / CI が immutable な PR base SHA・head SHA を渡して scripts/e501_migration_guard.py verify-diff と hardened ruff を out-of-band 実行する(恒久 pytest 化しない)

Remaining Parent Gaps

  • Child 3(未起票): scripts の E501 cleanup(33 件)
  • Child 4(未起票): .claude/skills の E501 cleanup(313 件)
  • Child 5(未起票): 全領域再検証 + CI global gate 有効化(.github/workflows/ci.yml の Ruff command を --select E,F --ignore E402 へ、actions/checkout に fetch-depth: 0 を付与)
  • guard 自身(scripts/e501_migration_guard.py とその test)は E501 (line-too-long) の段階導入 — line-length=120 基準で残 343 件を cleanup #1138 Remaining Parent Gaps に従い本 Issue Allowed Paths から除外する
  • VC allowlist 拡張 / env_test_override を CLI 経由では常に untrusted 化する guard 改修(本 Issue の trust boundary を恒久化するための follow-up。別 Issue)

Outcome

.claude/scripts 配下の Python の E501(line-length=120 基準)が hardened ruff で 0 件になり、変更が既存 2 ファイルの行分割のみ(PR base↔head の AST 同値・コメント/docstring/文字列値/shebang/encoding cookie/file mode 不変・noqa 等 suppression 追加なし)であることを、scripts/e501_migration_guard.py verify-diff(default ruff・hardened env)と hardened ruff の out-of-band 実行で確認でき、pnpm typecheck/lint/test/build と pnpm policy:check・CI python-test job が green の状態。

In Scope

  • .claude/scripts/check_secret_policy.py(行 125)と .claude/scripts/check_session_recording_policy.py(行 120/190/249)の長行を、AST を変えない reflow(括弧による行継続・暗黙文字列連結・代入の折り返し等)で 120 桁以内へ分割する
  • PR 差分を 上記 2 ファイル(status M)のみに保ち、追加 / 削除 / rename / copy / file mode 変更を一切含めない

Out of Scope

  • 挙動・ロジック変更
  • コメント・docstring・文字列値・shebang・encoding cookie・file mode の変更(reflow を含む。今回対象 4 件はすべてコードまたは返却文字列であり、コメント変更は不要)
  • 新規ファイルの追加(恒久 pytest を含む)。検証は out-of-band の reviewer / CI コマンドで行う
  • scripts の cleanup(Child 3)/ .claude/skills の cleanup(Child 4)
  • CI workflow 変更・global gate 切替・fetch-depth 付与(Child 5)
  • pyproject.toml / ruff 設定 / suppression(noqa 等)の追加
  • guard 自身(scripts/e501_migration_guard.py とその test)の変更
  • VC allowlist 拡張・env_test_override の untrusted 化 guard 改修(follow-up 別 Issue)

Runtime Verification Applicability

decision: not_applicable
rationale: >
  本 Issue は Python policy script の既存 2 ファイルを行分割するだけの static な
  tooling/lint 変更であり、ゲーム runtime(src/state・src/render・src/systems)の
  挙動には一切影響しない。AST 同値性を guard verify-diff で機械検証するため、手動
  プレイテストや runtime 観測による受け入れ確認は対象外。

(docs/dev/runtime-verification-policy.md の Applicability スキーマに基づく。decision=not_applicable のため AC に runtime-verification: true タグは付与しない。)

Acceptance Criteria

  • AC1: hardened ruff(--isolated --select E501 --line-length 120 --target-version py312 --no-preview --ignore-noqa --no-respect-gitignore --no-cache --output-format json)による .claude/scripts の E501 診断が空配列(0 件)になる
  • AC2: out-of-band の verify-diff --scope .claude/scripts --mode completion(immutable base/head SHA・default ruff・hardened env)が decision=pass で、changed_files が .claude/scripts/check_secret_policy.py と .claude/scripts/check_session_recording_policy.py の status M 2 件のみ、checks.status_scope / checks.suppression / checks.ast_equiv(全 equal=true)/ checks.ratchet(head_total==0)が ok、ruff.cmd_source=="default" / ruff.non_default_ruff_cmd==false / ruff.trusted==true、uv_lock_sha256 が記録される
  • AC3: 変更が行分割のみで、コメント・docstring・文字列値・shebang・encoding cookie・file mode を変更しない(git diff --summary <base> <head> が空、git diff --check <base> <head> が clean、guard の AST 同値性 ok)
  • AC4: pnpm typecheck が exit 0
  • AC5: pnpm lint が exit 0
  • AC6: pnpm test が exit 0
  • AC7: pnpm build が exit 0
  • AC8: pnpm policy:check(check_secret_policy.py / check_session_recording_policy.py の挙動保全)が pass し、GitHub Actions python-test job が green

Verification Commands

$BASE_SHA / $HEAD_SHA は PR の immutable な base / head commit SHA。AC1(hardened ruff)・AC2/AC3(guard verify-diff)・AC8(policy:check)は in-band の baseline では実行できないため preflight-scope: pr_review_only(verification_owner=reviewer/CI)とし、reviewer / CI が out-of-band で実行する。設定手順と hardened な完全版(env override 除去・report フィールド assertion・git diff guard)は「Out-of-Band Verification(Reviewer / CI)」セクションを正本とする。AC4–AC7 は regression gate として in-band 実行する。

# AC1
# preflight-scope: pr_review_only
$ uv run --locked ruff check --isolated --select E501 --line-length 120 --target-version py312 --no-preview --ignore-noqa --no-respect-gitignore --no-cache --output-format json .claude/scripts
# AC2
# AC3
# preflight-scope: pr_review_only
$ uv run --locked python scripts/e501_migration_guard.py verify-diff --base-ref "$BASE_SHA" --head-ref "$HEAD_SHA" --scope .claude/scripts --mode completion
# AC4
# baseline-expect: pass
$ pnpm typecheck
# AC5
# baseline-expect: pass
$ pnpm lint
# AC6
# baseline-expect: pass
$ pnpm test
# AC7
# baseline-expect: pass
$ pnpm build
# AC8
# preflight-scope: pr_review_only
$ pnpm policy:check

Out-of-Band Verification(Reviewer / CI)

検証は PR に新規ファイルを追加せず、reviewer / CI が immutable な base/head SHA を渡して直接実行する。verify-diff は merge-base↔HEAD の全変更ファイルを manifest し、scope 外を out_of_scope、追加(status A)ファイルを non_modified_status で拒否するため、PR は上記 2 ファイル(status M)のみでなければ pass しない(恒久 pytest を追加すると自身が non_modified_status で fail する)。env_test_override を trusted 扱いする現 guard 仕様を踏まえ、test 用 ruff override 環境変数を明示的に除去して default ruff を強制する。

BASE_SHA="${BASE_SHA:?set immutable pull_request.base.sha}"
HEAD_SHA="${HEAD_SHA:-$(git rev-parse HEAD)}"
REPORT=/tmp/e501-migration-guard-v1.json

env -u E501_GUARD_ALLOW_TEST_RUFF \
    -u E501_GUARD_RUFF_CMD \
    uv run --locked python scripts/e501_migration_guard.py verify-diff \
      --base-ref "$BASE_SHA" \
      --head-ref "$HEAD_SHA" \
      --scope .claude/scripts \
      --mode completion \
      > "$REPORT"

python - "$REPORT" <<'PY'
import json
import sys

with open(sys.argv[1], encoding="utf-8") as f:
    report = json.load(f)

expected = [
    {"path": ".claude/scripts/check_secret_policy.py", "status": "M"},
    {"path": ".claude/scripts/check_session_recording_policy.py", "status": "M"},
]

assert report["decision"] == "pass", report
assert report["changed_files"] == expected, report["changed_files"]
assert report["checks"]["status_scope"]["ok"]
assert report["checks"]["suppression"]["ok"]
assert all(x["equal"] for x in report["checks"]["ast_equiv"]["results"])
assert report["checks"]["ratchet"]["head_total"] == 0
assert report["diagnostics"]["head"]["items"] == []
assert report["ruff"]["cmd_source"] == "default"
assert report["ruff"]["non_default_ruff_cmd"] is False
assert report["ruff"]["trusted"] is True
assert report["uv_lock_sha256"]
PY

# hardened whole-scope E501(空配列を期待)
uv run --locked ruff check \
  --isolated \
  --select E501 \
  --line-length 120 \
  --target-version py312 \
  --no-preview \
  --ignore-noqa \
  --no-respect-gitignore \
  --no-cache \
  --output-format json \
  .claude/scripts

# 行分割のみ(mode / add / delete / rename / whitespace error がない)
test -z "$(git diff --summary "$BASE_SHA" "$HEAD_SHA")"
git diff --check "$BASE_SHA" "$HEAD_SHA"

# 挙動保全 + 一般ゲート
pnpm policy:check
pnpm typecheck
pnpm lint
pnpm test
pnpm build

baseline 証跡として、immutable base SHA / head SHA / merge-base SHA / uv.lock の sha256 / uv run --locked ruff --version を記録する。成功条件は「物理的に全行 120 文字以下」ではなく「固定した hardened Ruff 条件で E501 診断が 0 件」と表現する(Ruff の E501 は一部 URL / pragma / SPDX 等を仕様上除外するため)。

Allowed Paths

  • .claude/scripts/check_secret_policy.py
  • .claude/scripts/check_session_recording_policy.py

新規ファイルの追加・削除・rename・copy・file mode 変更は禁止する。

実装時の安全な変更形

対象 4 件はいずれもロジック変更なしで処理できる。

  • check_secret_policy.py(行 125): 現在の conditional expression 全体を括弧で囲んで改行する。直後に上書きされる冗長代入であっても削除・簡略化しない。
  • check_session_recording_policy.py(行 120/190/249): 長い f-string または通常文字列を括弧内の隣接 literal へ分割し、空白・文字列値・format conversion を変更しない。

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 行分割だけでは E501 を解消できず挙動・ロジック変更が必要になった場合(Issue 固有)
  • コメント・docstring・文字列値・shebang・encoding cookie・file mode の変更が必要になった場合(Issue 固有)
  • guard 自身(scripts/e501_migration_guard.py とその test)の変更が必要になった場合(Issue 固有)

Required Skills

  • Python
  • Ruff
  • Python ast / tokenize モジュール

Scope Delta(任意)

本 Issue は #1149 の REQUEST_CHANGES(OWNER 敵対レビュー, comment 4778757144)を反映して以下を縮小・修正した:

  • 新規 pytest scripts/tests/test_e501_cleanup_claude_scripts.py を Allowed Paths から削除(PR に追加すると verify-diff が non_modified_status で必ず fail する論理的非両立を解消)
  • Allowed Paths を既存 2 ファイル(status M)のみに縮小
  • PR 差分検証を恒久 pytest 化せず、immutable PR base/head SHA を渡す out-of-band の reviewer / CI コマンドへ変更
  • test 用 ruff override 環境変数(E501_GUARD_ALLOW_TEST_RUFF / E501_GUARD_RUFF_CMD)を明示除去し default ruff を強制、report の ruff.cmd_source / non_default_ruff_cmd / trusted を assertion
  • whole-scope ruff を hardened フラグ(--isolated --ignore-noqa --no-respect-gitignore --no-cache --target-version py312 --no-preview --output-format json)へ
  • file mode / shebang / comment / docstring / 文字列値 / encoding cookie の変更を明示禁止し、git diff --summary / git diff --check guard を追加
  • pnpm policy:check + CI python-test job green を AC へ追加(挙動保全証跡)

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jun 23, 2026
  2. squne121 commented on Jun 23, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    現契約のままでは実装開始不可です。最大の問題は、Issue名と親契約が「既存 *.py の変更のみ」と定めている一方、#1149自身が新規pytestファイルを同一PRに追加し、その差分に対してguardを実行しようとしている点です。

    Blocker 1 — AC1はguardの仕様上、必ず失敗する

    #1149は次の3ファイルをAllowed Pathsにしています。

    • .claude/scripts/check_secret_policy.py
    • .claude/scripts/check_session_recording_policy.py
    • 新規 scripts/tests/test_e501_cleanup_claude_scripts.py

    その一方で、AC1は同じPR差分に対して次を実行します。

    verify-diff --scope .claude/scripts --mode completion

    実装済みguardは、merge-baseからHEADまでの全変更ファイルをmanifestへ入れ、scope外のファイルを out_of_scope、追加ファイルを non_modified_status として拒否します。許可される対象はscope内のPythonファイルかつstatus Mだけです。

    したがって、新規pytestは以下のどちらでも通りません。

    • --scope .claude/scripts のまま: out_of_scope
    • --scope scripts/tests を追加: status A のため non_modified_status

    これは条件次第で起きる不安定性ではなく、現在のACと実装が論理的に両立しない確定的な失敗です。

    必須修正: 新規pytestを#1149から削除し、Allowed Pathsを既存2ファイルだけに戻してください。guardはPR外部の検証コマンドとして直接実行します。


    Blocker 2 — PR差分検証を恒久pytestにすると、merge後に壊れる

    新規テストは origin/main をfetchして現在のHEADとの差分を検証する設計ですが、これはunit testではなくPRコンテキスト依存の検証です。

    merge後のmainでは、通常 origin/main == HEAD となり、guardの変更対象が空になります。ところがguardは空のtarget listを明示的に処理しておらず、Ruffへ対象パスなしでコマンドを渡します。Ruffは対象が省略された場合に . を既定値として走査するため、リポジトリ全体を検査し始めます。guard側のdiagnostic path mappingはmaterializeしたtargetだけを想定しているため、他領域にE501が残るChild 2時点ではtool errorになり得ます。 ([Astral Docs]1)

    CI環境も適していません。現在のpython-testは actions/checkout@v6 に fetch-depth を指定しておらず、GitHub公式仕様では既定でtrigger SHAの1 commitしか取得しません。origin/mainだけをテスト内部でfetchしても、HEAD側の祖先が揃う保証はありません。 ([GitHub]2)

    必須修正: PR差分のguard検証を恒久pytestにしないでください。immutableなPR base SHAとhead SHAを渡す、レビューまたはCI用の直接コマンドとして扱うべきです。


    Blocker 3 — PRが追加するテスト自身にRuff検証を委ねると偽装できる

    guardにはテスト用Ruff置換があります。

    E501_GUARD_ALLOW_TEST_RUFF=1
    E501_GUARD_RUFF_CMD=<任意コマンド>
    

    両方が設定されると任意のRuff commandへ置換できます。さらに現実装は env_test_override を trusted_ruff として扱うため、reportの decision はその理由ではfailしません。

    新規pytestはsubprocessの環境変数を自由に設定できます。したがって「同じPRで追加されたテストがdecision=passを確認した」だけでは、実Ruffを使った証拠になりません。

    直接検証時には最低限、次が必要です。

    env -u E501_GUARD_ALLOW_TEST_RUFF \
        -u E501_GUARD_RUFF_CMD \
        uv run --locked python scripts/e501_migration_guard.py verify-diff ...

    reportについても以下を明示assertすべきです。

    assert report["ruff"]["cmd_source"] == "default"
    assert report["ruff"]["non_default_ruff_cmd"] is False
    assert report["ruff"]["trusted"] is True

    別Issueで、CLI経由のenv_test_overrideを常にuntrustedにするguard改修も推奨します。


    P1 — whole-scope Ruff検証がguard契約より弱い

    #1149記載のwhole-scope検証は概ね次だけです。

    ruff check --select E501 --line-length 120 .claude/scripts

    これでは以下が固定されません。

    • config探索を停止する --isolated
    • # noqaを無効化する --ignore-noqa
    • --target-version py312
    • --no-preview
    • .gitignore等を無視する --no-respect-gitignore
    • cacheを使わない --no-cache
    • machine-readableな --output-format json

    Ruffはファイルごとに最寄りの設定ファイルを探索し、設定がなければユーザー設定へfallbackする場合があります。--isolatedはすべての設定ファイルを無視し、--ignore-noqaは# noqaを無視して実診断を出します。([Astral Docs]1) ([Astral Docs]1)

    Child 1で導入されたguardも、同じ理由でこれらの固定引数を使用しています。


    P1 — 変更したPythonの動作テストがACにない

    現在のpnpm testはVitestであり、変更対象のPython policy checkerを実行しません。一方、リポジトリには両スクリプトを直接実行する pnpm policy:check が既にあります。

    GitHub Actionsのpython-testも、両checkerを直接実行しています。

    親#1138は .claude/scripts childに対応するsmoke/policy testを要求しています。PR #1136でCI greenのままテスト本体・assertionが大量削除された経緯からも、pnpmの一般ゲートだけを動作保全証拠にするのは不十分です。

    追加すべきAC:

    pnpm policy:check

    およびGitHub Actions python-test job全体のgreenです。


    P1 — file mode、shebang、コメント変更がguardをすり抜ける

    guardはbase/head双方のmodeが 100644 または 100755 であることは確認しますが、baseとheadのmodeが同一かは比較していません。そのため、実行bitの変更を伴うM差分はAST同値のまま通過できます。

    ASTはshebang、encoding cookie、通常コメントも比較しません。#1149のOut of Scopeは「コメント文言のreflow」を許していますが、今回対象の4件はすべてコードまたは返却文字列であり、コメント変更を許可する必要はありません。

    追加すべき条件:

    test -z "$(git diff --summary "$BASE_SHA" "$HEAD_SHA")"
    git diff --check "$BASE_SHA" "$HEAD_SHA"

    また、コメント・docstring・shebang・encoding cookie・file mode変更を明示禁止してください。


    P2 — baseline-expectが無意味

    現AC1のbaseline commandは新規テストファイルを指定するため、baselineでは「E501が残っているから」ではなく「テストファイルが存在しないから」失敗します。

    有効なbaseline evidenceは以下です。

    • immutable base SHA
    • uv.lock SHA
    • uv run --locked ruff --version
    • hardened Ruff JSON
    • diagnostic数が4
    • 対象パスと行番号が想定どおり

    RuffのE501は一部のURL、pragma、SPDX等を仕様上除外するため、成功条件は「物理的に全行120文字以下」ではなく「固定したRuff条件でE501 diagnosticが0件」と表現すべきです。([Astral Docs]3)


    推奨する修正版契約

    Allowed Paths

    - `.claude/scripts/check_secret_policy.py`
    - `.claude/scripts/check_session_recording_policy.py`

    新規ファイル、削除、rename、copy、mode変更は禁止します。

    Acceptance Criteria

    1. base SHA、head SHA、merge-base SHA、uv.lock SHA、Ruff versionを証跡化する。
    2. changed filesは上記2ファイルのstatus Mだけである。
    3. verify-diff --scope .claude/scripts --mode completion がdefault Ruffでpassする。
    4. guard reportのAST、suppression、status/scope、ratchetがすべてpassし、head_total == 0。
    5. hardened whole-scope E501検証のJSONが空配列になる。
    6. .claude/scripts の --select E,F --ignore E402 がpassする。
    7. pnpm policy:check がpassする。
    8. pnpm typecheck / lint / test / build がpassする。
    9. GitHub Actions python-test jobがgreen。
    10. コメント、docstring、文字列値、shebang、encoding cookie、file modeを変更しない。

    推奨Verification Commands

    BASE_SHA="${BASE_SHA:?set immutable pull_request.base.sha}"
    HEAD_SHA="${HEAD_SHA:-$(git rev-parse HEAD)}"
    REPORT=/tmp/e501-migration-guard-v1.json
    
    env -u E501_GUARD_ALLOW_TEST_RUFF \
        -u E501_GUARD_RUFF_CMD \
        uv run --locked python scripts/e501_migration_guard.py verify-diff \
          --base-ref "$BASE_SHA" \
          --head-ref "$HEAD_SHA" \
          --scope .claude/scripts \
          --mode completion \
          > "$REPORT"
    
    python - "$REPORT" <<'PY'
    import json
    import sys
    
    with open(sys.argv[1], encoding="utf-8") as f:
        report = json.load(f)
    
    expected = [
        {"path": ".claude/scripts/check_secret_policy.py", "status": "M"},
        {"path": ".claude/scripts/check_session_recording_policy.py", "status": "M"},
    ]
    
    assert report["decision"] == "pass", report
    assert report["changed_files"] == expected, report["changed_files"]
    assert report["checks"]["status_scope"]["ok"]
    assert report["checks"]["suppression"]["ok"]
    assert all(x["equal"] for x in report["checks"]["ast_equiv"]["results"])
    assert report["checks"]["ratchet"]["head_total"] == 0
    assert report["diagnostics"]["head"]["items"] == []
    assert report["ruff"]["cmd_source"] == "default"
    assert report["ruff"]["non_default_ruff_cmd"] is False
    assert report["uv_lock_sha256"]
    PY
    
    uv run --locked ruff check \
      --isolated \
      --select E501 \
      --line-length 120 \
      --target-version py312 \
      --no-preview \
      --ignore-noqa \
      --no-respect-gitignore \
      --no-cache \
      --output-format json \
      .claude/scripts
    
    uv run --locked ruff check \
      --select E,F \
      --ignore E402 \
      .claude/scripts
    
    test -z "$(git diff --summary "$BASE_SHA" "$HEAD_SHA")"
    git diff --check "$BASE_SHA" "$HEAD_SHA"
    
    pnpm policy:check
    pnpm typecheck
    pnpm lint
    pnpm test
    pnpm build

    実装時の安全な変更形

    対象4件はいずれもロジック変更なしで処理できます。

    • check_secret_policy.py: 現在のconditional expression全体を括弧で囲んで改行する。直後に上書きされる冗長代入であっても削除・簡略化しない。
    • check_session_recording_policy.py: 長いf-stringまたは通常文字列を括弧内の隣接literalへ分割し、空白・文字列値・format conversionを変更しない。

    新規pytestを除去し、上記の直接guard証跡へ切り替えれば、親#1138とPR #1148で確立したtrust boundaryに整合します。

  3. squne121 commented on Jun 23, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: Approved(impl_ready)

    OWNER の REQUEST_CHANGES(comment 4778757144)を反映して本文を再設計し、決定論的ゲートを全通過した。事実主張はすべて実測で裏付け済み(E501 行番号 125/120/190/249・計4件、guard の out_of_scope/non_modified_status 拒否、空 target→.走査、env_test_override=trusted、file mode 非比較、CI fetch-depth 未指定、pnpm lint=eslint のみ・E501 既定未選択)。

    Blocker / P1 / P2 への対応

    指摘 対応
    Blocker 1(新規 pytest が verify-diff で必ず fail) 新規 pytest を削除し Allowed Paths を既存 2 ファイル(status M)のみに縮小。検証は out-of-band 化
    Blocker 2(PR 差分検証を恒久 pytest 化すると merge 後に壊れる) 恒久 pytest を廃し、immutable な PR base/head SHA を渡す reviewer / CI 直接コマンドへ変更
    Blocker 3(追加テストに Ruff 検証を委ねると偽装可能) env -u E501_GUARD_ALLOW_TEST_RUFF -u E501_GUARD_RUFF_CMD で default ruff を強制し、ruff.cmd_source=="default" / non_default_ruff_cmd==false / trusted==true を assertion
    P1(whole-scope ruff が guard より弱い) --isolated --ignore-noqa --no-respect-gitignore --no-cache --target-version py312 --no-preview --output-format json を固定
    P1(動作テストが AC にない) AC8 に pnpm policy:check + CI python-test job green を追加
    P1(mode/shebang/comment が guard をすり抜ける) git diff --summary / git diff --check を追加し、comment/docstring/文字列値/shebang/encoding cookie/file mode 変更を明示禁止
    P2(baseline-expect が無意味) immutable base SHA / uv.lock sha256 / ruff --version を baseline 証跡に。成功条件を「固定 hardened Ruff で E501 診断 0 件」と表現

    決定論的ゲート結果(live body / body_sha256: 006b78ee…)

    • check_issue_contract.py: verdict approve(C1–C13 全 pass/na、非ブロッキング warning 1 件は Scope Delta で説明済み)
    • run_contract_review_once.py --mode static: status go(all_checks_pass / readiness go / blockers pass / product_spec pass / vc_preflight pass)
    • VC 分類: AC1・AC2/AC3・AC8 = pr_review_only(skipped→go, verification_owner=pr-review-judge)、AC4–AC7 = regression_gate(expected_pass→go, pnpm test 1073 passed / typecheck・lint・build exit 0)
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: "https://github.com/squne121/loop-protocol/issues/1149"
        generated_at: "2026-06-23T12:08:00Z"
        body_sha256: "sha256:006b78eefb9b055d05836d5b82c13513ac7570a1fd33698770da512d18df6d53"
      metadata:
        title_prefix_ready: true
        phase_label_ready: true
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-06-23T12:08:00Z"
      checked_body_sha256: "sha256:006b78eefb9b055d05836d5b82c13513ac7570a1fd33698770da512d18df6d53"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "vc-allowlist-and-env-test-override-untrust"
          observation: >
            #1149 の out-of-band 検証は VC allowlist に ruff/guard 直叩きが無いため
            pr_review_only で扱った。恒久的には (a) E501 guard verify-diff/ruff の
            VC allowlist 化、(b) CLI 経由の env_test_override を常に untrusted 化する
            guard 改修が望ましい(OWNER review が「別 Issue 推奨」と明示)。guard 改修
            Issue(Child 5 系列)着手時にまとめて起票する。
        - dedupe_key: "child-3-4-5-sequential-materialization"
          observation: >
            #1138 Child 3(scripts 33 件)/ Child 4(.claude/skills 313 件)/ Child 5
            (全領域再検証 + CI global gate 有効化 + fetch-depth:0)は delivery-rollup
            の sequential 起票方針により、本 Child 2(#1149)マージ後に起票する。

    次のアクション

    impl-review-loop 1149。実装は Allowed Paths 2 ファイルの行分割のみ。検証は PR レビュー / CI が out-of-band で immutable base/head SHA を渡して実行する(PR 差分が 2 ファイル status M のみであることが guard pass の前提)。

  4. squne121 commented on Jun 24, 2026

    @squne121
    OwnerAuthor

    impl-review-loop 完了(status: draft_pr_ready)

    PR #1152 が APPROVE / merge_ready: true に到達した。人間のマージ判断を待つ。

    IMPL_REVIEW_LOOP_RESULT_V1:
      issue_number: 1149
      status: draft_pr_ready
      merge_ready: true
      pr_number: 1152
      pr_url: https://github.com/squne121/loop-protocol/pull/1152
      head_sha: 782549fb
      branch: worktree-issue-1149-e501-cleanup-claude-scripts
      iterations_completed: 1
      termination_reason: approved
      loop_verdict: APPROVE
      allowed_paths_gate: ok
      ac_summary:
        AC1: pr_review_only → PASS(diff が括弧行継続・隣接 literal のみ)
        AC2: pr_review_only → PASS(changed_files 2 ファイル status M のみ)
        AC3: pr_review_only → PASS(AST 同値、ruff.cmd_source=default)
        AC4: regression_gate → CI SUCCESS(tsc --noEmit)
        AC5: regression_gate → CI SUCCESS(eslint .)
        AC6: regression_gate → CI SUCCESS(vitest 1073 tests)
        AC7: regression_gate → CI SUCCESS(vite build)
        AC8: pr_review_only → CI python-test SUCCESS
      ci_status: 全 required check SUCCESS(PR Body Japanese Check / python-test 含む)
      iteration_log:
        - iteration: 0
          verdict: REQUEST_CHANGES
          reason: python-test CI IN_PROGRESS / PR Body Japanese Check FAILURE(コード問題なし)
          action: CI 完了待ち + PR 本文 Japanese check 通過版に更新
        - iteration: 1
          verdict: APPROVE
          merge_ready: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions