Skip to content

実装: scope_signal_delta.py の _BULLET_LINE_RE / extract_directive_items() を Markdown 順序付きリスト検出に対応させる #2812

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2778"
goal_ref: "scope_signal_delta.py の _BULLET_LINE_RE / extract_directive_items() を Markdown 順序付きリスト検出に対応させ、explicit trusted human_review_directive の検出漏れを解消する"
change_kind: code
dedupe_key: "issue-refinement-loop:classifier:bullet-line-re-ordered-list-detection-gap:v1"

Parent Issue

#2778

Parent Goal Ref

Current Validated Scope

  • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py の _BULLET_LINE_RE(現行 r"^\s*[-*]\s+\S.*$")を Markdown 順序付きリストマーカー(1. , 2. 等)も検出するよう拡張する
  • 同ファイルの extract_directive_items() の bullet-prefix 判定を、順序付きリストマーカー行からも content を抽出できるよう拡張する
  • .claude/skills/issue-refinement-loop/tests/ 配下の該当テストファイルへ、正の代表例(unordered -/*、native ordered 1. /2. 、CF_HTML <ol><li>、CF_HTML <ul><li>)と負の対照例の回帰テストを追加する

Remaining Parent Gaps

Outcome

.claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py の _BULLET_LINE_RE と extract_directive_items() が Markdown 順序付きリスト(1. , 2. 等)を unordered bullet(-/*)と同様に検出できるよう拡張され、Issue #2730(HTML clipboard paste <ol><li>)および Issue #2805(native Markdown ordered list)の両方の実際のコメント本文をフィクスチャとした回帰テストが追加・PASS し、uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py -v が全件成功する状態。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本修正は正規表現・抽出ロジックの静的な単体テストおよび既存回帰テストの pytest 実行で完結し、外部サービス・ネットワーク・ランタイム環境への依存を持たないため。

In Scope

  • _BULLET_LINE_RE(現行 r"^\s*[-*]\s+\S.*$")を Markdown 順序付きリストマーカー(例: r"^\s*(?:[-*]|\d+[.)])\s+\S.*$"。正規表現の正確な形は実装者の判断・テストに委ねる)にも一致するよう拡張する
  • extract_directive_items() の bullet-prefix チェック("- " / "* " で始まる行の抽出)を、順序付きリストマーカー行(1. , 2. 等)からのコンテンツ抽出にも対応させる
  • 以下の positive representation matrix が classify_directive_confidence() により has_bullets: True かつ真正な directive marker を伴う場合に directive.confidence: explicit へ分類されることを確認する回帰テストを追加する:
    1. Markdown unordered - ...
    2. Markdown unordered * ...
    3. Markdown ordered 1. ..., 2. ...(native、HTML なし)
    4. CF_HTML clipboard paste <ol><li>...(既存の envelope canonicalization + 本修正後の順序付きマーカー検出経由)
    5. CF_HTML clipboard paste <ul><li>...(既存の unordered 検出で canonicalization 後にカバーされることを回帰テストで確認)
  • 以下の negative control が誤って explicit な human_review_directive に分類されないことを確認する回帰テストを追加する(既存の _has_semantic_directive_bullet() 等の safeguard を弱めない):
    1. directive marker のない単なる観察リスト
    2. 失敗ログ
    3. TODO / status report
    4. 命令的な directive content を含まない順序付き/非順序リスト
    5. with_human_context の trusted lane 上にないコメント
  • with_human_context → human_review_directive → confidence: explicit → contract_update_required →(section-bound patch で表現不能な場合)→ issue_editor_required の full production routing 回帰テストを追加し、full-rewrite handoff が既存契約どおり writes: 0 を維持することを確認する
  • Issue 調査: markdownlint-cli2 の gitignore option 導入是非を検討する #2730 の実際の HTML-paste コメント本文と Issue 調査: follow-up Issue の no-parent parent_issue: null 反復生成経路を特定し canonical none 強制策を決定する #2805 の実際の native Markdown ordered list アンカーコメント(https://github.com/squne121/loop-protocol/issues/2805#issuecomment-5856071817)を(必要に応じてサニタイズ・簡略化のうえ)回帰テストフィクスチャとして再利用する

Out of Scope

Acceptance Criteria

  • AC1: _BULLET_LINE_RE が順序付きリストマーカー(1. , 2. 等)を検出するよう拡張され、旧来の -/* 形式と新規の順序付き形式の両方が一致することを単体テストで確認する
  • AC2: extract_directive_items() が順序付きリストマーカー行からもコンテンツを抽出するよう拡張され、unordered bullet との抽出結果の対称性が単体テストで確認される
  • AC3: positive representation matrix(5 ケース)が classify_directive_confidence() により、真正な directive marker を伴う場合に directive.confidence: explicit を返すことを回帰テストで確認する(調査: markdownlint-cli2 の gitignore option 導入是非を検討する #2730・調査: follow-up Issue の no-parent parent_issue: null 反復生成経路を特定し canonical none 強制策を決定する #2805 の実コメントを由来とするフィクスチャを含む)
  • AC4: negative control(5 ケース)が引き続き non-explicit に分類されることを確認する。既存テスト test_ac4_ambiguous_no_bullet_directive_never_escalates と test_bare_severity_heading_does_not_produce_explicit_directive_confidence(.claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py)が無改変で PASS し続けることを確認する
  • AC5: with_human_context → issue_editor_required の full production routing 回帰テストが追加され、writes: 0 を維持することを確認する
  • AC6: decide_rewrite_route.py および _cf_html_canonical_text() / _canonicalize_cf_html_envelope() に差分がないことを確認する

Verification Commands

# AC1
$ rg -n "_BULLET_LINE_RE = re.compile" .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py

# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py -v -k "bullet_line_re or ordered"

# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py -v -k "explicit or representation_matrix"

# AC4
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py -v -k "test_ac4_ambiguous_no_bullet_directive_never_escalates or test_bare_severity_heading_does_not_produce_explicit_directive_confidence"

# AC5
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py -v -k "issue_editor_required or writes_zero"

# AC6
$ git diff --name-only -- .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py

# 全体回帰(対象テストファイル一式)
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py -v

# repo 標準ゲート
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py
  • .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
  • .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • decide_rewrite_route.py や _cf_html_canonical_text() / _canonicalize_cf_html_envelope() への変更が必要だと判明した場合(Out of Scope 明記事項のため、実装前に必ず立ち止まり Issue comment で報告する)

Required Skills

  • Python 正規表現(re module)
  • pytest(BDD 形式のユニット/回帰テスト設計)
  • なし(上記以外の runtime dependency はなし)

Required Design References

  • docs/dev/agent-skill-boundaries.md

Scope Delta(任意)

N/A

Source

Delivery Rule

  • 1 Issue = 1 PR を原則とし、本 Issue は 1 PR で完結させる
  • Draft PR をデフォルトとし、レビュー準備が整うまで Draft のまま維持する
  • 専用 worktree(main を汚染しない独立ブランチ)で作業する

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Sep 27, 2026
  2. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-27T21:40:33Z)

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