Skip to content

feat(task)!: make doubling the default growth strategy - #192

Draft
greenhat616 wants to merge 1 commit into
feat/hardening-29-silent-restartfrom
feat/hardening-30-default-doubling
Draft

greenhat616 wants to merge 1 commit into
feat/hardening-29-silent-restartfrom
feat/hardening-30-default-doubling

Conversation

@greenhat616

Copy link
Copy Markdown
Owner

C14 (T15, PR-7b) of the download strategy hardening stack. It is stacked on #191, the silent-runner restart, and that branch is its base. The design notes are in §14.20.

Why

T15 switches the default once G7 is met. With #189 (C28) and #191 (C29), §14.19 shows that G7 is met in s1, s2 and s3. The stall scenarios end in 12–14 s instead of waiting out the 30 s idle timeout.

What

Code

  • Doubling is the only strategy. StrategyControl holds DoublingStrategy directly.
    • execute drops the Legacy branch and the two speed inputs only Legacy read.
    • The tick sample is required (&TickSample).
  • Removed:
    • Legacy (dynamic_strategy.rs), the Growth enum and is_doubling;
    • ThroughputSampler::speed, which only Legacy read (per_runner_speed stays);
    • the Legacy-only split actions: SplitAllTask, SplitGivenTask, get_incomplete_states, find_chunk_to_split and SplitCandidate.
  • Rates are always sampled. DownloadLoop::rates is a plain RunnerRates, so the "Legacy samples nothing" branches in the slow and silent restarts, the hedge and planned_split_size are gone.

Feature and API (breaking)

  • The unstable-strategy feature is removed. A crate that enables it no longer builds.
  • GrowthStrategy, TaskOptions::growth_strategy and TaskBuilder::growth_strategy are removed. All three were behind that feature, so the default API is unchanged.
  • Default users get Doubling. That means growth by doubling, slow and silent restarts, and the endgame hedge.
  • There is no CHANGELOG. The break is described in the crate README and in the commit's BREAKING CHANGE footer.

Bench and docs

  • The bench runs Doubling only: no strategy column and no G7 verdict. §14.19 stays as the last A/B comparison.
  • README and docs/task.md describe Doubling as the only strategy. That includes the two C29 exceptions: a runner silent for 2 s does not hold growth back, and a runner silent for 4.5 s is restarted.
  • The design notes:
    • §1 and §7.2 note what C14 removed.
    • The §9.3 formula now matches planned_split_size.
    • The Legacy statements in §9.3 and §9.6 are marked historical.
    • The new §14.20 records the decisions, the breakage and every test change.
  • tests/silent_restart.rs needs only tokio.

Decisions where T15 was silent

These were made during implementation; the maintainer gave no separate instruction:

  • Keep the bench, Doubling-only.
  • Keep the Strategy trait and StrategyControl.
  • Remove the Legacy-only split actions in this PR, since they would be dead code under -D warnings.
  • Remove the gated API completely.
  • Leave the two idm-*.md analysis docs untouched and exclude them from T15's rg check, because they quote the old code.

Tests

  • Lib tests: 573 → 563 with all features and 542 → 532 with defaults. All 10 removed tests covered deleted code.
  • Rewritten to Grow or split(): §14.20 lists each one with its old and new assertion. The property test no longer picks a strategy.
  • Coverage dropped:
    • Splitting a nonexistent runner ID: no action selects runners by ID any more.
    • "A backing-off range doesn't block splits": growth only takes running chunks, so this holds by construction.
  • End-to-end tests run under Doubling by default for the first time: range_faults, empty_body, custom_adapter, custom_timer, silent_restart and bolt-load-tests. All pass unchanged.
  • Mutations, each failing tests:
    • growth also splits connecting runners;
    • growth ignores the planned split size;
    • a split while congested;
    • rates never sampled (34 tests).

Results

10 runs each, median / p90 in seconds, against §14.19's Doubling.

Scenario Now §14.19
s1, max 32 15.95 / 16.01 15.94 / 16.01
s1, max 8 21.10 / 21.12 21.08 / 21.09
s2 5.56 / 6.95 4.74 / 5.40
s3 15.57 / 15.58 15.61 / 15.63
s4 11.07 / 12.56 11.80 / 12.55
s4a 12.36 / 12.38 12.36 / 12.37
s4b 13.75 / 13.96 13.84 / 13.99
s4c 13.14 / 13.18 13.23 / 13.29
  • Behaviour is unchanged. Peaks, hedges and restarts match, and unmatched is 0 in every run. The no-stall controls match as well.
  • s2 looks like noise, not a change in the code path.
    • The behaviour is identical: peak 2, no 429s, hedges or restarts.
    • The time drifts within the round: runs #0–6 take 5.30–5.75 s, runs fix(deps): update rust crate thiserror to v2.0.7 #7–9 take 6.43–7.11 s.
    • Rerun alone, s2 gives 4.83 / 6.58 s with the same pattern.
    • The Doubling code path is unchanged.
    • Disk writeback or memory pressure is a plausible cause, not a demonstrated one.

Review

Reviewed with /ccg:review, using the codex backend only (a single-model review).

Round 1: PASS (96/100). It confirmed three things:

  • the removed code was Legacy-only;
  • the rewritten tests keep their intent;
  • nothing else changes on the default path.

Its two Minors are fixed:

  • The README and docs/task.md now document the C29 silent exceptions.
  • The live design sections no longer describe Legacy as current, and §9.3's formula is updated.

Checks

All on +nightly-2026-11-06. Clippy allows unnecessary_lazy_evaluations until #183 merges.

  • cargo fmt --all -- --check.
  • 4 clippy configs with -D warnings. The third used to need unstable-strategy and now builds -p bolt-load --lib --no-default-features --features smol.
  • cargo test --workspace --all-features --locked and cargo test --workspace --locked.
  • RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features -p bolt-load: 18 errors, one fewer than its base (a DynamicStrategy link is gone).
  • rg "threashold|DynamicStrategy|unstable-strategy" crates, excluding the two idm-*.md analysis docs: no matches.
  • The full bench, 10 runs each, plus an s2 rerun.

Doubling is now the only growth strategy, so every download grows by
doubling, restarts slow and silent runners and hedges a stalled range
at the endgame. Legacy, its task-speed split size and the split actions
only it used are removed, and the per-runner rates are always sampled.

The growth bench runs Doubling alone; the last comparison with Legacy
stays in the design notes.

BREAKING CHANGE: the unstable-strategy feature, GrowthStrategy,
TaskOptions::growth_strategy and TaskBuilder::growth_strategy are
removed; doubling is the only growth strategy.
@greenhat616
greenhat616 force-pushed the feat/hardening-30-default-doubling branch from a20ea81 to 50c5a15 Compare November 13, 2026 22:25
@greenhat616
greenhat616 removed this pull request from stack #190 November 13, 2026 22:28
@greenhat616
greenhat616 added this pull request to stack #215 November 13, 2026 22:29
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