feat(ci-health): codify a precise, reproducible governed-fleet CI-health sweep#2733
Merged
rysweet merged 4 commits intoJul 6, 2026
Conversation
…lth sweep
The CI-health stewardship goal was run each cycle by hand-rolling
`gh run list`, which cannot distinguish an actionable active-CI failure
from a disabled/cancelled non-failure. That ambiguity produced imprecise,
un-evidenced claims — e.g. "every workflow's latest run is success" when a
governed repo's latest default-branch runs are actually `failure`, on
workflows that had been manually disabled.
Add `simard::ci_health`: a pure classifier that carries workflow enablement
state alongside the latest default-branch run conclusion and labels each
workflow green / actionable_failure / ignored(reason). The fleet is green iff
there are zero actionable failures. Disabled workflows, cancelled/skipped/
in-progress runs never fail the fleet; an active workflow whose latest run
genuinely failed always does.
- src/ci_health/: types, pure classify, gh collector (trait + RealGhWorkflowClient
+ pure parse/join helpers + offline fixture loader), human/JSON report.
- `simard ci-health [--json] [--from-json <path>]` operator subcommand; exit 0
iff the fleet is green (mirrors `self-health`).
- error: add CiHealthGhCommandFailed.
- docs/reference/ci-health-sweep.md (+ mkdocs nav).
- tests/gadugi/ci-health-sweep.{sh,yaml} + fixtures encoding the real signal
classes (azlin disabled failures, kgpacks cancelled, Simard in-progress, and
a synthetic active failure) — deterministic, offline.
Verified against the live fleet: CI-HEALTH: GREEN, 63 workflows across 10 repos,
0 actionable failures.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… branch window Quality-audit finding (Medium, false-negative): the sweep fetched a single branch-wide window of the 200 most-recent runs and derived each workflow's latest run from it. An infrequently-triggered active workflow whose last (failing) run fell outside that window had zero rows in it, so the join produced NoRun and it was silently ignored — a genuine active-CI failure could be reported as a green fleet. If a workflow appears in the window at all, its newest row is its true latest run, so only workflows entirely absent from the window are at risk. Fetch the latest run directly (`gh run list --workflow <id> --limit 1`) for exactly those active workflows. Disabled workflows are skipped (ignored by state regardless). - gh.rs: RawWorkflowRow gains `id`; list_workflows fetches name,state,id; new GhWorkflowClient::latest_run; collect_fleet fills missing active-workflow runs. - tests: regression test collect_fleet_falls_back_for_active_workflow_missing_from_window proves an out-of-window active failure surfaces as actionable, an in-window workflow is not re-queried, and a disabled one is skipped. - docs updated to describe the fallback query. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lay name Quality-audit finding (Medium, false-negative): runs were matched to workflows by display name (`workflowName`), which GitHub does not guarantee unique across workflow files. Two workflows sharing a `name:` collapsed onto a single run (the newest of the two), so a failing sibling could be reported Green — and the id-based out-of-window fallback was skipped because latest_run was already (wrongly) filled. Match on the unique `workflowDatabaseId` instead: add it to RawRunRow and the `gh run list --json` field lists, key `latest_run_by_workflow` and the `build_repo_snapshot` join by workflow id. Renamed-but-not-since-run workflows still resolve via the id fallback. Regression test build_repo_snapshot_keys_by_id_so_same_named_workflows_dont_collapse proves two same-named workflows keep distinct verdicts (green vs actionable). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…stream fix) A new advisory issued 2026-07-06 turns cargo-audit/cargo-deny red fleet-wide: crossbeam-epoch's fmt::Display impl for Atomic/Shared dereferences a null pointer. There is NO patched release upstream, and the crate is transitive (simard -> rustyclawd-tools -> moka -> crossbeam-epoch). The faulty path only runs when Display-formatting a null crossbeam Atomic/Shared, which Simard never does, so it is unreachable in our usage. Per the documented advisory policy (deny.toml [advisories]; precedent RUSTSEC-2023-0071/rsa), add a justified per-ID ignore in both deny.toml and .cargo/audit.toml, and record the second permanent exemption in docs/reference/dependency-trust-policy.md. Restores green supply-chain CI. `cargo deny check` → advisories/bans/licenses/sources ok; `cargo audit` → exit 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📊 Coverage Summary
Coverage data from CI run. Test files matching |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Advances the standing CI-health stewardship goal by fixing the measurement instrument, not by fabricating a fix against a green fleet.
I grounded this cycle in real CI state rather than trusting the prior cycle's narrative. The naive hand-rolled
gh run listsweep cannot distinguish an actionable active-CI failure from a disabled/cancelled non-failure — which is exactly why prior "every workflow's latest run issuccess" claims were imprecise and reviewer-rejected. Concretely, the live sweep shows azlinmainhas 7 workflows whose latest run isfailure— but every one isdisabled_manually(turned off ~2026-06-15), and agent-kgpacks' "Build Knowledge Pack" latest run is a non-failure (cancelled/skipped). A sweep that reads only run conclusions either mislabels those as failures or falsely claims "all success."This PR codifies the sweep so its verdict is precise, reproducible, and evidence-producing.
What changed
src/ci_health/— a pure classifier that carries workflow enablement state alongside the latest default-branch run conclusion and labels each workflowgreen/actionable_failure/ignored(reason). Disabled workflows, cancelled/skipped/neutral/action_required/stale runs, and in-progress runs never fail the fleet; an active workflow whose latest completed run concludedfailure/timed_out/startup_failurealways does. The fleet is green iff zero actionable failures. Includes a pluggableGhWorkflowClient(liveghvs. offline fixture) so classification is deterministic and offline-testable.simard ci-health [--json] [--from-json <path>]operator subcommand (mirrorsself-health); exit code0iff the fleet is green.error: newCiHealthGhCommandFailedvariant (+ display + test).docs/reference/ci-health-sweep.md(+ mkdocs nav).tests/gadugi/ci-health-sweep.{sh,yaml}+ fixtures encoding the real signal classes.Substantive verdict (this cycle)
Live sweep result:
CI-HEALTH: GREEN— 63 workflows across 10 governed repos + Simard, 0 actionable failures. The only non-green latest-runs are azlin's 7 disabled workflows and agent-kgpacks' cancelled/skipped run — correctly classifiedignored, not failures. There is no failing default-branch workflow to fix this cycle; the deliverable is the codified, verifiable sweep that makes that conclusion reproducible.Merge-ready evidence
1. qa-team scenarios (validated + run)
tests/gadugi/ci-health-sweep.yaml(outside-in, offline fixtures).gadugi-test validate -f tests/gadugi/ci-health-sweep.yaml→✓ Scenario "CI-health governed-fleet sweep" is valid(1 valid, 0 invalid).gadugi-test run -d tests/gadugi -s ci-health-sweep→✓ Passed: 1 ✗ Failed: 0."green": true).src/ci_health/tests.rs(+ 1 error-display test) all pass:cargo test --lib -- ci_health:: display_ci_health→28 passed; 0 failed(ci_health + error-display). Cover: disabled+failure→ignored, active+failure→actionable, cancelled/skipped→ignored, no-run/in-progress→ignored, latest-run-by-createdAt selection, workflow↔run join, empty-conclusion→None,collect_fleetvia fake client, fixture round-trip.2. Docs updated for user-facing surfaces
simard ci-healthsubcommand. Documented indocs/reference/ci-health-sweep.md(front-matter compliant) and added tomkdocs.ymlnav + the operator CLI--helptext.mkdocs build --strict→Documentation builtwith 0 broken links, 0 orphaned nav pages (verify-docs T3/T4/T7 all PASS).4. CI green (local pre-push mirror of CI verify.yml)
All pre-push gates passed on push:
cargo fmt --all -- --check: Passedcargo test --release --librace subset: Passedcargo clippy --all-targets --all-features --locked -- -D warnings: Passedcargo build(default),cargo build --release --bin simard --no-default-features --locked(issue Make Simard's cargo features build BY DEFAULT so no functional capability is opt-in. Operator directive: "none of the features need to be opt-in in the future." One coherent merge-ready PR against rys #2576 contract): Passed.Supply-chain note (required for green CI): a new advisory RUSTSEC-2026-0204 (crossbeam-epoch
fmt::Displaynull-ptr deref) was issued 2026-07-06 and turnedcargo-audit/cargo-denyred fleet-wide (not caused by this change — no deps were modified; my first push passed these). It has no upstream fix and is transitive (simard→rustyclawd-tools→moka→crossbeam-epoch), unreachable in Simard (we neverDisplay-format crossbeam pointers). Per the repo's documented advisory policy (precedentrsa/RUSTSEC-2023-0071), added a justified per-IDignoreindeny.toml+.cargo/audit.tomland recorded it indocs/reference/dependency-trust-policy.md. Local:cargo deny check→ advisories/bans/licenses/sources ok;cargo audit→ exit 0.6. Focused diff
+1614 lines, 18 files, all under
src/ci_health/,src/operator_cli/,src/error/(additive variant),docs/,tests/gadugi/, and one nav line inmkdocs.yml. The only edits outside the ci_health feature are the RUSTSEC-2026-0204 supply-chain exemption (deny.toml,.cargo/audit.toml,dependency-trust-policy.md) — a required, justified, fleet-wide advisory remediation without which CI cannot be green; it follows the repo's documented advisory policy.3. quality-audit (≥3 SEEK→VALIDATE→FIX cycles, ended clean)
Independent code-review passes over the full diff:
gh run list --limit 200branch-wide window could drop an infrequently-triggered active workflow's latest run, misclassifying itNoRun→ false green. Fix: query the latest run per active workflow absent from the window (gh run list --workflow <id> --limit 1). Regression testcollect_fleet_falls_back_for_active_workflow_missing_from_window.name:collapsed onto one run, hiding a failing sibling → false green. Fix: key the join on the uniqueworkflowDatabaseId. Regression testbuild_repo_snapshot_keys_by_id_so_same_named_workflows_dont_collapse.Command::args, no shell; hardcoded slugs; discrete argv), exhaustive errorDisplaymatch, correct exit-code path.Ended on a clean cycle. 21 unit tests pass.
Reproduce