scorecard: verify README image references to prevent false positives - #1067
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the scorecard’s module context generation so README image references are deterministically verified (especially for images stored outside individual module folders, e.g. registry/coder/.images/), reducing false positives/negatives in LLM-based scoring.
Changes:
- Added
verifyReadmeImages()to parse Markdown image references from a module README and check whether referenced local files exist. - Appended a “README IMAGE VERIFICATION” section to the LLM context produced by
gatherModuleContext().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The LLM scoring Visual preview only saw markdown image references like `` but never received proof that the referenced file exists (images are stored in a shared .images/ directory outside the module folder). This led to score variance — sometimes the LLM inferred the image exists, sometimes it marked the reference as "not included in module content". PR #1057 hit this: vscode-web dropped from 82 to 79 due to a 5→2 Visual preview regression, despite the GIF existing and rendering correctly. Fix: verifyReadmeImages() now resolves relative image paths and checks existence with existsSync(). The context sent to the LLM includes a verification section: === README IMAGE VERIFICATION === ✓ ../../.images/vscode-web.gif — exists (5277.4 KB) → https://example.com/img.png — external URL Or for broken references: ✗ ../.images/missing.png — NOT FOUND This makes scoring deterministic and also catches real broken references (e.g. jetbrains-gateway has a typo: ../.images/ instead of ../../.images/). Fixes false positive from: #1057
DevelopmentCats
force-pushed
the
devcats/scorecard-images-fix
branch
from
August 20, 2026 17:48
ef1f9b4 to
75363fe
Compare
- Type match as RegExpExecArray | null - Skip absolute paths - Validate resolved paths stay within REGISTRY_ROOT
bpmct
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #1057 (a bug fix for
vscode-web) triggered a scorecard regression from 82 → 79 due to Visual preview dropping from 5 → 2. The LLM noted:The image exists at
registry/coder/.images/vscode-web.gifand renders correctly on the registry website. This is the documented pattern — module screenshots live in a shared.images/directory outside the module folder.Root Cause
gatherModuleContext()only collects files inside the module directory. The LLM sees markdown image references likebut receives no evidence that the referenced file exists. Without verification, it sometimes gives full credit (inferring the image exists) and sometimes gives partial credit (noting the file isn't in the provided content).Fix
Add
verifyReadmeImages()which:existsSync()The LLM now sees deterministic proof:
Or for broken references:
Testing
The fix also caught a real bug:
jetbrains-gatewayuses../.images/(one level) instead of../../.images/(two levels).