Adopt the estate CodeScene coverage pattern in generated repos - #32
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 24 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 682f4e701c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| output-path: coverage.xml | ||
| format: cobertura | ||
| artefact-name-suffix: {{ package_name | lower | replace("_", "-") }} | ||
| with-ratchet: 'true' |
There was a problem hiding this comment.
Fix the ratchet pin before enabling it
With with-ratchet enabled here, generated repos rely on the pinned generate-coverage action to restore the main-branch baseline before PR checks. I checked the pinned action at 927edd45ae77be4251a8a18ca9eb5613a2e32cbd: it restores with key: ratchet-baseline-${{ runner.os }}-${{ github.run_id }} and restore-keys: ratchet-baseline-${{ runner.os }}-, but saves with key: ratchet-baseline-${{ runner.os }}. Because GitHub cache restore keys are prefix matches, the saved cache does not start with the restore prefix, so the baseline is never restored and coverage drops compare against the freshly-created 0 baseline. Please bump/fix the action pin or leave the ratchet disabled until the cache keys align.
Useful? React with 👍 / 👎.
Bring generated projects into line with the proven estate coverage recipe (the Python leg pathfound in cmd-mox#190) so repos are born with the CodeScene wiring rather than needing a later onboarding PR. Templated ci.yml (pull-request coverage): - Check out with fetch-depth 0 so a future changed-line cs-coverage check can reach the merge base. - Bump the shared generate-coverage and setup-rust references to 927edd45ae77be4251a8a18ca9eb5613a2e32cbd, keeping a single repo-wide pin. - Guard coverage generation to pull requests (ci.yml also triggers on push, and coverage-main.yml now owns the push-to-main run) and enable the coverage ratchet. - Retain cobertura and coverage.xml, which the shared action mandates for Python and mixed projects. - Drop the bespoke CodeScene CLI install and cs-coverage upload steps from the pull-request job; leave a deferred-gate note explaining that the changed-line check awaits per-project CodeScene enablement. New templated coverage-main.yml (push-to-main upload): - Trigger on push to main plus workflow_dispatch, the latter being mandatory because automerge pushes do not fire push-event workflows. - Set up Python and uv explicitly, generate cobertura coverage with the ratchet, and upload to CodeScene through the guarded shared action so token-less repos skip the upload rather than fail. Add a codescene_project_id copier variable (default empty) surfaced in the deferred-gate note, so the pattern degrades gracefully until a generated repo is onboarded to CodeScene. Update the CI and coverage-main workflow contract tests and their synthetic fixtures to match the new pin, pull-request guard, ratchet input, and push-to-main upload wiring. Incidentally regenerate the committed typos.toml from the current shared en-GB-oxendict dictionary. The upstream dictionary had drifted, which left the required test gate latently red on main and would otherwise block this pull request; the regeneration is what `make spelling` produces in CI.
682f4e7 to
f90bd4c
Compare
|
Incidental fix folded into this PR: regenerated the committed |
Summary
Generated repos are now born with the estate's CodeScene coverage
pattern (the Python leg proven in
cmd-mox#190), so a new
project no longer needs a follow-up onboarding PR to wire coverage.
The change touches the templated workflows only; pins are handled
manually, as with the Dependabot and mutation rollouts.
ci.yml(template/.github/workflows/ci.yml.jinja):checkout gains
fetch-depth: 0; the sharedgenerate-coverageandsetup-rustreferences move to a single repo-wide pin927edd45ae77be4251a8a18ca9eb5613a2e32cbd; coverage generation isguarded to
pull_request(the workflow also triggers on push, nowowned by
coverage-main.yml) and enableswith-ratchet: 'true'; thebespoke CodeScene CLI install and
cs-coverage uploadsteps areremoved from the pull-request job in favour of a deferred-gate note.
Python coverage stays
format: cobertura/output-path: coverage.xmlbecause the shared action rejects lcov for non-Rust projects.
coverage-main.yml(template/.github/workflows/coverage-main.yml.jinja):triggers on
pushtomainplusworkflow_dispatch(mandatory,since automerge pushes do not fire push-event workflows); sets up
Python and uv explicitly; generates cobertura coverage with the
ratchet; and uploads to CodeScene through the guarded shared
upload-codescene-coverageaction (mode: uploaddefault, skippedwhen
CS_ACCESS_TOKENis empty).codescene_project_idcopier variable (copier.yml),default empty, surfaced in the deferred-gate note. Token-less,
id-less generated repos stay green; onboarding is a matter of setting
the secret and the id.
Review walkthrough
main(andmanual dispatches) do. This matches the estate rule that
cs-coverage uploadis accepted solely from analysed branches, andavoids duplicate uploads per commit.
cs-coverage checkgate is intentionally notwired in. CodeScene rejects
cs-coverage checkfor any project whosecoverage-gates configuration is absent — a per-project, UI-side
setting rather than a CI defect. The deferred-gate note records how to
add the guarded
mode: checkstep once a project is onboarded.use_rust) keeps Python detection: itscrate lives under
rust_extension/with no rootCargo.toml, so theshared action's detector still classifies the repo as Python
(cobertura). Both workflows pass
cargo-manifest: rust_extension/Cargo.tomland set up Rust for that variant so theextension is built and measured, mirroring the existing coverage step.
pytest-workersis deliberately left at its default (xdist): thetemplate's own test target already runs
pytest -v -n, so the suiteis xdist-native and needs no serial pin.
contract now asserts the new pin, the
pull_requestguard, and theratchet input; a new
assert_coverage_main_workflow_contracthelpervalidates the push-to-main upload workflow (triggers, guarded upload,
ratchet, and Rust manifest wiring), exercised by both the render tests
and focused unit tests.
Validation
make check-fmt,make lint(ruff + interrogate 100%), andmake typecheck(ty) all pass.pytest tests/test_helpers.py tests/test_parent_ci.py— 19 passed.pytest tests/test_template.py— 11 passed, 3 snapshots unchanged(both pure-Python and Rust variants render valid YAML for
ci.ymland
coverage-main.yml).(
codescene_project_idset) variants; all rendered workflows parse asvalid YAML.
test_typos_rollout::test_committed_config_matches_current_shared_dictionaryfails identically on pristine
main(shared oxendict-base dictionarydrift, environment-dependent);
main's CI is green, confirming itregenerates a matching config in CI. Not touched by this PR.