S008: notes, decisions and plan ticked

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-25 05:52:10 -06:00
commit 03c8c7763c
2 changed files with 25 additions and 9 deletions

View file

@ -33,3 +33,6 @@
- D-031 — 2026-11-25 — Retries of a task: 10 failures in a row without a new byte (setting, per task, 0 is forever), waits by kind (docs/RECOVERY.md), Retry-After honoured up to 24 h. Three network, busy or server failures of a host in a row shut it for all for 30 s, doubling to 10 min; then one download tries. Start and Resume by the user go past it. 4xx are never repeated blindly. — FEATURES 1.6, 1.17. — 02, 04
- D-032 — 2026-11-25 — Offline is only believed after a failure: downloads are always tried first, so local servers work without a network. D-Bus is `Bus::Off` by default; the app turns it on. zbus without its tokio feature. Downloads that can't resume are not stopped for sleep or a network change. — Never touch the real system in tests; lose no bytes. — 02, 03, 05
- D-033 — 2026-11-25 — A started download whose file or folder is gone waits for it (`Error::Missing`) and is never started over, nor its folder made again, by itself. A changed file fails and asks; keeping both leaves the old task as it is and adds a new one. — A pulled-out drive looks like a missing folder. — 02, 04
- D-034 — 2026-11-25 — A new link is judged by size, versions and bytes: the last 4096 bytes of up to 32 finished ranges, the first ones and 8 places in between. Equal samples with a matching tag or date are "same", without are "probably same". Another tag or date counts against it only on the same server, and a differing tag with the same date decides nothing. — Two servers name the same file differently. — 02, 04, 05
- D-035 — 2026-11-25 — Without ranges a new task starts over and the old one keeps its file until the new one is whole (`tasks.replaces`), then goes to the bin. — Nothing is lost if the new link fails too. — 02, 04
- D-036 — 2026-11-25 — Other programs' unfinished files are copied, never moved or written. Zero-filled stretches count only where the server has zeros too. — The browser may still have the file open, and space is often taken before it is filled. — 02, 04, 05

View file

@ -96,5 +96,15 @@ Verified: `--test recover` (13 tests: matrix of 27 faults × 4 moments, fake Net
- A Waiting task with `error: None` is S009's; those with a kind are taken up by the manager at the next start.
Not done: a host name that TLS finds invalid counts as `cut`; the real NetworkManager and logind were never touched; a disk that fills up in the middle is only unit-tested (space is reserved first); 4xx and 5xx texts show the number, not its meaning. Not tried: suspend for real.
## S008 — Continue from a new link (2026-11-25)
Done: `core::relink` (check, verdicts, matcher), `core::adopt` (browser files, aria2's list, anything else by a byte check). Choices: D-034 to D-036. Outside the plan's files: `Command::{AwaitLink, Continue, Adopt}`, `Manager::{check, check_partial}`, `ErrorKind::Link`, store migration 003 (`tasks.replaces`), `http::same_bytes`.
Verified: `--test relink` (13 tests, 5 runs), `--lib`, `http`, `manager`, `recover` green on exactly what was committed; clippy clean for the new code.
- S016, S024: `relink::find(&Incoming { url, name, size, page }, snapshot.iter().map(|v| &*v.task))` gives `Match { id, strength, awaited }`, best first; only unfinished ones that don't run. It is a guess: `manager.check(id, NewLink) -> Reply<Checked>` proves it. `checked.verdict()`, `.text()` (ready to show), `.starts_over()`; then `Command::Continue { id, checked }`. Go on without asking on `Same`; ask on `ProbablySame` and `CannotTell`; `Different` is refused.
- Continue answers with another id when it has to start over (`replaces`): the old one is renamed to `name (1)`, stays paused, and is binned when the new one is whole.
- `NewLink.secret` is the keyring item with the new cookies and login; `headers` hold the rest (Referer, User-Agent). All old ones are dropped. Mirrors, proxy, name and limits stay.
- Source page: `Command::AwaitLink(id)`, then open `task.source_page`. The task waits with `ErrorKind::Link`, also over a restart; `Match.awaited` puts it first. Pause and Resume end the wait.
- Adopt: `manager.check_partial(path, NewLink) -> Reply<Found>` (`partial.name`, `partial.bytes()`, `checked`), then `Command::Adopt { task, found }`. The other program's file is copied (a reflink where the disk can) and never changed.
Not done: only aria2's list is read, written from its manual from memory and never tried on a file aria2 made (not installed here); other managers' files count from the start until the first difference. Chrome's and Firefox's files are simulated. Old keyring items are not deleted (S010 told). Checks with logins and proxies come with S010's commit. Boxes were ticked together at the end, against rule 3.
## Later
-