Skip to content

feat(impl-review-loop): add VC adjudication artifact - #1250

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-1115-vc-failure-adjudicator-pre-existing-out-
Jun 30, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-1115-vc-failure-adjudicator-pre-existing-out-

Conversation

@squne121

@squne121 squne121 commented Jun 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Issue 実装: VC failure adjudicator を追加し pre-existing / out-of-scope 判定を構造化する #1115 向けに VC_ADJUDICATION_RESULT_V1 を返す adjudicate_vc_result.py を追加し、baseline/current/diff/allowed paths の証跡から pre_existing_fail / out_of_scope_fail / regression_fail / environment_blocked / indeterminate を fail-closed で裁定できるようにしました。
  • Step 2 の SSOT を更新し、TEST_VERDICT.baseline_only を routing 正本から外して VC_ADJUDICATION_RESULT_V1.overall_status と blocking を正本にする方針を明文化しました。
  • public-safe 境界を維持するため、raw stdout/stderr は private artifact のみへ閉じ、compact JSON には artifact_ref / artifact_digest だけを出す境界をテストと運用文書で固定しました。

受け入れ条件の達成状況

  • AC1: adjudicate_vc_result.py が overall_status / blocking / rerun_required / per_ac[] / evidence_refs[] / source_integrity / artifact_ref / errors[] を返します。
  • AC2: no-diff + 同一 command_hash + 同一 failure_keys の場合だけ pre_existing_fail non-blocking に倒し、証跡不足時は fail-closed にします。
  • AC3: failure key 証跡不足では indeterminate blocking、changed/allowed scope と無関係な証跡が揃う場合だけ out_of_scope_fail を返します。
  • AC4: changed paths に関連する failure は regression_fail blocking になります。
  • AC5: Step 2 文書で TEST_VERDICT.baseline_only を evidence input に格下げし、VC_ADJUDICATION_RESULT_V1.overall_status / blocking を routing 正本として扱います。
  • AC6: compact stdout から raw stdout/stderr を除外し、private artifact 参照に分離するテストと運用注記を追加しました。
  • AC7: pytest exit code 5 を regression_fail にせず fail-closed に扱う unit test を追加しました。

検証コマンド結果

以下は Issue 本文に対応する実行結果です。

  • test -f .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py を実行し、script の存在を確認しました。
  • rg -n "test_no_diff_same_baseline_failure_is_pre_existing_nonblocking" .claude/skills/impl-review-loop/tests/ を実行し、AC2 テスト名を確認しました。
  • rg -n "test_out_of_scope_requires_diff_and_failure_key_evidence" .claude/skills/impl-review-loop/tests/ を実行し、AC3 テスト名を確認しました。
  • rg -n "test_diff_related_failure_is_regression_blocking" .claude/skills/impl-review-loop/tests/ を実行し、AC4 テスト名を確認しました。
  • rg -n "VC_ADJUDICATION_RESULT_V1\\.overall_status.*blocking" .claude/skills/impl-review-loop/steps/step-2-verification.md を実行し、AC5 文言を確認しました。
  • rg -n "test_full_stdout_stderr_only_in_private_artifact" .claude/skills/impl-review-loop/tests/ を実行し、AC6 テスト名を確認しました。
  • rg -n "test_pytest_exit_5_is_not_regression_fail" .claude/skills/impl-review-loop/tests/ を実行し、AC7 テスト名を確認しました。
  • python3 -m py_compile .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py を実行し、構文エラーがないことを確認しました。
  • uv run pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -q を実行し、17 passed を確認しました。

Allowed Paths 遵守

編集は Issue 契約で許可された 4 パスのみに限定しました。

  • .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py のみを producer 実装として編集しました。
  • .claude/skills/impl-review-loop/steps/step-2-verification.md のみを Step 2 契約更新として編集しました。
  • .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py のみを contract test として追加しました。
  • docs/dev/agent-run-report.md のみを public-safe 境界注記として更新しました。

