Improve PAR2 create and verify/repair parity#8
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
=======================================
Coverage ? 92.89%
=======================================
Files ? 72
Lines ? 17781
Branches ? 0
=======================================
Hits ? 16517
Misses ? 1264
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Pull request overview
Adds PAR2 creation support and aligns verify/repair behavior and output closer to par2cmdline-turbo, along with a large expansion of regression/integration coverage and benchmarking scripts.
Changes:
- Implement PAR2 creation pipeline (config/builder, file planning, progress reporting, encoder plumbing) and wire a
par2createCLI. - Update verify/repair parsing, output/reporters, purge behavior, and exit codes to better match par2cmdline-turbo.
- Add/expand extensive tests, benchmarks, and helper scripts for create/verify/repair equivalence and regressions.
Reviewed changes
Copilot reviewed 67 out of 69 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/verification/test_global.rs | New integration tests for global block table verification paths |
| tests/test_verify_types_comprehensive.rs | Update verification type tests for new fields/output |
| tests/test_verify.rs | Update verification tests for new block_sources field |
| tests/test_verification_equivalence.rs | Extend config setup for new extra_files/base_path |
| tests/test_turbo_verify_repair_parity.rs | New tests matching turbo behaviors for extra files & repair parity |
| tests/test_silent_verification_reporter.rs | Update reporter tests for new block_sources field |
| tests/test_repair_types.rs | Update repair type tests to use new domain newtypes |
| tests/test_repair_progress_comprehensive.rs | Add coverage for new progress reporter methods |
| tests/test_repair_context.rs | Update purge semantics tests to match turbo behavior |
| tests/test_repair_bugs.rs | Fix slice size arithmetic with new BlockSize type |
| tests/test_packet_edges.rs | Update edge tests for new domain newtypes |
| tests/test_multifile_repair_bug.rs | Update formatting/math using BlockCount newtype |
| tests/test_mixed_recovery_sets.rs | New integration test ensuring mixed sets are ignored via base-stem filtering |
| tests/test_file_verifier.rs | Extend config construction for new fields |
| tests/test_console_verification_reporter.rs | Update console reporter tests for new block_sources field |
| tests/debug_repair_issue.rs | Update debug test code to use new newtypes |
| tests/create_hot_path_allocations.rs | New allocation-scaling regression test for create hot path |
| src/verify/types.rs | Add BlockSource tracking and adjust Display output |
| src/verify/mod.rs | Export BlockSource, relax reporter generic to support trait objects |
| src/verify/config.rs | Add extra_files and base_path CLI/config support |
| src/reporters/mod.rs | Export new concise verification reporter |
| src/reporters/console.rs | Add thread-safe console output + concise reporter mode |
| src/repair/types.rs | Introduce exit_code() and migrate fields to newtypes |
| src/repair/slice_provider.rs | Make error module public; factor IO error mapping into helpers |
| src/repair/progress.rs | Add new progress events and refine quiet/format behavior |
| src/repair/error_helpers.rs | New shared IO error mapping helpers (repair path) |
| src/repair/context.rs | Rework purge logic to match turbo-style purge semantics |
| src/reed_solomon/mod.rs | Export encoder module for creation |
| src/reed_solomon/codec.rs | Add explicit SIMD init + controllable low-level progress output |
| src/par2_files.rs | Prevent mixed recovery-set loading; add progress locking and ordering |
| src/packets/recovery_slice_packet.rs | Remove stray println on MD5 verification failure |
| src/packets/mod.rs | Add resync scanning and stronger recovery-packet validation path |
| src/lib.rs | Export new create module |
| src/domain.rs | Add newtype wrappers for sizes/counts used across create/repair |
| src/create/types.rs | New creation config/types |
| src/create/source_file.rs | New source-file metadata + checksum structs |
| src/create/progress.rs | New create progress reporter traits/impls |
| src/create/mod.rs | New create module entrypoints and exports |
| src/create/file_naming.rs | New recovery volume planning and allocation logic |
| src/create/error_helpers.rs | New shared IO error mapping helpers (create path) |
| src/create/error.rs | New create error types |
| src/create/cli.rs | New CLI parsing helpers for create redundancy/file expansion |
| src/create/builder.rs | New CreateContextBuilder fluent API |
| src/checksum/md5_reader.rs | New streaming MD5 reader wrapper |
| src/checksum.rs | Export Md5Reader from checksum module |
| src/bin/par2verify.rs | Rework verify CLI behavior for quiet/basepath/extra files/purge |
| src/bin/par2repair.rs | Rework repair CLI behavior for quiet modes/purge/exit codes |
| src/bin/par2create.rs | Implement par2create CLI using new creation module |
| src/args.rs | Split verify args; add flags consistent with turbo-like interfaces |
| scripts/stress_test_create.sh | New stress script for create reliability |
| scripts/debug_create.sh | New debugging script for intermittent create failures |
| scripts/benchmark_create.sh | New averaged benchmark script for create performance & validation |
| rust-analyzer.toml | Add rust-analyzer config |
| flake.nix | Add sccache/mold/linker env wiring for dev shell |
| docs/par2_parsing.md | Remove outdated parsing doc |
| docs/BENCHMARK_RESULTS.md | Add creation benchmark section + analysis |
| benches/create_benchmark.rs | Add Criterion benches for create performance |
| README.md | Document creation performance status and bottlenecks |
| Cargo.toml | Add create benchmark; tweak dev/release profile settings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3c6d9c6 to
867504a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/repair/mod.rs:430
- When
missing_slices.is_empty(), the current logic can classify a non-Presentfile as verified unless it has noncanonical block sources, which can lead tofiles_to_repairstaying empty and returningNoRepairNeededeven though verification flagged the file asCorrupted/Missing. This can happen for canonical-offset corruption detectable only via full-file checks (e.g., size/hash mismatch with extra trailing data). Consider ensuring that a non-Presentstatus with zero missing slices is either (a) revalidated with full-file criteria before treating as verified, or (b) scheduled for rewrite/repair based on the verification status, sorepairdoes not incorrectly report "already intact".
if missing_slices.is_empty() {
if *status != FileStatus::Present
&& self.has_noncanonical_block_sources(file_info, block_sources_map)
{
debug!(
"File {} has all valid slices from noncanonical sources; rewriting",
file_info.file_name
);
files_to_repair.push((file_info, missing_slices));
} else {
verified_files.push(file_info.file_name.clone());
}
continue;
}
debug!(
"File {} needs {} missing slices repaired",
file_info.file_name,
missing_slices.len()
);
files_to_repair.push((file_info, missing_slices));
}
if files_to_repair.is_empty() {
return Ok(RepairResult::NoRepairNeeded {
files_verified: verified_files.len(),
verified_files,
message: "All files are already intact".to_string(),
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ea3e30e to
42142b3
Compare
Summary
Tests