Skip to content

chore(checker): delete dead state, dedupe closure loop, share the test fixpoint - #142

Merged
sims1253 merged 1 commit into
mainfrom
cleanup/checker-dead-code
Aug 31, 2026
Merged

sims1253 merged 1 commit into
mainfrom
cleanup/checker-dead-code

Conversation

@sims1253

Copy link
Copy Markdown
Owner

Summary

Internal cleanup in crates/ry-checker. No behavior change. Net -68 lines.

Changes

  • Project::prev_return_slots was an Option<Vec<RType>> cloned in full on every emit and only tested for presence. Replaced with the has_prev_emit bool. The compared values already live in prev_fn_returns and prev_fn_signatures, keyed by name.
  • compute_fixpoint_scope re-implemented the reverse-caller closure that with_transitive_callers provides 25 lines below. The two loops were line-for-line identical. The method call replaces the copy.
  • The shared test helper check_with_scope replayed collect_fns plus its own fixpoint loop, which skipped quoting propagation and the discarding flag. It now delegates to the public Checker::check_with_scope, so unit tests run the real pass structure.
  • Verdict in tests/rule_evidence.rs carried a rationale field no assertion read. Dropped it and the #[allow(dead_code)]. code and verdict stay; three tests enforce them. The evidence text lives in docs/corpus/rule-evidence-0.9.md.
  • Removed the #[cfg(test)] is_package_library_file helper and its single assertion in scope_resolution.rs. It re-tested ry_workspace::package_file_kind, which exercises that classification through its own code paths. The cross-file resolution test itself stays.
  • infer_schema_call silenced its unused span parameter with let _ = span;. Renamed the parameter to _span. The sole caller lives in src/infer/call.rs, which this PR does not touch.
  • The filter-builder comment narrated a past move. It now states the current constraint: the builders construct SeverityFilter, a checker type, and the reverse dependency would be a cycle.

Skipped: deleting Checker::native_registration. The brief called it dead, but src/infer/call.rs:446 reads it (is_registered_ffi_wrapper(...) && self.native_registration). That file belongs to the src/infer/ PRs, so the field stays.

Verification

  • cargo fmt -p ry-checker — clean.
  • cargo clippy -p ry-checker --all-targets -- -D warnings — clean.
  • cargo test -p ry-checker — 595 passed, 0 failed, 9 ignored.
  • cargo check -p ry-cli -p ry-lsp — clean.

- Replace Project::prev_return_slots with a has_prev_emit bool; the
  full RType vector was cloned every emit and only tested for presence.
- compute_fixpoint_scope now calls with_transitive_callers instead of
  re-implementing its reverse-caller closure loop.
- The shared test helper check_with_scope delegates to the public
  Checker::check_with_scope instead of replaying collect plus a manual
  fixpoint.
- Drop the unused rationale field from Verdict in rule_evidence.rs;
  code and verdict are the asserted fields.
- Drop the cfg(test) is_package_library_file helper and its single
  assertion, which re-tested ry-workspace classification.
- Rename infer_schema_call's unused span parameter to _span.
- State the current constraint in the filter-builder comment instead
  of the move history.
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5b71bd09-902a-4143-943a-bfd0f89f42d0

📥 Commits

Reviewing files that changed from the base of the PR and between 2e93a59 and a798953.

📒 Files selected for processing (6)
  • crates/ry-checker/src/lib.rs
  • crates/ry-checker/src/nse.rs
  • crates/ry-checker/src/project.rs
  • crates/ry-checker/src/tests/mod.rs
  • crates/ry-checker/src/tests/scope_resolution.rs
  • crates/ry-checker/tests/rule_evidence.rs

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

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This run reviewed the full single-commit cleanup PR (6 files, all internal to crates/ry-checker); every equivalence and deadness claim in the description was verified against the code, and the crate's gates were re-run locally.

  • prev_return_slots → has_prev_emit — the Option<Vec<RType>> was cloned in full on every emit and only ever tested for presence; the bool now sits at all six former sites with identical semantics, and a workspace grep confirms zero remaining references. Change detection was already name-keyed via prev_fn_returns / prev_fn_signatures.
  • Closure-loop dedupe — the removed fixpoint loop in compute_fixpoint_scope is line-for-line the body of with_transitive_callers (crates/ry-checker/src/project.rs:516), whose other caller is the dirty-set expansion; semantics unchanged.
  • Shared test fixpoint — check_with_scope now delegates to the public Checker::check_with_scope (crates/ry-checker/src/lib.rs:773), so unit tests run the real pass structure (quoting propagation, discarding flag, parse errors) instead of a private replay that could diverge.
  • Verdict.rationale dropped — the three verdict-enforcing tests stay (every_rule_has_an_executed_verdict, verdicts_use_only_allowed_values, default_off_verdicts_match_the_registry), and the rationale texts are confirmed present in docs/corpus/rule-evidence-0.9.md (RY010/032/034/070/093/099/100/103 spot-checked).
  • Smaller removals — is_package_library_file (#[cfg(test)], zero remaining references, re-export kept), the span → _span rename in infer_schema_call (sole positional caller at src/infer/call.rs:549 unaffected), and the filter-builder comment now correctly states the current dependency direction (ry-checker → ry-config verified in Cargo.toml; no reverse dep).
  • Skipped deletion is sound — Checker::native_registration is still read at src/infer/call.rs:446, so keeping it out of this PR is right.

Local verification: cargo clippy -p ry-checker --all-targets -- -D warnings clean; cargo test -p ry-checker 591 passed / 0 failed / 9 ignored.

Pullfrog  | View workflow run | Using openai-compatible/glm-5.3 | 𝕏

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