refactor: keyword-only optional params for Ruff 0.16 lint (prep for #288) - #297
Conversation
) Ruff 0.16 stabilizes PLR0917 (too-many-positional-arguments) and ISC004 under the already-selected `PL` and `ISC` families. #288 moves the toolchain to Ruff 0.16.8; landing these fixes first keeps #288 under the 50-file reviewable-size policy. No rule ignores or excludes are added. PLR0917 (18 sites): parameters that every in-repo caller already passes by keyword become keyword-only (`*`). Required parameters of the engine APIs (AuditLogger.log_*, measure_health_impact, track_conversion_event, MultiHopTraverser) stay positional. Call sites passing more than five positionals were converted to keywords: tools/contract_scanner.py `_rule` (`remediation`, 28 rules), tests/test_algorithmic_upgrades.py `_make_fp`, tools/auditors/log_safety.py `_emit_finding`. ISC004 (3 sites): parenthesize the implicit string concatenations in engine/intake/impact_reporter.py format_impact_summary. Validation: ruff check / format --check clean on 0.15.12 and 0.16.8; mypy engine/ clean; pytest (non-integration, non-performance) 2134 passed; contract scanner clean. Content is byte-identical to the corresponding files on the #288 head (7b3be91). Refs: audit finding F-288-001 (contract work unit R1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JuFGxFjdiHKkGEvxDvADD1
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
✅ PR reviewable size is within recommended limits |
L9 Audit Harness Report
Step Results
Architecture Audit Findings
See Spec Coverage
See Next StepsAll checks passed. Safe to merge. |
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The keyword-only refactors are consistently applied and verified against in-repo call sites, with no remaining positional usage that would cause runtime breakage.
Review effort: Lite
Findings: None
What changed in this PR
This PR prepares the repo for the Ruff 0.16.8 upgrade (#288) by refactoring several functions to use keyword-only optional parameters (and updating affected call sites), addressing newly-enforced lint rules without adding ignores.
Changes:
- Converted selected optional parameters to keyword-only (via
*) to satisfy Ruff PLR0917 / ISC004 expectations. - Updated call sites to pass newly keyword-only arguments explicitly (e.g., audit/log safety reporting and drift test helpers).
- Minor formatting refactor to avoid implicit string concatenation patterns flagged by lint.
| File | Description |
|---|---|
| agents/cursor/cursor_session_hooks.py | Makes optional on_action params keyword-only. |
| engine/compliance/audit.py | Makes optional audit logging params keyword-only across log_* methods. |
| engine/health/enrichment_trigger.py | Makes optional measure_health_impact params keyword-only. |
| engine/health/health_report.py | Makes optional track_conversion_event params keyword-only. |
| engine/intake/impact_reporter.py | Refactors summary string construction for lint-friendly formatting. |
| engine/traversal/multihop.py | Makes optional traverser params keyword-only; makes _execute_hop keyword-only. |
| tests/test_algorithmic_upgrades.py | Updates helper signature/calls to use keyword-only optional args. |
| tests/unit/test_gds_scheduler.py | Makes _job helper options keyword-only. |
| tests/unit/test_health_engine.py | Makes _make_field_health helper options keyword-only. |
| tests/unit/test_resolver.py | Makes _make_spec helper options keyword-only. |
| tests/unit/test_signal_weights.py | Makes _spec_with_dimensions helper options keyword-only. |
| tests/unit/test_sync.py | Makes make_mock_sync_endpoint params keyword-only. |
| tools/auditors/log_safety.py | Makes _emit_finding keyword-only and updates call site accordingly. |
| tools/contract_scanner.py | Makes _rule remediation keyword-only and updates all rule definitions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



Problem
refactor: keyword-only optional params for Ruff 0.16 lint (prep for #288)
Ruff 0.16 stabilizes PLR0917 (too-many-positional-arguments) and ISC004 under the already-selected
PLandISCfamilies. #288 moves the toolchain to Ruff 0.16.8; landing these fixes first keeps #288 under the 50-file reviewable-size policy. No rule ignores or excludes are added.Closes #
Fix
refactor: keyword-only optional params for Ruff 0.16 lint (prep for #288)
Risk
Blast radius: measured paths in Changes by intent
Rollback: revert this PR
Evidence
Gates
semgrepclean, or findings triaged below — n/a — not this changeReviewer focus
See Changes by intent and Protected-root (if any additive_only path).
Changes by intent
Added
Modified
agents/cursor/cursor_session_hooks.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)engine/compliance/audit.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)engine/health/enrichment_trigger.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)engine/health/health_report.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)engine/intake/impact_reporter.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)engine/traversal/multihop.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tests/test_algorithmic_upgrades.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tests/unit/test_gds_scheduler.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tests/unit/test_health_engine.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tests/unit/test_resolver.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tests/unit/test_signal_weights.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tests/unit/test_sync.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tools/auditors/log_safety.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)tools/contract_scanner.py— refactor: keyword-only optional params for Ruff 0.16 lint (prep for chore(deps)(deps): bump the dev-tools group with 2 updates #288)Deleted
Files touched
Commits
Test plan
make prlocal gate receipt presentrelease_authorized)Changed files
Generated by Claude Code