Skip to content

fix(audit): ruff-clean lint and reconcile can_contain docs for #2 - #20

Closed
4444J99 wants to merge 1 commit into
mainfrom
limen/rsb2-audit-fixes
Closed

4444J99 wants to merge 1 commit into
mainfrom
limen/rsb2-audit-fixes

Conversation

@4444J99

@4444J99 4444J99 commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

What this does

Refs #2 (plan steps 1–2; plan comment 6966337195, re-verified claim-by-claim at live main 830d2879 — the plan's own head, unchanged since it was posted). The issue stays open; tag v0.1.0 + release is the owner's call (plan step 3), and closure is Anthony's call. The shared can_contain item means #1 and #2 close together once this lands.

  • Ruff: 7 errors → 0. ruff check --fix src tests fixed I001 x3, RUF022 (__all__ unsorted), UP035 (Sequence from collections.abc), UP045 x2 (X | None). The auto-fix also dropped the now-unused Optional import in container.py and a stray blank line in test_core.py — mechanical consequences of the listed fixes, no behavior change.
  • README Quick Start reconciled with the CLI. The old universe/system pair (functions "all" vs "organized", Jaccard 0, containment refused) is replaced by the CLI smoke path's own framework/bounded-system pair (function="govern" both, porous / semi_permeable, scale_range (0,100) vs scale 1), so the documented example now returns True exactly as rules-system-bound --json reports can_contain: true. Also fixes the stale line saying the command returns status: ok — it returns "status": "runnable".
  • CI now gates the lint. .github/workflows/ci-python.yml gains a Lint step (ruff check src tests) after tests, so the audit's acceptance criterion is enforced by CI instead of honor-system (ruff is already in the dev extras CI installs).

Verification (local, base 830d2879)

  • pytest tests -q: 30 passed (same count as the plan's baseline).
  • ruff check src tests: clean, exit 0 (was 7 errors, all auto-fixable, exactly the plan's list).
  • README Quick Start snippet runs verbatim from a checkout; the new pair returns True.
  • rules-system-bound --json: status: "runnable", can_contain: true, version: "0.1.0".
  • ci-python.yml parses; steps are checkout, setup-python, install, tests, Lint, smoke path.
  • No tags or releases exist for the repo (verified live) — step 3 stays the owner's call.

Note on the plan

The plan (posted 2026-11-17) predates the plan-status rule, so it carries no status paragraph; it is treated here as one take, not a solidified plan. Every load-bearing claim was re-verified against live source at build time and held; the only deviation is the count note above (ruff's --fix run reports 9 fixed items vs the 7 diagnostics — the extra two are the Optional import and blank-line removals shown in the diff). No rules change was made: the README example was aligned to the rules, per the plan's minimal-fix option.

Merge

Draft PR. Merge is Anthony's call. CI verdict at the exact head is the batch's independent check.

Summary by Sourcery

Enforce clean linting in CI and align the README examples with the current CLI containment behavior.

Bug Fixes:

  • Align the README Quick Start example and CLI status documentation with the actual runnable containment behavior.

Enhancements:

  • Clean up Ruff-reported lint issues and standardize import ordering and modern type annotations.

CI:

  • Add Ruff lint checks to the Python CI workflow.

Documentation:

  • Reconcile the Quick Start and CLI output documentation with the current smoke path.

Refs #2 (plan comment 6966337195, re-verified claim-by-claim at live main
830d287 — the plan's head, unchanged). Plan steps 1-2; step 3 (tag v0.1.0
+ GitHub release) is the owner's call and is not attempted here.

- ruff: all 7 errors fixed via `ruff check --fix` (I001 x3, RUF022, UP035,
  UP045 x2); the auto-fix also dropped the now-unused `Optional` import in
  container.py and a stray blank line in test_core.py. `ruff check src
  tests` now exits 0.
- README Quick Start: the universe/system example pair (functions "all"
  vs "organized", Jaccard 0) is replaced by the CLI smoke path's own
  framework/bounded-system pair (function="govern" both, porous /
  semi_permeable, scale_range (0,100) vs scale 1), so the documented
  example now returns True exactly as `rules-system-bound --json` reports
  `can_contain: true`. Also fixes the stale "status: ok" line — the
  command returns `"status": "runnable"`.
- .github/workflows/ci-python.yml: new `Lint` step (`ruff check src
  tests`) after tests, so the audit's acceptance criterion is gated by CI
  instead of honor-system (ruff is in the dev extras CI already installs).

Local verification at base 830d287: pytest 30 passed; ruff clean;
README Quick Start snippet runs verbatim and returns True; CLI --json
status "runnable", can_contain true, version 0.1.0; ci-python.yml parses.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@sourcery-ai

sourcery-ai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Update Container’s optional parent annotations to use the modern union syntax while preserving its public structure.

  • src/rules_system_bound/container.py L6, L28, L49

API

Reorder package imports and all entries to satisfy Ruff without changing the exported public API.

  • src/rules_system_bound/__init__.py L8-17, L33-38 (+4 small edits)

Implementation

Use collections.abc for Sequence in the CLI module to satisfy Ruff’s import rules.

  • src/rules_system_bound/cli.py L7-8

Configuration

Add a CI lint step so Ruff checks the source and tests on each workflow run.

  • .github/workflows/ci-python.yml L29-31

Documentation

Align the README Quick Start containment example with the CLI smoke path and correct the documented status value.

  • README.md L37-51, L56-59, L86

Tests

Reorder imports and remove an extra blank line in the tests to satisfy Ruff without changing test behavior.

  • tests/test_container_relationships.py L9
  • tests/test_core.py L10-17, L20 (removed lines)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@4444J99

4444J99 commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Superseded — closing this loop draft PR, no merge.

Anthony merged #21 (README Quick Start containment result, closes #1) and #22 (ruff 7 auto-fixes + Lint gate in ci-python.yml, closes #2) himself at 18:23 / 18:43 EST, both on non-loop branches (docs/readme-quick-start-containment-result-1, ci/ruff-gate-2). Both issues are closed live; main is now db1b9878, checks test (3.10/3.11/3.12) + Dependabot 4/4 SUCCESS. This PR's content (same ruff fixes, same Lint step, same README alignment) is on main via #22, and the branch is now mergeable=false against the moved main. Tag v0.1.0 + release remains his call. Receipt: ranked-queue-build 2026-11-28 22:15 run.

@4444J99 4444J99 closed this Nov 29, 2026
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