Skip to content

実装: adjudicate_vc_result.py の current PASS 認証を regression-gate 以外の VC 種別へ拡張する #1488

Closed

Description

@squne121

Parent Issue

none(単独改善。Issue #1453 / PR #1460 の follow-up)

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "baseline_vc_preflight.py の current-head mode を修正し、regression-gate 以外の VC(rg、test -f 等)の exit 0 を certified PASS として出力できるようにする"
change_kind: code

Parent Goal Ref

Current Validated Scope

  • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py の current-head evidence-mode における分類ロジックを対象に、pytest/pnpm regression-gate 種別以外の VC コマンド種別(rg、test -f 等)でも current-head 再実行結果を certified な current PASS として分類できるようにする。
  • adjudicate_vc_result.py 本体(producer envelope の scheme・consumer 側の判定ロジック)は変更しない。producer 側(baseline_vc_preflight.py)の修正のみで完結させる。
  • 上記変更に対応する pytest 回帰テストの追加・更新。

mode-aware truth table

evidence mode 実行結果 期待分類
baseline 非 regression VC exit 0 unexpected_pass / blocked を維持
baseline rg no match / test -f false expected_fail / go
current-head 静的 policy を通過したコマンドが exit 0 expected_pass / go
current-head exit nonzero 既存の error/failure 分類を維持
current-head unsafe・broad search・不正構文 実行せず blocked
current-head HEAD drift・dirty worktree・body hash不整合 envelope 全体を blocked

Remaining Parent Gaps

なし(親 Issue なし)。ただし本 Issue 完了後も、producer schema 側の破壊的変更が必要になった場合の migration 方針は別途 follow-up として扱う可能性がある。

Outcome

baseline_vc_preflight.py の current-head evidence-mode において、静的 policy を通過して実行された非 regression-gate VC コマンド種別(rg、test -f / test -s 等)の exit 0 が certified current PASS(expected_pass / go)として出力され、adjudicate_vc_result.py へ渡した際に baseline expected_fail が expected_fail_resolved_on_current_head として遷移する状態。既存の baseline evidence-mode の分類意味論(非 regression-gate VC の exit 0 は引き続き unexpected_pass / blocked)は変更しない。

In Scope

  • 選択肢1(既存 baseline_vc_preflight.py の current-head mode を修正するアプローチ)を採用して実装する。
  • current-head evidence-mode の分類ロジックに、静的 policy を通過して実行された rg / test -f / test -s 等の非 regression-gate VC コマンドの exit 0 を certified current PASS として扱う分岐を追加する。
  • unsafe command、broad rg、invalid regex、malformed test、exit nonzero、missing command、timeout といった既存の fail-closed 判定は current-head でも維持し、PASS へ昇格させない。
  • HEAD mismatch、dirty-before、dirty-after、body SHA mismatch、fallback_detected、human_review_required、stop_condition_triggered のいずれかが検出された場合は current-head でも envelope 全体を blocked とする既存挙動を維持する。
  • 実 producer(baseline_vc_preflight.py)が生成した current-head envelope を adjudicate_vc_result.py に渡し、baseline expected_fail が expected_fail_resolved_on_current_head に遷移することを確認する境界テスト(手書き fixture のみに依存しない)の追加。
  • 既存の pytest/pnpm regression-gate 種別の certified current PASS 判定(Issue 実装: expected-fail から current PASS の VC adjudication を判定する #1453 / PR fix: current PASS VC adjudication を fail-closed 化 (#1453) #1460 実装分)を破壊しないことの回帰確認。

Out of Scope

  • pnpm typecheck/lint/test/build 自体の実装変更。
  • baseline_vc_preflight.py が扱う VC コマンド種別の追加(新しい種類のコマンドサポート追加)そのもの。対象は既存でサポート済みの rg / test -f 等の分類意味論のみ。
  • Issue 実装: expected-fail から current PASS の VC adjudication を判定する #1453 の Scope(regression-gate 種別の certified current PASS 判定そのもの)の再実装。
  • 選択肢2(TEST_VERDICT_MACHINE/v1 から新規 CURRENT_VC_RESULT_V1 を生成する決定論的 adapter script を新規追加するアプローチ)。OWNER anchor comment(敵対的レビュー、issuecomment-4956900044)で棄却が確定した。理由: 既存 producer の拡張で完結する変更に対して、並行する別 adapter を新設すると producer の正本性が分裂し、consumer 側(adjudicate_vc_result.py)が2系統の current envelope 形式を扱う複雑性が生じるため。
  • adjudicate_vc_result.py 本体の変更。producer 側(baseline_vc_preflight.py)の修正責務であり、consumer 側に不要な契約緩和をさせないため Allowed Paths からも除外する。

Acceptance Criteria

  • AC1: baseline evidence-mode では、非 regression-gate VC の exit 0 が引き続き unexpected_pass / blocked になる。既存 contract review semantics を変更しない。
  • AC2: current-head evidence-mode では、static policy を通過して実行された rg VC が exit 0 の場合、expected_pass / go として出力され、producer envelope が pass になる。
  • AC3: current-head evidence-mode では、static policy を通過して実行された test -f / test -s VC が exit 0 の場合、expected_pass / go になる。
  • AC4: unsafe command、broad rg、invalid regex、malformed test、exit nonzero、missing command、timeout は current-head でも PASS に昇格しない。
  • AC5: producer が生成した実 current-head envelope を adjudicate_vc_result.py に渡すと、baseline expected_fail は expected_fail_resolved_on_current_head になる。手書き fixture のみを evidence としない(fixture-only false green 防止の境界テストを含める)。
  • AC6: HEAD mismatch、dirty-before、dirty-after、body SHA mismatch、fallback_detected、human_review_required、stop_condition_triggered のいずれかが不正なら uncertified_current_pass / blocking になる。
  • AC7: 既存 pytest・pnpm regression-gate suite と baseline mode suite が全件 PASS する。

Verification Commands

# AC1
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v

# AC2
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v

# AC3
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v

# AC4
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v

# AC5
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py -k "real_producer" -v

# AC6
# baseline-expect: pass
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v

# AC7
# baseline-expect: pass
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -v

Allowed Paths

  • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
  • .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
  • .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py(新規)
  • .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py(新規)

adjudicate_vc_result.py 本体は Allowed Paths から除外する(producer 側の修正責務であり、consumer 側に不要な契約緩和をさせないため。Out of Scope 参照)。

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • adjudicate_vc_result.py 本体の変更が必要だと判明した場合(Out of Scope 逸脱のため実装を止め issue-contract-review / 人間判断を仰ぐ)

Required Skills

なし

Required Design References

  • docs/dev/agent-skill-boundaries.md

Scope Delta(任意)

N/A

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は agent tooling 内部スクリプト(.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py の current-head evidence-mode 分類ロジック)の変更であり、外部プロセス起動・ネットワーク通信・ユーザー向け I/O を伴わない。変更の正しさは pytest 回帰テスト(静的検証: unit test)で decisively 検証可能であり、docs/dev/runtime-verification-policy.md の not_applicable 定義(静的検証(typecheck / lint / unit test / build)のみで完結し、プロセス起動・通信・I/O は不要)に合致する。

Source

Notes for Reviewer

  • 本 Issue 本文は issue-refinement-loop の rewrite ステップで、直近 review-issue の VERDICT: needs-fix(C9: Runtime Verification Applicability セクション欠落)と、上記 OWNER anchor comment の両方を反映するために書き換えた。
  • 実装方針は選択肢1(baseline_vc_preflight.py の current-head mode 修正)に確定済み。選択肢2(新規 adapter 追加)は Out of Scope として明示的に棄却した。
  • 推奨タイトルは「実装: baseline_vc_preflight current-head mode で非 regression-gate VC の exit 0 を certified PASS として出力する」。本 edit トランザクションは v1 scope の都合上 title mutation を含まないため、別途 title update routing での反映を検討すること。
  • baseline_vc_preflight.py は正本 producer であり、他 Issue の Allowed Paths とも重なる可能性があるため、着手前に overlap preflight(check_issue_overlap.py)または OPEN Issue 検索で並行変更がないか再確認すること。

Delivery Rule

  • 1 Issue = 1 PR
  • 実装は専用 worktree で行う(git worktree add 等)
  • PR は Draft PR として作成し、レビュー完了後に Ready 化する

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    on Jul 12, 2026
  2. squne121 commented on Jul 13, 2026

    @squne121
    OwnerAuthor

    敵対的レビュー判定

    REQUEST CHANGES — 現状の Issue #1488 は実装開始不可。

    目的自体は妥当です。ただし、実装方式が未決定のまま、Allowed Paths・Acceptance Criteria・Verification Commands が互いに矛盾しています。

    採用すべき方針は明確です。

    選択肢1を採用し、既存 baseline_vc_preflight.py の current-head mode を修正する。選択肢2の adapter は棄却する。

    Issue #1488 には現時点でコメントがなく、この設計判断はまだ記録されていません。


    主要 findings

    重大度 | Finding | 判定 -- | -- | -- P0 | 選択肢2は Allowed Paths 上、実装不能 | Blocker P0 | Verification Commands が実際の producer defect を検査していない | Blocker P0 | baseline と current-head の分類意味論が未定義 | Blocker P1 | 新規 schema 導入時の governance が欠落 | Major P1 | rg・test・pytest の終了コード差異を AC が扱えていない | Major P1 | Issue のタイトルと変更責務がずれている | Major

    P1-3: Issue の責務名と Allowed Paths が不適切

    タイトルは「adjudicate_vc_result.py の current PASS 認証を拡張」となっていますが、adjudicator はすでに必要な branch を実装しています。current PASS envelope の certification 条件も、body SHA、reviewed/current/diff HEAD 一致、全 changed paths の Allowed Paths 包含、安全フラグを要求しています。

    実際の不足は producer の current-head result classification です。

    そのため、次の修正が妥当です。

    推奨タイトル

    実装: baseline_vc_preflight current-head mode で非 regression-gate VC の exit 0 を certified PASS として出力する
    

    推奨 Allowed Paths

    - .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py
    - .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py
    

    adjudicate_vc_result.py 本体は、具体的な不足が新たに判明しない限り Allowed Paths から外すべきです。不要な consumer 側変更を許可すると、producer defect を consumer の契約緩和で隠す実装が可能になります。


    推奨 Acceptance Criteria

    AC1:
    baseline evidence-mode では、非 regression-gate VC の exit 0 が引き続き
    unexpected_pass / blocked になる。既存 contract review semantics を変更しない。
    

    AC2:
    current-head evidence-mode では、static policy を通過して実行された rg VC が
    exit 0 の場合、expected_pass / go として出力され、producer envelope が pass になる。

    AC3:
    current-head evidence-mode では、static policy を通過して実行された
    test -f / test -s VC が exit 0 の場合、expected_pass / go になる。

    AC4:
    unsafe command、broad rg、invalid regex、malformed test、exit nonzero、
    missing command、timeout は current-head でも PASS に昇格しない。

    AC5:
    producer が生成した実 current-head envelope を adjudicate_vc_result.py に渡すと、
    baseline expected_fail は expected_fail_resolved_on_current_head になる。
    手書き fixture のみを evidence としない。

    AC6:
    HEAD mismatch、dirty-before、dirty-after、body SHA mismatch、
    fallback_detected、human_review_required、stop_condition_triggered のいずれかが
    不正なら uncertified_current_pass / blocking になる。

    AC7:
    既存 pytest・pnpm regression-gate suite と baseline mode suite が全件 PASS する。

    推奨 Verification Commands

    # Producer semantics
    uv run --locked pytest
    .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
    -k "current_head and (rg or test_f or test_s)" -v

    Real producer → adjudicator boundary

    uv run --locked pytest
    .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py
    -k "real_producer" -v

    Producer regression

    uv run --locked pytest
    .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v

    Adjudicator regression

    uv run --locked pytest
    .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -v


    最終結論

    Issue #1488 は、問題の発見と Goal は正しいが、実装契約としては未成熟です。

    実装前に次の4点を確定する必要があります。

    1. 選択肢1へ一本化し、adapter 案を棄却する

    2. 変更責務を adjudicator ではなく current-head producer に置く

    3. baseline/current-head の mode-aware truth table を明記する

    4. fixture-only test ではなく、実 producer output を使う境界テストを追加する

    この修正後であれば、実装は大規模な schema 追加ではなく、producer の mode-aware remap と回帰テスト追加に限定できる見込みです。

    # 敵対的レビュー判定

    REQUEST CHANGES — 現状の Issue #1488 は実装開始不可。

    目的自体は妥当です。ただし、実装方式が未決定のまま、Allowed Paths・Acceptance Criteria・Verification Commands が互いに矛盾しています。

    採用すべき方針は明確です。

    選択肢1を採用し、既存 baseline_vc_preflight.py の current-head mode を修正する。選択肢2の adapter は棄却する。

    Issue #1488 には現時点でコメントがなく、この設計判断はまだ記録されていません。


    主要 findings

    重大度 Finding 判定
    P0 選択肢2は Allowed Paths 上、実装不能 Blocker
    P0 Verification Commands が実際の producer defect を検査していない Blocker
    P0 baseline と current-head の分類意味論が未定義 Blocker
    P1 新規 schema 導入時の governance が欠落 Major
    P1 rg・test・pytest の終了コード差異を AC が扱えていない Major
    P1 Issue のタイトルと変更責務がずれている Major

    P0-1: 選択肢2は Issue 自身の Allowed Paths に反する

    Issue は次の二案を未決定のまま残しています。

    1. baseline_vc_preflight.py を拡張する
    2. TEST_VERDICT_MACHINE/v1 から新規 CURRENT_VC_RESULT_V1 を生成する adapter を追加する

    しかし Allowed Paths には、新規 adapter の配置先が含まれていません。さらに adapter を正規経路へ接続するなら、少なくとも caller、snapshot producer、consumer inventory の更新が必要ですが、それらも対象外です。Issue の Stop Conditions は Allowed Paths 外変更や schema 契約変更が必要なら停止するよう要求しています。つまり、選択肢2は選んだ瞬間に Stop Condition へ到達します。

    加えて、#1461 / PR #1466 ですでに正規経路は次のように構築されています。

    baseline_vc_preflight.py
      → run_contract_review_once.py
      → ensure_contract_snapshot.py
      → adjudicate_vc_result.py
    

    この経路は、reviewed HEAD、実行前後 HEAD、clean worktree、body hash、安全フラグを含む完全な current-head envelope を伝播します。ここへ TEST_VERDICT_MACHINE adapter を追加すると、同じ current evidence を生成する producer が二系統になり、どちらが SSOT なのか再び曖昧になります。

    修正要求: Issue 本文で選択肢1を確定し、選択肢2を Out of Scope に移してください。


    P0-2: 現在の Verification Commands は false green を許す

    実際の defect は adjudicate_vc_result.py ではなく、producer 側です。

    現行 classify_result() は次の動作です。

    • regression gate の exit 0: expected_pass / go
    • 非 regression-gate の exit 0: unexpected_pass / blocked

    つまり rg や test -f が current head で成功しても、producer envelope のトップレベル status は blocked になります。

    一方、adjudicator はすでに以下を実装済みです。

    • current item の exit_code == 0
    • failure_keys なし
    • producer-certified envelope
    • baseline item が expected_fail

    この条件なら expected_fail_resolved_on_current_head として non-blocking PASS にします。

    Issue #1488 の新規 Verification Commands は、すべて impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py を実行します。したがって、テスト fixture に手作業で status: pass を入れれば、producer を一切修正せず AC1・AC2 を通せます。

    これは典型的な fixture-only false green です。

    修正要求: 少なくとも次の二層を検証してください。

    1. 実 baseline_vc_preflight.py --evidence-mode current-head が status: pass を生成する producer test
    2. その実出力を adjudicate_vc_result.py に渡す境界 integration test

    P0-3: baseline と current-head の意味論を分離していない

    現行コードは、実行後に # baseline-expect: pass だけを再マッピングしています。

    exit 0 + baseline-expect: pass
      → expected_pass / go / scope_class=regression_gate
    
    baseline-expect: fail
      → 再マッピングなし
    

    そのため、baseline-expect: fail の rg や test -f が実装後に成功しても、unexpected_pass / blocked のままです。

    ここで classify_result() の全 exit 0 を無条件に PASS に変えると、baseline preflight が壊れます。baseline mode では、実装前から VC が成功することは contract defect だからです。

    必要なのは mode-aware な truth table です。

    evidence mode 実行結果 期待分類
    baseline 非 regression VC exit 0 unexpected_pass / blocked を維持
    baseline rg no match / test -f false expected_fail / go
    current-head 静的 policy を通過したコマンドが exit 0 expected_pass / go
    current-head exit nonzero 既存の error/failure 分類を維持
    current-head unsafe・broad search・不正構文 実行せず blocked
    current-head HEAD drift・dirty worktree・body hash不整合 envelope 全体を blocked

    最小変更は、classify_result() の baseline semantics を大きく書き換えることではありません。実行後、result item を組み立てる前に mode-aware remap を追加する方が安全です。

    def remap_current_head_success(
        *,
        evidence_mode: str,
        exit_code: int | None,
        classification: str,
        category: str,
        decision: str,
        scope_class: str,
    ) -> tuple[str, str, str, str]:
        if (
            evidence_mode == "current-head"
            and exit_code == 0
            and classification == "unexpected_pass"
            and decision == "blocked"
        ):
            return (
                "expected_pass",
                "current_head_command_pass",
                "go",
                scope_class,
            )
    
        return classification, category, decision, scope_class

    重要なのは以下です。

    • 新しい classification enum は追加しない
    • scope_class を不正に regression_gate へ変えない
    • static blocker は絶対に remap しない
    • current-head の HEAD・cleanliness 認証は既存 finalization に委ねる

    現在の summary と downstream validator は既存 classification enum を前提にしているため、新しい classification 値を追加すると schema drift や集計エラーを招きます。


    P1-1: 選択肢2は新規 schema 変更なのに governance がない

    CURRENT_VC_RESULT_V1 は既存 Known Schemas に存在しません。一方、TEST_VERDICT_MACHINE v1 は明示的に schema として管理されています。

    新規 schema を追加する場合、リポジトリ規約上は schema_change です。PR 本文には次が必須です。

    • schema ID
    • before/after
    • 全 consumer の列挙
    • 各 consumer の更新状況
    • consumer 検索結果

    欠落時は APPROVE 禁止です。

    また、TEST_VERDICT_MACHINE の evidence policy は PR head の一致、skip、fallback などを扱いますが、current-head producer envelope が持つ Issue body hash、実行前後 clean state、command mapping までは同一契約として保証していません。

    外部の attestation model でも、証跡は特定の immutable artifact と digest で結び付けることが基本です。単なるテスト結果コメントを current evidence へ変換するなら、HEAD だけでなく body hash、command hash、対象 AC、diff head まで binding する必要があります。([SLSA]1) ([GitHub]2)

    選択肢2は小さな adapter ではなく、実質的に新規証跡 schema と trust boundary の設計です。今回の Issue に混ぜるべきではありません。


    P1-2: コマンドごとの終了コード意味論が AC に不足している

    rg、test、pytest は同じ「成功・失敗」の終了コードではありません。

    • ripgrep は、match があれば 0、no match なら1、エラーは2です。exit 2 には regex syntax error のような致命的エラーだけでなく、ファイルを読めない soft error も含まれます。
    • POSIX test は、式が true なら0、falseまたは式なしなら1、エラーなら1より大きい値です。([The Open Group]3)
    • pytest は0が全テスト成功、4が invocation/usage error、5が no tests collected です。([pytestドキュメント]4)

    現行 producer もこれらを個別に分類しています。

    • rg exit 1 → expected baseline failure

    • test -f/-d/-s exit 1 → expected failure

    • test -s exit 2 → malformed/blocked

    • pytest exit 5 → blocked

    • rg exit 2 のうち、Allowed Paths 内の missing path だけを厳密条件付きで expected failure にする

    したがって AC は単に「rg type」「test -f type」では不足しています。

    最低限、次を test matrix に固定すべきです。

    ケース baseline current head 期待
    rg pattern file 1/no match 0/match certified PASS
    rg pattern new-file 2/exact missing Allowed Path 0/match certified PASS
    rg invalid-regex file 2 2 blocked
    rg 複数 path の一部 missing 2 2 false PASS 禁止
    test -f file 1 0 certified PASS
    test -s file 1/empty 0/non-empty certified PASS
    test -f malformed >1 >1 blocked
    unsafe/broad command 未実行 未実行 blocked
    pytest/pnpm regression gate 既存挙動 既存挙動 regression なし

    P1-3: Issue の責務名と Allowed Paths が不適切

    タイトルは「adjudicate_vc_result.py の current PASS 認証を拡張」となっていますが、adjudicator はすでに必要な branch を実装しています。current PASS envelope の certification 条件も、body SHA、reviewed/current/diff HEAD 一致、全 changed paths の Allowed Paths 包含、安全フラグを要求しています。

    実際の不足は producer の current-head result classification です。

    そのため、次の修正が妥当です。

    推奨タイトル

    実装: baseline_vc_preflight current-head mode で非 regression-gate VC の exit 0 を certified PASS として出力する
    

    推奨 Allowed Paths

    - .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
    - .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py
    - .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py
    

    adjudicate_vc_result.py 本体は、具体的な不足が新たに判明しない限り Allowed Paths から外すべきです。不要な consumer 側変更を許可すると、producer defect を consumer の契約緩和で隠す実装が可能になります。


    推奨 Acceptance Criteria

    AC1:
    baseline evidence-mode では、非 regression-gate VC の exit 0 が引き続き
    unexpected_pass / blocked になる。既存 contract review semantics を変更しない。
    
    AC2:
    current-head evidence-mode では、static policy を通過して実行された rg VC が
    exit 0 の場合、expected_pass / go として出力され、producer envelope が pass になる。
    
    AC3:
    current-head evidence-mode では、static policy を通過して実行された
    test -f / test -s VC が exit 0 の場合、expected_pass / go になる。
    
    AC4:
    unsafe command、broad rg、invalid regex、malformed test、exit nonzero、
    missing command、timeout は current-head でも PASS に昇格しない。
    
    AC5:
    producer が生成した実 current-head envelope を adjudicate_vc_result.py に渡すと、
    baseline expected_fail は expected_fail_resolved_on_current_head になる。
    手書き fixture のみを evidence としない。
    
    AC6:
    HEAD mismatch、dirty-before、dirty-after、body SHA mismatch、
    fallback_detected、human_review_required、stop_condition_triggered のいずれかが
    不正なら uncertified_current_pass / blocking になる。
    
    AC7:
    既存 pytest・pnpm regression-gate suite と baseline mode suite が全件 PASS する。
    

    推奨 Verification Commands

    # Producer semantics
    uv run --locked pytest \
      .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py \
      -k "current_head and (rg or test_f or test_s)" -v
    
    # Real producer → adjudicator boundary
    uv run --locked pytest \
      .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py \
      -k "real_producer" -v
    
    # Producer regression
    uv run --locked pytest \
      .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v
    
    # Adjudicator regression
    uv run --locked pytest \
      .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -v

    最終結論

    Issue #1488 は、問題の発見と Goal は正しいが、実装契約としては未成熟です。

    実装前に次の4点を確定する必要があります。

    1. 選択肢1へ一本化し、adapter 案を棄却する
    2. 変更責務を adjudicator ではなく current-head producer に置く
    3. baseline/current-head の mode-aware truth table を明記する
    4. fixture-only test ではなく、実 producer output を使う境界テストを追加する

    この修正後であれば、実装は大規模な schema 追加ではなく、producer の mode-aware remap と回帰テスト追加に限定できる見込みです。

  3. squne121 commented on Jul 13, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. squne121 commented on Jul 13, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: blocked
        gate_result: missing_go
        latest_comment_url: ''
        generated_at: '2026-07-13T11:12:49Z'
        body_sha256: ''
      metadata:
        title_prefix_ready: true
        phase_label_ready: true
      auto_fixes:
        result: blocked
        required: []
        skipped: []
      blockers:
      - kind: contract_review_not_run
        description: issue-contract-review が未実行のため CONTRACT_REVIEW_RESULT_V1.status=go
          が未確認。次のステップとして issue-contract-review を実行し、fresh_go を確認してから impl-review-loop
          へ進むこと。
      permissions:
        unavailable: []
      generated_at: '2026-07-13T11:12:49Z'
  5. squne121 commented on Jul 13, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-13T14:13:33Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1488
      body_sha256: "sha256:0c00693d803e5329a9c740e94dc6e5142540c8aafde09675d2ed00a4dac2cdb3"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:0c00693d803e5329a9c740e94dc6e5142540c8aafde09675d2ed00a4dac2cdb3","source_provenance":{"source_type":"github_api","body_file":null}}
        vc_preflight:
          decision: pass
          classifications: [{"ac":"AC1","line":3,"raw_command":"uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v","command_hash":"sha256:37d0a63c666c804793c18933b18d056977d1bb753f097476a761c8dc828d1fff","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":195,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":2,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC2","line":7,"raw_command":"uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v","command_hash":"sha256:37d0a63c666c804793c18933b18d056977d1bb753f097476a761c8dc828d1fff","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":163,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":6,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC3","line":11,"raw_command":"uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v","command_hash":"sha256:37d0a63c666c804793c18933b18d056977d1bb753f097476a761c8dc828d1fff","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":156,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":10,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC4","line":15,"raw_command":"uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py -v","command_hash":"sha256:37d0a63c666c804793c18933b18d056977d1bb753f097476a761c8dc828d1fff","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_current_head_non_regression.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":160,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":14,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC5","line":19,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py -k \"real_producer\" -v","command_hash":"sha256:885739c70626a093648b5184b55d1f43c33d09f17a20943f6f49c991a360fac4","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":163,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":18,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC6","line":23,"raw_command":"uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v","command_hash":"sha256:275543cf028392215002dcc973ec9eb891b1d6c8d2f8000e224644fc792b5570","runner":"exec","exit_code":0,"classification":"expected_pass","category":"baseline_expect_pass","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 140 items",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_current_head_evidence_certifies_clean_temporary_repository PASSED [  0%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_current_head_evidence_rejects_dirty_temporary_repository PASSED [  1%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_current_head_evidence_rejects_abbreviated_oid_and_symbolic_ref PASSED [  2%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_finalize_dirty_after_execution_blocks_and_maps_to_nonzero_exit PASSED [  2%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_current_head_retrieval_failure_finalizes_blocked_safety_fields PASSED [  3%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac1_file_exists PASSED [  4%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac2_schema PASSED [  5%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac3_body_file PASSED [  5%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac4_unexpected_pass PASSED [  6%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac5_expected_fail PASSED [  7%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac6_env_missing_dep PASSED [  7%]",".claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py::test_ac7_output_truncation PASSED [  8%]"],"stdout_truncated":true,"stdout_original_line_count":151,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":72063,"fix_hint":null,"annotations":{"baseline_expect":"pass","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":22,"raw":"# baseline-expect: pass"},"strict":null,"repair":null},{"ac":"AC7","line":27,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -v","command_hash":"sha256:29d0c3fa7035aff95ad1c73de37d877b9575749f90f5454b3bc2411b77a98fd7","runner":"exec","exit_code":0,"classification":"expected_pass","category":"baseline_expect_pass","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 25 items",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_no_diff_same_baseline_failure_is_pre_existing_nonblocking PASSED [  4%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_ac3_failure_key_evidence_missing_becomes_indeterminate_blocking PASSED [  8%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_diff_related_failure_is_regression_blocking PASSED [ 12%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_allowed_paths_glob_matcher_v2_relevance_is_regression_blocking PASSED [ 16%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_pytest_exit_5_is_not_regression_fail PASSED [ 20%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_current_head_mismatch_is_indeterminate_blocking PASSED [ 24%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_mixed_expected_baseline_results_with_certified_current_pass_are_nonblocking PASSED [ 28%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_current_pass_requires_complete_certified_envelope_and_allowed_paths PASSED [ 32%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_mapping_and_invalid_paths_fail_closed_for_current_pass PASSED [ 36%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_bool_exit_code_and_pass_with_failure_keys_fail_closed PASSED [ 40%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_new_unrelated_failure_with_diff_is_not_out_of_scope PASSED [ 44%]",".claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py::test_out_of_scope_requires_diff_and_failure_key_evidence PASSED [ 48%]"],"stdout_truncated":true,"stdout_original_line_count":36,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":358,"fix_hint":null,"annotations":{"baseline_expect":"pass","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":26,"raw":"# baseline-expect: pass"},"strict":null,"repair":null}]
      source: ensure_contract_snapshot_auto
  6. squne121 commented on Jul 13, 2026

    @squne121
    OwnerAuthor

    Overlap preflight readback evidence(#1488, proceed_with_collision_evidence 相当)

    check_implementation_overlap.py は route: human_review_required(evidence_sha256: sha256:780bfe88e8c1c90db93bb5ab63e6c1309ab360fbf0c7ad96e67bc35fabe5efd8, 2026-07-13 14:40:41Z 時点の再実行)を返したが、以下の通り全 8 candidate の ## Outcome / ## In Scope / ## Out of Scope を人手で readback し、いずれも disjoint と確認できた。

    対象 Issue #1488 の編集対象: baseline_vc_preflight.py の current-head evidence-mode 分類ロジック(非 regression-gate VC の exit 0 を certified PASS 化)。

    Issue overlapping_paths(機械検出) readback 結果 判定根拠
    #351 test_adjudicate_vc_result_non_regression_gate.py disjoint(tool 自身が readback_confirmed_disjoint 済み) issue-refinement-loop rewrite routing。無関係
    #944 test_baseline_vc_preflight*.py disjoint Allowed Paths が広域ディレクトリ .claude/skills/issue-contract-review/scripts/tests/(ファイル名未指定)を含むための false positive。Outcome は「rewrite loop が non-body-author-fixable blocker で早期停止できるようにする」であり、current-head 分類ロジックとは無関係
    #961 test_adjudicate_vc_result_non_regression_gate.py disjoint Allowed Paths が広域ディレクトリ .claude/skills/impl-review-loop/tests/(evidence gate 関連のみ、と本文に明記)による false positive。Outcome は validate_subagent_result_evidence.py(SubAgent 自己申告の evidence gate)であり、VC current PASS 分類とは無関係
    #962 test_adjudicate_vc_result_non_regression_gate.py disjoint 同上(.claude/skills/impl-review-loop/tests/, capability router 関連のみと明記)。Outcome は Haiku fallback の capability routing。AC1 で baseline_vc_preflight.py を安全性の例示パスとして参照するのみで編集対象ではない
    #966 test_adjudicate_vc_result_non_regression_gate.py disjoint 同上(.claude/skills/impl-review-loop/tests/, concurrent work ledger 関連のみと明記)。Outcome は git worktree/dirty 状態の可視化 ledger。無関係
    #1053 baseline_vc_preflight.py(実ファイル一致) disjoint(同一ファイル・別セクション) In Scope は --issue/--issue-number 等 CLI alias 追加(argparse 層)。#1488 は current-head 分類ロジック(結果判定層)。shared_ac_ids なし、shared_output_schema なし、edit_intent_match: false(tool 検出済み)
    #1338 baseline_vc_preflight.py(実ファイル一致) disjoint(同一ファイル・別セクション) In Scope は同一 command の dedup/replay + --max-workers bounded parallel execution(コマンド実行層)。Out of Scope に classify_result() の rg exit_code==2 分類ロジックの変更(Issue #1328 の対象) を明記しており、#1488 が触る分類ロジック領域を意図的に除外している
    #1396 test_baseline_vc_preflight*.py disjoint Allowed Paths が広域 tests/** を含むための false positive。Outcome は Issue MRC 追加 key の検証ロス解消(docs/template/schema 側)であり baseline_vc_preflight.py 自体は編集対象外

    結論

    全 8 candidate は readback により意味的に disjoint と確認できた(#944/#961/#962/#966/#1396 は広域ディレクトリ Allowed Paths 宣言起因の false positive、#1053/#1338 は同一ファイル内の別セクションを対象とする真の disjoint)。

    同一ファイル(baseline_vc_preflight.py)を編集する #1053 / #1338 とは PR merge 順序調整が将来必要になる可能性がある(textual conflict リスク。scope conflict ではない)。

    open-pr skill の overlap hard gate(#1458)について

    open_pr.py の overlap-preflight hard gate(Issue #1458)は route が proceed / proceed_with_collision_evidence の場合のみ通過する fail-closed 設計であり、上記の人手 readback を汎用的な override として受理する機構を持たない(受理される waiver は Issue #1477 に紐づく無関係な issue_numbers [519, 520, 1429] 限定で本 Issue には適用不可)。そのため本コメント投稿時点では、この readback は open-pr skill 経由の自動 PR 起票を成立させるものではない。PR 起票方法(gate 対象 Issue の調整 / waiver 機構拡張 / 明示的な直接 gh pr create)は別途人間の判断を仰ぐ。

    • decision_inputs_sha256: sha256:8e626785e3879a924e3a32e909fe5f640a45da8cacd29bf6b6229c2870fcf20b
    • evidence_sha256: sha256:780bfe88e8c1c90db93bb5ab63e6c1309ab360fbf0c7ad96e67bc35fabe5efd8
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