Checks

追加の sanity check と unit test も通しています。

  • python3 -m py_compile .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py
  • uv run pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -q

Schema Change Applicability

この PR では Step 2 の裁定 artifact 契約を新設するため、schema change として扱います。

- decision: `schema_change`
  • reason: VC_ADJUDICATION_RESULT_V1 と VC_ADJUDICATION_PRIVATE_BUNDLE_V1 を新設し、Step 2 が参照する裁定 artifact の contract を追加したためです。

Schema Consumer Inventory

consumer と producer の対応関係を日本語で明示し、schema 差分の監査経路を固定します。

変更対象 schema: 今回追加する schema は VC_ADJUDICATION_RESULT_V1, VC_ADJUDICATION_PRIVATE_BUNDLE_V1 です。

before/after 差分: 変更前後の契約差分を以下に示します。

# before
# VC failure の裁定 artifact は存在せず、Step 2 は TEST_VERDICT.baseline_only の説明に依存していた

# after
VC_ADJUDICATION_RESULT_V1:
  overall_status: pass | pre_existing_fail | out_of_scope_fail | regression_fail | environment_blocked | indeterminate
  blocking: true | false
  rerun_required: true | false
  per_ac: []
  evidence_refs: []
  source_integrity: {}
  artifact_ref: <private artifact path or null>
  artifact_digest: <sha256 or null>
  errors: []

Consumer 列挙(rg コマンド例と結果):

rg -n "VC_ADJUDICATION_RESULT_V1" .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py .claude/skills/impl-review-loop/steps/step-2-verification.md .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py docs/dev/agent-run-report.md
  • docs/dev/agent-run-report.md: public-safe artifact 境界の運用注記
  • .claude/skills/impl-review-loop/steps/step-2-verification.md: Step 2 routing contract を日本語 SSOT に反映しました。
  • .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py: producer 実装
  • .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py: contract test として AC2-AC7 を固定しました。

Consumer 更新状況:

Consumer ファイル 更新有無 備考
.claude/skills/impl-review-loop/steps/step-2-verification.md 更新済み Step 2 routing 正本を VC_ADJUDICATION_RESULT_V1 に変更
.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py 更新済み producer を新規追加
.claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py 更新済み AC2-AC7 の contract test
docs/dev/agent-run-report.md 更新済み public-safe artifact 境界の注記

Compatibility Decision / 互換性判断

  • 変更種別: additive
  • 互換性: backward_compatible
  • migration_required: no(追加のみで移行不要です)
  • migration_or_followup: N/A(今回の追加だけで別移行は不要です)
  • reason: 既存 schema の rename/remove は行わず、新規 artifact 契約を追加して Step 2 の参照先を明確化する変更だからです。

Safety Claim Matrix

安全主張は今回の compact JSON 境界と fail-closed routing に限定し、未実装範囲へ拡張しません。

Claim Implemented? Not controlled Evidence Follow-up
Step 2 の裁定結果は raw stdout/stderr を public-safe 出力へ露出せず、compact JSON と private artifact 参照に限定される yes N/A uv run pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -q, docs/dev/agent-run-report.md 更新 N/A
baseline_only 単独で非 blocking 判定しない fail-closed contract を Step 2 SSOT に固定した yes N/A rg -n "VC_ADJUDICATION_RESULT_V1\\.overall_status.*blocking" .claude/skills/impl-review-loop/steps/step-2-verification.md N/A

Notes

  • Related issue: Closes #1115 としてこの実装 Issue を閉じます。
  • MVP scope: VC adjudication artifact の追加と Step 2 / report policy の整合までです。
  • AI / NotebookLM usage: GPT-5.3-Codex-Spark を bounded worktree edit に利用しました。

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1250 closed).

@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: 7
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results: []

検証結果レポート

Issue #1115: VC failure adjudicator pre-existing out-of-scope

AC 確認コマンド 実行結果(要約) exit code 判定
AC1 test -f .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py file exists 0 PASS
AC2 rg -n "test_no_diff_same_baseline_failure_is_pre_existing_nonblocking" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC3 rg -n "test_out_of_scope_requires_diff_and_failure_key_evidence" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC4 rg -n "test_diff_related_failure_is_regression_blocking" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC5 rg -n "VC_ADJUDICATION_RESULT_V1\\.overall_status.*blocking" .claude/skills/impl-review-loop/steps/step-2-verification.md routing text found 0 PASS
AC6 rg -n "test_full_stdout_stderr_only_in_private_artifact" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC7 rg -n "test_pytest_exit_5_is_not_regression_fail" .claude/skills/impl-review-loop/tests/ test found 0 PASS

総合判定

  • 全 AC PASS: YES
  • FAIL した AC: なし
  • SKIP した AC: なし
  • human_review_required: YES

FAIL / SKIP 詳細

  • gh pr view 1250 --json mergeable,mergeStateStatus の結果、mergeStateStatus=BLOCKED。
  • Verification Commands 自体は全件 PASS だが、Step 2 の routing 上は human judgment が必要。

@squne121
squne121 marked this pull request as ready for review June 30, 2026 12:18

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

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "3f56617fa43b5ccc4a0e2c2a990029baf4f3b396"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers:
  - "TEST_VERDICT_MACHINE evidence is stale for the current head: https://github.com/squne121/loop-protocol/pull/1250#issuecomment-4843212232 was posted at 2026-06-30T12:07:19Z, but reviewed_head_sha 3f56617fa43b5ccc4a0e2c2a990029baf4f3b396 was created at 2026-06-30T12:14:18Z. Current-head VC evidence is missing, so approve must fail closed."
  - "`.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py` uses literal/prefix path comparison for changed_paths and allowed_paths relevance, while the canonical allowed-paths matcher uses matcher v2 glob semantics (`*` / `**`). Contracts such as `src/**` or `.claude/skills/**` can therefore be misclassified as `out_of_scope_fail` instead of `regression_fail`, which violates Issue #1115 AC3/AC4."
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  head_sha: 3e0a398aed6ca1e5220afc187e44ab37966d1303
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 7
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "test -f .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "script present; current head matches PR head"
    - ac: AC2
      command: "rg -n \"test_no_diff_same_baseline_failure_is_pre_existing_nonblocking\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:67"
    - ac: AC3
      command: "rg -n \"test_out_of_scope_requires_diff_and_failure_key_evidence\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:100"
    - ac: AC4
      command: "rg -n \"test_diff_related_failure_is_regression_blocking\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:124"
    - ac: AC5
      command: "rg -n \"VC_ADJUDICATION_RESULT_V1\\\\.overall_status.*blocking\" .claude/skills/impl-review-loop/steps/step-2-verification.md"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/steps/step-2-verification.md:41"
    - ac: AC6
      command: "rg -n \"test_full_stdout_stderr_only_in_private_artifact\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:199"
    - ac: AC7
      command: "rg -n \"test_pytest_exit_5_is_not_regression_fail\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:182"

検証結果レポート

Issue #1115: VC failure adjudicator pre-existing out-of-scope

AC 確認コマンド 実行結果(要約) exit code 判定
AC1 test -f .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py file exists 0 PASS
AC2 rg -n "test_no_diff_same_baseline_failure_is_pre_existing_nonblocking" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC3 rg -n "test_out_of_scope_requires_diff_and_failure_key_evidence" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC4 rg -n "test_diff_related_failure_is_regression_blocking" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC5 rg -n "VC_ADJUDICATION_RESULT_V1\\.overall_status.*blocking" .claude/skills/impl-review-loop/steps/step-2-verification.md routing text found 0 PASS
AC6 rg -n "test_full_stdout_stderr_only_in_private_artifact" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC7 rg -n "test_pytest_exit_5_is_not_regression_fail" .claude/skills/impl-review-loop/tests/ test found 0 PASS

総合判定

  • 全 AC PASS: YES
  • FAIL した AC: なし
  • SKIP した AC: なし
  • human_review_required: NO

@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, merge_state_status=CLEAN

Evidence Check

  • AC coverage: PR 本文の ## 受け入れ条件の達成状況 で AC1-AC7 がすべて根拠付きで充足されています。
  • Allowed Paths: 変更ファイルは .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py, .claude/skills/impl-review-loop/steps/step-2-verification.md, .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py, docs/dev/agent-run-report.md の 4 件のみで、Issue #1115 の Allowed Paths 内です。
  • CI Verification: required checks は current head 3e0a398aed6ca1e5220afc187e44ab37966d1303 で通過しています。
  • 検証コマンド結果: TEST_VERDICT_MACHINE の latest comment が current head 一致、verification_commands_pass=7, verification_commands_fail=0, verification_skipped_count=0 です。

Blockers

  • なし

Non-blockers

  • なし

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "3e0a398aed6ca1e5220afc187e44ab37966d1303"
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
allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author

判定: REQUEST_CHANGES

このPRは方向性自体は正しいですが、現状の実装は fail-closed artifact としてまだ信用できません。特に、current head に対する検証証跡が stale に見える点、compact JSON がサイズ制限で壊れる点、out_of_scope_fail の成立条件が Issue #1115 のACより緩い点は merge blocker です。

確認した主な材料は、PR #1250本文・コメント、Issue #1115本文とオーナーコメント、関連PR #980、adjudicate_vc_result.py、Step 2文書、agent-run-report文書、既存の triage_contract_blockers.py / allowed_paths_review_gate.py / baseline_vc_preflight.py、および pytest / uv / Claude Code skills / JSON canonicalization の公式仕様です。


Blocker 1: current head に対する TEST_VERDICT / APPROVE 証跡が stale

PRメタデータ上の現在 head は da80e6a724aeca108678abcfe2c165e4dab170cc です。
一方、取得できた最新の TEST_VERDICT_MACHINE は head_sha: 3e0a398aed6ca1e5220afc187e44ab37966d1303 に対する PASS です。

これは過去レビューで既に blocker とされた stale evidence 問題の再発です。そのレビューは、検証コメントが reviewed head より古い場合は current-head VC evidence missing として fail-closed すべきだと明示していました。

修正要求:
da80e6a724aeca108678abcfe2c165e4dab170cc に対する TEST_VERDICT_MACHINE を再投稿し、Step 2 側では TEST_VERDICT.head_sha == PR current head_sha でないコメントを無条件に stale として拒否してください。PR本文やレビューコメントの「pass」ではなく、current head bound な machine evidence を正本にすべきです。


Blocker 2: --max-stdout-bytes が machine-readable JSON を破壊する

main() は compact JSON を作った後、長さが --max-stdout-bytes を超えると単純に文字列スライスして ... を付けています。これは JSON として不正な stdout を生成します。
一方、CLI引数には --max-stdout-bytes があり、default は 4096 bytes です。

これは Issue #1115 の「compact stdout は machine-readable result」という目的と衝突します。テストは json.loads(result.stdout) を通常サイズで確認しているだけで、4096 bytes 超過時に JSON が壊れないことを確認していません。

修正要求:
stdout は常に valid JSON にしてください。サイズ制限が必要なら、シリアライズ後に切るのではなく、シリアライズ前に以下のように構造を縮退させるべきです。

  • per_ac[].summary を短縮する
  • 大きい evidence_refs / raw-ish payload は private artifact に逃がす
  • stdout_truncated: true / omitted_fields: [...] を valid JSON 内に入れる
  • それでも収まらない場合は、valid JSON の indeterminate blocking を返す

追加テスト名は test_compact_stdout_remains_valid_json_when_truncated_budget_is_small が最低限必要です。


Blocker 3: out_of_scope_fail が baseline に無い新規 failure でも成立してしまう

Issue #1115 AC4 は、implementation diff があり、baseline に無い failure が出た場合は regression_fail blocking と定義しています。AC3 も、out_of_scope_fail は failure key が changed/allowed scope と無関係である証跡がある場合だけ許可するとしています。

しかし実装は、baseline signature に存在しない current failure でも、failure key が changed/allowed scope にマッチしなければ out_of_scope_fail を返します。該当分岐は「baselineに無い」「diffあり」「allowedあり」「scope非関連」だけで non-blocking に倒しています。
さらにテスト自体がこの危険な仕様を固定しています。baseline には command_hash=a の default failure しかなく、current は command_hash=b かつ docs/readme.md::test_readme という baseline に無い failure ですが、期待値は out_of_scope_fail non-blocking です。

これは「PR差分と無関係に見える新規 failure」を安全に非blockingへ落としてしまう穴です。実際には、テスト名が docs 配下に見えるだけで、fixture・import graph・package state・global hook・generated asset などを通じてPR差分が原因になり得ます。

修正要求:
baselineに無い current failure は、原則 regression_fail または indeterminate にしてください。out_of_scope_fail を返す条件は少なくとも次に限定すべきです。

out_of_scope_fail にできる条件:
- current failure_key が抽出済み
- baseline 側にも同一 failure_key が存在する、または producer が検証済み causal evidence を持つ
- changed_paths / allowed_paths と無関係である証跡が machine-readable に存在する
- 上記のどれかが欠けたら indeterminate blocking

追加テストは test_new_unrelated_failure_with_diff_is_not_out_of_scope が必要です。


Blocker 4: stale / source freshness を検出するための source_integrity が足りない

Step 2文書は、VC_ADJUDICATION_RESULT_V1.overall_status と blocking を routing 正本にし、欠落・破損・期限切れなら fail-closed とすると書いています。
しかし実装の source_integrity は、入力が None でないか、item数、changed_paths有無を見る程度で、head_sha、base_sha、contract_body_sha256、allowed_paths fingerprint、reviewed_head_sha といった freshness 判定材料を持っていません。

結果として、古い current VC result、古い diff summary、古い allowed paths を与えても、構造がそれっぽければ裁定できます。これは今回のPRコメント上で実際に起きている stale evidence 問題と同型です。

修正要求:
source_integrity に少なくとも以下を追加してください。

source_integrity:
  base_sha: <base sha>
  head_sha: <current PR head sha>
  reviewed_head_sha: <artifact-producing head sha>
  contract_body_sha256: sha256:<64hex>
  allowed_paths_normalized_sha256: sha256:<64hex>
  diff_summary_head_sha: <sha>
  current_vc_result_head_sha: <sha>
  evidence_complete: true | false
  evidence_fresh: true | false

reviewed_head_sha != current PR head_sha は indeterminate blocking で停止すべきです。既存の allowed_paths_review_gate.py は head / reviewed_head / fingerprint を明示的に持つ設計なので、これに寄せるべきです。


Blocker 5: public-safe境界が artifact_ref の local path で崩れる

agent-run-report 文書は public-safe source JSON に raw_transcript、full_command_output、stdout、stderr、local_path を含めることを禁止しています。
実装は private bundle に raw inputs を入れる点は良いですが、public compact result に artifact_ref = str(Path(args.artifact_out)) をそのまま入れています。

テストも tmp_path 配下の artifact file を public result に出すことを許容しており、artifact_ref が local filesystem path でないことは検査していません。

修正要求:
public result の artifact_ref は local path ではなく opaque reference にしてください。例えば:

{
  "artifact_ref": "vc-adjudication-private-bundle",
  "artifact_digest": "sha256:<64hex>"
}

local path が必要なら private artifact 側に閉じ、public surface には出さないでください。追加テストは test_compact_result_does_not_emit_local_artifact_path が必要です。


