fix(review): detect inline Rust tests in pre-merge checks #36

Merged
jwilger merged 2 commits from fix/issue-29-in-file-rust-tests into main 2026-05-02 12:35:04 -07:00
Owner

Summary

  • Treat added Rust in-file test attributes as evidence for the built-in Tests touched pre-merge check.
  • Add a regression test for a source-file-only patch that adds #[test] inside an adjacent test module.
  • Document the behavior fix in the Unreleased changelog.

RGR evidence

RED:

cargo test -p ar-review pre_merge::tests::tests_touched_accepts_added_rust_inline_test -- --nocapture
left: Fail
right: Pass

GREEN / verification:

  • cargo test -p ar-review pre_merge::tests::tests_touched_accepts_added_rust_inline_test -- --nocapture
  • cargo test -p ar-review pre_merge::tests:: -- --nocapture
  • cargo fmt --all -- --check
  • git diff --check -- CHANGELOG.md crates/ar-review/src/pre_merge.rs

Closes #29

## Summary - Treat added Rust in-file test attributes as evidence for the built-in Tests touched pre-merge check. - Add a regression test for a source-file-only patch that adds #[test] inside an adjacent test module. - Document the behavior fix in the Unreleased changelog. ## RGR evidence RED: ``` cargo test -p ar-review pre_merge::tests::tests_touched_accepts_added_rust_inline_test -- --nocapture left: Fail right: Pass ``` GREEN / verification: - cargo test -p ar-review pre_merge::tests::tests_touched_accepts_added_rust_inline_test -- --nocapture - cargo test -p ar-review pre_merge::tests:: -- --nocapture - cargo fmt --all -- --check - git diff --check -- CHANGELOG.md crates/ar-review/src/pre_merge.rs Closes #29
fix(review): detect inline Rust tests in pre-merge checks
All checks were successful
auto_review auto_review: no findings
CI / Nix flake check (pull_request) Successful in 1m45s
ae0b83ae48
Treat added Rust test attributes in source-file patches as evidence for the Tests touched pre-merge check, matching the project's adjacent unit-test convention.

RED: cargo test -p ar-review pre_merge::tests::tests_touched_accepts_added_rust_inline_test -- --nocapture failed with left: Fail, right: Pass.
auto-review left a comment

This PR enhances the pre-merge checks by detecting inline Rust tests, ensuring that added Rust in-file test attributes are treated as test changes. The changes are well-implemented and include a new test to verify the functionality. The PR appears safe to merge.

Walkthrough

  • CHANGELOG.md:

    • Updated to document the fix for detecting Rust in-file test markers as test changes.
  • crates/ar-review/src/pre_merge.rs:

    • Modified check_tests to include a check for Rust in-file test markers using the new adds_rust_test function.
    • Added adds_rust_test function to identify Rust test markers in patches.
    • Added a new test tests_touched_accepts_added_rust_inline_test to verify the detection of added Rust inline tests.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — source changed but no test file appears in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR enhances the pre-merge checks by detecting inline Rust tests, ensuring that added Rust in-file test attributes are treated as test changes. The changes are well-implemented and include a new test to verify the functionality. The PR appears safe to merge. ## Walkthrough - **CHANGELOG.md**: - Updated to document the fix for detecting Rust in-file test markers as test changes. - **crates/ar-review/src/pre_merge.rs**: - Modified `check_tests` to include a check for Rust in-file test markers using the new `adds_rust_test` function. - Added `adds_rust_test` function to identify Rust test markers in patches. - Added a new test `tests_touched_accepts_added_rust_inline_test` to verify the detection of added Rust inline tests. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [ ] Tests touched — source changed but no test file appears in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
Merge remote-tracking branch 'origin/main' into fix/issue-29-in-file-rust-tests
All checks were successful
auto_review auto_review: no findings
CI / Nix flake check (pull_request) Successful in 5s
8e9709cca2
auto-review left a comment

This PR enhances the pre-merge checks by detecting inline Rust tests, ensuring that added Rust test markers are treated as test changes. The changes include a new function to identify Rust test markers and a corresponding test to verify this behavior. The update appears safe to merge.

Walkthrough

  • crates/ar-review/src/pre_merge.rs:
    • The check_tests function has been updated to include a check for added Rust test markers using the new adds_rust_test function.
    • The adds_rust_test function is introduced to detect Rust test markers in patches, ensuring inline tests are recognized.
    • A new test, tests_touched_accepts_added_rust_inline_test, is added to verify that the check_tests function correctly identifies added Rust inline tests.
  • CHANGELOG.md:
    • Updated to document the fix that now treats added Rust in-file test markers as test changes in the pre-merge checks.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — source changed but no test file appears in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR enhances the pre-merge checks by detecting inline Rust tests, ensuring that added Rust test markers are treated as test changes. The changes include a new function to identify Rust test markers and a corresponding test to verify this behavior. The update appears safe to merge. ## Walkthrough - **crates/ar-review/src/pre_merge.rs**: - The `check_tests` function has been updated to include a check for added Rust test markers using the new `adds_rust_test` function. - The `adds_rust_test` function is introduced to detect Rust test markers in patches, ensuring inline tests are recognized. - A new test, `tests_touched_accepts_added_rust_inline_test`, is added to verify that the `check_tests` function correctly identifies added Rust inline tests. - **CHANGELOG.md**: - Updated to document the fix that now treats added Rust in-file test markers as test changes in the pre-merge checks. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [ ] Tests touched — source changed but no test file appears in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
jwilger referenced this pull request from a commit 2026-05-05 12:18:07 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/auto_review!36
No description provided.