feat(scorecard): add codecov backend module with 7 coverage metrics#3477
feat(scorecard): add codecov backend module with 7 coverage metrics#3477fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
Add a new scorecard-backend-module-codecov plugin that integrates with the Codecov API to provide 7 code coverage metrics: coverage percentage, coverage trend, tracked files, tracked lines, covered lines, partial lines, and missed lines. The module supports multi-account configuration with optional auth tokens and resolves service/owner/repo from entity annotations with fallback logic. All 7 metrics share a single API call via the batch provider pattern. Closes #3473 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Changed Packages
|
|
|
|
🤖 Finished Review · ✅ Success · Started 1:30 PM UTC · Completed 1:42 PM UTC |
ReviewFindingsHigh
Medium
Low
Info
|
| updatestamp: string; | ||
| author: CodecovAuthor; | ||
| language: string; | ||
| branch: string; |
There was a problem hiding this comment.
[high] nil/null handling
The CodecovRepoResponse.totals field is typed as non-optional CodecovTotals, but the Codecov API returns totals: null for repositories that have no coverage data uploaded yet. Both calculateMetric and calculateMetrics access repoInfo.totals[field] without any null check, which will throw a TypeError at runtime.
Suggested fix: Change the type to totals: CodecovTotals | null and add a null guard in both calculateMetric and calculateMetrics.
| async getRepoInfo( | ||
| service: string, | ||
| owner: string, | ||
| repo: string, |
There was a problem hiding this comment.
[medium] error-handling-idiom
When a specific account name is requested but not found in configuration, the CodecovClient only logs a warning and returns undefined, silently falling through to an unauthenticated request. The SonarQube module throws an Error in the same scenario.
Suggested fix: Throw an Error when a specific accountName is provided but not found in configuration, matching the SonarQube pattern.
| { id: string; title: string; description: string } | ||
| > = { | ||
| coverage: { | ||
| id: 'codecov.coverage', |
There was a problem hiding this comment.
[low] api-contract
The coverage_trend metric is described as Code coverage trend for the last 7 days but maps to the totals.diff field which represents diff coverage, not a time-based trend.
| id: 'codecov.tracked_lines', | ||
| title: 'Codecov Tracked Lines', | ||
| description: 'Total lines of code tracked by Codecov.', | ||
| }, |
There was a problem hiding this comment.
[low] edge-case
Threshold rules for partial_lines and missed_lines use absolute counts which may not scale well across repos of different sizes.
| getCatalogFilter(): Record<string, string | symbol | (string | symbol)[]> { | ||
| return { | ||
| [`metadata.annotations.${CODECOV_REPO_ANNOTATION}`]: | ||
| CATALOG_FILTER_EXISTS, |
There was a problem hiding this comment.
[low] error-handling-gaps
calculateMetric and calculateMetrics have no additional error context (entity ref, metric ID) around the API call.



Add a new scorecard-backend-module-codecov plugin that integrates with the Codecov API to provide 7 code coverage metrics: coverage percentage, coverage trend, tracked files, tracked lines, covered lines, partial lines, and missed lines. The module supports multi-account configuration with optional auth tokens and resolves service/owner/repo from entity annotations with fallback logic. All 7 metrics share a single API call via the batch provider pattern.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Closes #3473
Post-script verification
fs/3473-scorecard-codecov-module)7ccaff17753df64c7ab288cdcba34cee5a657254..HEAD)