Skip to content

Emit an Unclosed details Block's Preceding Text Once in details_spans #2186

Closed

Description

@ptr727

details_spans in scripts/pr_review.py emits the text before an unclosed top-level <details> twice. At the opening tag it appends (cursor, m.start()) to leftover. When the body ends with that block still open, it appends (cursor, len(body)) with the same cursor, so the second span repeats everything the first one covered.

marker_blocks joins those spans, so a review section sitting before the unclosed block comes back duplicated. A constructed body shows it: ### Suppressed comments (1) and one finding, followed by an unclosed <details><summary>Review details</summary>.... suppressed_blocks then returns the heading and the finding twice in one block. sibling_heading does not stop at the repeat, since it is the same marker. A truncated review body reaches this.

Found by a local review pass on the #2182 fix. The behavior is the same on develop, so it predates that change.

Done looks like: an unclosed top-level block contributes its tail once, with a test holding a section before an unclosed block to a single copy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingscriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions