Skip to content

feat: deduplicate scorer runs by (repo, subpath) in compute-metrics.yml #9

Description

@srbouffard

Context

The component-aware scoring model (#7) introduced EvaluationUnit — one unit per leaf product (charm/snap), identified by (repo, subpath). Scorers already iterate leaf units internally via build_graph + resolve_leaf_units.

However, the nightly GHA workflow (compute-metrics.yml) still invokes scorers once per root product. If the same charm appears as an inline leaf in two different root products, the scorer runs against that repo twice — wasting API quota and potentially producing divergent results if the repo state changes mid-run.

What needs to change

Update compute-metrics.yml to:

  1. Resolve all leaf evaluation units across all root product YAMLs before dispatching any scorer jobs
  2. Deduplicate by (repo, subpath) — each unique (repo, subpath) pair runs exactly once
  3. Attribute the results back to all root products that reference that leaf when assembling computed files

The scorer Python code already outputs {"leaf-id": {metrics}} dicts and merge_computed.py already reads the leaf_metrics envelope — so the scorer contract is already correct. Only the GHA orchestration layer needs updating.

Acceptance criteria

  • A charm shared by two root products produces exactly one scorer API call per run
  • computed/ files are populated correctly for all root products that reference the shared leaf
  • No regression in nightly scoring for single-leaf products

Notes

  • The resolve_leaf_units() function in engine/graph.py can be used (or called via a small Python helper script) to enumerate all unique leaf units across all product YAMLs
  • This is purely a GHA/orchestration change; no Python engine or scorer logic changes are needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions