Skip to content

feat(index): warm-started --from syncs (D21) - #21

Merged
bennischober merged 1 commit into
mainfrom
feat/d21-from-warm-start
Oct 24, 2026
Merged

bennischober merged 1 commit into
mainfrom
feat/d21-from-warm-start

Conversation

@bennischober

Copy link
Copy Markdown
Owner

What

Implements the one surviving piece of the warm-start design pass (D21 in the design ledger): the receiver-side --from sync indexes the old file at commit, so a repeated --from sync against the same old file warm-starts the receiver's scan (previously re-paid on every run). Measured: 238.6× on the 128 MiB fixture (116.53 ms cold scan → 488.50 µs warm load) — disk-bound, scales with size.

What was rejected, and why (the analysis is the point)

The outlook's "index snapshot a fresh machine could request" idea does not survive analysis: an index carries chunk lists (hash/offset/length), not bytes. Every PLAN_LOCAL entry is a byte-verified read from the receiver's own temp/old file — a fresh machine has neither, so a served manifest of unbacked chunks produces zero Local entries and degrades to exactly the full transfer we have today. Migration is a bulk-copy problem (out of niche, D9). Rename detection (cross-file chunk manifests) is recorded as the genuine future wire feature.

Verification

  • New test from_sync_writes_old_file_index_and_repeat_warm_starts: the old-file index carries its own identity (size/mtime/chunks), the target is never indexed from foreign content, and the repeated sync emits WarmStart.
  • Full gates green: fmt, clippy -D warnings, all suites (loopback 23, tree 27, tls/quic/soak/integration).
  • No wire change: the index is local-only state (no spec amendment needed).

The receiver-side --from sync now indexes the OLD file at commit (its
own identity: its size, its mtime, its chunks) on both conversation
outcomes — executed plan (the old file's chunks were hash-verified as
plan reads this session) and empty-plan match (the scan already ran).
A repeated --from sync against the same old file then warm-starts the
receiver's scan, which the old code re-paid on every run.

Measured (the --warm cell; the mechanism — same index, same load path —
is identical for either side): 128 MiB fixture, cold scan 116.53 ms vs
warm load 488.50 us = 238.6x. Disk-bound, scales with size.

The broader idea this replaces — an index snapshot a fresh machine
could request to turn first-sync into a delta — was analyzed and
REJECTED (D21): an index carries chunk lists, not bytes; every
PLAN_LOCAL entry is a byte-verified read from the receiver's own
temp/old file, so a manifest of unbacked chunks cannot produce Local
entries and degrades to the full transfer we already have. Migration
is a bulk-copy problem (out of niche, D9). Rename detection
(cross-file chunk manifests) is recorded as the future wire feature.

Test: from_sync_writes_old_file_index_and_repeat_warm_starts — index
identity per file, the target never indexed from foreign content,
repeated --from emits WarmStart. Docs: D21 ledger entry, CHANGELOG.
@bennischober
bennischober merged commit ec3e9d6 into main Oct 24, 2026
4 checks passed
@bennischober
bennischober deleted the feat/d21-from-warm-start branch October 24, 2026 11:12
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