S008: notes, decisions and plan ticked
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
4f1435e72f
commit
03c8c7763c
5 changed files with 25 additions and 9 deletions
|
|
@ -11,14 +11,14 @@ An expired or dead download carries on from a fresh link, and partial files can
|
|||
- docs/FEATURES.md 1.12, 4.6, 7.8
|
||||
|
||||
## Steps
|
||||
- [ ] Relink command: probe the new link, compare length and validators, then compare sampled finished ranges and the edges byte for byte before accepting
|
||||
- [ ] Verdicts: same file, probably same (no validators, samples equal), different, cannot tell; each with its message; never continues on "different"
|
||||
- [ ] Headers, cookies, referrer and login replaced with the new link's; old ones dropped
|
||||
- [ ] Server without ranges: explain that it must start over, keep the old partial until the new one is done
|
||||
- [ ] Matcher: given an incoming link (and name, size, page), rank unfinished downloads it may continue; signed-URL query noise ignored; tests with realistic CDN links
|
||||
- [ ] Adopt a partial file: plain truncated file from a browser (`.part`, `.crdownload`), and other managers' partials when the part list is readable and documented; otherwise treat the start of the file as finished only after a byte check
|
||||
- [ ] Expired link on the source page: "open source page" state that waits for a matching link
|
||||
- [ ] `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S008: …`, push
|
||||
- [x] Relink command: probe the new link, compare length and validators, then compare sampled finished ranges and the edges byte for byte before accepting
|
||||
- [x] Verdicts: same file, probably same (no validators, samples equal), different, cannot tell; each with its message; never continues on "different"
|
||||
- [x] Headers, cookies, referrer and login replaced with the new link's; old ones dropped
|
||||
- [x] Server without ranges: explain that it must start over, keep the old partial until the new one is done
|
||||
- [x] Matcher: given an incoming link (and name, size, page), rank unfinished downloads it may continue; signed-URL query noise ignored; tests with realistic CDN links
|
||||
- [x] Adopt a partial file: plain truncated file from a browser (`.part`, `.crdownload`), and other managers' partials when the part list is readable and documented; otherwise treat the start of the file as finished only after a byte check
|
||||
- [x] Expired link on the source page: "open source page" state that waits for a matching link
|
||||
- [x] `docs/PROGRESS.md` entry, tick `Plans/INDEX.md`, commit `S008: …`, push
|
||||
|
||||
## End criteria
|
||||
- `nice cargo test -j 2 -p medlar-core --test relink` green: expiring links, swapped content, same size but different bytes, no validators
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Tracker: https://claude.ai/artifact/XouimfVJS6FYVKskGJ8s7H
|
|||
- [x] [S005](02%20Engine/S005-dynamic-parts.md) Dynamic parts and adaptive connections
|
||||
- [x] [S006](02%20Engine/S006-manager.md) Download manager, events and snapshots
|
||||
- [x] [S007](02%20Engine/S007-error-recovery.md) Error recovery
|
||||
- [ ] [S008](02%20Engine/S008-continue-links.md) Continue from a new link
|
||||
- [x] [S008](02%20Engine/S008-continue-links.md) Continue from a new link
|
||||
- [ ] [S009](02%20Engine/S009-mirrors-checksums.md) Mirrors, Metalink and checksums
|
||||
- [ ] [S010](02%20Engine/S010-logins-proxies.md) Logins, cookies and proxies
|
||||
- [ ] [S011](02%20Engine/S011-ftp-sftp.md) FTP, FTPS and SFTP
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ impl Bench {
|
|||
url: self.server.url(path),
|
||||
folder: self.files.clone(),
|
||||
headers: vec![("Referer".into(), "https://old.example/".into()), ("X-Old".into(), "1".into())],
|
||||
secret: Some("old item".into()),
|
||||
..Task::default()
|
||||
};
|
||||
let id = self.run(Command::Add(Box::new(task))).await;
|
||||
|
|
@ -164,6 +165,7 @@ async fn an_expired_link_waits_for_a_new_one_and_keeps_its_parts() {
|
|||
b.server.clear_log();
|
||||
let mut link = b.link(&new);
|
||||
link.headers = vec![("Referer".into(), "https://new.example/".into())];
|
||||
link.secret = Some("new item".into());
|
||||
link.source_page = Some("https://new.example/page".into());
|
||||
let checked = b.manager.check(id, link).await.unwrap();
|
||||
assert_eq!((checked.verdict(), checked.reason, checked.here), (Verdict::Same, Reason::Version, had));
|
||||
|
|
@ -175,6 +177,7 @@ async fn an_expired_link_waits_for_a_new_one_and_keeps_its_parts() {
|
|||
assert!(b.sent(&path(1, "a.bin")) < left + 600_000, "{} of {left}", b.sent(&path(1, "a.bin")));
|
||||
let task = b.view(id).task.clone();
|
||||
assert_eq!(task.source_page.as_deref(), Some("https://new.example/page"));
|
||||
assert_eq!(task.secret.as_deref(), Some("new item"));
|
||||
assert_eq!(task.headers, [("Referer".to_string(), "https://new.example/".to_string())]);
|
||||
for r in b.server.log() {
|
||||
assert_eq!((r.header("referer"), r.header("x-old")), (Some("https://new.example/"), None));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue