Skip to content

fix(mft): apply snapshot/restore pattern to directory index merge#7

Merged
githubrobbi merged 1 commit intomainfrom
fix-live-parser-parity
Mar 17, 2026
Merged

fix(mft): apply snapshot/restore pattern to directory index merge#7
githubrobbi merged 1 commit intomainfrom
fix-live-parser-parity

Conversation

@githubrobbi
Copy link
Owner

Summary

Fixes remaining LIVE parser parity mismatches by applying the same snapshot/restore pattern used for $DATA to directory index sizes.

Root cause identified: Directory index merging used unconditional += at direct_index_extension.rs:742-743, causing data loss when IOCP delivered extension records before base records.

Impact: Reduced mismatches from 16,517 → 422 with the previous $DATA fix (commit e90aade). This fix is expected to resolve the remaining 422 mismatches by applying the same proven pattern to directory index sizes.

Changes

  • ✅ Apply snapshot/restore to dir_index merge (direct_index_extension.rs:737-766)
  • ✅ Add chaos test harness for reproducing LIVE out-of-order scenarios
  • ✅ Add regression tests for extension-before-base merging
  • ✅ Add CHAOS_TEST_HARNESS.md documentation

Validation

  • ✅ All 116 tests pass (OFFLINE correctness preserved)
  • ✅ Code formatted and linted (ultra-strict Clippy rules)
  • ⏳ Ready for Windows LIVE validation

Technical Details

The Bug

When extension arrives before base:

  1. Extension adds dir_index to first_stream.size (0 + ext = ext) ✅
  2. Base overwrites with = SizeInfo {...}, losing extension data

The Fix

Check if first_stream.size is empty (0, 0):

  • If empty → write extension's dir_index values
  • Otherwise → accumulate using saturating_add

This is the same pattern that successfully fixed the $DATA bug in commit e90aade.

Test Plan

  • All existing tests pass
  • Code formatted (just fmt)
  • Code linted (just lint-prod)
  • Windows LIVE validation against D: drive (next step)

Related Issues

🤖 Generated with coordination from Claude Code Coordinator

Fixes remaining LIVE parser parity mismatches by applying the same
snapshot/restore pattern used for $DATA to directory index sizes.

Root cause: Directory index merging used unconditional += at
direct_index_extension.rs:742-743, causing data loss when IOCP
delivered extension records before base records.

When extension arrives before base:
- Extension adds dir_index to first_stream.size (0 + ext = ext) ✓
- Base overwrites with = SizeInfo {...}, losing extension data ✗

Fix: Check if first_stream.size is empty (0, 0):
- If empty → write extension's dir_index values
- Otherwise → accumulate using saturating_add

This mirrors the proven fix from commit e90aade that reduced
mismatches from 16,517 → 422. Expected to resolve remaining
small directory size deltas (+51, +11 bytes).

Changes:
- Apply snapshot/restore to dir_index merge (direct_index_extension.rs:737-766)
- Add chaos test harness for reproducing LIVE out-of-order scenarios
- Add regression tests for extension-before-base merging
- Add CHAOS_TEST_HARNESS.md documentation

Validation:
- All 116 tests pass (OFFLINE correctness preserved)
- Code formatted and linted (ultra-strict)
- Ready for Windows LIVE validation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@githubrobbi githubrobbi merged commit ce4ac88 into main Mar 17, 2026
3 of 6 checks passed
@githubrobbi githubrobbi deleted the fix-live-parser-parity branch March 17, 2026 16:45
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