Skip to content

feat(#4338): add string MetricType and migrate catalog provider - #4339

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/4338-string-metric-type
Open

feat(#4338): add string MetricType and migrate catalog provider#4339
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/4338-string-metric-type

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Add 'string' as an alternative type to MetricType in scorecard-common so that metric providers can return status keys directly instead of encoding them as numbers.

Migrate CatalogRequiredAttributesMetricProvider from MetricProvider<'number'> to MetricProvider<'string'>, removing the numeric encoding layer (buildStatusCodeMapping, statusToCode). The provider now returns status strings ('found', 'missed', 'ok', 'invalid') directly as metric values, with threshold expressions using string equality (e.g. ==found) instead of numeric codes (e.g. ==0).

Changes:

  • scorecard-common: extend MetricType union with 'string',
    update MetricValue conditional type and EntityMetricDetail
  • scorecard-node: handle 'string' type in threshold expression
    parser (parseComparisonOperator), add string metric tests
  • scorecard-backend-module-catalog: simplify provider to return
    status strings directly, remove numeric code indirection
  • scorecard-backend: update Zod schemas in action files to
    include 'string' type and string values

Closes #4338

Post-script verification

  • Branch is not main/master (agent/4338-string-metric-type)
  • Secret scan passed (gitleaks — ee6947c241eb2aad2efcb8f6c8dd73fb24b24bf5..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

Add 'string' as an alternative type to MetricType in
scorecard-common so that metric providers can return status
keys directly instead of encoding them as numbers.

Migrate CatalogRequiredAttributesMetricProvider from
MetricProvider<'number'> to MetricProvider<'string'>, removing
the numeric encoding layer (buildStatusCodeMapping,
statusToCode). The provider now returns status strings
('found', 'missed', 'ok', 'invalid') directly as metric
values, with threshold expressions using string equality
(e.g. ==found) instead of numeric codes (e.g. ==0).

Changes:
- scorecard-common: extend MetricType union with 'string',
  update MetricValue conditional type and EntityMetricDetail
- scorecard-node: handle 'string' type in threshold expression
  parser (parseComparisonOperator), add string metric tests
- scorecard-backend-module-catalog: simplify provider to return
  status strings directly, remove numeric code indirection
- scorecard-backend: update Zod schemas in action files to
  include 'string' type and string values

Closes #4338
@rhdh-gh-app

rhdh-gh-app Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-scorecard-backend-module-catalog workspaces/scorecard/plugins/scorecard-backend-module-catalog minor v0.0.0
@red-hat-developer-hub/backstage-plugin-scorecard-backend workspaces/scorecard/plugins/scorecard-backend patch v4.2.0
@red-hat-developer-hub/backstage-plugin-scorecard-common workspaces/scorecard/plugins/scorecard-common minor v4.2.0
@red-hat-developer-hub/backstage-plugin-scorecard-node workspaces/scorecard/plugins/scorecard-node minor v4.2.0

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.38%. Comparing base (ee6947c) to head (dbd9df2).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4339      +/-   ##
==========================================
- Coverage   61.38%   61.38%   -0.01%     
==========================================
  Files        2520     2520              
  Lines      100936   100932       -4     
  Branches    28304    28305       +1     
==========================================
- Hits        61958    61955       -3     
+ Misses      38427    38426       -1     
  Partials      551      551              
Flag Coverage Δ *Carryforward flag
adoption-insights 84.55% <ø> (ø) Carriedforward from ee6947c
ai-integrations 73.13% <ø> (ø) Carriedforward from ee6947c
app-defaults 69.79% <ø> (ø) Carriedforward from ee6947c
augment 46.67% <ø> (ø) Carriedforward from ee6947c
boost 79.00% <ø> (ø) Carriedforward from ee6947c
bulk-import 72.79% <ø> (ø) Carriedforward from ee6947c
cost-management 13.55% <ø> (ø) Carriedforward from ee6947c
dcm 67.21% <ø> (ø) Carriedforward from ee6947c
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from ee6947c
e2e-extensions 62.13% <ø> (ø) Carriedforward from ee6947c
e2e-global-header 49.45% <ø> (ø) Carriedforward from ee6947c
e2e-homepage 43.49% <ø> (ø) Carriedforward from ee6947c
e2e-intelligent-assistant 46.68% <ø> (ø) Carriedforward from ee6947c
e2e-orchestrator 50.42% <ø> (ø) Carriedforward from ee6947c
e2e-quickstart 55.21% <ø> (ø) Carriedforward from ee6947c
e2e-scorecard 50.21% <ø> (ø) Carriedforward from ee6947c
e2e-theme 16.36% <ø> (ø) Carriedforward from ee6947c
extensions 56.59% <ø> (ø) Carriedforward from ee6947c
global-floating-action-button 71.18% <ø> (ø) Carriedforward from ee6947c
global-header 66.50% <ø> (ø) Carriedforward from ee6947c
homepage 47.50% <ø> (ø) Carriedforward from ee6947c
install-dynamic-plugins 59.95% <ø> (ø) Carriedforward from ee6947c
intelligent-assistant 75.42% <ø> (ø) Carriedforward from ee6947c
konflux 91.98% <ø> (ø) Carriedforward from ee6947c
lightspeed 69.02% <ø> (ø) Carriedforward from ee6947c
mcp-integrations 83.40% <ø> (ø) Carriedforward from ee6947c
orchestrator 70.87% <ø> (ø) Carriedforward from ee6947c
quickstart 63.74% <ø> (ø) Carriedforward from ee6947c
sandbox 79.56% <ø> (ø) Carriedforward from ee6947c
scorecard 87.36% <100.00%> (+<0.01%) ⬆️
theme 88.91% <ø> (ø) Carriedforward from ee6947c
translations 5.12% <ø> (ø) Carriedforward from ee6947c
x2a 79.20% <ø> (ø) Carriedforward from ee6947c

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee6947c...dbd9df2. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Agent PR ready for human review workspace/scorecard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scorecard: Refactore CatalogRequiredAttributesMetricProvider from number metrics to string metrics

0 participants