Skip to content

実装: issue-contract-review に product spec preflight gate を追加する(Follow-up B) #335

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#283"
goal_ref: "SDD 駆動運用方針の確定と不足 product SSOT の child 起票(product spec lifecycle policy 文書と最小局所ルールを整備する)"
change_kind: workflow

Parent Issue

#283

Parent Goal Ref

  • Goal: Spec Driven Development(SDD)駆動運用を採用しつつ、既存 docs/SSOT・Skill/SubAgent・Issue/PR 運用と整合させ、AI が実装前に必ず参照すべきプロダクト SSOT(game-thesis / game-design / game-logic / mvp-scope / playtest / lifecycle / release)を child Issue として段階起票する
  • Desired Destination: SDD ツール採否が ADR(docs/adr/0002-sdd-tool-adoption.md)で確定し、不足 product SSOT 7 種が child Issue としてマージ済み。docs/dev/ssot-registry.md に上記 SSOT が登録され、CLAUDE.md または .claude/rules/project-constitution.md の「まず読む順序」に新規 product SSOT が追加されている

Current Validated Scope

  • .claude/skills/issue-contract-review/SKILL.md に Product Spec Preflight セクション(短い skill 手順 + 判定表)を追加する
  • CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check を optional-compatible に追加する(既存 field は削除・改名しない)
  • .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py を追加し、6 条件を rule_id PS001〜PS006 として JSON 判定する
  • .claude/skills/issue-contract-review/scripts/tests/test_product_spec_check.py と scripts/tests/fixtures/ を追加し、fixture-driven に PASS / FAIL / n/a を検証する

Remaining Parent Gaps

  • Follow-up A — issue-refinement-loop に Spec Kit phase 分類を追加(後続 Issue)
  • Follow-up C — impl-review-loop に Spec Kit task preflight を追加(後続 Issue)
  • Follow-up D — Spec Kit template override / preset / extension 調査(後続 Issue)
  • C254-3〜C254-8 の未起票 child issue 群

Outcome

.claude/skills/issue-contract-review/SKILL.md に Product Spec Preflight セクションが追加され、6 条件すべてが stop condition / 判定規則として定義され、CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check が optional-compatible に追加され、pnpm typecheck/lint/test/build が PASS している状態

In Scope

  • issue-contract-review に Product Spec Preflight を追加する(baseline VC preflight より前に実行)

  • CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check を optional-compatible に追加する。schema は下記固定:

    product_spec_check:
      applicability: applicable | not_applicable
      decision: pass | fail | human_judgment
      triggers:
        docs_product_allowed_paths: true | false
        tasks_md_mentioned: true | false
        specify_artifact_mentioned: true | false
        generated_task_mentioned: true | false
        product_spec_context_present: true | false
      conditions:
        docs_product_requires_spec_evidence:
          status: pass | fail | n/a
          evidence: []
        tasks_md_not_direct_source:
          status: pass | fail | n/a
          evidence: []
        specify_not_canonical:
          status: pass | fail | n/a
          evidence: []
        diff_first_rationale_present:
          status: pass | fail | n/a | human_judgment
          evidence: []
        generated_task_trace_present:
          status: pass | fail | n/a
          evidence: []
        task_dependencies_materialized:
          status: pass | fail | n/a | human_judgment
          evidence: []
      blocked_reasons:
        - rule_id: PS001 | PS002 | PS003 | PS004 | PS005 | PS006
          source: issue_body | allowed_paths | dependencies
          excerpt: "<short excerpt>"
  • 判定規則を固定する:

    • decision: fail の場合: CONTRACT_REVIEW_RESULT_V1.status: blocked、next_action: propose_refinement_loop
    • decision: human_judgment の場合: status: blocked、next_action: human_judgment
    • applicability: not_applicable の場合: go / blocked を変更しない
  • product spec preflight は以下の authority docs を参照する(SKILL.md には全文転載せず短い参照のみ):

    • docs/adr/0002-sdd-tool-adoption.md
    • docs/dev/product-spec-lifecycle.md
    • docs/product/CLAUDE.md
    • docs/dev/agent-skill-boundaries.md
  • tasks.md / .specify/ / docs/product/** は 禁止対象ではなく役割境界 で判定する:

    • tasks.md: staging artifact としての参照は PASS、direct implementation source / tracking SSOT / canonical source としての参照は BLOCKED
    • .specify/: derived workbench としての参照は PASS、docs/ SSOT より優先する canonical source 化は BLOCKED
  • Stop Condition 1(allowed_paths: docs/product/**)は次のように分解する:

    • implementation issue が code change と docs/product/** update を同時に含み、product spec delta Issue(または同一 PR 内の spec/update Issue 参照)がない場合: BLOCKED
    • Issue 自体が docs-only product spec/update Issue として issue_kind / change_kind / Outcome / AC / Allowed Paths を明示している場合: PASS
    • product spec update が implementation の副作用として混入している場合: BLOCKED
  • generated task 由来 Issue には requirement_id と source_task_id を要求する

  • generated task dependency は GitHub native dependency または line-anchored Depends on #N として materialize されている必要がある。再利用する dependency checker は 専用に新設(check_product_spec_contract.py 内に閉じる)し、既存 check_blockers.sh の挙動は変えない(既存 grep は line-anchored 仕様と不一致だが、本 Issue では触らない)

Out of Scope

  • 実 diff が full-document rewrite かどうかの判定(PR review 側 follow-up)
  • 既存 check_blockers.sh の line-anchored 化(別 Issue / 既存 dependency 判定への影響波及を避けるため本 Issue では触らない)
  • implement-issue / impl-review-loop / pr-review-judge が product_spec_check を必須入力に昇格させる変更(optional-compatible に留め、必要なら follow-up)

Acceptance Criteria

  • AC1: .claude/skills/issue-contract-review/SKILL.md に Product Spec Preflight(または Product Spec Contract Gate)セクションが追加され、baseline VC preflight より前に実行されると明記されている
  • AC2: 6 条件すべてが Stop Condition / 判定規則として定義され、各条件に trigger、pass、blocked、n/a(必要に応じて human_judgment)の判定が rule_id PS001〜PS006 として明示されている
  • AC3: CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check の schema が SKILL.md に定義されており、applicability / decision / triggers / conditions / blocked_reasons の値域が固定されている
  • AC4: product_spec_check.applicability: not_applicable の経路があり、無関係 Issue を block しない
  • AC5: .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py が存在し、Issue body / allowed_paths / dependencies を入力に 6 条件を rule_id PS001〜PS006 として JSON 判定する
  • AC6: .claude/skills/issue-contract-review/scripts/tests/test_product_spec_check.py と scripts/tests/fixtures/ 配下に最低 8 ケースの fixture が存在し、PASS する(少なくとも以下を含む):
    • PASS: docs/product/** unrelated → applicability: not_applicable
    • FAIL: allowed_paths に docs/product/** ありで implementation issue かつ spec delta Issue リンクなし(PS001)
    • FAIL: tasks.md を implementation source として指定(PS002)
    • PASS: tasks.md を staging artifact として参照し GitHub Issue 化を要求
    • FAIL: .specify/ artifact を canonical source と明記(PS003)
    • PASS: .specify/ artifact を derived workbench と明記
    • FAIL: generated task に requirement_id / source_task_id 欠落(PS005)
    • FAIL: dependency が materialize されていない(PS006)
  • AC7: tasks.md は staging artifact としての正当な参照と direct implementation source としての禁止参照を区別する判定が SKILL.md / checker / fixture に存在する
  • AC8: .specify/ は derived workbench としての正当な参照と canonical source としての禁止参照を区別する判定が SKILL.md / checker / fixture に存在する
  • AC9: product spec update Issue には diff_rationale / changed_requirement_id / affected_sections 相当の contract evidence が要求される(PS004)。実 diff の全文書き換え検出は Out of Scope(PR review 側)と明記されている
  • AC10: CONTRACT_REVIEW_RESULT_V1 の schema delta として product_spec_check が optional-compatible に追加され、既存 field は削除・改名されていない
  • AC11: pnpm typecheck && pnpm lint && pnpm test && pnpm build が PASS する

Verification Commands

# AC1
$ rg -n "Product Spec Preflight|Product Spec Contract Gate" .claude/skills/issue-contract-review/SKILL.md

# AC2
# AC3
$ rg -n "product_spec_check|PS00[1-6]" .claude/skills/issue-contract-review/SKILL.md
$ rg -n "applicability:[[:space:]]*applicable[[:space:]]*\|[[:space:]]*not_applicable" .claude/skills/issue-contract-review/SKILL.md

# AC4
$ rg -n "applicability:[[:space:]]*not_applicable" .claude/skills/issue-contract-review/SKILL.md

# AC5
$ test -f .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py

# AC6
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_product_spec_check.py -q

# AC7
$ rg -n "tasks\.md.*staging artifact|direct implementation.*tasks\.md.*(prohibited|BLOCKED)|source_task_id|requirement_id" .claude/skills/issue-contract-review/SKILL.md

# AC8
$ rg -n "\.specify.*derived workbench|canonical source.*\.specify.*BLOCKED" .claude/skills/issue-contract-review/SKILL.md

# AC9
$ rg -n "diff_rationale|changed_requirement_id|affected_sections" .claude/skills/issue-contract-review/SKILL.md

# AC10
$ rg -n "product_spec_check" .claude/skills/issue-contract-review/SKILL.md

# AC11
$ pnpm typecheck && pnpm lint && pnpm test && pnpm build

Runtime Verification Applicability

  • decision: deferred
  • rationale: 本 Issue の AC は issue-contract-review skill の挙動変更であり、AC4〜AC9 の決定論的検証は scripts/tests/test_product_spec_check.py の fixture-driven test に集約される。pnpm typecheck/lint/test/build は静的検証として AC11 で実行する。実 Issue body を通した end-to-end 実行は impl-review-loop / pr-review-judge 側の責務に分離するため、本 Issue では deferred とする。
  • destination_type: pr_review
  • destination_ref: 本 Issue の PR review 時に reviewer が scripts/tests/test_product_spec_check.py の fixture 網羅性と SKILL.md の判定表整合(rule_id PS001〜PS006 / product_spec_check schema / tasks.md .specify/ の役割境界判定)を確認する。実 Issue body への適用と routing 検証は impl-review-loop / pr-review-judge への product_spec_check 連携(Out of Scope に明記、follow-up Issue で扱う)。
  • runtime_check_required: false

Allowed Paths

  • .claude/skills/issue-contract-review/SKILL.md
  • .claude/skills/issue-contract-review/scripts/
  • .claude/skills/issue-contract-review/scripts/tests/
  • .claude/skills/issue-contract-review/scripts/tests/fixtures/

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • CONTRACT_REVIEW_RESULT_V1 の既存 field を削除・改名する必要が出た場合(optional-compatible に留められない場合)
  • check_blockers.sh 等の既存 dependency 判定の挙動を変更する必要が出た場合(影響範囲が広いため別 Issue に分離)
  • product spec preflight の判定が長文 prose になり SKILL.md に大量の policy を転載する形になった場合(短い手順 + script-backed checker + fixture test に寄せる方針から外れたら停止)
  • implement-issue / impl-review-loop / pr-review-judge が product_spec_check を必須入力として要求する変更が必要になった場合(optional-compatible 維持失敗のため別 Issue に分離)
  • tasks.md / .specify/ / docs/product/** に対する判定が「全面禁止」に倒れ、staging artifact / derived workbench としての正当な参照まで BLOCKED するロジックを書き始めた場合(役割境界判定から外れたら停止)

Required Skills

なし

Scope Delta(任意)

N/A

Source

Delivery Rule

  • 1 Issue = 1 PR
  • Draft PR 既定
  • worktree: git worktree add ../loop-protocol-issue-<N> -b issue-<N>/spec-stop-conditions

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on May 24, 2026
  2. added 2 commits that reference this issue on May 24, 2026
  3. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    Issue #335 の方向性は正しいです。product-spec-lifecycle.md で定義した「tasks.md は staging artifact」「.specify/ は canonical ではない」「docs/product/** は diff-first」という規律を、実装着手前の issue-contract-review に接続するのは必要です。ただし現状の #335 は SKILL.md に文言を足して rg で存在確認するだけでも AC PASS できる契約になっており、preflight としては弱すぎます。

    issue-contract-review は既に「実装着手直前に決定論的に preflight する skill」と定義され、CONTRACT_REVIEW_RESULT_V1 も routing-critical な機械可読出力として扱われています。したがって product_spec_check も、単なる説明文ではなく fail-closed の判定項目・証跡・blocked reason を持つ決定論的チェックにする必要があります。

    関連 Issue / PR から見た前提

    #254 の親目的は、Spec Kit を使うかどうかではなく、SDD を既存の docs/ SSOT、.claude/ skills、Issue/PR 運用に矛盾なく接続することです。特に Decision Points には「正本/派生境界」「Issue contract と tasks.md の責務分担」「.claude/ skill 共存」「token 対策」が含まれています。

    #283 / PR #322 では、product-spec-lifecycle.md は policy/reference 文書であり、直接の操作手順ではないと整理されています。tasks.md は staging artifact、GitHub Issue が tracking SSOT、.specify/ は派生 artifact、docs/product/** は product SSOT、という境界も既に文書化されています。

    つまり #335 の責務は「Product Spec policy を SKILL.md に転載すること」ではありません。責務は 実装 Issue が product spec / Spec Kit 由来の危険な契約を含む場合に、実装着手前に止めることです。

    外部実装調査からの制約

    Spec Kit は specify → plan → tasks → taskstoissues → implement のような作業導線を持ち、speckit-taskstoissues は generated task list を GitHub Issues に変換する役割を持ちます。さらに project-local overrides / presets / extensions でテンプレートやワークフローを拡張する仕組みがあります。したがって LOOP_PROTOCOL 側では、tasks.md を直接実装ソースにせず、Issue 化された後の trace fields を検証する adapter 境界が必要です。([GitHub]1)

    Kiro Specs も requirements.md / design.md / tasks.md を分け、requirements で EARS を使い、tasks を実装進捗管理単位として扱います。これは tasks.md が自然に「作業分解 artifact」になりやすいことを示しますが、LOOP_PROTOCOL では tasks.md を tracking SSOT にしないという追加制約が必要です。([Kiro]2)

    Claude Code skills は SKILL.md だけでなく supporting files / scripts を持てます。また paths glob によるスコープ制御や、長い参照文書を都度読ませない構成が想定されています。#335 も prose 追加ではなく、短い skill 手順 + script-backed checker + fixture test に寄せるべきです。([Claude API Docs]3) ([Claude API Docs]3)

    Blockers

    B1. AC / VC が文字列存在確認に寄りすぎている

    現状の VC は rg "product spec Stop Conditions"、rg "product_spec_check"、rg "tasks\.md" ... grep -q "Stop Condition" のような存在確認です。これだと、実際に tasks.md 直接実装を検出できなくても PASS します。

    修正すべきです。scripts/check_product_spec_contract.py のような checker を追加し、6 条件それぞれについて pass / fail fixture を用意してください。rg は補助確認に留めるべきです。

    B2. product_spec_check のスキーマが未定義

    #335 は CONTRACT_REVIEW_RESULT_V1 に product_spec_check を追加するとだけ書いていますが、型・enum・evidence・blocked reason が定義されていません。既存の CONTRACT_REVIEW_RESULT_V1 は checks.* 配下に分類結果と証跡を持つ構造なので、ここに雑な boolean を足すと downstream routing が壊れます。

    最低限、以下のような形に固定すべきです。

    product_spec_check:
      applicable: true | false
      status: pass | fail | n/a
      triggers:
        allowed_paths_docs_product: true | false
        mentions_tasks_md: true | false
        mentions_specify_artifact: true | false
        generated_from_tasks_md: true | false
      checks:
        linked_product_spec_context: pass | fail | n/a
        direct_tasks_md_source: pass | fail | n/a
        specify_canonical_source: pass | fail | n/a
        diff_first_rationale: pass | fail | n/a
        trace_fields_present: pass | fail | n/a
        dependency_materialized: pass | fail | n/a
      evidence:
        - rule_id: PS001
          source: issue_body | allowed_paths | dependencies
          excerpt: "<short excerpt>"
      blocked_reasons: []

    B3. 「linked spec/update Issue」が曖昧

    条件 1 の「allowed_paths が docs/product/** を含むが、リンクされた spec/update Issue がない」は危険です。docs/product/** を更新する Issue 自体が spec/update Issue である場合、さらに別 Issue を要求するのか不明です。

    より正確には、docs/product/** を含む Issue には Product Spec Trace セクションを要求すべきです。

    product_spec_context:
      change_type: create | update | archive | supersede | task_materialization
      target_paths:
        - docs/product/<name>.md
      product_spec_id: <id>
      requirement_ids:
        - REQ-001
      source_task_ids:
        - TASK-001
      parent_issue: "#N"
      diff_rationale: "<why this specific delta is needed>"

    これがあれば、追加 Issue を必須にせず、contract-review が決定論的に判定できます。

    B4. 「全文書き換え」は issue-contract-review 単体では完全検出できない

    条件 4 の「product spec 更新が diff rationale なしに全文書き換えになっている」は重要ですが、実装前の Issue contract だけでは実 diff を見られません。issue-contract-review が判定できるのは「Issue 本文が full regeneration / rewrite all を宣言しているのに diff rationale がない」までです。実際の差分が全文書き換えかどうかは impl-review-loop または PR review 側の責務です。

    #335 では、以下のように責務を分けるべきです。

    issue-contract-review:
      - Issue body に diff_rationale があるか
      - full_regeneration / rewrite all / 全文再生成 が宣言されていないか
      - docs/product/** 更新なのに Product Spec Trace がない場合は blocked
    
    impl-review-loop / pr-review-judge:
      - 実 diff が大規模全文置換になっていないか
      - requirement-level diff になっているか
    

    #333 側の impl-review-loop preflight と責務が重なるため、#335 は「実 diff 判定をしない」と明記した方がよいです。#335 自身も Follow-up C を Out of Scope にしています。

    B5. tasks.md dependency materialization は入力がないと検証不能

    条件 6 は「tasks.md からの dependency が GitHub native dependency または Depends on に materialize されていない」場合を止めるものですが、Issue contract に source_task_id と dependency list がなければ、何と照合すべきか分かりません。

    既存の issue-contract-review には GitHub native dependency API と Depends on #N fallback の確認手順があります。これを再利用するのは妥当ですが、前提として tasks.md 由来 Issue には source_task_id / requirement_id / parent_issue / dependencies を必須にすべきです。

    B6. #327 / #329 との衝突リスク

    #327 は Issue body validator を作り、rule ID と JSON error で Issue body を機械検証する計画です。#329 は baseline VC preflight を issue-contract-review/scripts/ に追加し、JSON を issue-contract-review と impl-review-loop が共有する計画です。

    #335 で新しい checker を足すなら、validate_issue_body.py と baseline_vc_preflight.py の設計と重複しないようにする必要があります。推奨は、#335 の checker を issue-contract-review 専用の readiness gate とし、出力は rule ID ベースの JSON にして、後で #327 側からも再利用可能にすることです。

    推奨 contract patch

    #335 は実装前に、少なくとも次のように修正してください。

    In Scope 追加

    - `.claude/skills/issue-contract-review/scripts/check_product_spec_contract.py` を追加する
      - Issue body / title / labels / allowed paths を入力に product spec readiness を JSON 判定する
      - 6 条件を rule_id `PS001`〜`PS006` として実装する
      - 判定不能な場合は `human_judgment` ではなく `blocked` を既定にする。ただし明示的に `not_applicable` な場合のみ `n/a`
    - `.claude/skills/issue-contract-review/scripts/tests/` に fixture test を追加する
    - `CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check` の完全スキーマを定義する

    Acceptance Criteria 差し替え

    - [ ] AC1: `Product Spec Contract Gate` セクションが `issue-contract-review/SKILL.md` に追加されている
    - [ ] AC2: `product_spec_check` の schema が `CONTRACT_REVIEW_RESULT_V1.checks` 配下に定義されている
    - [ ] AC3: `check_product_spec_contract.py` が存在し、6 条件を rule_id `PS001`〜`PS006` として JSON 出力する
    - [ ] AC4: 6 条件それぞれの fail fixture と、少なくとも 2 件の pass / n/a fixture が存在する
    - [ ] AC5: `issue-contract-review` 手順が VC preflight より前に product spec gate を実行し、`status: fail` の場合 `next_action: propose_refinement_loop` にする
    - [ ] AC6: `pnpm typecheck && pnpm lint && pnpm test && pnpm build` が PASS する

    Verification Commands 例

    # AC2
    rg "product_spec_check:" .claude/skills/issue-contract-review/SKILL.md
    
    # AC3
    test -f .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py
    
    # AC4
    python3 -m pytest .claude/skills/issue-contract-review/scripts/tests/test_check_product_spec_contract.py -q
    
    # PS002: tasks.md direct implementation source blocks
    python3 .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py \
      --body-file .claude/skills/issue-contract-review/scripts/tests/fixtures/ps002_tasks_md_direct.md \
      | python3 -c 'import sys,json; d=json.load(sys.stdin); assert d["status"]=="fail"; assert any(r["rule_id"]=="PS002" for r in d["blocked_reasons"]); print("PASS")'
    
    # PS003: .specify canonical source blocks
    python3 .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py \
      --body-file .claude/skills/issue-contract-review/scripts/tests/fixtures/ps003_specify_canonical.md \
      | python3 -c 'import sys,json; d=json.load(sys.stdin); assert d["status"]=="fail"; assert any(r["rule_id"]=="PS003" for r in d["blocked_reasons"]); print("PASS")'
    
    pnpm typecheck && pnpm lint && pnpm test && pnpm build

    実装方針

    SKILL.md には長い policy を貼らず、次の短い分岐だけを追加するのがよいです。

    ### Product Spec Contract Gate
    
    Run before VC preflight.
    
    Trigger when any of the following is true:
    - Allowed Paths contains `docs/product/**`
    - Issue body mentions `tasks.md`
    - Issue body mentions `.specify/`
    - Issue body has `generated_from_tasks_md: true`
    - Issue body contains `product_spec_context`
    
    Command:
    `python3 .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py --issue-body <file> --repo <owner/repo>`
    
    If `status: fail`, set:
    - `CONTRACT_REVIEW_RESULT_V1.status: blocked`
    - `checks.product_spec_check.status: fail`
    - `next_action: propose_refinement_loop`

    check_product_spec_contract.py は、product-spec-lifecycle.md の内容を読ませる代わりに、同文書から抽出した最小ルールだけを機械判定する構成にしてください。policy/reference 文書を作業のたびに全文ロードする設計は、#322 で人間が疑問視した点と同じ失敗になります。

    結論

    #335 は そのまま実装しない方がよいです。現状のまま進めると、「Product Spec Stop Conditions が書いてある」だけで、実際には tasks.md 直接実装、.specify/ canonical 化、trace 欠落、dependency 未 materialize を止められない可能性が高いです。

    高品質化するなら、#335 は issue-contract-review の product spec readiness gate を script-backed / fixture-tested / schema-defined にする Issueへ contract patch してください。文言追加 Issue ではなく、Product Spec / Spec Kit 由来の実装事故を実装前に止めるための決定論的 gate として扱うべきです。

  4. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES / contract patch 必須

    #335 の方向性は正しいです。ただし現状の Issue contract は「issue-contract-review に文言と product_spec_check フィールドを足す」粒度に留まっており、このまま実装すると Stop Condition が決定論的 preflight ではなく、運用ポエム化する 可能性が高いです。対象 skill は実装前ゲートであり、現行 CONTRACT_REVIEW_RESULT_V1 は handoff 用の routing-critical フィールドを持つ設計です。そこへ product_spec_check を追加するなら、形・値域・適用条件・fail 時の next_action まで固定しないと壊れます。

    確認した前提

    親 #254 / #283 / PR #322 の流れでは、docs/dev/product-spec-lifecycle.md は policy / reference 文書であり、作業手順そのものは既存ループ、特に issue-refinement-loop / issue-contract-review / impl-review-loop 側で扱う設計に着地しています。PR #322 では一度 dedicated skill / rule を追加した後、人間レビューを受けて撤回し、既存ループへ寄せる方針に戻しています。したがって #335 は dedicated product-spec-lifecycle skill を再導入する Issue ではなく、既存 issue-contract-review の preflight 能力を拡張する Issueとして扱うべきです。

    ADR 0002 は、docs/ を正本、.specify/ 等を derived workbench、tasks.md を staging artifact、GitHub Issue を tracking SSOT と定義しています。さらに tasks.md 由来の task は requirement_id / source_task_id / parent_issue を保持し、dependency を GitHub native dependency または Depends on fallback に materialize してから実装へ進む必要があります。

    外部実装上もこの警戒は妥当です。Spec Kit は /speckit.taskstoissues で task list を GitHub Issues に変換し、/speckit.implement で task 実行へ進むコマンド体系を持ちます。Kiro Specs も requirements.md / design.md / tasks.md を分け、tasks.md を trackable な実装計画として扱います。つまり外部 SDD ツールの自然な流れは tasks.md を実装入口にしやすいため、LOOP_PROTOCOL 側の gate で明示的に止める必要があります。([GitHub]1) ([Kiro]2)

    Claude Code の skill は、description で選択され、読み込まれた本文はセッション context に残るため、長大な汎用手順を増やすほど token cost と遵守率のリスクが上がります。したがって #335 の実装は、既存 issue-contract-review に小さく決定論的な checker を足す方向が適切です。([Claude API Docs]3)


    Blockers

    B1. product_spec_check の出力スキーマが未定義

    #335 は CONTRACT_REVIEW_RESULT_V1 に product_spec_check を追加するとしていますが、値域・構造・status: go | blocked への反映規則がありません。現行 skill の出力契約は template_compliance、vc_preflight、ac_verifiability などの routing-critical fields を持ち、next_action を決める構造です。ここへ曖昧な自由記述 field を足すと、後続の implement-issue / judge / ledger が消費できません。

    最低限、次のような shape を #335 本文に固定してください。

    product_spec_check:
      applicability: applicable | not_applicable
      decision: pass | fail | human_judgment
      triggers:
        docs_product_allowed_paths: true | false
        tasks_md_mentioned: true | false
        specify_artifact_mentioned: true | false
        generated_task_mentioned: true | false
      conditions:
        docs_product_requires_spec_issue:
          status: pass | fail | n/a
          evidence: []
        tasks_md_not_direct_source:
          status: pass | fail | n/a
          evidence: []
        specify_not_canonical:
          status: pass | fail | n/a
          evidence: []
        diff_first_rationale_present:
          status: pass | fail | n/a | human_judgment
          evidence: []
        generated_task_trace_present:
          status: pass | fail | n/a
          evidence: []
        task_dependencies_materialized:
          status: pass | fail | n/a | human_judgment
          evidence: []
      blocked_reasons: []

    判定規則も固定すべきです。

    if product_spec_check.decision == fail:
      status: blocked
      next_action: propose_refinement_loop
    if product_spec_check.decision == human_judgment:
      status: blocked
      next_action: human_judgment
    if product_spec_check.applicability == not_applicable:
      do not affect go/blocked

    B2. 検証コマンドが rg 文字列確認に偏りすぎている

    #335 の VC は、セクションや語の存在確認が中心です。これは「書いた」ことは確認できますが、「実装前 gate として止まる」ことは確認できません。今回の対象は docs ではなく preflight skill の挙動変更です。最低でも fixture issue body を使う script/unit test が必要です。

    追加すべき Allowed Paths:

    - `.claude/skills/issue-contract-review/tests/`
    - `.github/workflows/ci.yml`(新規 test を CI に接続する場合のみ)

    追加すべき VC:

    uv run pytest .claude/skills/issue-contract-review/tests/test_product_spec_check.py -q

    fixture は最低 8 ケース必要です。

    PASS: docs/product/** unrelated で applicability: not_applicable
    FAIL: allowed_paths に docs/product/** あり、Issue が spec/update issue でない
    FAIL: tasks.md を implementation source として指定
    PASS: tasks.md を staging artifact として参照し GitHub Issue 化を要求
    FAIL: .specify artifact を canonical source と明記
    PASS: .specify artifact を derived workbench と明記
    FAIL: generated task に requirement_id / source_task_id 欠落
    FAIL: dependency が materialize されていない
    

    B3. Stop Condition 1 が曖昧で、正当な product doc Issue まで止める

    現状の条件は「allowed_paths が docs/product/** を含むが、リンクされた spec/update Issue がない」です。しかし #283 系の child Issue では、Issue 自体が product spec/update Issue になることがあります。単純に「リンクされた別 Issue が必要」と解釈すると、正当な docs/product/** 変更 Issue を誤 BLOCK します。

    条件は次のように分解するべきです。

    - implementation issue が code change と `docs/product/**` update を同時に含む場合:
      - product spec delta Issue が存在し、その Issue / PR が先行または同一 PR 内で明示されていなければ BLOCKED
    - docs-only product spec issue の場合:
      - Issue 自体が spec/update Issue として `issue_kind`, `change_kind`, `Outcome`, `AC`, `Allowed Paths` で明示されていれば PASS
    - product spec update が implementation の副作用として混入している場合:
      - BLOCKED。spec delta Issue に分割

    この分岐は ADR 0002 の「spec delta issue → implementation issue → PR」順序、および product-spec-lifecycle.md の Product Spec Delta Flow と整合します。

    B4. Depends on fallback parser に既存不整合がある

    現行 SKILL.md は Depends on #N fallback を専用セクションの line-anchored 宣言だけに限定すると説明しています。一方、現在の check_blockers.sh はまず本文全体から Depends on #N を grep しており、Delivery Rule や注記内の文言を dependency と誤検出し得ます。

    #335 の条件 6 は dependency materialization を扱うため、この既存スクリプトをそのまま根拠に使うと false positive / false negative が混入します。選択肢は二つです。

    1. check_blockers.sh を仕様通り line-anchored に修正し、regression test を追加する。
    2. product task dependency 専用 checker を新設し、既存 blocker 判定には触れない。

    #335 の Allowed Paths は scripts/ を許可しているため実装は可能ですが、既存 dependency 判定全体を変えるなら影響範囲が広くなります。安全なのは 2 です。

    B5. product_spec_check は schema change なのに consumer inventory がない

    #335 の Stop Conditions には「In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要なら停止」とあります。一方で #335 自身は CONTRACT_REVIEW_RESULT_V1 の schema に field を追加する Issue です。これは矛盾ではありませんが、Issue 本文で「今回の schema delta は意図された scope」と明示し、consumer inventory を要求しないと、実装者が自分で Stop Condition に当たって停止する設計になります。

    追加すべき AC:

    - [ ] AC5: `CONTRACT_REVIEW_RESULT_V1` の schema delta として `product_spec_check` が optional-compatible に追加され、既存 field は削除・改名されていない
    - [ ] AC6: `implement-issue` / `impl-review-loop` / `pr-review-judge` が `product_spec_check` を必須入力として仮定していないことを確認し、必要なら follow-up Issue として分離している

    Major findings

    M1. tasks.md 検出は単純 grep ではなく「役割」を見るべき

    #335 の VC には rg "tasks\.md" ... | grep -q "Stop Condition" がありますが、これは弱すぎます。tasks.md は完全禁止ではなく、staging artifact として参照することは正当です。禁止なのは tasks.md を direct implementation source / tracking SSOT / canonical source として扱うことです。ADR 0002 と lifecycle doc はこの境界を明確にしています。

    Stop Condition はこう書くべきです。

    BLOCKED:
    - "Implement tasks.md"
    - "Use tasks.md as source of truth"
    - "Proceed from tasks.md directly to implementation"
    - "Track progress in tasks.md after issue materialization"
    
    PASS:
    - "tasks.md is a staging artifact"
    - "Convert tasks.md to GitHub Issues before implementation"
    - "source_task_id / requirement_id must be preserved"

    M2. .specify/ 条件も「参照」と「正本化」を区別する

    .specify/ は derived workbench として存在します。PR #308 で .specify/ と 9 本の speckit-* skills は main に入っていますが、Safety Claim Matrix でも direct execution や existing flow bypass を抑制する前提になっています。したがって .specify/ への言及自体を止めるのではなく、「canonical source として扱う」「docs/SSOT に反するのに .specify/ を優先する」場合に止めるべきです。

    M3. full-document rewrite without diff rationale は preflight だけでは完全判定できない

    Issue contract review は PR diff を見ません。したがって「全文書き換えかどうか」は preflight 時点では厳密に検出できません。#335 では次のように扱うべきです。

    - preflight: `docs/product/**` 更新 Issue に `diff_rationale` / `changed_requirement_id` / `affected_sections` がない場合 BLOCKED
    - PR review: 実 diff が全文再生成に見える場合 BLOCKED

    つまり #335 の責務は「diff-first で更新することを Issue contract に要求する」までです。実 diff の敵対的検査は PR review 側の follow-up に分けるのが妥当です。

    M4. ssot-catalog.md には戻らない

    PR #302 で .claude/skills/ssot-discovery/references/ssot-catalog.md は削除され、docs/dev/ssot-registry.md が唯一の registry 正本になっています。#335 で関連 SSOT discovery を追加する場合、参照先は registry のみです。古い catalog 同期や fallback を復活させないでください。


    #335 を高品質化する contract patch 案

    Allowed Paths 修正

    ## Allowed Paths
    
    - `.claude/skills/issue-contract-review/SKILL.md`
    - `.claude/skills/issue-contract-review/scripts/`
    - `.claude/skills/issue-contract-review/tests/`
    - `.github/workflows/ci.yml`(新規 issue-contract-review tests を CI に接続する場合のみ)

    In Scope 修正

    ## In Scope
    
    - `issue-contract-review` に product spec preflight を追加する
    - `CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check` を optional-compatible に追加する
    - product spec preflight は以下の authority を参照する:
      - `docs/adr/0002-sdd-tool-adoption.md`
      - `docs/dev/product-spec-lifecycle.md`
      - `docs/product/CLAUDE.md`
      - `docs/dev/agent-skill-boundaries.md`
    - `tasks.md` / `.specify/` / `docs/product/**` への言及を、禁止ではなく「正本化・直接実装・materialization 欠落」の観点で判定する
    - 必要に応じて checker script と fixture test を追加する

    AC 修正案

    ## Acceptance Criteria
    
    - [ ] AC1: `.claude/skills/issue-contract-review/SKILL.md` に `Product Spec Preflight` セクションが追加されている
    - [ ] AC2: 6 条件が Stop Condition として定義され、各条件に `trigger`, `pass`, `blocked`, `n/a` の判定規則がある
    - [ ] AC3: `CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check` の schema が明示されている
    - [ ] AC4: `product_spec_check.applicability: not_applicable` の経路があり、無関係 Issue を block しない
    - [ ] AC5: `tasks.md` は staging artifact としての正当な参照と direct implementation source としての禁止参照を区別する
    - [ ] AC6: `.specify/` は derived workbench としての正当な参照と canonical source としての禁止参照を区別する
    - [ ] AC7: product spec update Issue には `diff_rationale` / `changed_requirement_id` / `affected_sections` 相当の contract evidence が要求される
    - [ ] AC8: generated task 由来 Issue では `requirement_id` と `source_task_id` が要求される
    - [ ] AC9: generated task dependency は GitHub native dependency または line-anchored `Depends on #N` として materialized される
    - [ ] AC10: fixture tests が PASS する
    - [ ] AC11: `pnpm typecheck && pnpm lint && pnpm test && pnpm build` が PASS する

    VC 修正案

    # AC1-3: section and schema
    rg -n "Product Spec Preflight|product_spec_check" .claude/skills/issue-contract-review/SKILL.md
    rg -n "applicability: applicable \| not_applicable|decision: pass \| fail \| human_judgment" .claude/skills/issue-contract-review/SKILL.md
    
    # AC5: tasks.md role distinction
    rg -n "tasks\.md.*staging artifact|direct implementation.*tasks\.md.*prohibited|source_task_id|requirement_id" .claude/skills/issue-contract-review/SKILL.md
    
    # AC6: .specify role distinction
    rg -n "\.specify.*derived workbench|canonical source.*\.specify.*BLOCKED|docs.*SSOT.*wins" .claude/skills/issue-contract-review/SKILL.md
    
    # AC7: diff-first contract evidence
    rg -n "diff_rationale|changed_requirement_id|affected_sections|full_regeneration" .claude/skills/issue-contract-review/SKILL.md
    
    # AC8-10: deterministic fixture tests
    uv run pytest .claude/skills/issue-contract-review/tests/test_product_spec_check.py -q
    
    # AC11
    pnpm typecheck && pnpm lint && pnpm test && pnpm build

    推奨実装方針

    最小実装は、SKILL.md に巨大な説明を足すのではなく、Product Spec Preflight を 60〜100 行程度で追加し、判定の細部を script + tests に寄せる形です。Claude skill は一度ロードされると context に残るため、長大な規約再掲より、authority docs への短い参照と機械的判定表の方が安全です。([Claude API Docs]3)

    推奨ファイル構成:

    .claude/skills/issue-contract-review/
      SKILL.md
      scripts/
        check_product_spec_contract.py
      tests/
        test_product_spec_check.py
        fixtures/
          no_product_scope.md
          docs_product_spec_issue_ok.md
          docs_product_in_impl_without_spec_delta_fail.md
          tasks_md_direct_impl_fail.md
          tasks_md_staging_ok.md
          specify_canonical_fail.md
          generated_task_missing_trace_fail.md
          dependency_not_materialized_fail.md
    

    GitHub コメント案

    判定: REQUEST_CHANGES / contract patch 必須。
    
    #335 の方向性は正しいですが、このままでは `issue-contract-review` に product spec 関連の文言と `product_spec_check` field を追加するだけで、実装前 gate として決定論的に止まる保証がありません。
    
    特に修正が必要です。
    
    1. `CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check` の schema / 値域 / `status` への反映規則を固定してください。
    2. `tasks.md` は全面禁止ではなく staging artifact としては正当です。禁止するのは direct implementation source / tracking SSOT / canonical source としての扱いです。
    3. `.specify/` も全面禁止ではなく derived workbench としては正当です。禁止するのは docs/SSOT より優先する正本化です。
    4. `allowed_paths: docs/product/**` 条件は、docs-only product spec Issue と implementation Issue を分けて判定してください。Issue 自体が spec/update Issue の場合まで BLOCKED しないようにする必要があります。
    5. 現行 `check_blockers.sh` は `Depends on #N` を本文全体 grep しており、SKILL.md の line-anchored 専用セクション仕様とズレています。条件 6 の dependency materialization に使うなら専用 checker か regression test が必要です。
    6. `.claude/skills/issue-contract-review/tests/` を Allowed Paths に追加し、fixture test で PASS/FAIL ケースを検証してください。
    
    この Issue は docs-only ではなく preflight gate の挙動変更です。`rg` による文字列存在確認だけでは不十分です。

    結論

    #335 は実施すべきですが、現 contract のまま実装すると「Stop Conditions を書いたが、止め方が実装されていない」状態になります。product_spec_check を routing 可能な machine-readable check にし、tasks.md / .specify/ / docs/product/** の 禁止対象ではなく役割境界 を判定する設計へ直してから着手するのが妥当です。

  5. changed the title [-]実装: issue-contract-review に product spec Stop Conditions を追加する(Follow-up B)[/-] [+]実装: issue-contract-review に product spec preflight gate を追加する(Follow-up B)[/+] on May 24, 2026
  6. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    Issue Contract Update via edit-issue skill

    Change Summary

    Updated by issue-refinement-loop Step 4 based on REQUEST_CHANGES anchor comments.

    Scope Impact: amend (scope contract strengthened; Outcome maintained)

    Applied Patches

    1. Current Validated Scope — Reframed from "Stop Conditions section" to concrete deliverables:

      • Product Spec Preflight section (skill procedure + decision table)
      • product_spec_check field (optional-compatible)
      • Python checker check_product_spec_contract.py
      • Fixture-driven test suite
    2. In Scope — Expanded with schema definition and role-boundary rules:

      • product_spec_check YAML schema (applicability / decision / triggers / conditions / blocked_reasons)
      • Decision logic (fail → blocked; human_judgment → blocked; not_applicable → no change)
      • Authority docs references (ADR 0002, product-spec-lifecycle, etc.)
      • Role-boundary rules for tasks.md (staging artifact vs. direct source) and .specify/ (derived workbench vs. canonical source)
      • Stop Condition 1 decomposition with three cases (code+spec no link / docs-only spec-declared / spec side-effect)
      • Dependency materialization requirements
    3. Out of Scope — Added clarifications:

      • Full-document rewrite detection (PR review follow-up)
      • Existing check_blockers.sh line-anchored fix (separate issue to avoid wave propagation)
      • Mandatory product_spec_check promotion (optional-compatible only)
    4. Acceptance Criteria — Expanded from AC1-4 to AC1-11:

      • AC1: Product Spec Preflight section exists and runs before baseline VC
      • AC2: 6 conditions as rule_id PS001-PS006
      • AC3: Schema with fixed value domains
      • AC4: not_applicable path exists for non-spec issues
      • AC5: Python checker with JSON output
      • AC6: 8+ fixture test cases (specific cases enumerated)
      • AC7: tasks.md distinction (staging vs. direct source)
      • AC8: .specify/ distinction (derived vs. canonical)
      • AC9: product spec update contract evidence (diff_rationale / changed_requirement_id / affected_sections)
      • AC10: product_spec_check optional-compatible with no existing field changes
      • AC11: Full build/test/lint/typecheck PASS
    5. Verification Commands — Replaced with rg-based grep, Python test runner, and fixture verification

    6. Allowed Paths — Normalized to scripts/tests/ (matching existing project convention):

      • .claude/skills/issue-contract-review/SKILL.md
      • .claude/skills/issue-contract-review/scripts/
      • .claude/skills/issue-contract-review/scripts/tests/
      • .claude/skills/issue-contract-review/scripts/tests/fixtures/
    7. Stop Conditions — Added three hard stops:

      • Existing field deletion/renaming risk
      • Existing check_blockers.sh behavior change risk
      • Policy prose bloat risk (prevents design drift from script-backed checker model)

    Title Update

    • From: 実装: issue-contract-review に product spec Stop Conditions を追加する(Follow-up B)
    • To: 実装: issue-contract-review に product spec preflight gate を追加する(Follow-up B)
    • Reason: Anchor feedback reframes from "Stop Conditions section" to "preflight gate" (decidability focus). AC/VC/In Scope now emphasize preflight / checker / fixture.

    Contract Integrity

    • Machine-Readable Contract: unchanged
    • Parent Issue / Parent Goal Ref: unchanged
    • Remaining Parent Gaps: unchanged
    • Outcome: updated to reflect reframed scope (Product Spec Preflight instead of Stop Conditions section)
    • Required Skills: unchanged

    Status: ready for implementation

  7. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop iteration 1: Focused Patch Applied

    Applied three deterministic blocking fixes per reviewer feedback:

    Patch A: Stop Conditions expanded to 7 items

    • Restored 2 earlier items (Allowed Paths constraint, In Scope contract changes)
    • Retained existing 3 items (field deletion, dependency check, preflight prose overflow)
    • Added 2 new items (product_spec_check optional-compatible, role boundary guard for tasks.md/.specify/docs/product)

    Patch B: Runtime Verification Applicability section added

    • Location: Between ## Verification Commands and ## Allowed Paths
    • applicability: deferred (fixture-driven test responsibility, not end-to-end runtime)
    • rationale: AC4-AC9 verified via script test suite, AC11 via pnpm gates
    • deferred_destination: PR review fixture coverage & SKILL.md alignment check

    Patch C: Verification Commands reformatted with AC reference comments

    • All AC1-AC11 commands now have leading # AC<N> bash hash comments
    • Preserved all 11 commands in single fenced bash block
    • Maintains machine-readable format for CI/verification integration

    All changes are isolated to listed sections only:

    • ✓ Verification Commands (complete replacement)
    • ✓ Runtime Verification Applicability (new section)
    • ✓ Stop Conditions (7-item expansion)

    Protected sections remain unchanged:

    • Machine-Readable Contract, Parent Issue, Parent Goal Ref, Remaining Parent Gaps
    • Outcome, Current Validated Scope, In Scope, Out of Scope
    • Acceptance Criteria, Allowed Paths, Title

    Status: Ready for implementation phase

    Co-Authored-By: Claude Code [email protected]

  8. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop iteration 2: Schema Compliance Patches Applied

    Patches Applied

    Patch D: Verification Commands — `$` prefix compliance (C4 check)

    • All 11 verification commands now have `$ ` prefix in the bash fenced code block
    • AC comments (`# AC`) and empty lines preserved
    • Satisfies `check_issue_contract.py` C4 deterministic check: `stripped.startswith('$')`

    Patch E: Runtime Verification Applicability — Schema normalization (C9/C10 checks)

    • Replaced flat `applicability: deferred` with decision-based structure:
      • `decision: deferred` (C9: literal schema)
      • `destination_type: pr_review` (C10: required field)
      • `destination_ref: ...` (C10: required field)
      • `runtime_check_required: false`
    • Updated rationale text to reference fixture coverage and rule ID ranges (PS001-PS006)
    • Satisfies C9 check: `decision:.*deferred` pattern
    • Satisfies C10 check: both `destination_type` and `destination_ref` present

    Sections Unchanged (per edit-issue guardrails)

    • Title, Machine-Readable Contract, Parent sections: unchanged
    • Current Validated Scope, Remaining Parent Gaps, Outcome: unchanged
    • In Scope / Out of Scope / Acceptance Criteria: unchanged (AC 1-11 remain with `applicability:` in checkbox text — schema field, not touched)
    • Allowed Paths, Stop Conditions, Required Skills, Source, Delivery Rule: unchanged

    Next Steps

  9. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-05-24T04:22:00Z)

    • iteration: 3 (initial edit + 2 deterministic fix iterations)
    • verdict: approve (all 11 deterministic checks PASS — C1〜C11)
    • termination_reason: approved

    改善履歴

    • iteration 0: anchor comments (REQUEST_CHANGES × 2) の contract patch を反映
      • title 再フレーム: Stop Conditions → product spec preflight gate
      • In Scope: product_spec_check schema (applicability / decision / triggers / conditions / blocked_reasons) を固定
      • AC を AC1〜AC11 に拡張(schema 定義 / checker script / fixture test 8 ケース / role-boundary 判定 / diff-first evidence / optional-compatible 制約)
      • Allowed Paths は既存規約整合のため scripts/tests/ 配下を採用(reviewer 原案の tests/ ルートは正規化)
      • Out of Scope に「実 diff full-document rewrite 判定 / 既存 check_blockers.sh 挙動変更 / mandatory 昇格」を追加
    • iteration 1: deterministic check C2 / C5 / C9 への対応
      • Stop Conditions を 7 項目に拡張(旧 2 項目復元 + 新 2 項目)
      • Runtime Verification Applicability セクション新設
      • VC を # AC<N> hash コメント形式に統一
    • iteration 2: deterministic check C4 / C9 / C10 schema 準拠
      • VC コマンドに $ prefix 追加
      • applicability: deferred → decision: deferred literal
      • destination_type: pr_review + destination_ref: 追加

    確認済み repo facts

    • .claude/skills/issue-contract-review/scripts/check_blockers.sh:67 は line-anchored 仕様と不一致(B4 妥当)— 本 Issue では触らない方針で Out of Scope / Stop Conditions に明記
    • .claude/skills/issue-contract-review/tests/ は不在、既存規約は scripts/tests/ 配下 — Allowed Paths は規約整合

    次アクション

    • issue-contract-review を起動して着手前 preflight (status: go) を確認
    • impl-review-loop で実装着手
  10. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-05-24T04:29:20Z)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-05-24T04:29:20Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/335
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: true
          vc_failed_as_expected: 4
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          classifications:
            - ac: AC1
              command: "rg -n 'Product Spec Preflight|Product Spec Contract Gate' .claude/skills/issue-contract-review/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              confidence: high
              decision: go
            - ac: AC3
              command: "rg -n 'product_spec_check|PS00[1-6]' .claude/skills/issue-contract-review/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              confidence: high
              decision: go
            - ac: AC5
              command: "test -f .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py"
              exit_code: 1
              category: file_not_found_expected
              confidence: high
              decision: go
            - ac: AC6
              command: "test -f .claude/skills/issue-contract-review/scripts/tests/test_product_spec_check.py"
              exit_code: 1
              category: file_not_found_expected
              confidence: high
              decision: go
        ac_verifiability: pass
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings: []
    • Outcome: .claude/skills/issue-contract-review/SKILL.md に Product Spec Preflight が追加され、6 条件が rule_id PS001〜PS006 として固定され、CONTRACT_REVIEW_RESULT_V1.checks.product_spec_check が optional-compatible に追加され、pnpm typecheck/lint/test/build が PASS
    • Acceptance Criteria: AC1〜AC11(Issue 本文参照)
    • Verification Commands: Issue 本文の Verification Commands セクション参照
    • Allowed Paths: .claude/skills/issue-contract-review/SKILL.md, .claude/skills/issue-contract-review/scripts/, .claude/skills/issue-contract-review/scripts/tests/, .claude/skills/issue-contract-review/scripts/tests/fixtures/
    • Worktree: .claude/worktrees/issue-335-spec-stop-conditions
    • Branch: worktree-issue-335-spec-stop-conditions
    • VC preflight: baseline fail = 4, 想定外 pass = 0, 実行不可 = 0
    • Runtime Verification Applicability: deferred(fixture-driven test に集約)
  11. added 2 commits that reference this issue on May 24, 2026
  12. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    Implementation Report (iteration 0)

    IMPLEMENT_RESULT_V1:
      status: ok
      pr_url: https://github.com/squne121/loop-protocol/pull/348
      worktree: .claude/worktrees/issue-335-spec-stop-conditions
      branch: worktree-issue-335-spec-stop-conditions
      verification:
        typecheck: pass
        lint: pass
        test: {passed: 25, failed: 0, files: 5}
        build: pass
        pytest_product_spec: {passed: 10, failed: 0}
      allowed_paths_compliance: true
      generated_at: "2026-05-24T04:40:48Z"

    Draft PR #348 を起票しました。pr-review-judge による LOOP_VERDICT 判定へ進みます。

    Note: 初回 implementation-worker 委譲時に worktree が git reset --hard origin/main で誤って削除されましたが、reflog の commit fc2095c から復元し、pytest collection error(test_fixture_case が pytest にテスト関数と誤検出される問題)を修正した上で PR 起票しています。

  13. added a commit that references this issue on May 24, 2026
  14. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    PR #348 REQUEST_CHANGES 修正完了

    修正内容:

    B1: live path bug 修正

    • gh issue view --json フィールドから baseRefName を削除 (issue view に存在しない field)
    • mock test で subprocess.run を monkeypatch して検証

    B2: decision: n/a をスキーマ外で削除

    • applicability チェック not applicable の場合は pass を返す
    • conditions[].status の n/a は individual rule level で維持
    • exit code: decision in ("pass",) で 0、それ以外 1 に修正

    B3: PS004 spec delta issue で evidence 欠落を fail に

    • spec-delta Issue で evidence (diff_rationale / changed_requirement_id / affected_sections) 欠落時は fail
    • Machine-Readable Contract と Product Spec Context 両方で evidence search
    • 新 fixture: product_spec_update_without_rationale_fail.md

    B4: PS002 source_task_id bypass を削除

    • direct implementation source 表現がある場合は source_task_id があっても fail
    • allow pattern の優先順位を高める(false positive 防止)
    • 新 fixture: tasks_md_direct_with_source_task_id_fail.md

    B5: PS006 GitHub native dependency claim を削除

    • SKILL.md で GitHub native dependency を follow-up に限定
    • line-anchored Depends on #N のみ実装

    B6: PS001 change_kind pattern を厳密化

    • change_kind: update 単体を除外
    • product-spec specific パターンのみ許可
    • 新 fixture: change_kind_update_only_not_product_spec.md

    テスト結果:

    PR #348 は自動更新済み。

  15. added 2 commits that reference this issue on May 24, 2026
  16. added a commit that references this issue on May 24, 2026
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