Blocker 6: evidence_refs と digest が schema / canonicalization として弱い

Issueコメントの推奨schemaでは、evidence_refs[] は kind, ref, digest, validation_verdict を持つ形でした。
実装の _build_evidence_refs() は ref に hash文字列を入れているだけで、digest と validation_verdict を分離していません。

また artifact_digest は json.dumps(bundle, ensure_ascii=False) に対するhashで、sort_keys=True や canonical separators がありません。
JSONをhash/signature対象にする場合、canonicalization がないと同じ意味のJSONでも key order や serialization 差で digest が変わります。RFC 8785 は、暗号学的に安定したJSON digestのために deterministic property sorting と canonical serialization を定義しています。([RFC Editor]1)

修正要求:
最低限、repo内で共通の canonical JSON 関数を作ってください。

def _canonical_json(value: Any) -> str:
    return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"))

その上で、evidence_refs は次の形に寄せるべきです。

evidence_refs:
  - kind: current_vc_result
    ref: <opaque ref or comment/artifact id>
    digest: sha256:<64hex>
    validation_verdict: pass | fail | unknown

Blocker 7: failure key の kind を捨てているため、非path failureを out-of-scope にできてしまう

Issueコメントの推奨schemaでは、failure key は kind: pytest_nodeid | process_exit | command_category のように種別付きで扱う想定でした。
しかし実装の _normalize_failure_keys() は dict item から key だけを抜き、kind を捨てています。

その後 _failure_key_root() / _key_relates_to_path() は、全ての failure key を path-like 文字列として changed/allowed paths と照合します。
このため、process_exit:1 や command_category:package_manager_no_tty_prompt のような path ではない failure key が、scope非関連として out_of_scope_fail へ流れる危険があります。

修正要求:
failure key は少なくとも以下のように型を保持してください。

failure_keys:
  - kind: pytest_nodeid
    key: tests/foo/test_bar.py::test_x

kind が pytest_nodeid または repo-relative path として検証済みのものだけ path relevance 判定に使うべきです。process_exit、command_category、unknown kind は、baseline完全一致がない限り indeterminate blocking にしてください。


Blocker 8: invalid allowed path pattern を fail-closed していない

canonical matcher v2 は、segment単位の grammar を持ち、* と ** 以外の partial glob を invalid とします。
allowed_paths_review_gate.py の canonicalize は invalid pattern で ValueError を投げ、fail-closed できる構造です。

一方、このPRの _key_relates_to_path() は normalize_allowed_pattern() が None を返した場合に単に False を返します。
つまり invalid allowed path が「関連なし」として扱われ、条件次第で out_of_scope_fail の方向に倒れます。これは malformed input を fail-closed にするAC7と合いません。

修正要求:
allowed path の canonicalization を adjudication の前段で一括実行し、invalid pattern が1件でもあれば indeterminate blocking にしてください。invalid pattern を「no match」として扱ってはいけません。


Blocker 9: Step 2文書の routing table が artifact導入の目的とまだズレている

Step 2文書は VC_ADJUDICATION_RESULT_V1 を routing 正本にすると書いています。
しかし判定表では、TEST_VERDICT.result == FAIL は「任意」条件で Step 5 へ直行し REQUEST_CHANGES として処理する、と書かれています。

これだと、今回追加した adjudicator が pre_existing_fail / out_of_scope_fail を non-blocking と判断しても、TEST_VERDICT.result=FAIL の時点で Step 5 に落ちる可能性があります。Issue #1115 の目的は、散文判断を構造化 artifact に置き換えて Step 2 routing の正本にすることなので、表がまだ古い判断軸を残しています。

修正要求:
Step 2の表は TEST_VERDICT.result 主導ではなく、次の順に明確化してください。

