D-037: test: cover ChangeStatus Deleted and Renamed variants#7
Open
Sephyi wants to merge 1 commit intodevelopmentfrom
Open
D-037: test: cover ChangeStatus Deleted and Renamed variants#7Sephyi wants to merge 1 commit intodevelopmentfrom
Sephyi wants to merge 1 commit intodevelopmentfrom
Conversation
Per audit D-037, the test suite never constructed `ChangeStatus::Deleted`
or meaningfully exercised `ChangeStatus::Renamed` through the splitter or
context builder. This closes that gap:
tests/helpers.rs
- Extract `make_renamed_file_with_diff` so rename fixtures can carry a
non-empty diff body plus explicit add/delete counts. The original
`make_renamed_file` becomes a thin wrapper for existing callers.
tests/context.rs
- Extend `format_files_shows_renamed_marker` to assert the old path,
the `->` arrow, and the new path all appear in `file_breakdown` —
proving `old_path` is respected, not silently dropped.
- Add `format_files_mixed_statuses_show_all_markers`: one FileChange
per variant in a single StagedChanges, asserting every `[+]`/`[M]`/
`[-]`/`[R]` prefix and every `change_summary` count fires.
tests/splitter.rs
- `deleted_file_is_represented_in_splitter_output`: a deleted file
colocated with a sibling modification must land in exactly one group
(or the SingleCommit branch) — never dropped.
- `deleted_file_is_placed_into_a_splitter_group`: with a symbol-bearing
addition in an unrelated module, the deletion still lands in exactly
one split group.
- `renamed_file_grouped_by_new_path_module`: the splitter must key
module detection off the new path, not `old_path`.
- `renamed_file_is_placed_into_a_splitter_group_with_old_path_preserved`:
splitter output references the rename by its new path, and both
`old_path` and `rename_similarity` round-trip unchanged on the input.
Closes audit entry D-037 from #3.
There was a problem hiding this comment.
Pull request overview
This PR adds regression tests to ensure ChangeStatus::Deleted and ChangeStatus::Renamed are exercised in test fixtures, addressing audit item D-037 by covering splitter grouping and context formatting paths for these variants.
Changes:
- Add
CommitSplittertests that includeDeletedandRenamedFileChangefixtures and assert expected grouping/output inclusion. - Extend context formatting tests to verify deleted/renamed markers, including
old_path -> new_pathrendering and summary counts. - Enhance test helpers with a
make_renamed_file_with_diffconstructor to build rename fixtures with explicit diff bodies and add/delete stats.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/splitter.rs | Adds new splitter tests for Deleted/Renamed fixtures and grouping expectations. |
| tests/helpers.rs | Introduces make_renamed_file_with_diff and routes make_renamed_file through it. |
| tests/context.rs | Adds assertions and a new test to cover formatting/summary output for all ChangeStatus variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "src/services/llm/anthropic.rs", | ||
| ChangeStatus::Modified, | ||
| "@@ -0,0 +1,20 @@\n+pub fn brand_new_api() {}\n", | ||
| 20, |
Comment on lines
+722
to
+723
| "@@ -0,0 +1,20 @@\n+pub fn brand_new_api() {}\n", | ||
| 20, |
| ChangeStatus::Deleted, | ||
| "@@ -1,10 +0,0 @@\n-pub fn retired() {}\n-pub fn also_retired() {}\n", | ||
| 0, | ||
| 10, |
Comment on lines
+595
to
+601
| SplitSuggestion::SingleCommit => { | ||
| // Single-commit means all files fall into the one implicit group | ||
| // — the deleted file is still present in the input, so no further | ||
| // assertion is needed beyond verifying the input shape. | ||
| assert!(changes.files.iter().any(|f| f.path == deleted_path)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test: cover ChangeStatus Deleted and Renamed variants.
Audit context
Closes audit entry D-037 from #3.
Verification
cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-targets