Repository navigation
feat(#170): add E_SCHEMA_CONSUMER_INVENTORY_MISSING guard to open_pr.py - #478
Conversation
Adds `_classify_validator_errors` to map LP050 and LP052 (missing Schema Consumer Inventory section) to the new error code `E_SCHEMA_CONSUMER_INVENTORY_MISSING`, enabling fail-closed PR creation when the inventory section is absent or incomplete. Other validator failures continue to emit `E_PR_BODY_VALIDATION_FAILED`. Tests cover AC1-AC6 including dry-run, internal-error non-misclassification, and LP052 boundary (other missing sections still map to the generic code). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: UNSTABLE
branch_behind_main: false
baseline_only: false
verification_commands_pass: 1
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac1_lp050_classified_as_schema_consumer_inventory_missing"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "LP050 failure correctly classified as E_SCHEMA_CONSUMER_INVENTORY_MISSING"
- ac: AC2
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac2_lp052_schema_consumer_inventory_classified_correctly"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "LP052 missing Schema Consumer Inventory section correctly classified"
- ac: AC2_BOUNDARY
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac2_lp052_other_section_not_misclassified"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "LP052 missing other sections correctly classified as E_PR_BODY_VALIDATION_FAILED"
- ac: AC3
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac3_stdout_includes_validator_rule_ids_on_lp050"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "stdout correctly includes VALIDATOR_RULE_IDS and ERROR=E_SCHEMA_CONSUMER_INVENTORY_MISSING"
- ac: AC4
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac4_not_schema_change_na_pass_path"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "not_schema_change + inventory N/A pass path preserves existing validator behavior"
- ac: AC5_INTERNAL_ERROR
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac5_validator_internal_error_not_misclassified"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "validator internal error NOT misclassified as E_SCHEMA_CONSUMER_INVENTORY_MISSING"
- ac: AC5_SCHEMA_MISMATCH
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac5_schema_mismatch_not_misclassified"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "schema mismatch NOT misclassified as E_SCHEMA_CONSUMER_INVENTORY_MISSING"
- ac: AC6
command: "uv run pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_ac6_dry_run_also_validates_and_classifies"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "dry-run mode still applies E_SCHEMA_CONSUMER_INVENTORY_MISSING classification"検証結果概要Issue #170: LP050/LP052 に E_SCHEMA_CONSUMER_INVENTORY_MISSING error code を追加
全体検証コマンド実行結果: 53/53 テスト PASS
実装は Issue #170 の全 Acceptance Criteria を満たし、既存 validator 挙動も維持されています。 |
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 6/6 PASS — TEST_VERDICT_MACHINE に AC1〜AC6 の per-AC 証跡あり(全 exit_code: 0)。AC5 は内部エラー・schema mismatch の2ケースを新規追加、target_mismatch / body_sha256_mismatch は既存 test_b3_* テストでカバー済み
- Allowed Paths: 遵守。変更ファイル 3 件(open_pr.py / test_open_pr_validation_hook.py / fixtures/pr_body/missing_schema_consumer_inventory_section.md)はすべて Allowed Paths 内
- CI Verification: 全 7 チェック pass(build / e2e / lint / python-test / test / typecheck / Generate agent session manifest)
- 検証コマンド結果:
uv run pytest .claude/skills/open-pr/scripts/tests/ -v→ 53/53 PASS。Checks セクション + TEST_VERDICT_MACHINE コメントで確認済み - Schema Change Applicability:
not_schema_change(open_pr.py / test / fixture のみ変更)→ Schema Consumer Inventory 不要 ✓ - Safety Claim Matrix: 存在 ✓。全 Claim の Not controlled = N/A。Evidence は pytest AC1-AC6 に対応 ✓
Blockers
なし
Non-blockers(任意改善)
- AC5 の 4 対象(internal error / schema mismatch / target mismatch / body_sha256 mismatch)のうち、新規 explicit test は 2 件のみ。target_mismatch / body_sha256_mismatch については既存
test_b3_*テストで非ゼロ終了を確認しているが、E_SCHEMA_CONSUMER_INVENTORY_MISSINGへの非誤分類を明示するテストは追加されていない。動作上の問題はないが、次回以降の同種 issue で explicit assertion を追加することを推奨する(severity: optional_follow_up)
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 28c9fa631a369792f98812146c364017d2390d7c
recommendations: []
follow_up_issue_requests:
- title: "open_pr.py AC5: target_mismatch / body_sha256_mismatch を E_SCHEMA_CONSUMER_INVENTORY_MISSING への非誤分類テストとして明示する"
issue_kind: implementation
severity: optional_follow_up
source:
kind: pr_review
url: "https://github.com/squne121/loop-protocol/pull/478"
note_id: "1"
dedupe_key: "follow-up:squne121/loop-protocol:https://github.com/squne121/loop-protocol/pull/478:1"
desired_destination: "AC5 対象 4 ケース全てに explicit non-misclassification assertion が存在する状態"
validated_scope_delta: "test_open_pr_validation_hook.py に test_ac5_target_mismatch_not_misclassified / test_ac5_body_sha256_mismatch_not_misclassified を追加する"
origin_skill: pr-review-judge
labels:
- triage-required
判定: REQUEST_CHANGESPR #478 は方向性は妥当ですが、このまま BlockersB1. Issue #170 AC3 と exit code が不一致Issue #170 は AC3 で「欠落時に これは単なる細部ではなく、CLI wrapper の machine-readable contract です。下流 loop が 修正要求 どちらかを必ず選ぶべきです。
現状のまま B2.
|
…idator integration test - B4: change LP052 classification from substring match to exact match (`message.strip() == "Missing required section: Schema Consumer Inventory"`) - B3: add integration test `test_integration_missing_schema_consumer_inventory_uses_real_validator` that calls real validator subprocess without monkeypatching `_run_pr_body_validator` Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
baseline_only: false
verification_commands_pass: 1
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: "AC1-AC54"
command: "uv run pytest .claude/skills/open-pr/scripts/tests/ -v"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "All 54 tests passed"検証結果レポートIssue #170: open-pr py/e schema consumer inventory (M contract consumer)
総合判定
|
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: All 6 ACs covered with dedicated unit tests (AC1-AC6) and B3 integration test using real validator subprocess. No placeholder text remaining.
- Allowed Paths: Compliant. 3 changed files all within issue Allowed Paths (.claude/skills/open-pr/scripts/open_pr.py, tests/test_open_pr_validation_hook.py, tests/fixtures/pr_body/missing_schema_consumer_inventory_section.md).
- CI Verification: All 7 checks pass (build, e2e, lint, python-test, test, typecheck, generate agent session manifest).
- 検証コマンド結果: TEST_VERDICT_MACHINE PASS — 54 tests passed, verification_commands_fail: 0, verification_skipped_count: 0.
- Schema Change Applicability:
schema_changedeclared (stdout error-code vocabulary extended). Schema Consumer Inventory section present with rg consumer enumeration. Two consumers identified: SKILL.md (no update needed, additive/backward-compat) and test file (updated). Compatibility: non-breaking additive extension. No "未対応" entries. - Safety Claim Matrix: Present. All claims implemented, Not controlled = N/A for all rows.
- Runtime Verification Applicability:
not_applicable— correct for CLI tool tested via pytest.
Blockers
- なし
Non-blockers
- なし
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 1223e8b450b2fd183d3e14264c04f6843fc965f1
recommendations: []
follow_up_issue_requests: []
Verdict: REQUEST_CHANGESこのPRは方向性は正しいですが、このまま merge すると 「Schema Consumer Inventory guard を入れるPR自体が、stdout/error-code contract の schema change を BlockersB1.
|
… Codes table E_PR_BODY_VALIDATION_FAILED の説明を一般的な validation 失敗に限定し、 E_SCHEMA_CONSUMER_INVENTORY_MISSING を専用行として追加(LP050/LP052 による Schema Consumer Inventory 欠落の専用コード)。 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BLOCKED
baseline_only: false
verification_commands_pass: 1
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results: []検証結果レポートIssue #170: open-pr skill の schema consumer inventory classification (Schema変更は LP050消費化へ)
総合判定
追加情報Iteration 2 修正後、全 54 テストが正常に完了しました。schema consumer inventory classification に関連する全テストが成功しています。 Note: mergeStateStatus が BLOCKED である理由は PR のブロッキング要因(CI チェック等)によるもので、VC 結果の PASS 判定に影響しません。 |
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 6/6 - AC1(LP050 classification), AC2(LP052 exact match), AC3(return 2 + stdout), AC4(pass path), AC5(no misclassification), AC6(dry-run) 全 [x] 記載あり、根拠付き
- Allowed Paths: 遵守 - 変更 4 ファイルすべて Allowed Paths 内(open_pr.py / test_open_pr_validation_hook.py / fixtures/pr_body/missing_schema_consumer_inventory_section.md / SKILL.md)
- CI Verification: 全 7 チェック pass(build/e2e/lint/python-test/test/typecheck + Generate agent session manifest)、headSha=8f37bb7f66815da5d5a5ff231bacb21cc2c7ada6 一致
- 検証コマンド結果: TEST_VERDICT_MACHINE v1 — result=PASS, 54 passed, verification_skipped_count=0, verification_commands_pass=1, fail=0
- Schema Change Applicability: schema_change(stdout error code vocabulary 追加)。Schema Consumer Inventory セクション存在、before/after 明示、consumer 列挙(rg 実行済み)、全 consumer 更新済み or 更新不要理由あり
- Safety Claim Matrix: セクション存在、Not controlled 列はすべて N/A、Evidence は pytest AC1-AC6 と対応
Blockers
- なし
Non-blockers
- なし
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 8f37bb7f66815da5d5a5ff231bacb21cc2c7ada6
recommendations: []
follow_up_issue_requests: []
Summary
open_pr.pyにE_SCHEMA_CONSUMER_INVENTORY_MISSINGerror code を追加し、_classify_validator_errorsヘルパーで LP050 および LP052(missing Schema Consumer Inventory) を新コードに分類する thin adapter を実装した_classify_validator_errorsは errors リストを走査し、LP050 を検出するか LP052 かつ message が "Missing required section: Schema Consumer Inventory" と exact match する場合にE_SCHEMA_CONSUMER_INVENTORY_MISSINGを返す(B4: substring match から exact match に変更)E_PR_BODY_VALIDATION_FAILEDのまま維持するdry-runでも同じ validation / error-code mapping を通る(dry-run は validator を skip しない)_run_pr_body_validatorを monkeypatch しない統合テストを追加(real validator subprocess を使用)Checks
pnpm typecheckpnpm lintpnpm testpnpm builduv run pytest .claude/skills/open-pr/scripts/tests/ -v(54 passed)Schema Change Applicability
ERROR=<CODE>)にE_SCHEMA_CONSUMER_INVENTORY_MISSINGを追加するため。下流 automation がERROR=stdout を読む contract に新値を追加することは schema change に相当する。Schema Consumer Inventory
変更対象 schema:
ERROR=stdout contract)E_APPROVAL_MISSING | E_PR_BODY_VALIDATION_FAILED | E_LINKED_ISSUE_STATE_UNKNOWN | E_GH_FAILUREE_APPROVAL_MISSING | E_PR_BODY_VALIDATION_FAILED | E_SCHEMA_CONSUMER_INVENTORY_MISSING | E_LINKED_ISSUE_STATE_UNKNOWN | E_GH_FAILUREConsumer 列挙(rg 実行済み):
.claude/skills/open-pr/SKILL.md.claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py.claude/skills/impl-review-loop/E_PR_BODY_VALIDATION_FAILEDを routing に使っていない.claude/skills/implement-issue/Safety Claim Matrix
Notes
Closes #170