Skip to content

feat(ci): repo-scoped ripr badges (#182 PR 2)#232

Merged
EffortlessSteven merged 1 commit into
mainfrom
feat/ripr-repo-scoped-badges-182
May 12, 2026
Merged

feat(ci): repo-scoped ripr badges (#182 PR 2)#232
EffortlessSteven merged 1 commit into
mainfrom
feat/ripr-repo-scoped-badges-182

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Adds the public README badges for ripr and ripr+ as Shields endpoint JSON committed under badges/. Repo-scoped, not diff-scoped — a diff-scoped artifact would read 0 on `main` simply because no diff exists, not because the repo is clean.

What changed

  • cargo xtask repo-ripr-badge-artifacts (new) — runs ripr check --root . --mode ready --format repo-exposure-json, extracts metrics.headline_eligible, maps to a Shields color, writes both endpoint files. Requires ripr on PATH (regenerating with stale numbers is worse than failing loud).
  • badges/ripr.json + badges/ripr-plus.json (new) — initial values committed: 2711 (red).
  • README.md — two new badge images linking docs/ci/ripr.md.
  • docs/ci/ripr.md — new "Repo Badges" section explaining the repo-scoped framing, the Shields URLs, the JSON schema, the regen command, the threshold mapping, and the manual refresh cadence.
  • policy/generated-allowlist.tomlbadges/*.json glob receipted as shields_badge_endpoint.
  • .gitattributesbadges/*.json linguist-generated=true (hides badges from default diff view and language stats).

Threshold mapping (Shields color)

```
0 brightgreen (inbox-zero goal)
1..=99 yellowgreen
100..=999 orange
1000+ red
```

Tunable as Shipper's debt shrinks.

Initial Shipper numbers

Both badges project metrics.headline_eligible = 2711 ⇒ `red`. Differentiating ripr+ to also include unsuppressed test-efficiency findings is upstream territory and deferred.

Refresh cadence

Manual. Run cargo xtask repo-ripr-badge-artifacts locally and commit the regenerated badges in their own PR. The badge is a repo health endpoint, not a PR tax. An optional workflow_dispatch refresh workflow is noted as a future extension but not added here.

Test plan

  • cargo build -p xtask — clean
  • cargo test -p xtask — 21/21 (two new: shields_color_thresholds, write_shields_endpoint_shape)
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • cargo xtask repo-ripr-badge-artifacts locally — generates both endpoints, headline_eligible=2711
  • cargo xtask check-file-policy --mode blocking-allowlist — unreceipted=0 with the new badge files
  • CI green (this PR doesn't change CI-blocking surface; only the badge endpoints + docs)

Scope explicitly excludes (deferred)

Refs #182.

Adds public README badges for `ripr` and `ripr+` as Shields endpoint
JSON committed under `badges/`. Per upstream ripr policy, README badges
must be repo-scoped — a diff-scoped artifact would read `0` on `main`
simply because no diff exists, not because the repo is clean. The
PR-time pilot artifact added in #230 stays diff-scoped and is never
republished as a README badge.

  cargo xtask repo-ripr-badge-artifacts

runs `ripr check --root . --mode ready --format repo-exposure-json`,
extracts `metrics.headline_eligible` (the count of repo seams the
configured `[severity.seams]` policy treats as non-off), maps the
number to a Shields color, and writes both endpoint files. The command
REQUIRES `ripr` on PATH — unlike `cargo xtask ripr-pr` which is
advisory locally, regenerating badges with stale numbers is worse than
failing loud.

Threshold mapping for Shields color:

  0          brightgreen   (inbox-zero goal)
  1..=99     yellowgreen
  100..=999  orange
  1000+      red

Initial Shipper count: 2,711 (red). Both badges currently project the
same count; differentiating `ripr+` to include unsuppressed
test-efficiency findings is upstream territory and deferred.

Receipts and metadata:

  policy/generated-allowlist.toml   `badges/*.json` glob, kind
                                    `shields_badge_endpoint`,
                                    classification `generated`
  .gitattributes                    `badges/*.json` linguist-generated
  README.md                         two new badges (ripr, ripr+) linking
                                    docs/ci/ripr.md
  docs/ci/ripr.md                   new "Repo Badges" section: scope
                                    (repo not diff), Shields URLs,
                                    schema, regen command, threshold
                                    mapping, refresh cadence

Refresh cadence is intentionally manual — the badge is a repo health
endpoint, not a PR tax. An optional workflow_dispatch refresh job is
mentioned as a future extension but not added here.

Tests:

  ripr::tests::shields_color_thresholds       (new)
  ripr::tests::write_shields_endpoint_shape   (new)

21/21 tests passing.
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8efb2e2e-819c-4ea0-aca6-418b22779a06

📥 Commits

Reviewing files that changed from the base of the PR and between d5df7a2 and f6b9b7e.

📒 Files selected for processing (9)
  • .gitattributes
  • CHANGELOG.md
  • README.md
  • badges/ripr-plus.json
  • badges/ripr.json
  • docs/ci/ripr.md
  • policy/generated-allowlist.toml
  • xtask/src/main.rs
  • xtask/src/ripr.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ripr-repo-scoped-badges-182

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@factory-droid

factory-droid Bot commented May 12, 2026

Copy link
Copy Markdown

Droid finished @EffortlessSteven's task —— View job


Droid Review Complete — PR #232

Status:Approved — no actionable findings.

Summary

LGTM — no issues found. The new repo-ripr-badge-artifacts xtask command is correctly implemented with proper error handling, the Shields endpoint JSON is valid, tests cover threshold boundaries and schema requirements, and the configuration entries are consistent with existing patterns.

Validation Details

Check Result
Candidates validated 0
Comments posted 0
Security review Ran

Inspected surfaces: xtask/src/ripr.rs (repo_badge_artifacts, write_shields_endpoint, shields_color), xtask/src/main.rs (command registration), badges/*.json (endpoint schema), policy/generated-allowlist.toml (glob receipt), .gitattributes (linguist-generated).

Residual risk: None identified for this PR scope.

View validated output

@EffortlessSteven EffortlessSteven merged commit 9598b14 into main May 12, 2026
22 checks passed
@EffortlessSteven EffortlessSteven deleted the feat/ripr-repo-scoped-badges-182 branch May 12, 2026 12:21
EffortlessSteven added a commit that referenced this pull request May 12, 2026
* feat(ci): mutation testing PR-time lane + cargo xtask mutants-pr (#182 PR 3)

Adds a label-gated PR-time mutation lane and the xtask wrapper it
invokes, keeping mutation off every PR's hot path while making it cheap
to opt in when warranted.

  cargo xtask mutants-pr --changed [--base origin/main] [--dry-run]

is a thin wrapper around `cargo-mutants` that:

  1. Refuses to run without `--changed`. Whole-workspace mutation is
     intentionally not part of the PR-time lane — that lives in the
     weekly schedule (see docs/ci/test-evidence-lanes.md).
  2. Computes `git diff <base>...HEAD --name-only -- '*.rs'`, filters
     out `tests/` and `benches/` paths (cargo-mutants only mutates
     production source).
  3. Runs `cargo mutants --no-shuffle --file <each-path>` (or `--list`
     when `--dry-run` is passed).
  4. If `cargo-mutants` is missing locally, prints install instructions
     and exits advisory-success rather than erroring. CI installs the
     tool before invoking.
  5. Surfaces `cargo mutants` non-zero exit codes — surviving mutants
     are load-bearing failures, unlike ripr's purely advisory findings.

`.github/workflows/mutation.yml` adds the `mutants-pr` job alongside
the existing `mutants-weekly` job. The PR job's gate:

  if: github.event_name == 'pull_request' && (
    contains(github.event.pull_request.labels.*.name, 'mutation') ||
    contains(github.event.pull_request.labels.*.name, 'full-ci')
  )

The weekly job's crate list stays unchanged (shipper-duration,
shipper-types, shipper-config). Expanding it to the full trust-critical
surface (shipper-core, shipper-encrypt, etc.) is too expensive for a
60-minute job and is its own future rollout step; the policy stays
about routing, not coverage scope.

  xtask/src/mutants.rs          new — 3 unit tests
  xtask/src/main.rs             `mutants-pr` subcommand wiring
  .github/workflows/mutation.yml   two-job split (mutants-weekly +
                                   mutants-pr)
  docs/ci/test-evidence-lanes.md   advisory-routed table + targeted
                                   mutation section updated
  CHANGELOG.md                  Added entry

Tests:

  mutants::tests::install_hint_mentions_cargo_install    (new)
  mutants::tests::args_defaults_are_explicit             (new)
  mutants::tests::changed_requires_the_flag              (new)

24/24 tests passing.

Refs #182 (this is the third PR in the #182 sequence: advisory lane in
#230, --base + projection in #231, badges in #232, mutation scoping
here).

* fix(xtask): wrap mutants-pr doc-comment Behaviour block in fenced code

`<REF>` inside a doc comment is parsed by rustdoc as an invalid HTML tag
under `-D rustdoc::invalid-html-tags` (implied by RUSTDOCFLAGS=-D
warnings on the CI Documentation job). Wrap the whole Behaviour block in
a ```text fence so the angle brackets are literal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant