Skip to content

test: shared parser consumer semantic parity matrix を追加 (#2799) - #2830

Merged
squne121 merged 4 commits into
mainfrom
worktree-issue-2799-vc-consumer-compat
Sep 29, 2026
Merged

squne121 merged 4 commits into
mainfrom
worktree-issue-2799-vc-consumer-compat

Conversation

@squne121

@squne121 squne121 commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

受け入れ条件の達成状況

  • AC1: 七 family の一つの表から五 consumer の可観測判定を照合し、non-$ のみ全体拒否を検証。
  • AC2: 五つの shell punctuation を positive、引用済み alternation を negative、壊れた quote を fail-closed として検証。
  • AC3: prose と二つの fence を持つ fixture で shared section 行 8/16、block 行 3/3、annotation 行 2/2 と normal の raw を厳密に照合。
  • AC4: grouped AC2/AC3 の集合・決定的スカラー・一つの occurrence/result と実行境界で一回の起動を検証。
  • AC5: annotation_source_line の docstring のみを block-relative に修正。
  • AC6: fix: baseline_vc_preflight の通常実行を shared VC parser に統一する #2796 の既存 point regressions と baseline VC syntax suite が成功。matrix は consumer の出力と subprocess 起動境界を照合。
  • AC7: 変更は tests subtree と許可済み docstring に限定。新しい依存・wrapper・production 挙動変更なし。差分をレビュー対象とする。
  • AC8: 型検査・lint・テスト・ビルド・model-routing がすべて成功。

検証コマンド結果

実行場所: canonical linked worktree。以下は修正前 HEAD の terminal 実行履歴です。今回の本文修正後に fresh full VC/CI を実行済みと主張するものではありません。

$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_vc_consumer_compat_matrix.py -q
18 passed
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_vc_consumer_compat_matrix.py::test_annotation_source_docstring_semantics -q
1 passed
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
28 passed
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -q
143 passed, 1 skipped(既存 suite の skip)
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_vc_format_and_command_policy.py -q
77 passed
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_vc_consumer_compat_matrix.py::test_scope_and_classifier_contract -q
1 passed
$ pnpm typecheck
PASS
$ pnpm lint
PASS
$ pnpm test
108 files / 1943 tests passed
$ pnpm build
PASS
$ uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py
24 passed
$ uv run --locked ruff check .claude/skills/issue-contract-review/scripts/tests/test_vc_consumer_compat_matrix.py .claude/skills/issue-contract-review/scripts/vc_contract_syntax.py
PASS

Allowed Paths 遵守

  • 変更ファイル: .claude/skills/issue-contract-review/scripts/tests/test_vc_consumer_compat_matrix.py、.claude/skills/issue-contract-review/scripts/vc_contract_syntax.py(docstring のみ)。
  • Allowed Paths 逸脱: なし。canonical な判定は独立 PR review の git diff に委ねます。

Checks

以下は修正前 HEAD で成功した記録です。今回の本文修正後の現行 HEAD について fresh full VC/CI 済みとは主張しません。

  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build

Schema Change Applicability

  • decision: not_schema_change
  • reason: 出力スキーマ・キー・実行挙動は一切変更せず、既存仕様に対する回帰テストと docstring だけを追加したため。

Schema Consumer Inventory

  • N/A: スキーマ変更なし。既存 consumer の出力だけをテストで比較します。

Compatibility Decision(互換性判定)

  • change_type: N/A
  • compatibility: N/A
  • migration_required: N/A
  • migration_or_followup: N/A
  • reason: スキーマは変更しません。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
検証コマンドの既存分類について表駆動回帰検出を追加し、隔離・権限・実行ポリシーは変更しない yes none 新 matrix 18 件成功、既存 parser 28 件成功、変更差分二ファイル N/A

Notes

Closes #2799
マージ時に対象の Issue を閉じる連携です。

IMPLEMENTATION_SCOPE_COVERAGE_V1:
  schema_version: "IMPLEMENTATION_SCOPE_COVERAGE_V1"
  issue_number: 2799
  issue_body_sha256: "sha256:bb412cfc8e6d6aa8352bb7bc990e5c9e97ae5c794a1b154e3aec00d4fbc0a015"
  normalized_scope_manifest_sha256: "sha256:1df34a89e8937752196b782bd0c6423dc9b284af295611d1a7c61913ee50c7d7"
  pr_head_sha: "9f23a7c4dae7306b108daab2f17d158845a0f750"
  scope_manifest: {"acceptance_criteria": ["PR #2796 の shared-command-parser point regressions と既存 baseline VC syntax regressions が引き続き PASS し、matrix は単なる関数 identity / field existence / point tests のコピーではなく consumer-visible output を比較する。", "VcCommandEntry.annotation_source_line docstring が block-relative の実値を正確に記述するよう documentation-only で修正し、既存の line_number section-relative と block_line_number block-relative semantics を変更しない。", "grouped # AC2, AC3 の同 matrix row から shared ac_refs、normal deterministic AC2,AC3 scalar、1 source command / 1 plan occurrence / 1 normal result / 1 subprocess launch を observable assertion で確認する。", "prose と複数 bash fence と baseline annotation を含む同 matrix fixture で shared entry の section-relative line_number と block-relative block_line_number / annotation_source_line、normal results[].line / annotation_source.line/raw を exact integer / raw text で assert する。", "repository quality gates(型検査・lint・test・build・model-routing regression)が PASS する。", "test_vc_consumer_compat_matrix.py に七 family の reusable case row を作り、同一 row から parser・static-only・plan・normal・validator の case × consumer expected observable mapping と意図的差異(whole-body rejection は non-$ のみ等)を table-driven に assert する。各 family の candidate population・status/diagnostic・AC association を検証し、除外 dimension は理由を明記する。", "同 matrix が punctuation positive 2>&1, &>, |&, >|, <> と quoted rg -n \"foo|bar\" PATH negative を quote-aware shared classifier / consumer-visible classification で固定する。malformed quoting の fail-closed は current classifier 契約と整合する場合追加する。", "新しい security layer・sandbox・wrapper・shell parser dependency を追加せず、production behavior の変更は matrix で current main の violation が実証されない限り行わない。変更差分を PR review で確認する。"], "allowed_paths": [".claude/skills/issue-contract-review/scripts/tests/**(new matrix + fixture、必要なら既存 tests の最小 refactor)", ".claude/skills/issue-contract-review/scripts/vc_contract_syntax.py(provenance documentation / docstring correction のみを原則とする。matrix で current main の semantic violation が実証されない限り functional production change 不可)"], "change_kind": "fix", "goal_ref": "shared parser authority への移行時に既存 consumer の observable semantics・candidate population・AC association・provenance coordinate の drift を共通 compatibility regression matrix で検出する", "in_scope": ["Exact provenance: fence 前 prose・複数 bash fence・# baseline-expect: pass を同じ fixture に置く。shared VcCommandEntry.line_number は VC section-relative、block_line_number と annotation_source_line は enclosing block-relative、legacy normal results[].line / annotation_source.line は block-relative。section content の冒頭空行を含む fixture で section-relative integer を計算し、両 fence の command line・annotation raw text を exact assert する(non-null のみ不可)。", "Grouped # AC2, AC3: 同じ row から shared ac_refs == {\"AC2\", \"AC3\"}、normal scalar ac == \"AC2,AC3\"、1 source command = 1 plan occurrence = 1 normal result = 1 subprocess launch を検証する。set の非決定的順序・association loss・先頭 AC のみ・fan-out execution を拒否する。", "Punctuation: quote-aware fail-closed classifier で 2>&1, &>, |&, >|, <> を positive、rg -n \"foo|bar\" PATH を negative とし、malformed quoting の fail-closed を追加 case として検討する。Bash AST/parser dependency は追加せず既存 classifier を oracle にする。", "Scope exclusions: 実際に consumer-visible VC outputs を比較できる上記五経路を主要 matrix 対象にする。_distinct_command_texts_from_body() の deduplicated population は relevant row で比較してよいが、外部 review orchestrators の独立 end-to-end 実行や security policy の網羅は扱わない。その理由を table/test comments に残す。", "七つの case family を共通 table にし、各 row に fixture と consumer ごとの期待 observable を宣言する。parity は全 consumer 同じ status ではなく case × consumer → expected observable result と定義する。少なくとも shared parser(errors.kind, commands, ac_refs)・baseline static-only(status / error category)・canonical plan(occurrences / budgets)・normal(status / results / error と subprocess 候補)・Issue body validator(warning/error・LP rule)を実際の output で検証する。", "現行実装に基づく期待差異(混合 case では valid $ true を別に置き、実行の分類には # baseline-expect: pass を利用):"], "schema_version": "IMPLEMENTATION_SCOPE_MANIFEST_V1"}

実装補助に Claude Code を使用しました。
🤖 Generated with Claude Code

Seven case families share a table across parser, static preflight, canonical plan, normal execution, and Issue-body validator; exact provenance, punctuation and grouped AC cardinality cover migration drift. Correct only the annotation_source_line provenance docstring in production.

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

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2830/

The preview will be removed when this PR is closed.

Assert occurrence and budget hashes against source-row commands, including grouped AC, rather than plan-derived expectations.

Co-Authored-By: Claude Code <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author

Findings

Verdict: REQUEST_CHANGES。current PR HEAD 82de97fa54aed9da6213f1414c983f63add2eb6b、current main 070f99fc34605178791ccc4969dd3ac9614af6d3 を基準に、PR #2830、Issue #2799、関連 #2788 / PR #2796、現行 parser / validator / parity tests、open Issue #1719、current CI を照合しました。

BLOCKER — known bug の LP016 grouped marker を compatibility contract として固定している

PR の test_grouped_ac_one_source_one_occurrence_one_result_one_launch() は最後に、

lint = validator.validate_issue_body(GROUPED.body)
assert [(e.rule_id, e.severity) for e in lint.errors] == [("LP016", "error")]

を要求しています。コメントでも「legacy LP016 を current observable mapping として retain」すると明記しています。

しかしこれは 意図的な consumer 差ではなく、既に repository 上で defect として追跡されている drift です。current shared parser は # AC2, AC3 を canonical grouped marker と明示してサポートしています。一方 open [Issue #1719](#1719) は validate_issue_body.py の LP016 が grouped marker を「誤 reject」していると明記し、AC9 で LP016 を発生させないこと、AC10 で validator を含む consumer parity を要求しています。

さらに既存 .claude/skills/review-issue/tests/test_vc_grammar_parity.py 自体が # AC2, AC3 を「canonical」「3 checker すべて pass」と定義しています。ただし現状そのテストは validator について LP010 の不存在しか検査せず、LP016 による overall fail を見逃しています。#2830 はその既存 false-green を直すのではなく、反対側の誤挙動を新しい regression oracle に固定しています。

実装時点でも「grouped AC の LP016 は observed behavior なので matrix に固定した」と明示的に認識されていました。:chatgpt-content-reference{index="0"}

Impact: #1719 が intended fix を実装すると、正しい変更なのに #2830 の新 matrix が赤くなります。より重要なのは、#2799 の Outcome が「意図的な consumer 差異を保存する」なのに、既知の誤 reject を同格の compatibility contract に昇格してしまう点です。

最小修正: #2830 で validator production code まで直す必要はありません。Allowed Paths を広げず、grouped AC test から LP016 == error の hard assertion を外し、validator の grouped-marker dimension は「known drift、#1719 ownership」と明示的に除外してください。ac_refs == {"AC2","AC3"}、scalar AC2,AC3、1 occurrence / 1 result / 1 launch はそのまま残せます。


P1 — 「consumer semantic parity」としては既知 consumer が抜けており、migration false-green がまだ成立する

新 matrix は shared parser、static-only、canonical plan、normal execution、validate_issue_body.py の5経路を扱っています。これは #2799 の最低限の AC には沿っていますが、repository には既に別の VC grammar consumer が存在します。

特に .claude/skills/edit-issue/scripts/guard-issue-body.py::guard_ac_vc_alignment() は grouped marker / inline suffix を独自に解析しており、open #1719 はまさにこの consumer を shared evaluator へ統合するための Issue です。また既存 test_vc_grammar_parity.py は check_issue_contract.py / validate_issue_body.py / baseline_vc_preflight.py を明示的に「3 checkers」としています。

したがって #2830 が green でも、shared parser migration 後に guard-issue-body.py や check_issue_contract.py だけが drift する経路は残ります。これは #2799 が狙う failure class と同型です。

Impact: test_vc_consumer_compat_matrix.py の green を「consumer semantic parity が保証された」と解釈すると false-green になります。特に module docstring の「External review orchestrators ... do not expose independent VC-grammar outputs」という除外説明では guard-issue-body.py を説明できません。これは edit guard であり、実際に AC/VC grammar output を持っています。

最小修正: production scope を増やす必要はありません。速度優先なら PR / test の claim を「5-path compatibility matrix」に狭め、check_issue_contract / edit guard parity は existing parity suite + #1719 が authority であると明記してください。より強くするなら test-only で guard/checker の read-only observation を row に追加できますが、#1719 と重複実装する必要はありません。

確認できた良い点

shell punctuation 部分は設計変更不要です。Python 公式 shlex は punctuation_chars=True の場合 ();<>|& の任意の連続 runを1 token にし、shell として意味的に有効かまでは検証しないと明記しています。したがって「Bash の完全 parser」ではなく conservative classifier として扱う現方針は適切です。:chatgpt-content-reference{index="1"}

また Bash 公式仕様でも 2>&1、&>、>|、<> は redirection syntax、|& は pipeline operator です。#2830 の positive set 自体は妥当で、新規 Bash AST parser・sandbox・wrapper を追加する理由はありません。:chatgpt-content-reference{index="2"}

exact provenance、non-$ whole-body rejection、plan candidate hash identity、grouped AC の 1 source → 1 occurrence/result/launch の検証は、PR #2796 の point regression を reusable oracle にするという #2799 の中心目的に沿っています。特に current HEAD の追加 commit 82de97f で plan occurrence/budget の hash を source row 由来の expected command と照合するよう修正されたため、初版より false-green 耐性が上がっています。

Current live state

PR #2830 は open / Draft / mergeable、current HEAD は 82de97fa54aed9da6213f1414c983f63add2eb6b。変更は test_vc_consumer_compat_matrix.py と vc_contract_syntax.py の2ファイルのみです。current main は PR base と同じ 070f99fc34605178791ccc4969dd3ac9614af6d3 で、base-behind はありません。

current HEAD の ci、check-hook-integrity、Check Japanese Content、deploy-pages、agent-session-manifest の workflow runs はすべて success で、ci 内の test / python-test-core / lint / typecheck / e2e-core 等も success でした。review submissions と unresolved review threads は現在ありません。つまり今回の blocker は CI failure ではなく、green test が誤った future contract を固定する semantic defect です。

最小の着地は、grouped marker の LP016 hard assertion を #2830 から除外して #1719 を明示参照し、matrix の coverage claim を実際の5経路へ正確に狭めることです。それ以外の shell parser/harness/security の追加は不要です。

@squne121

Copy link
Copy Markdown
Owner Author

確認した live state では、PR #2830 は open / Draft / mergeable、HEAD は 82de97fa54aed9da6213f1414c983f63add2eb6b、main は 070f99fc34605178791ccc4969dd3ac9614af6d3 です。指定コメント #issuecomment-5888669628 が最新の human review comment で、current HEAD の CI workflow はすべて success です。

推奨アクションは、既存 PR #2830 を resume し、指定コメントの2点だけを最小修正して impl-review-loop を再開することです。具体的には、grouped marker の LP016 == error hard assertion を外して「known drift / #1719 ownership」と明示し、matrix の保証 claim を実際の 5-path compatibility matrix に狭めます。LP016 の production fix や guard/checker の統合作業は open Issue #1719 が既に正規に所有しているため、新規再発防止 Issue は現時点では重複です。

現行 impl-review-loop は implementation-worker → test-runner → pr-reviewer を SubAgent として使い、各 task について final result の取得と list_agents 上の terminal completed の両方を確認してから downstream へ進む契約になっています。この条件を明示した実行プロンプトです。

repo=squne121/loop-protocol。

現在の repository-owned Claude-GPT launcher/profile で起動済みの、この interactive Claude Code session / auto mode をそのまま継続して作業してください。plain Claude への fallback、session の不要な再起動、permission mode の変更、bypassPermissions / --dangerously-skip-permissions は行わないでください。

対象:

目的は、指定 human review の REQUEST_CHANGES を修正し、現行 impl-review-loop に従って実装→独立検証→PR review→必要なら自動修正を bounded に反復し、実 merge / auto-merge は行わず、人間が最終 merge 判断できる直前まで進めることです。

この interactive instruction は、上記 #issuecomment-5888669628 の指摘を修正対象として処理し、その後の loop を継続するための、当該コメントより新しい operator instruction です。したがって、この古い REQUEST_CHANGES コメント自体を「作業停止」の human veto として再解釈しないでください。以後、新しい live human comment に明示的な停止指示が出た場合は current repository contract に従って停止してください。

最初に current repository state を fresh に取得してください。過去の chat やこの prompt に書かれた SHA を authority にせず、Issue #2799 本文、PR #2830 body / current HEAD / diff / comments / review threads / CI、current main、関連 Issue #1719、必要な repository SSOT を live 再取得してください。

そのうえで current HEAD の以下を読み、記憶や旧仕様ではなく現在の契約に従ってください。

impl-review-loop の Root-Owned Synchronous Entry Transition を省略しないでください。current-run の live Issue fetch → current issue-contract-review → live re-fetch → routing → 許可された場合の Step 1 起動を、現行 skill が要求する一続きの root transition として実行してください。

pre-Step-1 の Evidence-Based Landing Disposition は canonical producer の結果をそのまま使ってください。現在は existing open/draft PR #2830 があるため existing_pr_resume が自然に予想されますが、結果を hardcode せず fresh evidence で判定してください。既存 PR #2830、branch worktree-issue-2799-vc-consumer-compat、canonical linked worktree が有効ならそれらを再利用し、新しい branch / worktree / PR を重複作成しないでください。

指定 comment URL は human_context_comment_urls として provenance を保持しつつ、raw comment をそのまま execution instruction に連結せず、repository evidence と照合した root-normalized technical_recommendation / fix_delta にしてください。

今回の優先 fix_delta は以下です。

  1. BLOCKER:
    grouped # AC2, AC3 test で validate_issue_body() の LP016 == error を compatibility contract として hard-code しない。

  2. P1:
    matrix の保証範囲を実装実態どおり正確に表現する。

  3. PR body も current implementation と一致させる。
    「grouped LP016 を observed behavior として保存する」といった stale claim が残る場合は更新する。
    必要なら coverage wording を「5-path compatibility matrix」へ修正する。
    PR body-only hygiene は現行 workflow が許す mechanical action として扱う。

shell punctuation、exact provenance、non-$ whole-body rejection、plan hash identity 等、指定 review で問題なしとされた部分を無関係に再設計しないでください。新しい Bash AST parser、sandbox、security wrapper、approval layer、schema 等を追加しないでください。

SubAgent delegation は必須です。root thread が implementation worker の代わりに直接編集・テスト・review judgment を行わないでください。

各 canonical SubAgent task について、dispatch しただけで完了扱いしてはいけません。現行 Common Completion Protocol を厳守してください。

  • implementation-worker

  • test-runner

    • current PR head SHA、current Issue body SHA、literal Verification Commands、AC を実値で渡す
    • read-only independent verification を実施
    • final report を取得する
    • list_agents で terminal completed を確認する
    • report の head binding / literal command binding を root が独立照合する
    • canonical VC_ADJUDICATION_RESULT_V1 を生成・保持し、Step 4 current-head gate を満たすまで pr-reviewer を起動しない
  • pr-reviewer

    • current HEAD の実 diff、Issue AC、Allowed Paths、Verification evidence、required checks を materialize して渡す
    • current pr-review-judge skill でレビュー
    • final LOOP_VERDICT を取得する
    • list_agents で terminal completed を確認する
    • result + terminal completed の両方を確認してから Step 5 routing を行う

wait_agent の timeout / mailbox activity / intermediate message は完了証拠ではありません。SubAgent の最終結果を必ず回収してください。errored / interrupted / shutdown / not_found を成功扱いしないでください。recoverable discovery failure は current Step 4 recovery contract に従って bounded に回復してください。Claude-GPT を使っているので fresh runtime recovery が必要な場合も current repository-owned Claude-GPT adapter/profile を維持し、ambient plain Claude に silently fallback しないでください。

REQUEST_CHANGES、通常の test failure、CI failure、stale reviewed head は、current impl-review-loop の routing が許す限り人間承認を挟まず自動修正・再検証してください。fix 後は必ず fresh HEAD で Step 2 / Step 4 を再実行し、古い review/CI evidence を使い回さないでください。

loop iteration は current canonical policy(既定 max_iterations=3)に従ってください。単なる advisory artifact stale/missing、scope snapshot telemetry 等を独自に hard stop へ昇格しないでください。actual Git conflict、secret/protected boundary、canonical max iteration、newer explicit human stop など current skill が定める真正の停止条件だけを尊重してください。

current HEAD について targeted regression と Issue #2799 の literal Verification Commands を実行し、必要な repository quality gates / required CI を current head に束縛して確認してください。以前 green だった CI を修正後 HEAD の evidence として流用しないでください。

再発防止については、まず既存 Issue を検索してください。今回の LP016 grouped-marker drift / edit-guard parity は open Issue #1719 が既に明示的に所有しています。coverage が一致する限り新規 Issue を重複起票しないでください。別の recurrent defect が新たに発見され、既存 Issue に同じ root cause / prevention scope が存在しない場合だけ、重複検索後に repository-native な再発防止 Issue を起票してください。

終了条件:

  • fresh HEAD に対する Verification が nonblocking
  • fresh HEAD に対する pr-reviewer verdict が APPROVE
  • blockers == []
  • current required CI が満たされる
  • live mergeability を current canonical router で評価
  • Allowed Paths compliance が current linked Issue に対して成立
  • PR body / scope coverage evidence が current HEAD と整合

実 merge、auto-merge、force push、不可逆 cleanup は実行しないでください。

PR #2830 は現在 GitHub Draft です。Draft→Ready の transition は、作業時点の current repository SSOT がこの loop に明示的に authorization している場合だけ実行してください。current SSOT が人間操作境界としているなら勝手に override せず、code/review/CI を完了させたうえで「Draft→Ready が唯一残った manual pre-merge action」と明確に報告してください。

最後に以下を簡潔に報告してください。

一点だけ注意があります。現行 impl-review-loop の SSOT では GitHub の merge_state_status: DRAFT は自動 human escalation にはしない一方、Draft→Ready を当然に自動実行する契約にもなっていません。そのため上の prompt は、コード・検証・review を自律完了させつつ、Ready 化だけは current SSOT の authority をその場で確認する形にしています。

@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop: current-head PR review

verdict: APPROVE
reviewed_head_sha: 9f23a7c4dae7306b108daab2f17d158845a0f750
blockers: []
warnings:
  - "Grouped-marker validator LP016 の既知 drift は open #1719 所管であり、本 matrix の保証対象外。"

@squne121
squne121 marked this pull request as ready for review September 29, 2026 14:04
@squne121
squne121 merged commit 4a30792 into main Sep 29, 2026
32 of 46 checks passed
@squne121
squne121 deleted the worktree-issue-2799-vc-consumer-compat branch September 29, 2026 14:33
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.

実装: shared parser 移行時の consumer semantic parity を共通回帰 matrix で固定する

1 participant