Skip to content

[Bug] Issue-quality media normalization accepts wrapped placeholders and can corrupt protected code #1196

Description

@luvs01

Client or integration

GitHub issue-quality automation and issue template validation

Area

CI and GitHub automation

Summary

The issue-quality normalizer has two related media-boundary defects:

  1. A placeholder wrapped in an HTML media element can be treated as substantive. For example, clean("<video>No response</video>") retains the wrapper instead of classifying the section as an empty placeholder.
  2. In a multiline media block, indented child tags such as <source> or <img> can be protected as ordinary indented code before the media block is stripped, so a media-only section is not recognized consistently.

A direct combination of the obvious fixes is unsafe. The current indented-code protection restores sentinels by line position, while media stripping can collapse several lines to one. That can leak a NUL sentinel or drop an unrelated indented line before/after the media block.

Expected: placeholders wrapped only in media markup are rejected, real captions/fallback prose stay substantive, and fenced or indented code is preserved byte-for-byte.

Reproduction

Run the current issue-quality core against these cases:

clean("<video>No response</video>")
// currently remains substantive

isMediaOnly("<picture>\n    <source src=\"x\">\n    <img src=\"x\">\n</picture>")
// inconsistent because child lines are protected as indented code

A line-accounting regression appears when a stripped multiline media block is surrounded by protected lines:

    ![before](url)
<video>
    <source src="x">
</video>
    ![after](url)

If multiline media is collapsed before positional restoration, the later sentinel can be restored to the wrong line or remain as a NUL byte.

Version

Current dev at 44dce33a; also reproducible from the current issue-quality core split

Operating system

All platforms

Provider and model

Not provider-specific

Logs or error output

direct media-wrapped placeholder: accepted as substantive
multiline media + neighboring indented code: positional sentinel restoration can lose a line or retain NUL

Screenshots and supporting files

No screenshot is needed; the string fixtures above reproduce the parser behavior.

Redacted configuration

{
  "configuration_dependency": "none"
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Root cause and proposed boundary

protectIndentedCodeLines, HTML media stripping, and placeholder detection operate as separate text rewrites but assume line positions remain stable. Media removal violates that assumption.

A safe implementation should:

  • identify fenced and indented code spans before inspecting media;
  • strip or normalize media only outside protected code spans;
  • preserve line count during intermediate masking, or restore protected spans from an ordered token queue rather than positional line indexes;
  • inspect media fallback text for exact placeholder values without erasing real captions;
  • preserve fenced HTML/media examples and ordinary indented Markdown exactly.

Required regressions include direct wrapped placeholders, single- and multiline captions, media-only nested source/img tags, fenced HTML/media, plain indented code, media surrounded by two protected lines with no NUL output, and the full issue-template validation result.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions