Skip to content

refactor: keyword-only optional params for Ruff 0.16 lint (prep for #288) - #297

Merged
cryptoxdog merged 1 commit into
mainfrom
claude/ruff016-source-compat
Sep 24, 2026
Merged

cryptoxdog merged 1 commit into
mainfrom
claude/ruff016-source-compat

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

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 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.

Closes #

Fix

refactor: keyword-only optional params for Ruff 0.16 lint (prep for #288)

Risk

  • Low — additive, reversible, no data or contract change — n/a — not this change
  • Medium — touches shared code, config, or a public interface
  • High — breaking change, migration, IAM/network, or irreversible — n/a — not this change

Blast radius: measured paths in Changes by intent
Rollback: revert this PR

Evidence

gate-receipt.json present: schema=l9.pr_gate_receipt.v2 content_digest=1749597710 passed_at=2026-09-23T05:44:18Z
L4 receipt present: phase=release_authorized tree_digest=34ef54b4ce62bec5547b3d54834c77523873781db129b20c66af3ac44d5fdc76 kernel_evidence=evidenced

Gates

  • Regression test added that fails without this fix — n/a — not this change
  • No secrets, tokens, or customer data in code, tests, fixtures, or logs
  • semgrep clean, or findings triaged below — n/a — not this change
  • New IAM / workflow permissions are least privilege and enumerated — n/a — not this change
  • Third-party actions pinned to a full commit SHA — n/a — not this change
  • Public interface change is documented and versioned — n/a — not this change
  • Observability exists for the new path (metric, log, trace, or alert) — n/a — not this change

Reviewer focus

See Changes by intent and Protected-root (if any additive_only path).

Changes by intent

Added

  • n/a

Modified

Deleted

  • n/a

Files touched

  • M agents/cursor/cursor_session_hooks.py
  • M engine/compliance/audit.py
  • M engine/health/enrichment_trigger.py
  • M engine/health/health_report.py
  • M engine/intake/impact_reporter.py
  • M engine/traversal/multihop.py
  • M tests/test_algorithmic_upgrades.py
  • M tests/unit/test_gds_scheduler.py
  • M tests/unit/test_health_engine.py
  • M tests/unit/test_resolver.py
  • M tests/unit/test_signal_weights.py
  • M tests/unit/test_sync.py
  • M tools/auditors/log_safety.py
  • M tools/contract_scanner.py

Commits

Test plan

  • make pr local gate receipt present
  • L4 release receipt present (release_authorized)
  • CI green — not measured by open_pr_after_gate.sh — do not treat as verified

Changed files

  • M agents/cursor/cursor_session_hooks.py
  • M engine/compliance/audit.py
  • M engine/health/enrichment_trigger.py
  • M engine/health/health_report.py
  • M engine/intake/impact_reporter.py
  • M engine/traversal/multihop.py
  • M tests/test_algorithmic_upgrades.py
  • M tests/unit/test_gds_scheduler.py
  • M tests/unit/test_health_engine.py
  • M tests/unit/test_resolver.py
  • M tests/unit/test_signal_weights.py
  • M tests/unit/test_sync.py
  • M tools/auditors/log_safety.py
  • M tools/contract_scanner.py

Generated by Claude Code

)

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
Copilot AI lite review requested due to automatic review settings September 23, 2026 05:44
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

✅ PR reviewable size is within recommended limits

@github-actions

Copy link
Copy Markdown

L9 Audit Harness Report

  • Generated: 2026-09-23T05:44:43.608784+00:00
  • Repo root: /home/runner/work/Cognitive.Engine.Graphs/Cognitive.Engine.Graphs
  • Overall result: ✅ PASSED
  • Exit code: 0

Step Results

Step Status Exit Code Notes
Architecture Audit ✅ Passed 0
Spec Coverage ✅ Passed 0
Contract Wiring ✅ Passed 0

Architecture Audit Findings

Severity Count
🔴 CRITICAL 0
🟠 HIGH 0
🟡 MEDIUM 17
🔵 LOW 0

See artifacts/audit_report.md for full details.

Spec Coverage

  • ✅ Implemented: 37
  • ⚠️ Partial: 9
  • ❌ Missing: 0
  • Total features: 46
Category Implemented Partial Missing Total
gates 10 0 0 10
scoring 7 0 0 7
v1.1_node 2 0 0 2
v1.1_edge 2 0 0 2
v1.1_action 0 2 0 2
v1.1_scoring 1 1 0 2
action_handler 0 6 0 6
gds_algorithm 5 0 0 5
research_pattern 10 0 0 10

See artifacts/coverage_report.md for full details.

Next Steps

All checks passed. Safe to merge.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cryptoxdog
cryptoxdog merged commit ddfafc1 into main Sep 24, 2026
57 checks passed
@cryptoxdog
cryptoxdog deleted the claude/ruff016-source-compat branch September 24, 2026 16:25
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.

3 participants