1. TEST_VERDICT current-head freshness を確認
2. VC_ADJUDICATION_RESULT_V1 を生成
3. VC_ADJUDICATION_RESULT_V1.blocking が true なら Step 5 / rerun / human escalation
4. blocking false なら Step 3

TEST_VERDICT.result=FAIL は adjudicator input であり、routing正本ではない、と表にも反映すべきです。


中リスク指摘

1. command_hash 検証が弱く、既存 producer との互換も曖昧

_is_valid_command_hash() は sha256: prefix と長さしか見ておらず、hex文字列かどうかを確認していません。
一方、既存の baseline_vc_preflight.py の compute_command_hash() は bare 64hex を返します。

安全側ではありますが、既存producer由来の bare hash を raw_command 無しで受け取ると missing_or_invalid_command_hash になり得ます。互換性を切るならschema migrationとして明記し、受けるなら sha256: なし64hexを正規化するテストが必要です。

2. empty current result を pass と見なしている

per_ac が空なら overall_status="pass" を返しています。
しかし current_vc_result.results=[] が「VC全件pass」を意味するのか、「producerがclassificationを落とした」のかはこのartifact単体では区別できません。current result 側に top-level result: PASS / verification_commands_pass / verification_commands_fail のような証跡がないなら、empty classifications は indeterminate に寄せる方が安全です。

3. matcher import failure が machine JSON にならない

_get_allowed_paths_matcher() は importできなければ RuntimeError を投げます。
CLI実行中にこれが起きると Python stack trace で落ちる可能性があり、VC_ADJUDICATION_RESULT_V1 の machine-readable fail-closed になりません。import失敗も indeterminate blocking JSON に変換してください。


外部仕様に基づく高品質化

pytest公式は exit code 5 を “No tests were collected” と定義しています。したがって、現実装が exit code 5 を regression_fail にしない方向は正しいです。ただし、pytest_exit_5 は summary だけでなく reason_code と rerun_required、場合によっては environment_blocked / indeterminate の厳密な基準を文書化すべきです。(pytest)

uv run はproject environmentを作成・更新してコマンドを実行するため、検証コマンドの再現性を上げるなら uv run --locked ... を推奨すべきです。uv公式CLIは --locked について、lockfileが変更されないことをassertし、lockfileが無い・古い場合はエラーにすると説明しています。([Astral Docs]3)

Claude Code skill内から bundled script を呼ぶなら、固定repo pathより ${CLAUDE_SKILL_DIR} を使う方が堅いです。Claude Code docs は、${CLAUDE_SKILL_DIR} が SKILL.md のあるディレクトリを指し、cwdに依存せず bundled scripts を参照できると説明しています。([Claude Platform Docs]4)

digestは将来的に監査・署名・artifact照合に使うなら、JCS/RFC 8785 互換または少なくともrepo内統一の canonical JSON で計算してください。RFC 8785 はJSON dataを「hashable」にするための deterministic serialization を定義しています。([RFC Editor]1)


追加すべきテスト

最低限、以下を追加しない限り、このPRは artifact contract として弱いです。

test_current_head_mismatch_is_indeterminate_blocking
test_compact_stdout_remains_valid_json_when_truncated_budget_is_small
test_new_unrelated_failure_with_diff_is_not_out_of_scope
test_failure_key_kind_process_exit_cannot_prove_out_of_scope
test_invalid_allowed_path_pattern_is_indeterminate
test_compact_result_does_not_emit_local_artifact_path
test_artifact_digest_is_canonical_and_stable_across_key_order
test_bare_legacy_command_hash_is_either_normalized_or_rejected_with_migration_reason
test_empty_current_classifications_without_pass_signal_is_indeterminate
test_allowed_paths_matcher_import_failure_returns_machine_json

最終コメント

このPRは「散文判断をJSON化しただけ」になる危険をかなり減らしています。特に matcher v2 を取り込んだ点、pytest exit code 5 を regression扱いしない点、raw stdout/stderr を private artifact に逃がす方向は良いです。実際、以前のレビューで指摘された literal/prefix path比較の問題に対して、現在の実装は AllowedPathsMatcher を読み込む形に修正されています。

