WI-143: per-article damage ledger in nzb-core - #140
Merged
Conversation
Add a persisted per-article damage ledger to nzb-core, the shared truth the download engine and the streaming provider both consult and update so a hole learned once is not rediscovered. Migration v10 adds a `damage_ledger` table keyed (scope_id, file_index, segment_number), created empty. There is no backfill from v9 `history.retry_data`: that blob is a retry checkpoint, not damage evidence — it carries no failure reason, per-server evidence, TTL, or server fingerprint to reconstruct a confirmed miss (see WI-142/WI-143 convergence). The rules that decide a verdict live in exactly one function, `apply_outcome`, following zurg's holes.go: - a transport failure never creates or refreshes a missing record; - a single 430 is provisional and confirms only once every enabled server has refused and >= 1s has passed since the first refusal; - a confirmed hole is believed for 24h, then a caller re-probes; - the record is keyed to the set of servers asked (server_fingerprint); adding or removing a provider invalidates it. API on Database: ledger_note, ledger_consult, ledger_held_provisionally, ledger_file_gone_ratio, ledger_load_file. Callers translate their own failure taxonomy into Outcome (Present / Refused / Transport). Deterministic unit tests cover transient 430-then-200, 430 on every server, transport-on-the-last-server (never confirms), TTL expiry re-probe, fingerprint invalidation, and the file-gone ratio. Change is additive to the public surface, so the published nzbdav consumer keeps building. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TpoFnScdkRq7qxQLQZe1we
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First code payload of the parity-in-flight initiative (Vogt WI-143, initiative
parity-in-flight-damage-ledger-in-memory-par2-streaming-repair). Parent audit: WI-142.What
A persisted per-article damage ledger in nzb-core — the shared truth the download engine (WI-145/146) and the streaming provider (WI-156+) both consult and update, so a hole learned once is not rediscovered.
damage_ledgertable keyed(scope_id, file_index, segment_number), created empty. No backfill from v9history.retry_data: that blob (WI-133) is a retry checkpoint, not damage evidence — it has no failure reason, per-server evidence, TTL, or server fingerprint to reconstruct a confirmed miss from. (Convergence decision recorded on WI-133/WI-143.)crates/nzb-core/src/damage_ledger.rs:LedgerState(unknown / provisional_missing / confirmed_missing / present / unservable_file), per-server evidence (430 vs transport + timestamp),first_refused_at/confirmed_at/expires_at,server_fingerprint.apply_outcome(from zurgholes.go):Database:ledger_note,ledger_consult,ledger_held_provisionally,ledger_file_gone_ratio,ledger_load_file. Callers translate their own failure taxonomy (nzb-dispatch::ArticleFailureKind) intoOutcome(Present / Refused / Transport) — nzb-core does not depend on the dispatcher.Tests
6 deterministic unit tests (injected clocks, in-memory DB) covering transient 430-then-200, 430 on every server, transport-on-the-last-server (never confirms), TTL-expiry re-probe, fingerprint invalidation, and the file-gone ratio. Full nzb-core suite: 128 passed.
cargo fmt --checkandcargo clippy -D warningsclean.Scope notes
mock-nntp-server; end-to-end mock-NNTP coverage lands with WI-151 fixtures and the WI-144/145 wiring.🤖 Generated with Claude Code
https://claude.ai/code/session_01TpoFnScdkRq7qxQLQZe1we