fix(#3532): standardize metric IDs from snake_case to lowerCamelCase#3534
fix(#3532): standardize metric IDs from snake_case to lowerCamelCase#3534fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
Rename all Scorecard metric and provider IDs from snake_case to lowerCamelCase to align with the app-config.yaml naming convention and the planned Scorecard design. Key changes: - Provider ID definitions (e.g. github.open_prs -> github.openPrs) - SonarQube metric config keys and type members - OpenSSF dynamic ID generation (hyphen-to-camelCase conversion) - Translation keys in ref.ts and all 5 locale files - Config schema (config.d.ts) and YAML config keys - All test fixtures, e2e tests, and documentation - MetricProvidersRegistry error message format SonarQube API metric keys (e.g. security_rating, code_smells) are preserved as-is since they are external API field names. This is a breaking change for existing configurations that reference metric IDs by name. Closes #3532
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3534 +/- ##
=======================================
Coverage 53.63% 53.63%
=======================================
Files 2260 2260
Lines 85976 85978 +2
Branches 24193 24201 +8
=======================================
+ Hits 46116 46118 +2
Misses 38302 38302
Partials 1558 1558
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
|
🤖 Finished Review · ✅ Success · Started 5:09 PM UTC · Completed 5:22 PM UTC |
ReviewFindingsHigh
Info
|
| const normalizedName = this.getMetricName() | ||
| .toLowerCase() | ||
| .replace(/-/g, '_'); | ||
| .replace(/-([a-zA-Z])/g, (_, c) => c.toUpperCase()) |
There was a problem hiding this comment.
[high] logic-error
The camelCase conversion regex only lowercases a single leading uppercase character, not a run of them. For metric names starting with uppercase acronyms, this produces incorrect IDs: CII-Best-Practices -> cIIBestPractices (documented: ciiBestPractices), CI-Tests -> cITests (documented: ciTests), SAST -> sAST (documented: sast). Three of eighteen OpenSSF metrics will have provider IDs that do not match the README or downstream configuration.
Suggested fix: Apply .toLowerCase() first, then camelCase the hyphens: name.toLowerCase().replace(/-([a-z])/g, (_, c) => c.toUpperCase()). This yields ciiBestPractices, ciTests, and sast as documented.
| const providerIds = providers.map(provider => provider.getProviderId()); | ||
| const expectedProviderIds = OPENSSF_METRICS.map(metric => { | ||
| const normalizedName = metric.name.toLowerCase().replace(/-/g, '_'); | ||
| const normalizedName = metric.name |
There was a problem hiding this comment.
[high] test-integrity
The test computes expectedProviderIds using the same broken regex as production code. Because the expected values are derived from the same buggy logic, the test passes but cannot detect that generated IDs diverge from documented/intended values for CII-Best-Practices, CI-Tests, and SAST.
Suggested fix: Fix the regex in both production and test code, or hardcode expected provider IDs in the test so it serves as an independent correctness check.



Rename all Scorecard metric and provider IDs from snake_case to lowerCamelCase to align with the app-config.yaml naming convention and the planned Scorecard design.
Key changes:
SonarQube API metric keys (e.g. security_rating, code_smells) are preserved as-is since they are external API field names.
This is a breaking change for existing configurations that reference metric IDs by name.
Closes #3532
Post-script verification
agent/3532-snake-case-to-camel-case)ed84b21fc3f37da0e0d2ffb05b78432d11ec7ce6..HEAD)