Skip to content

Live PAR reads the queue's printed 16k hashes in the right byte order - #747

Draft
xbmc4lyfe wants to merge 5 commits into
mainfrom
live-par-hash16k-order
Draft

xbmc4lyfe wants to merge 5 commits into
mainfrom
live-par-hash16k-order

Conversation

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator

Follow-up to #739. The queue stores each file's first-16-KiB MD5 (Hash16k) printed the way nzbget prints an MD5: the digest bytes last to first, in upper-case hex (renameanalyzer::print). #739 fixed par-rename with parrenamer::parse_printed_hash16k. Live PAR still read the queue's text in digest order, so no queue hash ever matched its par2 entry.

Change

  • parchecker::live_hash16k read hex in digest order. It is removed. Every 16k hash hint that reaches live PAR now goes through one helper, parchecker::live_hint_hash16k, which is parrenamer::parse_printed_hash16k. That covers the queue's text (articledl, queuecoord, postproc, the namespace capture and recheck) and the hint built from a file's first article. Its users:
    • parchecker.rs: first-article binding, resolve_live_source_id, streaming_session_source_length
    • parchecker/live_namespace.rs: candidate, follow_rename, the bound-hash check in bind
  • first_article_hash16k now prints its hint the same way the queue does (renameanalyzer::print). Every hint is in one form, so the text comparisons in the namespace recheck also compare like with like.
  • Other hash users I checked, all consistent and left unchanged:
  • The lifecycle tests passed digest-order hex as if it were the queue's hash, which built the bug into the tests. They now use the queue's real form (queue_hash16k).

Tests

  • New unit tests:
    • live_hint_hash16k_reads_printed_known_vectors: MD5("") printed is 7E42F8EC980980E904B2008FD98C1DD4; lower case is accepted; the digest-order text does not parse to the digest; wrong lengths and non-hex input are refused
    • live_hint_hash16k_round_trips_printed_and_first_article: 256 digests, plus first articles longer and shorter than 16 KiB
    • live_queue_printed_hash_binds_an_obfuscated_file
  • New scenarios: liveparrarobfuscated and liveparrarobfuscatedslow. They use the production options with DirectRename=yes, and the RAR volumes are posted under random names with no extension. They check that live PAR repairs as the download ends, never stops on a source identity, and that post-processing trusts it (no par-check, nothing missing).
  • Control on main: commit a2d30556 is origin/main plus the converted lifecycle tests and the binding test (farm job farm-val-a2d30556). 5 tests fail on main:
    • live_obfuscated_article_uses_checked_hash_mapping_and_owned_ram
    • live_obfuscated_completed_source_reads_its_committed_path
    • live_queue_printed_hash_binds_and_keeps_first_article_binding (the binding test under its earlier name)
    • live_repair_refuses_a_target_whose_name_and_binding_disagree
    • live_repair_takes_an_obfuscated_target_and_certifies_it_through_par_rename
  • Limit: the end-to-end scenarios also pass on main. The queue has a 16k hash only when DirectRename=yes (it is set only by directrenamer). The direct rename gives the files their par2 names using those same hashes, so live PAR then binds them by name. I tried three variants (par2 first, par2 last, a slow line) on main and on this head. They gave the same results and the same log lines. So the end-to-end effect on main is hidden by the direct rename, and the unit tests above are the control that fails on main.
  • Pre-existing flake, not caused by this change: on main under load, liveparrarobfuscated once fell back to a par-check with "a slice rebuilt ahead waits for its file to complete". That is the rebuilt-ahead certification, not hashes.

Validation (GitHub Actions unavailable; farm gate on head 84b9090)

Linux x86_64:

cargo_exit=0   (cargo test --tests -- --test-threads=12 on rustyget-x86-a, 221s)
daemon_exit=0   (just test-daemon on rustyget-x86-a, 46s)
436 / 442 scenarios passed on target=local
FLAKY under load, PASS when rerun alone: liveedgehole5, livepardecodeahead, liveparnocache, liveparobfuscated, liveparrarobfuscated, livepartrusted

These ran at load 30 to 46 on rustyget-x86-a. Their logs show live PAR deferred for lack of ParBuffer ("16 MB is available"), so a batch repair ran instead.

Linux arm64:

cargo_exit=0   (cargo test --tests -- --test-threads=12 on rustyget-arm-b, 148s)
daemon_exit=0   (just test-daemon on rustyget-arm-b, 45s)
442 / 442 scenarios passed on target=local

macOS (m5air): MAC_LINES

Review: G2G on 84b9090. That was a full clean-room review on 76513e5, then a delta-only re-review of its notes.

Deploy: DEPLOY_LINE

🤖 Generated with Claude Code

https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM

xbmc4lyfe and others added 5 commits November 26, 2026 18:11
…6k hashes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
…ob stop; fix test field

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
… hashes); say what they prove

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM

This branch has not been deployed

No deployments
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