Skip to content

gh-mode meta writes truncate bodies that quote a board:meta marker (strip_meta leftmost-match bug) #60

Closed

Description

@SSFSKIM

Found during dp#51 consumption Task 4 (branch dp51-a1-consumption, spec 2026-08-11-dp51-a1-consumption-design.md §Surprises).

_board.META_RE is \n?<!-- board:meta\n(.*?)\n-->\s*$ with re.S. re.search is leftmost-first and the lazy .*? backtracks across intervening prose to the trailing -->, so on any issue body whose PROSE quotes a <!-- board:meta marker (e.g. documentation about the meta block itself), strip_meta deletes everything from the quoted marker onward — real prose included.

Blast radius: strip_meta → render_body → update_meta — i.e. every gh-mode meta write (branch:, pr:, parent-pin:, relates bookkeeping) silently truncates such a body on its next write. Reproduced: B.strip_meta on a marker-quoting body returned only the text before the quote.

board-body.sh (landed on the dp51 branch) anchors on the RIGHTMOST match and is immune; it's the pattern for the fix. Suggested: make the trailing-block location a shared helper (rightmost walk, byte offsets only) and point strip_meta/render_body at it, with a regression test whose prose quotes a marker.

Activity

  1. SSFSKIM commented on Aug 12, 2026

    @SSFSKIM
    OwnerAuthor

    Fixed on PR #65 (auto-closes on merge). The shape of the fix outgrew the issue's own suggestion: the rightmost walk alone regressed legacy-nested bodies, so the landed rule chooses the opener by INTERIOR CONTENT — a candidate wins iff every line between its opener and the final closer is block-legal under parse_meta's own line model (all 11 splitlines() separators), with a segment-aware fallback that carries pre-grammar blocks through board-body.sh's raw splice untouched. clean_meta closes the write side (single-line values, no marker tokens), validated BEFORE any external write so a refusal can't tear a transition. All consumers share the helper: parse_meta/strip_meta/update_meta, board-body.sh, and board-migrate-gh.sh (the one-shot migration was the worst surviving path). The rule is guarded by a committed property fuzzer — 140k generated legacy bodies, zero divergences, and it reproduces the known divergences of all three superseded formulations, so the next revision gets judged by generation, not hand-reasoning.

  2. added a commit that references this issue on Oct 18, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions