Skip to content

fix(issue-quality): treat media-only sections as empty so image-only goals cannot hide repeated prose - #1101

Merged
Wibias merged 4 commits into
lidge-jun:devfrom
Wibias:codex/1098-issue-quality-image-section
Aug 6, 2026
Merged

fix(issue-quality): treat media-only sections as empty so image-only goals cannot hide repeated prose#1101
Wibias merged 4 commits into
lidge-jun:devfrom
Wibias:codex/1098-issue-quality-image-section

Conversation

@Wibias

@Wibias Wibias commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the issue-quality gate treating a section whose only content is an image (HTML <img> or markdown ![alt](url)) as substantive text, which let repeated identical prose in the other sections escape duplicate and title-repeat detection (the exact It is hoped that the usage query will support time-based queries and statistics, as well as key-based queries and statistics #1098 case).
  • Media-only sections now participate in emptiness checks like any other blank section: an image-only goal makes the report fail with "Required sections are missing or empty: goal / problem" plus the duplicate-content and repeat-title reasons.
  • Sections that mix an image with real text (screenshot + caption/repro steps) are preserved unchanged.

Validation

Review notes

  • stripMediaTokens/isMediaOnly are new pure helpers exported for testability; clean() calls isMediaOnly to decide whether to strip media tokens before the placeholder/emptiness pipeline.
  • Handles HTML <img>/<picture>/<video>/<audio> and markdown images including bracketed alt text; text around media is preserved.

Limitations

Fixes #1098

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for sections containing only images, videos, audio, or other embedded media.
    • Media-only sections are now treated as empty, preventing them from bypassing missing-content and duplicate-content checks.
    • Sections combining media with meaningful text continue to be validated normally.
    • Added support for Markdown and HTML media formats, including images with bracketed alternative text.

…goals cannot hide repeated prose (#1098)

An HTML <img> or markdown image in a section made it look non-empty, so
repeated identical prose in the other sections escaped duplicate and
title-repeat detection and the issue passed the quality gate. Strip
media-only tokens in clean() so media-only sections participate in
emptiness/duplicate checks like any other blank section.

Closes the image-only-section bypass seen on #1098.
@github-actions github-actions Bot added the bug Something isn't working label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Wibias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4286de4a-d07b-4415-80c9-b3102a59e59e

📥 Commits

Reviewing files that changed from the base of the PR and between 718b57a and f9a1172.

📒 Files selected for processing (2)
  • .github/scripts/issue-quality.cjs
  • .github/scripts/issue-quality.test.cjs
📝 Walkthrough

Walkthrough

Changes

Media validation

Layer / File(s) Summary
Media normalization and exports
.github/scripts/issue-quality.cjs
stripMediaTokens removes supported HTML and Markdown media tokens. The Markdown scanner handles nested brackets, balanced URL parentheses, escapes, titles, malformed tokens, indented code, and reference definitions. isMediaOnly and clean use the normalized content for validation and duplicate detection. Both helpers are exported.
Media validation tests
.github/scripts/issue-quality.test.cjs
Tests cover HTML and Markdown media-only sections, balanced URL syntax, escaped images, reference images, other media tags, duplicate validation, mixed content, indented code, and direct helper behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR improves image-only validation but does not implement #1098's requested time-based and API-key usage queries or CLI interfaces. Implement #1098's usage queries, statistics, CLI workflows, and interfaces, or link the PR to an issue that defines the validator requirements.
Out of Scope Changes check ⚠️ Warning The PR contains validator-only changes that are unrelated to the usage-query and statistics objectives described in linked issue #1098. Link this PR to an issue for issue-quality validation, or expand the change to implement #1098 and remove unrelated validator-only changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: treating media-only sections as empty to prevent repeated prose from bypassing validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/issue-quality.cjs:
- Around line 77-79: Update stripMediaTokens() to replace the regex-only image
matching with a Markdown-aware scanner that balances image delimiters and
parentheses in destinations, including URLs such as image_(final).png. Preserve
existing handling for balanced alt-text brackets and ensure isMediaOnly()
receives the fully removed image content; add a regression covering an image URL
with balanced parentheses.

In @.github/scripts/issue-quality.test.cjs:
- Around line 267-270: Extend the assertions for the repeated-content validation
case to verify that result.reasons includes a reason matching /repeat the issue
title/i. Keep the existing empty-section and duplicate-content assertions
unchanged, using the same result.reasons assertion style.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d674e0ae-7536-4aed-a47f-e9892ce84e1d

📥 Commits

Reviewing files that changed from the base of the PR and between 35f87e8 and b471294.

📒 Files selected for processing (2)
  • .github/scripts/issue-quality.cjs
  • .github/scripts/issue-quality.test.cjs

Comment thread .github/scripts/issue-quality.cjs Outdated
Comment thread .github/scripts/issue-quality.test.cjs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b47129420a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/scripts/issue-quality.cjs Outdated
Comment thread .github/scripts/issue-quality.cjs Outdated
Comment thread .github/scripts/issue-quality.cjs Outdated
Wibias added 2 commits August 6, 2026 06:25
…deRabbit)

Replace the regex-only markdown-image matcher with a small balanced scanner
so destinations containing balanced parentheses (e.g.
![diagram](https://example.com/image_(final).png)) are stripped as
media-only instead of leaving a trailing fragment that evades the
empty-section check. Also assert the repeated-title reason in the #1098
regression test and cover balanced-paren URLs and malformed destinations.
… indented code (Codex)

- Strip reference-style markdown images (![alt][ref] plus [ref]: url) when the
  reference is used by an image, including implicit ![alt][] references.
- Preserve fallback/caption prose inside <video>/<audio>/<picture> blocks;
  only strip the block when its inner content is media-only.
- Leave indented code blocks (4+ spaces or tab) untouched so literal image
  syntax in example code is not treated as an embedded image.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/issue-quality.cjs:
- Around line 171-185: Unify the reference-image parsing in isMediaOnly() by
using one balanced, code-aware scanner for both removing image tokens and
collecting explicit or implicit reference labels, including nested alt text such
as ![Image [screenshot]][shot]. Normalize each collected label before matching
reference definitions, while preserving indented reference-image syntax as
literal code. Add regressions covering explicit nested-alt, implicit nested-alt,
and indented reference-image cases.
- Around line 69-70: Update the text-cleaning flow around stripHtmlMedia(),
stripMarkdownImages(), and isMediaOnly() so HTML media inside indented code is
preserved and does not make the content media-only. Make stripping code-aware or
protect indented-code lines before HTML media removal, and add a regression
asserting isMediaOnly('    <img src="x.png">') returns false.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 730a47b5-6d7f-461f-83b9-e35b4e383c20

📥 Commits

Reviewing files that changed from the base of the PR and between 98de510 and 718b57a.

📒 Files selected for processing (2)
  • .github/scripts/issue-quality.cjs
  • .github/scripts/issue-quality.test.cjs

Comment thread .github/scripts/issue-quality.cjs Outdated
Comment thread .github/scripts/issue-quality.cjs Outdated
…d parse nested ref labels (CodeRabbit)

- Protect indented code lines (4+ spaces or tab) before both the HTML and
  Markdown media strippers run, so literal example syntax like
  "    <img src='x.png'>" is not treated as an embedded image.
- Parse reference-style image labels with the same balanced bracket grammar
  as alt text, so "![Image [screenshot]][shot]" collects "shot" and removes
  its "[shot]:" definition.
@Wibias

Wibias commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Merging #1101.

Why it helps: this closes the issue-quality bypass where an image-only section (HTML <img> or markdown ![alt](url)) counted as substantive text, so repeated identical prose in the other sections escaped duplicate and title-repeat detection — the exact #1098 case. Media-only sections now participate in empty-section checks like any other blank section, while sections that mix an image with real text (captions, repro steps) are preserved.

@Wibias
Wibias merged commit 6865c00 into lidge-jun:dev Aug 6, 2026
6 checks passed
@Wibias
Wibias deleted the codex/1098-issue-quality-image-section branch August 6, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant