Repository navigation
Persistent-partial sessions honour damaged_input (Salvage/Resync); members bound by header position - #321
Persistent-partial sessions honour damaged_input (Salvage/Resync); members bound by header position#321xbmc4lyfe wants to merge 4 commits into
Conversation
…mbers bound by header position ProgressiveSession::new_partial now reads past damaged RAR 4.x / 5.0 headers under ProgressiveOptions::extract.damaged_input as an ordinary progressive session does: the same members, bytes and ProgressiveEvent::HeaderDamaged events, with the same hole rule (NotYet waits, a header in a Hole is HeaderHole, no resync across a hole). Refuse (the default) is unchanged. Journal binding: a member whose first header was read as damage is keyed by its position (volume, header offset; ordinal MemberKey::POSITIONAL), and a whole header after damage in the session by position and bytes, since damage can move the ordinals of later members. A whole header is looked up under its ordinary key, then its positional key, then the salvaged-position key, so a restart over the same damaged bytes and a resume over a header repaired since both find the member. Adoption accepts a witness that differs from the recorded one only when either was salvaged and both parse to the same member (name, sizes, data offset, method, checks, split flags, encryption, host); otherwise BindingMismatch(Member), naming the header, before anything is written. State format: salvaged witnesses are listed in a new header-witness section (tag 0x5A, version 1), written only when one exists, and parsed as they stand on reopen. Every other state is byte-identical; older builds refuse a state with the section as StateVersion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b512c8798
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ain header drops its recorded bytes A file header whose type byte was hit so that it reads as a main header is dropped (its data passed over); its bytes stayed in the persistent session's header buffer, so the next header was not contiguous and the session ended with SourceContract. They are now dropped with the frame. Case "rar5 file read as main" added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Persistent-partial sessions (
ProgressiveSession::new_partial, RustyGet's direct unpack) now honourextract::Options::damaged_input(Salvage,Resync), as #316 did for ordinary progressive sessions. Refuse (the default) is unchanged.Behaviour
ProgressiveEvent::HeaderDamaged { volume, damage }events as an ordinary progressive session over the same damaged archive (checked over every RAR damaged-input salvage: Options::damaged_input (Salvage as UnRAR 7.30, Resync) and a headers-damaged signal #310/Progressive sessions honour damaged_input (Salvage/Resync), reported as HeaderDamaged #316 fixture, read whole and a few bytes a call).NotYetis waited for; a header inside aHole(or a range declared withdeclare_hole) stops withHeaderHole; a resync never searches across a hole; on a growing source an unfinished resync waits.Journal binding
The key used to be (ordinal, SHA-256 of the first header's bytes), and adoption compared every header witness byte for byte. Damage breaks both: a damaged header's bytes change once repaired, and damage can hide or invent a member, so the ordinals after it move. Under Salvage/Resync:
v1+ header bytes (unchanged)MemberKey::POSITIONAL(u64::MAX)at/v1+ volume + header offset + header bytesMemberKey::POSITIONALsalvaged-at/v1+ volume + header offsetPartial(BindingMismatch(Member)), whose context names the header's volume and offset, before anything is written. Data is never mixed across members. Later parts' witnesses follow the same rule; a changed part isBindingMismatch.Compatibility
whole_headers_keep_their_keyspins the key derivation).0x5A, version 1), written only when one exists and parsed as it stands on reopen. Every other state is byte-identical, so existing states and anchors load and adopt unchanged. Older builds refuse a state carrying the section withStateVersion(unknown tag), and an unknown section version isStateVersiontoo.damaged_inputchoice: Refuse does not look up positional keys.Tests
tests/persistent_salvage.rs(new):salvage_and_resync_extract_what_the_progressive_session_doesa_header_still_to_come_is_waited_for_and_one_in_a_hole_stops_the_sessiona_restart_over_the_same_damaged_bytes_binds_the_same_membersa_repaired_header_rebinds_to_the_same_member(RAR5 + RAR4, mid-member resume)a_repaired_continuation_header_is_the_same_parta_header_repaired_into_another_member_is_refuseda_member_found_again_after_its_ordinal_moveda_salvaged_state_reopensrefuse_is_unchanged_in_a_persistent_sessionwhole_headers_keep_their_keyscorrupting_every_37th_offset_never_panics_and_restarts_the_sameThere is also
partial::tests::ledger::salvaged_witnesses_persist_in_their_own_section(section layout, strict versus salvaged parse, version and index rejection).a_persistent_session_still_refuses_damaged_headersis removed because it is superseded.Revert-check: on origin/main, 8 of the 11 new integration tests fail. The 3 that pass are refuse, key compatibility and hostile. With the witness leniency disabled, both repair tests fail.
Known limit (documented): a damaged mode applied as an output's permissions can make the output unreadable to its owner, and a later adoption cannot get past that. The same is true of a clean member stored with mode 000.
Clean-room: no third-party code read or used.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LG44gZ63jJDJGeNcamsGrj