Skip to content

scorecard: verify README image references to prevent false positives - #1067

Merged
DevelopmentCats merged 4 commits into
mainfrom
devcats/scorecard-images-fix
Aug 20, 2026
Merged

scorecard: verify README image references to prevent false positives#1067
DevelopmentCats merged 4 commits into
mainfrom
devcats/scorecard-images-fix

Conversation

@DevelopmentCats

Copy link
Copy Markdown
Collaborator

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:

README references an image (![VS Code Web...](../../.images/vscode-web.gif)) but the actual file is not included in the provided module content, only the reference exists.

The image exists at registry/coder/.images/vscode-web.gif and 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 like ![alt](../../.images/foo.gif) but 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:

  1. Parses the README for markdown image references
  2. Resolves relative paths against the module directory
  3. Checks existence with existsSync()
  4. Appends verification results to the context sent to the LLM

The LLM now sees deterministic proof:

=== README IMAGE VERIFICATION ===
  ✓ ../../.images/vscode-web.gif — exists (5277.4 KB)

Or for broken references:

=== README IMAGE VERIFICATION ===
  ✗ ../.images/missing.png — NOT FOUND

Testing

Module Before After
vscode-web Visual preview: 2/5 (false positive) Visual preview: 5/5 ✓
jetbrains-gateway Broken ref undetected Visual preview: 0/5 + "NOT FOUND" ✓

The fix also caught a real bug: jetbrains-gateway uses ../.images/ (one level) instead of ../../.images/ (two levels).

@DevelopmentCats
DevelopmentCats requested review from bpmct and a lite review from Copilot August 20, 2026 17:42

Copilot AI 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.

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.

Comment thread .github/scorecard/score-modules.ts
Comment thread .github/scorecard/score-modules.ts Outdated
The LLM scoring Visual preview only saw markdown image references like
`![alt](../../.images/foo.gif)` 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
DevelopmentCats force-pushed the devcats/scorecard-images-fix branch from ef1f9b4 to 75363fe Compare August 20, 2026 17:48
- Type match as RegExpExecArray | null
- Skip absolute paths
- Validate resolved paths stay within REGISTRY_ROOT
@DevelopmentCats
DevelopmentCats enabled auto-merge (squash) August 20, 2026 18:00
@DevelopmentCats
DevelopmentCats merged commit d4ceee4 into main Aug 20, 2026
4 checks passed
@DevelopmentCats
DevelopmentCats deleted the devcats/scorecard-images-fix branch August 20, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants