fix(ci): restore default-branch template validation and cruft updates - #110
fix(ci): restore default-branch template validation and cruft updates#110williaby wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe Cruft workflow now uses an isolated Python 3.12 environment. Post-generation helpers and rate-limit middleware configuration now require keyword arguments. ChangesCruft workflow environment
Keyword-only Python interfaces
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The workflow and keyword-only interface updates are internally consistent, with no actionable merge-blocking risk identified. Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are targeted, internally consistent (signatures + call sites updated), and directly resolve the stated CI failures without introducing broader behavioral changes.
Pull request overview
This PR restores CI stability in this cookiecutter template repo by addressing two “main went red due to environment/tooling drift” failures: Ruff’s now-stable PLR0917 rule and Ubuntu runner PEP 668 restrictions impacting the scheduled cruft update workflow.
Changes:
- Fixes Ruff
PLR0917by converting high-arity helper functions and middleware tuning parameters to keyword-only arguments (instead of suppressing lint). - Updates hook call sites to use keyword arguments to match the new keyword-only signatures.
- Fixes
cruft-update.ymlon Ubuntu 24.04+ by creating a uv-managed venv underRUNNER_TEMP, installing dependencies into it, and ensuring subsequentpythoninvocations use that interpreter.
File summaries
| File | Description |
|---|---|
| hooks/post_gen_project.py | Makes helper functions keyword-only and updates the internal call sites accordingly to satisfy Ruff PLR0917. |
| {{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/middleware/security.py | Makes RateLimitMiddleware tuning parameters keyword-only (preserving the existing keyword-based usage). |
| .github/workflows/cruft-update.yml | Reworks dependency installation to use a uv venv (avoids PEP 668 externally-managed system Python installs) and keeps later python steps using that venv. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Two independent default-branch CI failures, both reproducible on main.
1. ruff stabilised PLR0917 (too-many-positional-arguments), which fires on
three call surfaces that predate the rule. validate-template.yml installs
ruff unpinned, so the new rule landed on main without a code change and
broke "Validate Cookiecutter Template / validate (3.10-3.14)" plus
"Test Template / Integration Tests (api-service)" and "Test Summary" on
every open PR.
Fixed at the source rather than suppressed: the affected helpers now take
keyword-only arguments, which is ruff's documented remedy for PLR0917.
- hooks/post_gen_project.py: _collect_optional_features (11 positional)
and _print_developer_tool_integrations (7 positional); both call sites
updated to keyword form.
- generated project middleware: RateLimitMiddleware.__init__ tuning
parameters (5 positional). The only in-template call site already used
keyword arguments, so generated projects are unaffected.
Verified locally with ruff 0.16.5 (the version CI resolved): ruff check
and ruff format --check pass on hooks/, basedpyright passes on hooks/,
and all seven fixture configurations generate and pass ruff check.
2. cruft-update.yml installed into the runner's system interpreter with
uv pip install --system. Ubuntu 24.04 images mark that interpreter
externally managed (PEP 668), so uv refuses and the scheduled job has
failed daily. Both jobs now build a dedicated uv venv under RUNNER_TEMP
and prepend it to PATH.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1c3342d to
fe1da5e
Compare
Why
Two independent CI failures originate on
main, not in any PR. Both are visiblein the check rollup of every open PR in this repo.
1. ruff PLR0917 breaks template validation and integration tests
validate-template.ymlinstalls ruff unpinned (pip install cookiecutter ruff basedpyright). ruff stabilisedPLR0917(too-many-positional-arguments), so aruff release, not a code change, turned
mainred.Evidence, run
33684401670, jobvalidate (3.12):Evidence, run
33684401693, jobIntegration Tests (api-service):Affected contexts on every PR:
validate (3.10)throughvalidate (3.14),Integration Tests (api-service), andTest Summary.2. cruft-update.yml cannot install its dependencies
uv pip install --system cruft pyyamltargets the runner's system interpreter,which Ubuntu 24.04 marks externally managed (PEP 668). Run
33722728236:The scheduled job has failed on every daily run for weeks.
What changed
PLR0917, fixed at the source, not suppressed. ruff's documented remedy is to
make the excess parameters keyword-only, so that is what this does:
hooks/post_gen_project.py:_collect_optional_featuresand_print_developer_tool_integrationsare now keyword-only; both call sites inthe same file were updated to keyword form.
{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/middleware/security.py:RateLimitMiddleware.__init__tuning parameters are keyword-only. The onlyin-template call site (
add_security_middleware, viaapp.add_middleware)already passed them by keyword, so generated projects are unaffected.
No
# noqa, no rule added toignore, nocontinue-on-error.PEP 668. Both jobs in
cruft-update.ymlnow create a uv venv underRUNNER_TEMPand prepend itsbintoGITHUB_PATH, so the later barepythoninvocations resolve to an interpreter that actually has
cruftandpyyaml.Verification
Reproduced and re-verified locally with ruff 0.16.5, the version CI resolved:
ruff check hooks/andruff format --check hooks/: pass (failed before).basedpyright hooks/: 0 errors. Worth noting: this step never ran in CIbefore, because
ruff checkaborted the sharedrun:block first.minimal,cli-app,api-service,ml-project,full-featured,frontend-react,supply-chain) and ranruff check .in each: all pass.pre-commit run --all-files: all 25 hooks pass.actionlintandyamllintoncruft-update.yml: clean, only pre-existingwarnings.
The cruft workflow change cannot be exercised locally; it is scheduled-only and
will be confirmed by the next daily run after merge.
Out of scope
validate-template.ymlinstallscookiecutter,ruff, andbasedpyrightunpinned, which is why a tool release could break
mainwith no commit. Pinningthem is worth doing but is a separate decision and is not part of this PR.
Generated with Claude Code
Summary by CodeRabbit
Chores
Refactor