Skip to content

extract-closing-refs.sh: a setext underline pushes a list container and hides the indented code beneath it #142

Description

@garretpremo

Spawned from #141 (which fixed #134).

Problem

scripts/extract-closing-refs.sh now measures fence indent from the enclosing list item's content column. Deciding that column means recognizing list markers — and a setext H2 underline is a bare lone - on its own line, indistinguishable from a list marker without knowing what the previous line was.

So the pre-pass pushes a container for the underline, which raises the column enough that the indented block below it opens as a fence instead of staying visible:

Title
-

    ```
    Closes #<n>
    ```

CommonMark renders that as an <h2> followed by an indented code block, and per #129 indented code is deliberately not stripped — so #<n> should stay visible. On dev it does. On this branch it does not, and nothing is printed to stderr.

Why it matters

This is a false negative: a real closing reference read as code. That is the direction #134's header comment argues is strictly worse than a false positive, because an issue that silently never auto-closes on release is the one failure nothing flags. It was introduced by #141 rather than being pre-existing, which is why it deserves a tracking issue rather than only a code comment.

Why it wasn't fixed in #141

Telling a setext underline from a list marker requires previous-line state (was the preceding line paragraph text?), which the line-oriented awk pre-pass doesn't carry. That is the same class of "meaningfully more state" reasoning that deferred #134 out of #130.

The shape is also very narrow, and the evidence says nothing real reaches it:

  • It needs a bare lone - underline specifically — -- and --- both take other paths, and --- is caught by the thematic-break check.
  • The 4-space-indented content underneath must begin with a fence marker.
  • A sweep of all 135 issue and PR bodies in the repo reaches it zero times.
  • A 4000-body differential fuzz against a reference CommonMark parser never generated one.

Current state

Known and pinned rather than silently divergent, the same way #129 and #130 handled this class:

  • Documented in the header comment of scripts/extract-closing-refs.sh
  • Pinned by tests/extract-closing-refs.test.tsdocumented gapsa setext underline hides the indented code beneath it — and is silent, including an explicit expect(stderr).toBe('') recording that it is silent

Acceptance criteria

  • A setext H2 underline (bare lone - beneath paragraph text) does not push a list container
  • The indented code block beneath it stays visible, matching dev and reference CommonMark
  • Real single-item lists (- followed by content, and a lone - that genuinely opens an empty list item) still push a container
  • The documented gaps pin is updated to assert the fixed behavior rather than pinning the divergence
  • No regression against the full-repo sweep — dev vs. branch should still differ on zero real bodies

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageMarks an issue that has not yet received acknowledgement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions