You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo-anvil uploads coverage from several independent platform jobs, but Codecov can publish intermediate PR coverage comments before all generated reports arrive. Existing repositories also should not need to configure duplicate project and patch coverage gates themselves.
What this changes
Keep the existing per-platform coverage uploads and flags.
Derive comment.after_n_builds from the generated PR coverage matrix so Codecov waits for every expected upload before updating the PR comment.
Generate a repository-owned codecov.yml policy that keeps Codecov comments informative by disabling duplicate Codecov project and patch merge statuses, while preserving unrelated settings.
Refuse ambiguous YAML, merge-key migrations, catalog-owned configuration collisions, and unsynchronized customized workflows without replacing repository content.
Release the catalog change as cargo-anvil 0.30.0 and regenerate the repository workflows, snapshots, manifest, README, changelog, and lockfile.
The new behavior remains unpublished until the cargo-anvil 0.30.0 release runs after merge.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues can suppress Codecov notifications for customized workflows and tokenless runs, while default configuration creation can overwrite catalog-owned settings and invalidate manifest checksums.
This PR coordinates Codecov reporting across cargo-anvil’s GitHub coverage jobs, keeping Codecov informational while Anvil remains the coverage merge gate.
Changes:
Adds final PR and scheduled notification jobs while retaining per-platform uploads.
Introduces repository-owned Codecov policy updates, migration safeguards, and regression coverage.
Prepares cargo-anvil 0.30.0 with updated documentation and regenerated artifacts; publication follows release after merge.
Generated during preparation, before the review. Completeness questions are preliminary, not verified findings or a merge recommendation. This snapshot is not updated by later review work.
Oxidizer Tools provides utilities for building and validating Rust services. cargo-anvil gives Rust repositories a common local verification interface and generates matching CI infrastructure for GitHub Actions and Azure DevOps. Its coverage check evaluates the released library and binary surfaces; Codecov displays coverage data from the GitHub runs.
Substance
This change coordinates Codecov reporting across the GitHub pull request and scheduled coverage matrices. Anvil keeps the individual platform uploads, then asks Codecov to notify once the matrix finishes. It also creates or updates the repository's Codecov policy to request manual notification and disable duplicate project and patch statuses. The local coverage gate still determines the coverage verdict. The Azure DevOps backend is unchanged.
Design changes
Coverage notification timing. The previous GitHub coverage design specified best-effort per-platform uploads and an authoritative local gate. The workflows did not explicitly trigger notifications after the matrix. The updated design retains the uploads and adds a best-effort final trigger that can run after matrix failure but not after cancellation or a skipped matrix. This bases notification timing on job completion rather than a fixed upload count.
Policy and ownership. Previously, Anvil did not configure Codecov YAML; the repository's own codecov.yml specified a project coverage target. The updated GitHub design specifies one repository-owned YAML file with manual notification enabled and both Codecov statuses disabled, while preserving unrelated settings. The planner enables the policy only when both implementation workflows are in sync or can be written from the catalog; customized workflows can be reconciled via Anvil's proposal mechanism. The update design documents this as a repository-owned policy edit, like the existing Dependabot exclusions, rather than a file tracked by Anvil's ownership manifest.
Significant changes
No separate significant behavior changes beyond those covered by the design changes above.
Structure
Update planning and editing:crates/cargo-anvil/src/run.rs discovers the configuration, checks backend and workflow compatibility, and plans the write. The new crates/cargo-anvil/src/codecov.rs supplies the default policy, edits existing YAML, and tests preservation, idempotence, and refusals.
CI: The PR and scheduled implementation templates under crates/cargo-anvil/templates/github/ add the notification jobs. Their checked-in copies under .github/workflows/ and the GitHub backend snapshot reflect the same wiring. src/anvil/artifacts/github.rs adds checks for the template wiring, and src/run.rs tests fresh setup, existing policy migration, and customized workflows. Root codecov.yml applies the policy in Oxidizer Tools itself.
Documentation and release metadata: The design updates describe the coordination and ownership rules. The crate documentation in src/lib.rs and the generated crate README describe the public behavior. The crate manifest, workspace lockfile, release notes, and .anvil/manifest.toml record version 0.30.0; the Anvil manifest also records the new catalog and implementation-workflow checksums.
Mechanism
On GitHub backend updates, the planner checks that the active catalog manages both implementation workflows and that each is either in sync or planned for writing. It then looks for codecov.yml and .codecov.yml in the root, dev/, and .github/. If none exists, it writes a root default. If exactly one eligible file exists, it plans only the needed edits. Multiple candidates, conflicting catalog ownership, or unsupported YAML produce a refusal instead of an edit to the policy file.
The editor uses parser source spans to change codecov.notify.manual_trigger, coverage.status.project, and coverage.status.patch. It preserves unrelated source text instead of serializing the document, reparses the result, and returns no change when the policy is already present. Anvil does not record a whole-file checksum for this policy write.
Native test matrix (PR or scheduled)
├─ Linux, Windows, Linux ARM: upload both LCOV reports if present
└─ Windows ARM: tests only
│ matrix completes
▼
One Linux notification job
│ best-effort trigger
▼
Codecov coverage display
The notification job calls the pinned Codecov action's send-notifications command using the same CODECOV_TOKEN input as the uploads. The unchanged callers inherit secrets; the workflow does not enable Codecov OIDC. A failed matrix can reach the notification job, but a skipped matrix or canceled workflow does not. The job does not require the matrix to report a successful upload. Neither reporting step supplies the coverage verdict.
Completeness assessment
The diff connects the policy editor, planner, generated workflows, repository configuration, tests, and documentation. No unfinished implementation or missing generated counterpart is apparent. The static evidence does not establish Codecov's live response to the new job. Review should check:
Does the pinned action resolve the same commit, repository, and authentication for the standalone notification as for the uploads, including fork PRs, merge groups, and scheduled runs? How does Codecov handle a trigger with no accepted report or with reports still being processed?
Does configuration discovery and editing preserve unrelated settings across supported file locations and layout variants, especially document markers, comments next to edited fields, and shared YAML structures?
Do upgrades with proposed workflow changes, already-enabled policy, or independent upload jobs preserve the intended ordering? Does disabling either Codecov status require a separate change to any consumer repository's required checks?
The feature commit adds Codecov coordination; the source commit packages it as cargo-anvil 0.30.0 and synchronizes the generated metadata.
Related work
The previous workflow let separate platform jobs upload as they finished, without a shared notification point. The repository's Codecov project threshold also supplied a coverage status alongside the Anvil gate. The patch addresses both in the GitHub backend. No separate work item or removed TODO is identified in the feature commits or changed implementation.
ℹ️ Replies are not monitored. To discuss the comment, reach out via Teams.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The published crate includes a test with an unavailable compile-time input, while Codecov planning can mishandle retired configurations and miscount upload jobs.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The upload-count logic treats unsupported matrix conditions as valid, producing after_n_builds: 4 when only one leg uploads and leaving the PR comment waiting indefinitely.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject unsupported upload-condition predicates to avoid incorrect build counts
crates/cargo-anvil/src/codecov.rs:73
With the four-platform matrix, a downstream upload condition using matrix.os == 'linux' and the existing report guards returns Some(4) here, although only one leg uploads. Anvil consequently writes after_n_builds: 4, leaving the PR comment waiting for uploads that cannot arrive. Validate every condition clause against a supported grammar and return None for unknown predicates; add regressions for equality restrictions and disjunctions.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because condition parsing can make Codecov wait for uploads that cannot arrive, while bare-CR YAML handling can silently leave statuses enabled.
❌ Patch coverage is 99.38776% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.5%. Comparing base (bc0d1de) to head (eae6f14). ⚠️ Report is 1 commits behind head on main.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because platform-restricted conditions can overcount expected uploads and leave Codecov waiting indefinitely, while negative tests do not verify the intended failure causes.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because an interaction between configuration ownership and workflow validation can make dry runs fail even when all artifacts are synchronized.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The test’s substring and idempotence assertions can pass even when unrelated settings move between mappings, leaving the source-preservation contract insufficiently verified.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because unpublished findings identify persistent dry-run failures for catalog-owned policies and empty Codecov files that subsequent updates refuse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Copilot speaking]
Motivation
cargo-anvil uploads coverage from several independent platform jobs, but Codecov can publish intermediate PR coverage comments before all generated reports arrive. Existing repositories also should not need to configure duplicate project and patch coverage gates themselves.
What this changes
comment.after_n_buildsfrom the generated PR coverage matrix so Codecov waits for every expected upload before updating the PR comment.codecov.ymlpolicy that keeps Codecov comments informative by disabling duplicate Codecov project and patch merge statuses, while preserving unrelated settings.The new behavior remains unpublished until the cargo-anvil 0.30.0 release runs after merge.
Closes #421