Repository navigation
feat: baseline_vc_preflight/v1 に重複 non-pure VC コマンド検出の diagnostics フィールドを追加する - #2255
Conversation
…ールドを追加する (#2232) canonical execution plan(command_occurrence_count / launch_upper_bound / status / results / exit code)とは独立した vc_duplicate_diagnostic_report/v1 を baseline_vc_preflight.py の全出力箇所へ伝播させる。compute_canonical_vc_plan() の pure/non-pure 分類を planner 経路と executor 経路で同一の cwd / Allowed Paths へ収束させ(AC2)、body/plan を取得できない early-return 経路では status: not_computed を返して「診断済み・重複なし」と「未診断」を区別する (AC3)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #2255 closed). |
impl-review-loop: PR レビュー結果 (iteration 0)Mergeability:
Blockers: なし Non-blockers(Warnings):
verdict: APPROVE
reviewed_head_sha: "fb370b93952edc01e024e23bce13401bc54454a7"
blockers: []
warnings:
- "PR本文に「## 受け入れ条件の達成状況」の[x]/[ ]形式チェックリストがなく、AC1-9の網羅性は「## Checks」節のコマンド対応表で代替されている(内容は独立検証済みで機能的に同等)"
- "python-test-core check は現在 pending だが、canonical required-CI evaluator(wait_ci_checks.py)の branch-protection required set には含まれておらず、承認判定に影響しない"impl-review-loop はここで終了する( |
判定: REQUEST_CHANGESPR #2255 は現状 merge 不可です。少なくとも merge blocker 2件があります。特に1件目は、Issue #2232 の OWNER review が事前に明示していた P0-2 を、実装が
推奨修正最小でも、 同時に なお外部仕様照合では、既存コード/コメントにある「JCS-style」という表現にも注意が必要です。Python 最終 verdict: |
Issue #2232 OWNER REQUEST_CHANGES (#2255 (comment)) P0 blocker 2件への fix_delta。 - run_contract_review_once.py / contract_readiness_check.py(2箇所)/ run_root_review_pipeline.py が compute_canonical_vc_plan() を context-free なデフォルトで呼んでいたため、baseline_vc_preflight.py executor(実 cwd/Allowed Paths)側と plan_digest が食い違い得た (vc_plan_digest_mismatch)。extract_allowed_paths() を共有し、 child が実際に使う cwd/Allowed Paths を全 parent 呼び出しに配線。 - test_command_timeout_budget_aggregate_invariant.py へ directory-scoped rg + Allowed Paths の positive/negative control (subprocess-boundary negative control 込み) を追加。 - test_vc_quality_guards.py の closed top-level key-set テストへ diagnostic_report(Issue #2232) 用の versioned additive allowlist を 導入し、既存 CI failure を解消。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta: OWNER REQUEST_CHANGES 対応OWNER の REQUEST_CHANGES レビュー(https://github.com/squne121/loop-protocol/pull/2255#issuecomment-5340600982)で指摘された P0 blocker 2件 + P1 1件に対応した(head Issue #2232 の Allowed Paths を Scope Delta で拡張し( P0-1: cross-consumer
|
Summary
baseline_vc_preflight.pyにvc_duplicate_diagnostic_report/v1(重複 non-pure VC コマンド検出)を追加し、baseline_vc_preflight/v1の全出力箇所(early-return 経路含む)へdiagnostic_reportフィールドとして伝播させた(Closes 実装: baseline_vc_preflight/v1 に重複 non-pure VC コマンド検出の diagnostics フィールドを追加する #2232)。diagnostic_report自体はplan_digest(canonical execution plan の identity hash)から独立して算出され、既存のcommand_occurrence_count/launch_upper_bound/status/results/ exit code を一切変更しない(Out of Scope 節どおり不変。この主張自体はここまで正しい)。compute_canonical_vc_plan()の pure/non-pure 分類を planner 経路と executor 経路で同一のcwd/ Allowed Paths を用いて収束させる」対応は、is_pure(したがってcommand_occurrences[].is_pure/plan_digest)自体を classification context(実cwdと Allowed Paths)に依存させる変更であり、「execution semantics は不変」という主張は成立しない。Allowed Paths 内 directory を対象とするrgのような command は、実装後は文字どおり実cwd/Allowed Paths によってis_pure(=plan_digest)が変わりうる。これは AC2 が最初から意図した挙動であり、バグではない。Fix Delta(OWNER REQUEST_CHANGES 対応)
OWNER レビュー #2255 (comment) (REQUEST_CHANGES、P0 blocker 2件 + P1 1件)を受け、Issue #2232 の Allowed Paths を Scope Delta で拡張したうえで以下を修正した。
plan_digest収束(merge blocker):compute_canonical_vc_plan()を呼ぶ 4 つの consumer のうち、baseline_vc_preflight.py自身の executor(_main_impl())だけが実cwd/ body から抽出した Allowed Paths を渡し、残り 3 consumer(run_contract_review_once.py/contract_readiness_check.py(2 箇所) /run_root_review_pipeline.py)は context-free なデフォルト(cwd=".",allowed_paths=None)のままcompute_canonical_vc_plan()/_compute_canonical_vc_plan()を呼んでいた。Allowed Paths 内 directory を対象とするrgのような command では、parent 側(non-pure と判定)と child 側(pure と判定)でplan_digestが食い違い、vc_plan_digest_mismatchを引き起こしうる状態だった。run_contract_review_once.py:baseline_vc_preflight.py's ownextract_allowed_paths()ヘルパーを import し、child が--cwdを渡さない場合の実効cwd(".")と、child が--cwdを渡す場合(evidence_mode == "current-head")の実cwdを分岐して、child が実際に使う context と同一のcwd/allowed_pathsを parent 側の digest 計算に渡すよう変更した。contract_readiness_check.py:compute_invocation_local_baseline_timeout()とrun_baseline_vc_preflight()内の 2 箇所とも、同じextract_allowed_paths()を import し、cwd="."+ body から抽出した Allowed Paths を渡すよう変更した(child subprocess も--cwdなしで起動されるため、両者とも実 OS-level cwd に対する"."で一致する)。run_root_review_pipeline.py: 同様にextract_allowed_paths()(_baseline_vc_preflight.extract_allowed_paths経由)を使い、_compute_canonical_vc_plan(body)呼び出しへcwd="."+ Allowed Paths を渡すよう変更した。test_all_four_consumer_paths_observe_identical_plan_digest(test_command_timeout_budget_aggregate_invariant.py)に、新規テストtest_all_four_consumer_paths_observe_identical_plan_digest_for_directory_scoped_rgを追加。Allowed Paths 内 directory を対象とするrgコマンドで (a) context-free 分類と context-aware 分類が実際に異なることの precondition、(b) 4 consumer 全てが収束後は同一plan_digestを観測すること、(c) 実 subprocess boundary(baseline_vc_preflight.pyexecutor の実 CLI 呼び出し)がその digest を受理すること、(d) stale(context-free)な digest を渡した場合は実 child subprocess がvc_plan_digest_mismatchで fail-closed に拒否することを、それぞれ独立した assertion として検証する(OWNER コメントが明示的に要求した subprocess-boundary negative control を含む)。diagnostic_reportの additive schema migration(CI failure): 既存の schema-guard テストtest_vc_quality_guards.py::test_unexpected_pass_classification_no_new_schemaがbaseline_vc_preflight/v1の top-level key set を closed set として固定しており、diagnostic_reportの追加を「予期しない schema leak」として fail させていた(headfb370b93の CI failure の直接原因)。テストの意図(accidental な新規 top-level key の混入を防ぐ)は維持しつつ、_ADDITIVE_OPTIONAL_TOP_LEVEL_KEYS(Issue 番号付きコメント付きのバージョン管理された allowlist)を導入し、diagnostic_reportを Issue 実装: baseline_vc_preflight/v1 に重複 non-pure VC コマンド検出の diagnostics フィールドを追加する #2232 由来の意図的な additive migration として明示的に許可するよう更新した。同種の closed key-set 契約を持つテストが他にないか repo 全体を検索し、baseline_vc_preflight/v1に対する同種の contract はtest_vc_quality_guards.pyのこの 1 箇所のみであることを確認した(test_contract_readiness.pyの closed key-set は別 schemaISSUE_CONTRACT_READINESS_RESULT_V1用であり無関係)。diagnostic_reportはplan_digestから独立」という主張(今も真)と、「execution semantics は不変」という主張(もはや不正確)を分離して記述した。is_pure/plan_digestは Allowed-Paths-sensitive な command に対して、feat: baseline_vc_preflight/v1 に重複 non-pure VC コマンド検出の diagnostics フィールドを追加する #2255 以前の baseline と比較して正当に変わりうる(AC2 が最初から意図した効果であり、今回の fix_delta で追加で全 consumer に伝播させた)。Checks
rg -n "canonical_vc_plan/v2" .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py-> PASS(AC1)uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_duplicate_diagnostics.py -v-> 24 passed(AC2〜AC6, AC8 を-kで個別実行しても同じサブセットが選択されることを確認済み)uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -k "not test_issue_393_snapshot_fixture_processed" .claude/skills/issue-contract-review/scripts/tests/test_review_budget_planner.py -v-> 142 passed, 1 skipped, 1 deselected(AC7、既存 fixture の canonical plan フィールドが不変であることを確認)uv run --locked pytest .claude/skills/impl-review-loop/tests/test_triage_contract_blockers.py .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py .claude/skills/issue-contract-review/tests/test_run_contract_review_once.py .claude/skills/issue-contract-review/tests/test_contract_readiness_check.py -v-> 91 passed(AC9、全 production consumer の schema dispatch / status / results / exit code 判定が不変であることを確認)uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_duplicate_diagnostics.py .claude/skills/issue-contract-review/scripts/tests/test_command_timeout_budget_aggregate_invariant.py .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py .claude/skills/issue-contract-review/tests/test_run_contract_review_once.py .claude/skills/issue-contract-review/tests/test_contract_readiness_check.py .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py .claude/skills/issue-contract-review/scripts/tests/test_review_budget_planner.py .claude/skills/impl-review-loop/tests/test_triage_contract_blockers.py .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -v-> 294 passed, 1 skippedtest_run_contract_review_once_wrapper_wiring.py/test_contract_readiness_check_execute_mode_parent_skip.py/test_contract_readiness_check_broad_search_path.py/test_pnpm_gate_security_boundary.py(48 passed)、issue-refinement-loop/tests全件、ruff checkを実行し、compute_canonical_vc_plan(/_compute_canonical_vc_plan(の呼び出し元を repo 全体で再 grep して Issue 実装: baseline_vc_preflight/v1 に重複 non-pure VC コマンド検出の diagnostics フィールドを追加する #2232 Scope Delta が列挙した 4 consumer 以外に production consumer が存在しないことを確認した。Schema Change Applicability
baseline_vc_preflight/v1の全出力にdiagnostic_report(新規vc_duplicate_diagnostic_report/v1schema オブジェクト)フィールドを additive に追加した。既存フィールド(schema/status/summary/results/errors等)の意味・型は一切変更していない。compute_canonical_vc_plan()にもcwd/allowed_pathsの新規 keyword-only 引数を追加し、fix_delta で全 4 consumer にその実 context を配線した。デフォルト値(cwd=".",allowed_paths=None)自体は変わっていないが、AC2 の意図どおりis_pure/plan_digestは Allowed-Paths-sensitive な command に対して実 context に依存するようになった点に注意(Fix Delta 節参照)。Schema Consumer Inventory
.claude/skills/impl-review-loop/scripts/triage_contract_blockers.pydiagnostic_reportを読まない既存の schema dispatch / status 判定は不変であることを回帰テストで確認済み.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py.claude/skills/issue-contract-review/scripts/run_contract_review_once.pycompute_canonical_vc_plan(body_snapshot)に実cwd(child が使う実効値)と body 抽出済み Allowed Paths を明示的に渡すよう変更(cross-consumer digest 収束).claude/skills/issue-contract-review/scripts/contract_readiness_check.pycompute_invocation_local_baseline_timeout()/run_baseline_vc_preflight()の両呼び出し箇所にcwd="."+ body 抽出済み Allowed Paths を明示的に渡すよう変更.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py_compute_canonical_vc_plan(body)にcwd="."+ body 抽出済み Allowed Paths を明示的に渡すよう変更Safety Claim Matrix
diagnostic_reportフィールドは canonical execution plan(occurrence_count/launch_upper_bound/status/results/exit code)に一切影響しないtest_baseline_vc_preflight.py/test_review_budget_planner.py142 passed)、test_diagnostic_report_does_not_influence_canonical_plan_fieldsdiagnostic_report.status: not_computedを返し、実行済み診断の「重複なし」と誤認されないtest_cli_integration_source_retrieval_failure/test_cli_integration_current_head_validation_failure/test_cli_integration_parse_failure_*/test_cli_integration_policy_rejection_plan_digest_mismatchtest_scope_semantics_pure_command_duplicate_is_never_flagged、Allowed Paths 内 directory 対象 rg の positive/negative controlcompute_canonical_vc_plan()の 4 つの canonical-plan consumer(baseline_vc_preflight.pyexecutor /run_contract_review_once.py/contract_readiness_check.py/run_root_review_pipeline.py)は全て同一のcwd/ Allowed Paths classification context を用い、plan_digestが process boundary を越えて収束するtest_all_four_consumer_paths_observe_identical_plan_digest_for_directory_scoped_rg(positive convergence + subprocess-boundary negative control 込み)Notes
command_occurrence_count/launch_upper_bound/derive_review_budget()の算出式変更、diagnostic_reportをreadiness status判定に反映すること、diagnostic_reportを canonical plan 自体のplan_digestに混入させること、Issue 起票時の重複 VC 事前バリデーション、_canonicalize_for_digest()の RFC 8785 厳密化、shlex.split()による shell 意味論的同値性判定。canonical_vc_plan/v2へcommand_occurrences/command_budgets/aggregate_timeout_seconds/plan_digestを追加)の最終 merge commit(e8323222)へ rebase 済みの状態を base として実装した。受け入れ条件の達成状況
baseline_vc_preflight.pyが PR feat: canonical VC plan に command-level timeout budget を追加する (#2233) #2245 の最終 merge commit(e8323222)へ rebase された状態を base とし、main にcanonical_vc_plan/v2schema とplan_digestフィールドが存在する —rg -n "canonical_vc_plan/v2" .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyPASScompute_canonical_vc_plan()の pure/non-pure 分類が、planner 経路と executor 経路の両方で同一のcwd/ Allowed Paths を用いて収束する —test_baseline_vc_preflight_duplicate_diagnostics.py -k classification_convergence3 passed(fix_delta で 4 consumer 全てへ context 配線を収束済み)diagnostic_report.status == "complete"、early-return 経路では"not_computed"を返す —test_baseline_vc_preflight_duplicate_diagnostics.py -k report_statusPASSdiagnostic_report.items[]がrule_id/level/message/command_identity_hash/occurrence_count/occurrences[].{ordinal, ac_label, block_index, line_in_block}を持つ —test_baseline_vc_preflight_duplicate_diagnostics.py -k diagnostic_schemaPASSdiagnostic_report.items[]が byte-identical に返る(ordinal 順、同順位はcommand_identity_hash順) —test_baseline_vc_preflight_duplicate_diagnostics.py -k determinismPASSpreflight-scope/baseline-expect: deferred/ static-blocked / state-changing command を挟んだ意図的再実行の診断対象可否が固定され、テストが存在する —test_baseline_vc_preflight_duplicate_diagnostics.py -k scope_semanticsPASSdiagnostic_report追加後も既存command_occurrence_count/launch_upper_bound/status/results/ exit code が既存 fixture に対して不変 —test_baseline_vc_preflight.py -k "not test_issue_393_snapshot_fixture_processed"+test_review_budget_planner.py142 passed, 1 skipped, 1 deselectedtest_baseline_vc_preflight_duplicate_diagnostics.py -k cli_integrationPASStriage_contract_blockers.py/adjudicate_vc_result.py/run_contract_review_once.py/contract_readiness_check.pyの全 production consumer が新旧 fixture で schema dispatch / status / results / exit code 判定を変更せず動作する —test_triage_contract_blockers.py test_adjudicate_vc_result.py test_run_contract_review_once.py test_contract_readiness_check.py91 passed検証コマンド結果
rg -n "canonical_vc_plan/v2" .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyuv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_duplicate_diagnostics.py -vuv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -k "not test_issue_393_snapshot_fixture_processed" .claude/skills/issue-contract-review/scripts/tests/test_review_budget_planner.py -vuv run --locked pytest .claude/skills/impl-review-loop/tests/test_triage_contract_blockers.py .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py .claude/skills/issue-contract-review/tests/test_run_contract_review_once.py .claude/skills/issue-contract-review/tests/test_contract_readiness_check.py -vuv run --locked pytest test_baseline_vc_preflight_duplicate_diagnostics.py test_command_timeout_budget_aggregate_invariant.py test_vc_quality_guards.py test_run_contract_review_once.py test_contract_readiness_check.py test_baseline_vc_preflight.py test_review_budget_planner.py test_triage_contract_blockers.py test_adjudicate_vc_result.py -v(詳細は本文「Checks」節参照)いずれも現行 head(
1058b0d2bd6cd4b646ee668818e56e0777cce39e)に対する fix_delta commit で確認済みの実測結果であり、本 PR body 編集はコード変更を含まないため exit code / pass 数に変化はない。Allowed Paths 遵守
本 PR で変更したファイル(
gh pr diff 2255 --name-onlyで確認、いずれも Allowed Paths に含まれる):.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py(Allowed Paths 内).claude/skills/issue-contract-review/scripts/contract_readiness_check.py(Allowed Paths 内).claude/skills/issue-contract-review/scripts/run_contract_review_once.py(Allowed Paths 内).claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_duplicate_diagnostics.py(Allowed Paths 内).claude/skills/issue-contract-review/scripts/tests/test_command_timeout_budget_aggregate_invariant.py(Allowed Paths 内).claude/skills/issue-contract-review/tests/test_vc_quality_guards.py(Allowed Paths 内).claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py(Allowed Paths 内)上記 7 ファイルは、いずれも Issue #2232 本文の Scope Delta で拡張された Allowed Paths(12 エントリ)に完全に含まれる。Allowed Paths 外の変更はない。