ただし、今のまま merge すると、out_of_scope_fail の過剰許可、stale evidence、壊れたcompact JSON、local path leakage により、肝心の「後続レビューで再検証できる fail-closed 裁定 artifact」には届きません。現時点の判定は REQUEST_CHANGES です。

@squne121
squne121 force-pushed the worktree-issue-1115-vc-failure-adjudicator-pre-existing-out- branch from 9dc3c67 to 3e0a398 Compare June 30, 2026 12:55
@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  head_sha: c501c7ece2d3fa472d17a66ec401c14a328ec58e
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 7
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "test -f .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "script present; current head matches PR head"
    - ac: AC2
      command: "rg -n \"test_no_diff_same_baseline_failure_is_pre_existing_nonblocking\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:86"
    - ac: AC3
      command: "rg -n \"test_out_of_scope_requires_diff_and_failure_key_evidence\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:277"
    - ac: AC4
      command: "rg -n \"test_diff_related_failure_is_regression_blocking\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:139"
    - ac: AC5
      command: "rg -n \"VC_ADJUDICATION_RESULT_V1\\\\.overall_status.*blocking\" .claude/skills/impl-review-loop/steps/step-2-verification.md"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/steps/step-2-verification.md:39"
    - ac: AC6
      command: "rg -n \"test_full_stdout_stderr_only_in_private_artifact\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:339"
    - ac: AC7
      command: "rg -n \"test_pytest_exit_5_is_not_regression_fail\" .claude/skills/impl-review-loop/tests/"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "matched .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py:204"

検証結果レポート

Issue #1115: VC failure adjudicator pre-existing out-of-scope

AC 確認コマンド 実行結果(要約) exit code 判定
AC1 test -f .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py file exists 0 PASS
AC2 rg -n "test_no_diff_same_baseline_failure_is_pre_existing_nonblocking" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC3 rg -n "test_out_of_scope_requires_diff_and_failure_key_evidence" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC4 rg -n "test_diff_related_failure_is_regression_blocking" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC5 rg -n "VC_ADJUDICATION_RESULT_V1\\.overall_status.*blocking" .claude/skills/impl-review-loop/steps/step-2-verification.md routing text found 0 PASS
AC6 rg -n "test_full_stdout_stderr_only_in_private_artifact" .claude/skills/impl-review-loop/tests/ test found 0 PASS
AC7 rg -n "test_pytest_exit_5_is_not_regression_fail" .claude/skills/impl-review-loop/tests/ test found 0 PASS

総合判定

  • 全 AC PASS: YES
  • FAIL した AC: なし
  • SKIP した AC: なし
  • human_review_required: NO

@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, merge_state_status=CLEAN

Evidence Check

  • AC coverage: PR 本文の ## 受け入れ条件の達成状況 で AC1-AC7 が根拠付きで充足されています。
  • Allowed Paths: PR diff は .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py, .claude/skills/impl-review-loop/steps/step-2-verification.md, .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py, docs/dev/agent-run-report.md の契約内に収まっています。
  • CI Verification: current head c501c7ece2d3fa472d17a66ec401c14a328ec58e で required checks は 13 passed / 0 failed です。
  • 検証コマンド結果: latest TEST_VERDICT_MACHINE は current head 一致で verification_commands_pass=7, verification_commands_fail=0, verification_skipped_count=0 です。

Blockers

  • なし

Non-blockers

  • なし

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "c501c7ece2d3fa472d17a66ec401c14a328ec58e"
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
allowed_paths_gate_source: review_subagent

@squne121
squne121 merged commit 819f1a1 into main Jun 30, 2026
26 checks passed
@squne121
squne121 deleted the worktree-issue-1115-vc-failure-adjudicator-pre-existing-out- branch June 30, 2026 16:30
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.

1 participant