Skip to content

Fix Drive D/S parity: remove premature metrics + child sorting#4

Merged
githubrobbi merged 1 commit intomainfrom
fix-f-drive-parity
Mar 16, 2026
Merged

Fix Drive D/S parity: remove premature metrics + child sorting#4
githubrobbi merged 1 commit intomainfrom
fix-f-drive-parity

Conversation

@githubrobbi
Copy link
Owner

Summary

  • Drive D fix: Remove premature compute_tree_metrics() from IOCP inline readers (to_index.rs, to_index_parallel.rs). These called metrics before sort, producing wrong directory sizes. Now metrics are computed exactly once in the caller.
  • Drive S fix: Remove ALL sort_directory_children() calls. C++ outputs children in reverse MFT parse order (no sorting). Rust was sorting alphabetically, causing 99.96% diff rate on Drive S.

Expected Impact

Drive Before (diffs) After (expected)
D 5,756,841 ~0
S 8,275,020 ~0
G 1 1

Test plan

  • just check passes
  • All 105 MFT tests pass
  • Windows trial_run.ps1 on all drives
  • Verify Drive D directory sizes match C++
  • Verify Drive S output order matches C++

🤖 Generated with Claude Code

…+ parity

Drive D root cause: to_index.rs called compute_tree_metrics() before
returning to index_read.rs, which sorted and recomputed. The premature
call on unsorted children produced wrong directory sizes.

Drive S root cause: C++ outputs children in reverse MFT parse order
(no sorting). Rust sorted alphabetically, causing 99.96% diff rate.
Files were identical — only ordering differed.

Fix: Remove all sort_directory_children() calls (C++ doesn't sort)
and remove premature compute_tree_metrics() from inline IOCP readers.
Tree metrics are now computed exactly once per read path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@githubrobbi githubrobbi merged commit 165fdb8 into main Mar 16, 2026
5 of 6 checks passed
@githubrobbi githubrobbi deleted the fix-f-drive-parity branch March 16, 2026 10:38
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