Repository navigation
refactor(sort): introduce ChunkNamer to centralize temp file naming - #179
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #179 +/- ##
=======================================
Coverage 85.65% 85.65%
=======================================
Files 128 128
Lines 51990 51983 -7
=======================================
- Hits 44533 44528 -5
+ Misses 7457 7455 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f181491 to
2203498
Compare
e60e7d6 to
61d6cde
Compare
2203498 to
adb0c4e
Compare
adb0c4e to
3cafbc8
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIntroduces an internal 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/sort/raw.rs (1)
2261-2265:⚠️ Potential issue | 🟡 MinorMake the regression assert the actual collision path.
With
max_temp_files(4), the old overwrite only happens on the first spill after consolidation, so this needs at least 5 chunk writes.>= 4can pass while never exercising the buggy naming path.Suggested tweak
assert!( - stats.chunks_written >= 4, - "expected at least 4 chunks to trigger consolidation, got {}", + stats.chunks_written >= 5, + "expected at least 5 chunks to exercise post-consolidation naming, got {}", stats.chunks_written );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/sort/raw.rs` around lines 2261 - 2265, The regression test's assertion is too loose: with max_temp_files(4) the overwrite-only bug is exercised only on the first spill after consolidation, which requires at least 5 chunk writes, so update the assertion that references stats.chunks_written in raw.rs to require >= 5 (or otherwise assert the specific collision/overwrite path was taken) so the test actually exercises the buggy naming path; locate the check using stats.chunks_written in the failing test and change the expected minimum from 4 to 5 (or add an explicit assertion that the consolidation+spill collision code path ran).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/lib/sort/raw.rs`:
- Around line 2261-2265: The regression test's assertion is too loose: with
max_temp_files(4) the overwrite-only bug is exercised only on the first spill
after consolidation, which requires at least 5 chunk writes, so update the
assertion that references stats.chunks_written in raw.rs to require >= 5 (or
otherwise assert the specific collision/overwrite path was taken) so the test
actually exercises the buggy naming path; locate the check using
stats.chunks_written in the failing test and change the expected minimum from 4
to 5 (or add an explicit assertion that the consolidation+spill collision code
path ran).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: df7163d1-2a78-4ba1-9242-f48991483684
📒 Files selected for processing (1)
src/lib/sort/raw.rs
Replace the per-method chunk_counter and consolidation_count variables with a ChunkNamer struct that encapsulates both monotonic counters and the temp directory path. This makes it impossible to forget to increment the counter and centralizes the naming format strings. Also removes the clippy::too_many_lines allow on sort_coordinate_with_index, which is no longer needed after the variable reduction.
3cafbc8 to
890b933
Compare
Summary
Stacked on #178.
ChunkNamerstruct that encapsulates both monotonic counters (chunk files and merged files) and the temp directory path, replacing 3 separate variables per sort method (chunk_counter,consolidation_count,temp_pathpassed to consolidation).next_chunk_path()andnext_merged_path()handle it atomically.maybe_consolidate_temp_filessignature from 3 parameters to 2.clippy::too_many_linesallow onsort_coordinate_with_indexthat fix(sort): use monotonic counter for chunk file naming during consolidation #178 added — no longer needed after the variable reduction.Test plan
cargo ci-test)cargo ci-fmtcleancargo ci-lintclean (including removal oftoo_many_linesallow)