Skip to content

調査: canonical Markdown section extractor の重複実装を棚卸しし parser drift 再発箇所を特定する #2784

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "Issue #2782 で顕在化した Markdown section extraction の parser drift が他の独自 section extractor にも再発し得るかを、実 consumer とテスト証跡に基づいて棚卸しし、必要な follow-up のみを特定する"
change_kind: research-only

Source

Outcome

リポジトリ内の Markdown ## section 抽出実装を棚卸しし、既存 .claude/skills/create-issue/scripts/prose_boundary_policy.py の canonical heading / fence semantics と共有すべき consumer、独自 semantics を維持すべき consumer、既に十分な回帰テストを持つ consumerを区別できている状態にする。

具体的な同型 drift(closing hash、nested heading、fenced pseudo-heading、section presence と empty content の混同)が再現する consumer が見つかった場合のみ、重複しない bounded implementation Issue を起票する。実害が確認できなければ、repo-wide parser 統合そのものを目的化しない。

Background

Issue #2782 の OWNER review では、baseline_vc_preflight.py::extract_verification_commands_section() と contract_readiness_check.py::_extract_section_by_canonical_name() の parser drift、および Optional[str] の truthiness を section presence として使う consumer semantics が指摘された。

current main のコード検索では、Markdown section extraction 相当の独自 helper が複数箇所に存在する。例:

  • .claude/skills/issue-contract-review/scripts/vc_baseline_shape_compiler.py::extract_section_lines
  • .claude/skills/edit-issue/scripts/issue_contract_hygiene_autofix.py::extract_section_lines
  • .claude/skills/issue-refinement-loop/scripts/check_vc_scope.py::_extract_section
  • .claude/skills/create-issue/scripts/validate_issue_body.py::_extract_section / _extract_sections
  • .claude/skills/open-pr/scripts/validate_pr_body.py::_extract_sections
  • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py::extract_sections
  • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py::_extract_sections
  • .claude/skills/issue-contract-review/scripts/check_product_spec_contract.py::_extract_sections

これらは用途・戻り値・section semantics が同一とは限らないため、機械的に一つの parser へ統合することは本 Issue の目的ではない。

In Scope

  • repository code search により、Markdown level-2 section を抽出・走査する helper と主要 consumer を inventory 化する
  • 各 helper について以下を分類する:
    • canonical heading alias / closing-hash 対応が必要か
    • fenced code 内 pseudo-heading を境界から除外すべきか
    • nested heading を section boundary とみなすべきか
    • missing / present-empty / present-nonempty を区別する必要があるか
    • prose_boundary_policy の shared primitive / shared section helper を消費すべきか
  • 実装: 再発防止: issue-contract-review の Verification Commands section 抽出を GFM-aware canonical parser に統一する #2782 で追加される shared helper が current main に存在する場合は、その API と consumer 候補を照合する
  • concrete failing fixture または明確な semantic divergence が確認された consumer のみ、既存 OPEN Issue と dedupe したうえで follow-up implementation Issue 候補にする

Out of Scope

Acceptance Criteria

Verification Commands

rg -n "def .*extract.*section|def .*section.*extract|extract_section_lines|_extract_sections|extract_sections" .claude scripts
rg -n "parse_atx_heading_line|lookup_heading_policy|iter_markdown_blocks|prose_boundary_policy" .claude scripts
gh issue list --repo squne121/loop-protocol --state open --search "section extractor parser drift canonical Markdown"

Allowed Paths

  • 読み取り専用。repository production code の変更なし
  • GitHub Issue 本文・コメントへの調査結果記録、および AC5 で必要と確定した follow-up Issue 起票のみ

Stop Conditions

Notes for Reviewer

本 Issue は #2782 の implementation blocker ではない。#2782 は OWNER review で特定された shared extractor / return-contract / consumer regression をそのまま精緻化して先行できる。こちらは同型 parser drift の横断再発防止を evidence-first で評価するための独立調査。

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions