:bug: Verify commit-pinned results in `scorecard mcp` #5420
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 299 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.341
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5420"
general
weight: 0.35
justaugustus
What kind of change does this PR introduce?
Bug fix: normalize commit-pinned lookups in
scorecard mcpand verify the commit the REST API returns.What is the current behavior?
For requests that pass
commit:?commit=unchanged. The REST API matches only lowercase SHAs, so they 404.repo.commit, the result reports the requested commit as resolved, and a returnedrepo.committhat differs from the request goes unnoticed.What is the new behavior (if this is a feature change)?
committo get the latest published results.repo.commitis missing or differs from the request is rejected, so a result never reports a commit the API didn't confirm.Which issue(s) this PR fixes
Fixes #5403
Special notes for your reviewer
Rebased onto
main. The last commit makes the commit-specific not-found message point to the latest results, since #5403 notes they may exist when the pinned commit has none.Rejecting a pinned response without
repo.commit, rather than returning it with an empty commit, is a deliberate choice: without it the provenance can't be verified.go test ./cmd/internal/mcp/...passes, and golangci-lint v2.15.0 reports 0 issues on./cmd/internal/mcp/provider/. Againstapi.scorecard.dev, the uppercase SHA from #5403 (2EF237F4…) now returns the result for2ef237f4…, an unscanned commit returns the commit-specific error, and an unpinned request still returns the latest result.Does this PR introduce a user-facing change?
``
release-note
scorecard mcplowercases commit SHAs before querying published results, reports a missing result for a pinned commit separately from a repository with no results, and rejects results whose commit doesn't match the requested one.
``