Skip to content

実装: review-issue checker の scope_cvs_in_scope_mismatch tokenization を backtick token 以外(自然文 significant token / 裸 path)にも拡張する #396

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "scope_cvs_in_scope_mismatch warning の tokenization を backtick token に加えて裸 path / ASCII significant token にも拡張し、Jaccard < 0.3 閾値と stop-token フィルタリングを維持したまま自然文スコープ乖離を検出する"
change_kind: code

Parent Issue

none

Parent Goal Ref

  • Goal: review-issue checker の scope_cvs_in_scope_mismatch warning を、backtick path 限定の現行 tokenization から、裸 path token と ASCII significant token(stop-token 除外あり)に拡張し、AC3「Current Validated Scope と In Scope の乖離が warning として現れる」を自然文ベースの Issue にも適用可能にする。
  • Desired Destination: N/A

Current Validated Scope

  • .claude/skills/review-issue/scripts/check_issue_contract.py
    • _bullet_tokens() の拡張(backtick token 維持 + 裸 path token + ASCII significant token、stop-token 除外、lower() 正規化、末尾記号 strip)
    • detect_warning_scope_cvs_in_scope_mismatch() の閾値は Jaccard < 0.3 を維持(overlap == 0 に変更しない)
    • evidence に jaccard, overlap, missing_from_cvs, missing_from_in_scope を出力するよう拡張
  • .claude/skills/review-issue/tests/test_check_issue_contract_c12.py
    • scope_cvs_in_scope_mismatch fixture-driven test を最低 9 件まで拡張
  • .claude/skills/review-issue/fixtures/
    • 既存 fixture(scope_cvs_in_scope_mismatch_issue.md:1 件)を維持し、新規 fixture を追加

Remaining Parent Gaps

なし

Outcome

detect_warning_scope_cvs_in_scope_mismatch() が backtick token に加え、裸 path token(既知拡張子セット + 既知 prefix セット)と ASCII significant token(4 文字以上、lower() 正規化、domain stop-token 除外)も抽出対象とし、Jaccard < 0.3 閾値を維持したまま、Current Validated Scope と In Scope のいずれの組み合わせでも乖離を検出できる状態。evidence は jaccard, overlap, missing_from_cvs, missing_from_in_scope を含み、レビュー可能。既存 backtick path 互換テストと新規 fixture matrix 全件が PASS する。

In Scope

  • _bullet_tokens() の拡張(決定論的に列挙):
    • 既存 backtick token 抽出(r"([^]+)"`)を維持
    • 裸 path token 抽出(専用 regex PATH_TOKEN_RE、語境界判定あり):
      • PATH_TOKEN_EXTENSIONS = (".md",".py",".ts",".tsx",".js",".json",".yml",".yaml",".toml",".sh")
      • PATH_TOKEN_PREFIXES = ("docs/",".claude/",".github/")
      • PATH_TOKEN_STRIP_CHARS = ".,:;)]}" を rstrip 対象とする
      • ./ prefix の正規化(先頭 ./ を剥がす)
    • ASCII significant token 抽出:SIGNIFICANT_TOKEN_RE = re.compile(r"[A-Za-z0-9_]{4,}") の matches を lower() し、STOP_TOKENS を除外
    • STOP_TOKENS(モジュールレベル定数、最低限固定):{"issue","scope","current","validated","warning","token","tokens","checker","review","script","scripts","test","tests","fixture","fixtures","implementation","function","detect","result","output","outcome","verification","commands","acceptance","criteria","allowed","paths"}
  • detect_warning_scope_cvs_in_scope_mismatch() の閾値はモジュールレベル定数 JACCARD_THRESHOLD = 0.3 を定義し、(len(overlap) / len(union)) < JACCARD_THRESHOLD を維持(overlap == 0 には変更しない)
  • warning evidence に以下を追加:
    • jaccard(float, 小数 3 桁)
    • overlap(list[str]、最大 10 件)
    • missing_from_cvs(list[str]、最大 10 件)
    • missing_from_in_scope(list[str]、最大 10 件)
  • fixture-driven test 拡張(fixture 配置: .claude/skills/review-issue/fixtures/):
    • scope_cvs_in_scope_mismatch_issue.md(既存 1 件、引き続き PASS)
    • scope_cvs_in_scope_mismatch_bare_path_mismatch.md(裸 path の片側乖離で warning)
    • scope_cvs_in_scope_mismatch_bare_path_overlap.md(同一裸 path 重複で warning なし)
    • scope_cvs_in_scope_mismatch_natural_en_mismatch.md(英語自然文の乖離、stop-token 除外後に warning)
    • scope_cvs_in_scope_mismatch_natural_en_overlap.md(英語自然文の meaningful 重複で warning なし)
    • scope_cvs_in_scope_mismatch_boilerplate_only_overlap.md(scope,checker,issue 等 stop-token のみ一致では warning が消えない)
    • scope_cvs_in_scope_mismatch_punct_normalization.md(foo.py, と foo.py が一致して warning なし)
    • scope_cvs_in_scope_mismatch_extension_coverage.md(.yaml/.tsx/.json の扱いを固定)
    • scope_cvs_in_scope_mismatch_one_side_empty.md(片側 token 0 の挙動を固定:warning なし)
    • scope_cvs_in_scope_mismatch_japanese_only.md(日本語のみで token 0 → warning なし、Out of Scope の挙動を fixture で固定)

Out of Scope

  • tokenization アルゴリズムそのものの大幅設計変更(CountVectorizer 等の外部依存導入)
  • path / text token の weight 付け(全 token 等重と仮定)
  • 日本語など非 ASCII 言語の significant token 抽出(fixture では明示的に「warning なし」として固定するのみ)
  • STOP_TOKENS の動的設定 / 設定ファイル化
  • 既存 C1〜C13 checker のロジック変更
  • SKILL.md / docs の構造変更

Acceptance Criteria

  • AC1: _bullet_tokens() が backtick token / 裸 path token / ASCII significant token の 3 系統を抽出する(rg で PATH_TOKEN_RE STOP_TOKENS SIGNIFICANT_TOKEN_RE 相当の sentinel を検出可能)
  • AC2: 裸 path token の専用 regex が拡張子 .md|.py|.ts|.tsx|.js|.json|.yml|.yaml|.toml|.sh および prefix docs/|.claude/|.github/ をカバーし、末尾記号 .,:;)]} を strip する(unit test で確認)
  • AC3: ASCII significant token は [A-Za-z0-9_]{4,} を lower() 正規化し、STOP_TOKENS(最低 20 件、scope/checker/token 等を含む)を除外する
  • AC4: detect_warning_scope_cvs_in_scope_mismatch() は Jaccard < 0.3 閾値を維持し、overlap == 0 には変更しない(実装行を rg で確認)
  • AC5: warning evidence に jaccard / overlap / missing_from_cvs / missing_from_in_scope の 4 フィールドが含まれる(pytest で evidence をパースし確認)
  • AC6: 既存 fixture scope_cvs_in_scope_mismatch_issue.md(1 件)が引き続き PASS する
  • AC7: 新規 fixture 15 件(bare_path_mismatch / bare_path_overlap / natural_en_mismatch / natural_en_overlap / boilerplate_only_overlap / punct_normalization / extension_coverage / one_side_empty / japanese_only / japanese_path_divergence / asterisk_bullet / plus_bullet / indented_bullet / sentence_final_punct / trailing_dot_same / jaccard_boundary_{0,0.25,0.30,0.34})すべてが PASS する
  • AC8: pnpm typecheck / pnpm lint / pnpm test / pnpm build が PASS する

Verification Commands

# AC1: 新規 token 抽出ロジック(既存 _bullet_tokens は除外、新規 3 定数のみ sentinel)
$ rg -n "PATH_TOKEN_RE|STOP_TOKENS|SIGNIFICANT_TOKEN_RE" .claude/skills/review-issue/scripts/check_issue_contract.py

# AC2: 裸 path 拡張子セット / prefix セット sentinel 定数の存在確認(実装時に明示的に定義)
$ rg -n "PATH_TOKEN_EXTENSIONS|PATH_TOKEN_PREFIXES|PATH_TOKEN_STRIP_CHARS" .claude/skills/review-issue/scripts/check_issue_contract.py

# AC3: STOP_TOKENS リスト存在確認(新規定数)
$ rg -n "STOP_TOKENS\s*=" .claude/skills/review-issue/scripts/check_issue_contract.py

# AC4: Jaccard 閾値定数化の確認(overlap == 0 への劣化を回帰検出可能にする sentinel)
$ rg -n "JACCARD_THRESHOLD\s*=" .claude/skills/review-issue/scripts/check_issue_contract.py

# AC5: evidence 4 フィールド存在確認(新規キー)
$ rg -n "missing_from_cvs|missing_from_in_scope" .claude/skills/review-issue/scripts/check_issue_contract.py

# AC6 / AC7: scope_cvs_in_scope_mismatch fixture-driven test 全 PASS(baseline で fixture 9 件未作成のため fail することを期待)
$ uv run pytest .claude/skills/review-issue/tests/test_check_issue_contract_c12.py -k scope_cvs_in_scope_mismatch -v

# AC6: 既存 fixture 維持確認(regression gate, baseline では既存ファイルが存在するため pass する)
# preflight-scope: pr_review_only
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_issue.md

# AC7: 新規 fixture 15 件の存在確認
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_bare_path_mismatch.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_bare_path_overlap.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_natural_en_mismatch.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_natural_en_overlap.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_boilerplate_only_overlap.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_punct_normalization.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_extension_coverage.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_one_side_empty.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_japanese_only.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_japanese_path_divergence.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_asterisk_bullet.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_plus_bullet.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_indented_bullet.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_sentence_final_punct.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_trailing_dot_same.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_jaccard_boundary_0.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_jaccard_boundary_0.25.md
$ test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_jaccard_boundary_0.30.md
$ test -f ".claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_jaccard_boundary_0.34.md"

# AC8: 全体品質ゲート(regression gate, baseline で pass することを期待)
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は review-issue checker の Python tokenization ロジックと fixture 拡張のみを変更する。ゲーム実行時挙動(DOM / Canvas / systems / state / render)には触れず、docs/dev/runtime-verification-policy.md の Applicability 判定スキーマで not_applicable に該当する。fixture-driven pytest と pnpm 品質ゲートで AC を完全に検証可能。

Allowed Paths

  • .claude/skills/review-issue/scripts/check_issue_contract.py
  • .claude/skills/review-issue/tests/test_check_issue_contract_c12.py
  • .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_*.md(新規 15 件、既存 1 件は維持)
  • .claude/skills/review-issue/tests/test_check_issue_contract.py(C13 カウント修正のみ)
  • .claude/skills/review-issue/SKILL.md(C13 / details フィールド言及更新)
  • .claude/agents/issue-reviewer.md(C13 / details フィールド言及更新)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(裸 path 拡張子セット / prefix セット / STOP_TOKENS / Jaccard 閾値 / evidence 4 フィールド / fixture matrix 10 件)の変更が必要になった場合
  • Jaccard < 0.3 閾値を overlap == 0 に変更する必要が出た場合(劣化)
  • 日本語など非 ASCII tokenization に踏み込む必要が出た場合(別 Issue 切り出し)
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python 3 / regex(語境界判定、Unicode 範囲指定)
  • pytest fixture-driven test 設計
  • review-issue checker(check_issue_contract.py)の C12 / warning 群の SSOT 配置の理解

Scope Delta(任意)

  • 本 Issue は anchor comment(OWNER REQUEST_CHANGES, 2026-05-27)で提示された 5 blocker をすべて反映する第 2 版 contract:
    • Blocker 1(C1/C5/C9 失敗): ## Allowed Paths / ## Runtime Verification Applicability 追加、AC を - [ ] 形式、VC に # AC<N> 対応コメント
    • Blocker 2(significant token の粗さ): STOP_TOKENS を固定、lower() 正規化、日本語は明示的に Out of Scope
    • Blocker 3(裸 path 仕様の曖昧さ): 拡張子セット / prefix セット / 末尾記号 strip / ./ prefix 正規化を固定
    • Blocker 4(Jaccard 劣化): 既存 < 0.3 閾値を維持、overlap == 0 には変更しない、evidence 4 フィールド追加
    • Blocker 5(fixture 不足): positive/negative 2 件 → fixture matrix 10 件(既存 1 + 新規 9)に拡張
  • 既存 fixture 件数の修正: 初版 contract で「既存 4 件」と記載したが、実際は .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_issue.md の 1 件のみ(fact-check 済み)。AC6 に正しく反映済み。
  • PR feat(#396): scope_cvs_in_scope_mismatch tokenization を 3 系統(backtick/裸 path/significant token)に拡張する #430 REQUEST_CHANGES (iteration 1) 対応: Blocker 1(evidence を list[str] + details dict に分離)、Blocker 2(BULLET_RE で *, +, indented 対応)、Blocker 3(PATH_TOKEN_RE 末尾句読点対応)、Blocker 4(PATH_TOKEN_RE を SSOT 化)、Blocker 5(日本語限定明記 + fixture 再設計)、Non-blocking A(Jaccard 境界 fixture 4 件追加)、Non-blocking C(\w → [A-Za-z0-9_])。fixture 総数: 1 + 9 → 1 + 15 = 16 件。

Source

References

Activity

  1. added
    enhancement
    triage-required
    on May 25, 2026
  2. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    Verdict: REQUEST_CHANGES

    #396 は方向性は妥当です。#390 のレビューで「scope_cvs_in_scope_mismatch が backtick token しか見ないため、自然文や裸 path では検出できない」と明示され、その follow-up として記録されています。([GitHub]1) 現行実装も実際に backtick 内だけを _bullet_tokens() に入れており、自然文・裸 path は無視されます。([GitHub]2)

    ただし、この Issue は このまま実装に渡すべきではありません。Issue 契約・検出仕様・テスト設計のいずれも弱く、実装すると false negative / false positive の温床になります。


    Blocker 1: #396 自体が現行 checker 契約に通らない

    #396 は issue_kind: implementation ですが、現行 checker の required section には Runtime Verification Applicability と Allowed Paths が含まれています。([GitHub]2) #396 の本文には少なくとも表示範囲上、これらがありません。([GitHub]3)

    また、現行 checker は AC に - [ ] 形式を要求しますが、#396 の AC は * AC1: 形式です。([GitHub]3) さらに C5 は VC 側に # AC<N> コメント参照を要求しますが、#396 の VC は AC 対応コメントなしの箇条書きです。([GitHub]3)

    修正要求:

    • ## Allowed Paths を追加する。
    • ## Runtime Verification Applicability を追加する。
    • AC を - [ ] AC1: 形式へ直す。
    • VC を fenced code block 化し、各コマンドに # AC1 などの対応コメントを入れる。

    Blocker 2: 4文字以上の英数 significant token は仕様として粗すぎる

    #396 は [a-zA-Z0-9_]{4,} を significant token としていますが、このままだと scope, issue, warning, token, checker, test, script, review のような汎用語が両セクションで一致し、実質的なスコープ乖離を隠します。逆に、日本語だけの自然文はほぼ token 化されません。Python の re は Unicode 文字列を扱えますが、[a-zA-Z0-9_] は明示的に ASCII 範囲へ限定する指定です。([Python documentation]4)

    一般的なテキスト tokenization でも、小文字化・stop words・token pattern・文書頻度による除外などを明示的に設計します。scikit-learn の CountVectorizer も lowercase, stop_words, token_pattern を別パラメータとして扱い、既定 token pattern は「2文字以上の英数字、句読点は separator」と定義しています。([scikit-learn]5) #396 の仕様はそのレベルの正規化方針を持っていません。

    修正要求:

    significant token を次のように限定してください。

    STOP_TOKENS = {
        "issue", "scope", "current", "validated", "warning",
        "token", "tokens", "checker", "review", "script",
        "test", "tests", "fixture", "fixtures", "implementation",
        "function", "detect", "result", "output",
    }
    
    SIGNIFICANT_TOKEN_RE = re.compile(r"[A-Za-z0-9_]{4,}")

    抽出後に lower() し、STOP_TOKENS を除外する。日本語自然文は本 Issue の Out of Scope に残すか、少なくとも「英数字 token のみ対象」と明記するべきです。


    Blocker 3: 裸 path token の検出条件が曖昧

    #396 は裸 path token を「.md|.py|.ts|.yml|docs/|.claude/ を含む語」としています。([GitHub]3) しかしこの定義だと、次の扱いが未定義です。

    • .yaml, .json, .tsx, .js, .toml, .sh を拾うのか。
    • docs/foo.md, の末尾カンマを token に含めるのか。
    • foo.py: のコロンを token に含めるのか。
    • .claude/skills/review-issue/ のようなディレクトリ末尾 / を正規化するのか。
    • backtick path と裸 path の正規化が一致するのか。

    現行の issue は .claude/skills/review-issue/scripts/check_issue_contract.py と .claude/skills/review-issue/tests/test_check_issue_contract_c12.py を対象にしています。([GitHub]3) ここで path 正規化が曖昧だと、テストだけ通って実 Issue で揺れます。

    修正要求:

    裸 path は「語に含まれる」ではなく、専用 regex で抽出してください。

    PATH_TOKEN_RE = re.compile(
        r"(?<![\w./-])"
        r"(?:"
        r"(?:[\w.-]+/)*[\w.-]+\.(?:md|py|ts|tsx|js|json|yml|yaml|toml|sh)"
        r"|"
        r"(?:docs|\.claude|\.github)/(?:[\w./-]+)"
        r")"
        r"(?![\w./-])"
    )

    抽出後は rstrip(".,:;)]}") などで末尾記号を除去し、./ prefix を剥がす程度の normalize を入れるべきです。


    Blocker 4: 共通 token がゼロなら warning は既存設計から劣化する

    #390 では scope_cvs_in_scope_mismatch は Jaccard < 0.3 の warning として導入されています。([GitHub]1) 現行実装も len(overlap) / len(union) < 0.3 で warning を出します。([GitHub]2)

    #396 の Outcome は「共通 token がゼロの場合に warning」と読めます。([GitHub]3) これは弱いです。checker や scope のような汎用 token が 1 個一致しただけで warning が消えます。

    修正要求:

    既存の Jaccard threshold を維持してください。

    if union and (len(overlap) / len(union)) < 0.3:
        warn()

    さらに evidence には overlap, missing_from_in_scope, missing_from_cvs, jaccard を出してください。単に token list 先頭 5 件だけではレビュー不能です。


    Blocker 5: テストが不足している

    #396 は positive / negative fixture 2 件だけを要求しています。([GitHub]3) これは不足です。#338 では C12 / scope mismatch / VC anti-pattern / C1 skeleton を fixture-driven に固定する方針が明示されました。([GitHub]6) #390 でも fixture-driven test 不足が blocker になっています。([GitHub]1)

    最低限追加すべき fixture:

    • backtick path mismatch: 既存挙動が維持される。
    • bare path mismatch: 裸 .py / .md で warning。
    • bare path overlap: 同一裸 path で warning なし。
    • natural English mismatch: stop token 除外後に warning。
    • natural English overlap: meaningful token overlap で warning なし。
    • boilerplate-only overlap: scope, checker, issue だけの一致では warning が消えない。
    • Japanese-only natural text: token なしなら warning しない、または別仕様として明記。
    • one side token empty: 既存と同じく warning しないのか、片側のみ非空で warning するのかを固定。
    • punctuation normalization: foo.py, と foo.py が一致。
    • extension coverage: .yaml, .tsx, .json などを拾うか拾わないかを固定。

    関連 Issue / PR 整理

    #396 は #390 の post-merge follow-up です。#390 の最終レビューでも scope_cvs_in_scope_mismatch tokenization は follow-up として明示されています。([GitHub]1) 一方で #176 は Current Validated Scope と In Scope の整合確認を追加する元 Issue としてまだ open で、内容も同じ問題領域です。([GitHub]7) #338 でも #176 など既存 OPEN Issue 群のクローズ判断は post-merge follow-up とされています。([GitHub]6)

    修正要求:

    #396 の Parent Issue: none は弱いです。少なくとも以下を References に明示してください。

    #176 を残すなら「#396 は checker 実装、#176 は旧 SKILL.md 手順追加であり、#338/#390 後は superseded 予定」と明示するべきです。


    GitHub コメント案

    Verdict: REQUEST_CHANGES
    
    #396 は #390 の post-merge follow-up として方向性は妥当です。現行 `detect_warning_scope_cvs_in_scope_mismatch()` は backtick token しか抽出しておらず、自然文 / 裸 path の scope 乖離を拾えないため、改善 Issue としては必要です。
    
    ただし、この Issue はこのまま実装に渡すべきではありません。
    
    Blockers:
    
    1. Issue 契約不備
       - `issue_kind: implementation` なのに `## Runtime Verification Applicability` と `## Allowed Paths` がない。
       - AC が `- [ ] AC1:` 形式ではない。
       - VC に `# AC<N>` 対応コメントがない。
       - 現行 checker の C1/C3/C5 に通らないため、まず Issue body を修正してください。
    
    2. `significant token = [a-zA-Z0-9_]{4,}` が粗すぎる
       - `scope`, `issue`, `warning`, `token`, `checker`, `script`, `test` 等の汎用語が overlap して false negative になります。
       - 日本語自然文はほぼ拾えません。
       - `lower()` + domain stop tokens を定義するか、日本語は明示的に Out of Scope としてください。
    
    3. 裸 path token の仕様が曖昧
       - `.yaml`, `.json`, `.tsx`, `.sh`, `.github/` などを拾うか未定義。
       - `foo.py,` / `foo.py:` の punctuation normalize が未定義。
       - backtick path と裸 path が同じ正規化規則を通ることを AC にしてください。
    
    4. warning 条件を `overlap == 0` に劣化させない
       - #390 の実装は Jaccard `< 0.3` です。
       - 汎用 token が 1 個一致しただけで warning が消える設計は弱いので、既存 threshold を維持してください。
       - evidence に `jaccard`, `overlap`, `missing_from_cvs`, `missing_from_in_scope` を出すべきです。
    
    5. テスト不足
       - positive/negative 2 fixture だけでは不十分です。
       - 少なくとも backtick path 既存互換、bare path mismatch/overlap、natural text mismatch/overlap、boilerplate-only overlap、punctuation normalization、one-side empty、日本語-only の挙動を fixture-driven で固定してください。
    
    Related issue handling:
    - #396 は #390 follow-up であり、#176 と同じ問題領域です。
    - `Parent Issue: none` のままでは trace が弱いので、References に #338/#390/#176 を明示してください。
    - #176 を superseded / partial-superseded にするか、本 Issue との責務差分を明記してください。

    結論

    #396 は 採用可だが、現状は未成熟です。特に 4文字以上英数字 と overlap == 0 の組み合わせは、実装すると「警告が出てほしいところで出ない」方向に壊れやすいです。先に Issue 契約を直し、token normalization / stop token / path extraction / Jaccard threshold / fixture matrix を固定してから実装に回すべきです。

  3. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop result

    Anchor comment の 5 blocker 反映状況

    1. Issue 契約不備(C1/C5/C9): ## Allowed Paths / ## Runtime Verification Applicability(decision: not_applicable)追加、AC を - [ ] 形式、VC に # AC<N> 対応コメント
    2. significant token の粗さ: STOP_TOKENS(20+ 件)+ lower() 正規化を In Scope に固定、日本語 token は Out of Scope(fixture japanese_only で「warning なし」固定)
    3. 裸 path 仕様の曖昧さ: 拡張子セット(.md|.py|.ts|.tsx|.js|.json|.yml|.yaml|.toml|.sh)+ prefix セット(docs/|.claude/|.github/)+ 末尾記号 strip + ./ 正規化を In Scope に固定
    4. Jaccard 劣化: 既存 < 0.3 閾値を維持(overlap == 0 には変更しない)、evidence に jaccard/overlap/missing_from_cvs/missing_from_in_scope 4 フィールド追加
    5. fixture 不足: positive/negative 2 件 → fixture matrix 10 件(既存 1 + 新規 9)に拡張

    Fact-check correction

    初版 contract の AC5 が「既存 fixture 4 件」と記載していたが、実際は .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_issue.md の 1 件のみ。AC6 / Scope Delta に正しく反映済み。

    References 補強

    termination_reason: approved

  4. changed the title [-]改善: review-issue checker の scope_cvs_in_scope_mismatch tokenization を backtick token 以外(自然文 significant token / 裸 path)にも拡張する[/-] [+]実装: review-issue checker の scope_cvs_in_scope_mismatch tokenization を backtick token 以外(自然文 significant token / 裸 path)にも拡張する[/+] on May 27, 2026
  5. added
    phase/implementation
    and removed
    triage-required
    on May 27, 2026
  6. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-05-27T20:49:20Z)

    • Outcome: detect_warning_scope_cvs_in_scope_mismatch() を backtick token に加え裸 path / ASCII significant token + STOP_TOKENS フィルタに拡張し、Jaccard < 0.3 閾値を JACCARD_THRESHOLD 定数化したまま evidence に jaccard/overlap/missing_from_cvs/missing_from_in_scope 4 フィールドを出力する状態。
    • Acceptance Criteria: AC1〜AC8(本文参照)
    • Verification Commands: 19 行(baseline preflight pass / 1 件 pr_review_only skip)
    • Allowed Paths: .claude/skills/review-issue/scripts/check_issue_contract.py, .claude/skills/review-issue/tests/test_check_issue_contract_c12.py, .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_*.md
    • Worktree: .claude/worktrees/issue-396-scope-cvs-tokenize-natural
    • Branch: worktree-issue-396-scope-cvs-tokenize-natural
    • VC preflight: baseline fail = 14, 想定外 pass = 0, 実行不可 = 0, regression_gate pass = 5, skipped = 1
    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: 2026-05-27T20:49:20Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/396
      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: 14
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 5
          vc_skipped: 1
          classifications:
          - ac: AC_UNKNOWN
            command: rg -n "PATH_TOKEN_RE|STOP_TOKENS|SIGNIFICANT_TOKEN_RE" .claude/skills/review-issue/scripts/check_issue_contract.py
            exit_code: 1
            classification: expected_fail
            category: expected_baseline_fail
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: rg -n "PATH_TOKEN_EXTENSIONS|PATH_TOKEN_PREFIXES|PATH_TOKEN_STRIP_CHARS"
              .claude/skills/review-issue/scripts/check_issue_contract.py
            exit_code: 1
            classification: expected_fail
            category: expected_baseline_fail
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: rg -n "STOP_TOKENS\s*=" .claude/skills/review-issue/scripts/check_issue_contract.py
            exit_code: 1
            classification: expected_fail
            category: expected_baseline_fail
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: rg -n "JACCARD_THRESHOLD\s*=" .claude/skills/review-issue/scripts/check_issue_contract.py
            exit_code: 1
            classification: expected_fail
            category: expected_baseline_fail
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: rg -n "missing_from_cvs|missing_from_in_scope" .claude/skills/review-issue/scripts/check_issue_contract.py
            exit_code: 1
            classification: expected_fail
            category: expected_baseline_fail
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: uv run pytest .claude/skills/review-issue/tests/test_check_issue_contract_c12.py
              -k scope_cvs_in_scope_mismatch -v
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: '============================= test session starts ==============================
          
                platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python
          
                cachedir: .pytest_cache'
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_issue.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: VC marked pr_review_only; verification deferred to PR review
            runtime_verification_required: false
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_bare_path_mismatch.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_bare_path_overlap.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_natural_en_mismatch.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_natural_en_overlap.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_boilerplate_only_overlap.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_punct_normalization.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_extension_coverage.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_one_side_empty.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: test -f .claude/skills/review-issue/fixtures/scope_cvs_in_scope_mismatch_japanese_only.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_UNKNOWN
            command: pnpm typecheck
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: $ tsc --noEmit
          - ac: AC_UNKNOWN
            command: pnpm lint
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: $ eslint .
          - ac: AC_UNKNOWN
            command: pnpm test
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: " RUN  v4.1.6 /home/squne/projects/LOOP_PROTOCOL\n Test Files\
                \  12 passed (12)\n      Tests  122 passed (122)"
              stderr_excerpt: $ vitest run
          - ac: AC_UNKNOWN
            command: pnpm build
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: "vite v8.0.13 building client environment for production...\n\e\
                [2K\ntransforming...✓ 22 modules transformed."
              stderr_excerpt: $ tsc && vite build
          summary:
            expected_fail: 14
            unexpected_pass: 0
            blocked: 0
            human_judgment: 0
            expected_pass: 5
            skipped: 1
            extraction_errors: 0
          
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
          triggers:
            docs_product_allowed_paths: false
            tasks_md_mentioned: false
            specify_artifact_mentioned: false
            generated_task_mentioned: false
            product_spec_context_present: false
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings:
        - non_blocking: scope_cvs_in_scope_mismatch warning が現行 checker (backtick-only tokenizer) で発火(本 Issue の改善対象そのもの。Scope Delta で明示済み)
  7. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-05-27T20:57:12Z)

  8. added a commit that references this issue on May 27, 2026
  9. added a commit that references this issue on May 27, 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

    enhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions