Skip to content

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

Closed

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

  1. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. Ingwannu commented on Aug 8, 2026

    @Ingwannu
    Owner

    Confirmed on current dev: the three supplied boundaries still reproduce. <video>No response</video> remains substantive, indented child tags keep a multiline media block alive, and positional restoration is unsafe once media stripping changes line count.\n\nI am fixing this by protecting fenced/indented code before media normalization, restoring protected lines through ordered opaque tokens rather than line indexes, and treating only exact placeholder fallback text inside media as empty. Real captions/fallback prose remain substantive. The regression set covers direct wrapped placeholders, multiline media children, fenced examples, ordinary indented code, protected lines on both sides of a removed media block, and zero leaked NUL markers. I will link the draft PR and exact validation results here once pushed.

  3. Ingwannu commented on Aug 8, 2026

    @Ingwannu
    Owner

    Implemented and pushed as draft PR #1270: on exact head 03b05115:\n\n- issue-quality tests: 112/112 passed\n- related issue/PR-quality and target-enforcement tests: 211/211 passed\n- typecheck passed\n- privacy scan passed\n- git diff --check passed\n\nThe issue stays open until the CI-workflow change receives independent maintainer review, exact-head CI is green, and the PR merges into dev.

  4. Wibias commented on Aug 9, 2026

    @Wibias
    Contributor

    Resolved on dev.

    The fix originally developed in #1270 has been landed directly with a maintainer correction:

    • 96141e8f — fix(ci): preserve code while normalizing issue media
    • d493c147 — fix(ci): narrow media placeholder stripping

    The landed implementation fixes the original three boundaries:

    • fenced and indented code is protected with ordered opaque tokens rather than restored by line position;
    • indented children of multiline HTML media blocks are treated as media rather than accidentally preserved as Markdown code;
    • <video>No response</video> and equivalent GitHub-generated No response wrappers are treated as empty.

    The maintainer follow-up also narrowed the placeholder rule so legitimate fallback/caption text such as TBD, N/A, None, arbitrary text, filenames, URLs, emoji, and non-English content remains substantive.

    The final corrected implementation is present on current dev, so the original corruption and wrapped-placeholder defects are resolved.

    Closing as completed.

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