Skip to content

Add a Coverage Shield Class for Repositories That Upload Coverage #3692

Done

Description

@ptr727

Proposal

Add a coverage shield class to spec/readme-sections.json, so the README audit expects a Codecov coverage badge in "Build and Distribution > Build Status" wherever the hub already produces coverage data.

Why

The reusable validate-task.yml already runs tests and uploads a Cobertura report to Codecov in every repository that has a .NET test project (its .NET steps run under hashFiles('**/*Tests*.csproj') != '', and the upload is report-only with fail_ci_if_error: false). The data exists fleet-wide, but shieldClasses declares no shield that surfaces it, so a repository adding the badge is doing so outside the spec, and one omitting it is never told.

Shape

  • name: coverage
  • trigger: the same condition the upload runs under, a repository carrying a test project. No trigger kind for that exists today (always and publish are the two in use), so this likely needs a new trigger kind.
  • shields: one entry, label "coverage", match /codecov/c/github/, in "Build and Distribution > Build Status", reporting the default branch like the other Build Status shields.

Open points

  • CODECOV_TOKEN is optional and the upload is best-effort, so a repository without the token may have no Codecov project and the badge would render "unknown". The trigger may need to be narrower than "has a test project", or the class may need to be optional.
  • Python test projects: whether the Python side uploads coverage the same way decides whether the trigger covers them.

Raised from ptr727/PlexCleaner#1106, which added the badge to that repository's README.

Activity

  1. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Decision needed (decision triage, 2026-11-01)

    Question: When spec/readme-sections.json gains a coverage shield class (a Codecov badge in "Build and Distribution > Build Status"), which repositories should it apply to: a new "has a test project" trigger kind, a narrower trigger, or an optional class, given CODECOV_TOKEN is optional?

    Options, recommended first:

    1. Reuse the existing secret trigger on CODECOV_TOKEN (recommended): The audit already supports this trigger kind and the registry already marks the right repositories, so it is one JSON entry with no new code, covering Python and C#. The 15 repositories declaring the secret (the hub among them) each get a LETTER finding until their README carries the badge. No work in flight.
    2. Add a new "has a test project" trigger kind: Matches where the upload runs, but needs new audit code reading each repository tree over the API plus a schema change, and does nothing for the "unknown" badge on a repository with no token. No work in flight.
    3. Make the class optional: The shield model has no optional flag (only sections do), so it needs a new field, and leaves a missing badge unreported, the gap the issue was filed for. No work in flight.
    4. Decline, keep the badge outside the spec: Repositories adding it (as PlexCleaner#1106 did) keep doing so ad hoc, and one omitting it is never told. No work in flight.

    Evidence: The issue says only always and publish trigger kinds exist, but secret is already in spec/readme-sections.schema.json:117, and spec/audit_markdown.py:542 evaluates it against registry requiredSecrets (since #632, unused by any class). spec/secrets.json:39: a csharp or python repo carrying tests lists CODECOV_TOKEN. In registry/repos.json the 15 repositories declaring it are exactly the 15 csharp or python ones. WORKFLOW.md D1.6 covers Python upload too. The hub's own README has no codecov shield.

    Blocks: none

  2. added
    decision
    on Nov 1, 2026
  3. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer (decision triage, 2026-11-01): Option 1: the coverage shield class uses the existing 'secret' trigger kind on CODECOV_TOKEN, so it applies to repositories whose registry requiredSecrets lists it. This is now work for the next burndown round.

  4. removed
    decision
    on Nov 1, 2026
  5. ptr727 commented on Nov 3, 2026

    @ptr727
    OwnerAuthor

    Decided (maintainer, 2026-11-03)

    Both open points are settled. The issue is ready to implement.

    1. Trigger: a new coverage trigger kind. It is true where the audit's existing coverage_types (spec/audit.py) is non-empty, meaning a declared csharp or python type whose tests exist in the tree. That predicate already decides whether a repo owes codecov.yml and CODECOV_TOKEN. One predicate for all three keeps the badge, the config, and the token from disagreeing. It covers Python as well as .NET, so the issue's Python open point is answered too. The secret kind (trigger on CODECOV_TOKEN being configured) and a registry opt-in were both declined. Under either one, a repo that should carry the badge is never told it owes one.
    2. Severity: required. A missing coverage badge is a readme finding, like the other shield classes. spec/secrets.json typeMechanisms already requires CODECOV_TOKEN of every such repo whatever it opts into, and the audit reports a missing token. So a badge rendering "unknown" points at a token defect already reported elsewhere. It is no reason to make the class optional.

    The issue's shape stands otherwise. The shield entry is label "coverage", match /codecov/c/github/, in "Build and Distribution > Build Status", against the default branch. The schema's trigger kind enum in spec/readme-sections.schema.json gains coverage.

    🤖 Generated with Claude Code

  6. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-24): PR #4416 merged to develop at 0b1cf75; branch and worktree cleaned up, so this claim holds no files. The issue closes on promotion.

    Backlog burndown claim (away run 2026-11-24, round 3, refill): branch burndown/coverage-shield-class, issue #3692.

    Per the maintainer's decision of 2026-11-03: a new coverage trigger kind, true where the audit's coverage_types is non-empty, and a required class.

    Predicted files:

    • spec/readme-sections.json, the new coverage shield class (label "coverage", match /codecov/c/github/, in "Build and Distribution > Build Status", default branch).
    • spec/readme-sections.schema.json, the trigger kind enum gaining coverage.
    • spec/audit_markdown.py, the trigger evaluation beside always, publish and secret.
    • spec/audit.py, handing the existing coverage_types predicate to the README check. spec/secret_names.py, which holds that predicate, is read, not edited.
    • spec/readme-structure.md, a Coverage row in the "Shields" table.
    • README.md, the hub's own Build Status badge, only where the hub's audit then owes one (the hub carries .codecov.yml).
    • tests/test_audit_helpers.py, the new trigger for a repository with coverage types and one without.
    • spec/project-types.json, the readme.shields assert text near line 210 (granted 2026-11-24).
    • AUDIT.md near line 95, the readme-structure dimension sentence: granted 2026-11-24 after the Fix the Defects a First Whole-Unit Read of AUDIT.md Section 0 Found, Including Three Checks That Cannot Fire #1613 group merged (PR Correct AUDIT.md Section 0's Account of What the Audit Checks #4413) and released it.

    Any other group needing one of these files waits for this branch to merge.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions