feat(delta): update an install by the chunks it lacks, not a whole installer

Every Studio update downloads the whole installer (115 MB on Windows),
even when a release changes a few megabytes. Measured on the real
v2.18.1 -> v2.19.0 Windows builds: the Electron binary is identical but
for its version resource, the kernel changes, and the frontend changes
by about half a megabyte.

internal/platform/delta describes a release as a signed-to-be Index: every
file's path, size and SHA-256, and the content-defined chunks it is made
of (normalized gear CDC, 4/16/64 KiB). Chunks are stored zstd-compressed
under the SHA-256 of their plain bytes, so any chunk two releases share
is stored and fetched once. An update cuts the running install with the
same chunker; content-defined boundaries move with an insertion instead
of shifting every chunk after it. It fetches only the missing chunks,
checking each against its name, and writes the new tree to a staging
directory, checking every file against the Index. Validate refuses
paths that leave the tree, backslashes and drive letters, two paths
that are one file on Windows, and chunks that do not add up to their
file.

cmd/studio-delta builds an Index and chunk store from a release zip, and
replays an update from an unpacked older release. On the real pair it
fetches 21.9 MB instead of 115 MB, reuses 344 of 387 MB, and verifies
the staged tree, in about five seconds.

Nothing publishes or consumes this yet. Wiring it into the release
workflow and the updater comes next.

Adds github.com/klauspost/compress for zstd.
This commit is contained in:
yhh committed 2026-09-24 03:47:15 -07:00
1 parent 073eba26c4
commit 887c17e4bf
12 files changed
+960

No files matched your search

+1
View File
@@ -17,6 +17,7 @@
/reasonix-plugin-example
/reasonix-studio-host
/signpath-contract
/studio-delta
/covergate
/pricecheck
/repolint