fix(issue-quality): treat media-only sections as empty so image-only goals cannot hide repeated prose - #1101
Conversation
…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.
|
Warning Review limit reached
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesMedia validation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
.github/scripts/issue-quality.cjs.github/scripts/issue-quality.test.cjs
There was a problem hiding this comment.
💡 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".
…deRabbit) Replace the regex-only markdown-image matcher with a small balanced scanner so destinations containing balanced parentheses (e.g. .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.
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
.github/scripts/issue-quality.cjs.github/scripts/issue-quality.test.cjs
…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.
|
Merging #1101. Why it helps: this closes the issue-quality bypass where an image-only section (HTML |
Summary
<img>or markdown) 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).Validation
node --test .github/scripts/issue-quality.test.cjs— 111 pass, 0 fail (includes new regression tests: HTML-img-only goal, markdown-img-only goal, bracketed-alt markdown image, image+text preservation,isMediaOnly/stripMediaTokensunit cases).node --teston all workflow-script test files (the exact set CI runs inissue-quality-tests.yml) — 346 pass, 0 fail.validateIssuebefore and after:valid: true→valid: falsewith the expected reasons.Review notes
stripMediaTokens/isMediaOnlyare new pure helpers exported for testability;clean()callsisMediaOnlyto decide whether to strip media tokens before the placeholder/emptiness pipeline.<img>/<picture>/<video>/<audio>and markdown images including bracketed alt text; text around media is preserved.Limitations
enforce-issue-quality.yml); the GitHub Models brownout that prevented the AI translation step on It is hoped that the usage query will support time-based queries and statistics, as well as key-based queries and statistics #1098 is out of scope.Fixes #1098
Summary by CodeRabbit