Repository navigation
feat(task): make resuming public - #210
Draft
greenhat616 wants to merge 1 commit into
Draft
greenhat616 wants to merge 1 commit into
greenhat616 wants to merge 1 commit into
Conversation
greenhat616
force-pushed
the
feat/hardening-45-resume-public
branch
from
November 13, 2026 07:44
6d6e8eb to
48d0115
Compare
greenhat616
marked this pull request as draft
November 13, 2026 08:55
Resume::On, set through TaskBuilder::resume, lets a task keep its partial file and a state file when it ends early, and continue from them next time. It is off by default, and an Off task behaves exactly as before. An optional resume_source names the download, for example by its URL, and a resume with another source is rejected. A task never starts over on its own. If the pair cannot be resumed, it fails with ResumeRejected and leaves both files as they were, so the caller decides. TaskStatus::kept_for_resume names the partial file a task kept, and discard_partial removes the pair for a destination. The README and the task guide describe what is kept and checked, why a fresh adapter is needed to check against the current resource, the lock requirement, and the ureq2 connection limitation (#207). End-to-end tests resume after a cancellation at 21 seeded positions on all three clients, and after a child process is killed before, during and after a checkpoint and after a failed rename. While a child holds the lock, tasks in another process fail with InUse.
greenhat616
force-pushed
the
feat/hardening-45-resume-public
branch
from
November 13, 2026 22:26
48d0115 to
21da379
Compare
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.
C20c (T21), the last of three commits of C20 (resume) and the eighth commit of PR-9d in the download strategy hardening stack. It is stacked on #209 (C20b, engine resume), its base branch. With #208 and #209 it completes C20, and with it T21. The design notes are in §11.5 and §14.30.3.
What
Public API
Resume { Off, On }:#[non_exhaustive],Offby default (§11.5.2). Set throughTaskBuilder::resume.TaskBuilder::resume_source(impl Into<String>):SourceMismatch.validate()with the existingBuildError::InvalidOptions.TaskStatus::kept_for_resume: the partial file a task kept for resuming (STATUS-13).bolt_load::task::discard_partial: removes the partial file and the state file of a destination, under the lock (C33c).Docs
docs/task.mdhas a new "Resuming" section, and the README a shorter one. They cover:discard_partial;If-Rangecatches a change only when the resume issues a range request, and a resume that kept every block issues none. To check against the current resource, resume with a fresh adapter;TaskBuilder::prefer_mode: a resumableOntask runs concurrently with one connection, so that it keeps a state file (§11.5.8);max_connections, and without agent timeouts that can last indefinitely. Tracked in ureq2: a dropped stream can keep its connection open, so a retry briefly overlaps it #207, with a link to the adapter README's timeout guidance.task-api-spec: STATUS-12 is final. tasks.md: both T21 C20 boxes are ticked.
Not breaking
Checked item by item against the final API:
Resumeis a new#[non_exhaustive]enum.resumeandresume_sourceare new methods.discard_partialis a new function.kept_for_resumeis a new field of the#[non_exhaustive]TaskStatus.BuildErrorgains no variant.Offis the default, and its behaviour is unchanged.The test crate gained a server mode, but it is
publish = false.Tests
tests/resume.rs), public API only.Cancelled,kept_for_resumeis the partial file, and the state file is present.resumedis set, and nothing is left next to the file. Each client keeps blocks on at least one seed.src/task/tests/resume_crash.rs). The test binary re-runs itself as a child process. The child stops at a gate with no deadline, prints, and is killed (TerminateProcess or SIGKILL), so no cleanup runs and no test waits on a timer.OnandOfftasks in the parent fail withInUse.discard_partialafter a cancellation: both files are removed, and the next task starts fresh.resume_source: the same source resumes; another source, or none, is rejected with both files untouched. The 4096-byte limit holds.Review
Reviewed with
/ccg:review, using the codex backend only (a single-model review).Round 1: PASS (88). Four Minors, all fixed:
Its Suggestion, the
Sendprobe's initializer, is fixed, and the probe was checked with both CI configurations.Round 2: PASS (97/100). Its Suggestion is applied: G9's wait now requires a full block.
Checks
All on
+nightly-2026-11-06, with--no-fail-fast. Clippy allowsunnecessary_lazy_evaluationsuntil #183 merges.cargo fmt --all -- --check.-D warnings.cargo test --workspace --all-features --locked: 29 suites, 960 passed, 1 ignored (the benchmark).cargo test --workspace --locked: 29 suites, 887 passed, 1 ignored.RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -p bolt-load: the same 18 errors as its base.