Expand description
red ui bundle resolver — pin→URL resolution, HTTPS download,
SHA-256 verification, tgz extraction, and local cache management.
Implements the runtime download path described in ADR 0050:
- The pinned
red-uiversion and its bundle SHA-256 are build-time constants set by CI (RED_UI_PINNED_VERSION/RED_UI_PINNED_SHA256). resolve_ui_bundlechecks~/.cache/reddb/ui/<version>/for a cached bundle whose manifest matches the pin. Cache hit → returns the directory immediately (no network call).- On a cache miss it downloads the GitHub release asset, verifies the SHA-256 (refuses on mismatch), extracts the tgz into a staging directory, writes a manifest, and atomically promotes the staging directory to the live version directory.
- Offline first-run with no cached bundle fails with a clear,
actionable
io::Errormessage.
The UiBundleFetcher trait makes the network layer injectable for
tests.
Structs§
- Http
Fetcher - Production fetcher — HTTPS via
ureqwith rustls, per ADR 0050.
Constants§
- RED_
UI_ PINNED_ SHA256 - SHA-256 (lower-case hex) of the
ui-dist.tgzfor the pinned version. CI sets this alongsideRED_UI_PINNED_VERSION. - RED_
UI_ PINNED_ VERSION - Exact
red-uiversion thisredbinary was tested against. CI that validates thered↔red-uipair sets this before the release build.
Traits§
- UiBundle
Fetcher - Abstraction over the network layer so tests can inject a fake without making real HTTP calls.
Functions§
- reddb_
user_ cache_ root - Compute
~/.cache/reddb(XDG-aware on Linux, standard on macOS/Windows). - release_
asset_ url - GitHub release asset URL for a given
red-uiversion. - resolve_
ui_ bundle - Ensure the pinned
red-uibundle is cached and return its directory.