Files
skylar taylor-barrickandDylan M. Taylor 11372822d7 Defer Developer Build verification until installation (#1706)
* Defer Developer Build verification until installation

* Keep obsolete Developer Build verification failures job-local

* Address catalog discovery review consistency and backoff findings

* Keep build verification waits out of catalog refresh status

* Register verification hold refusal for translation

* fix: scope legacy nightly retry metadata on upgrade

* Fix warm nightly replay and typed admission refusals

Keep a recovered signed listing visible but stale when an older persisted absence disagrees. Capture the eligible install candidate once before reservations and report capture failures through the typed Nightly refusal path; retain worker revalidation at use.

* test: add CodeRabbit follow-up regressions before fixes

Tests-only (plus a test-only download-turn hook) on 8084fe64 production code;
expected to fail until the follow-up fixes land.

* Address CodeRabbit follow-up on Developer Build scheduling and install checks

- A catalog request the ArtCraft throttle holds charges no app its turn and keeps
  activation revalidation pending; automatic sweeps wait for the hold, cached
  listings still display, and apps it says nothing about keep their result.
- A signed offer or omission that expired after its last check is revalidated
  before the cadence, once, in Native and in the UI's request gate.
- Live and replayed omissions share the no-build record's exclusive two-hour window.
- An install's descriptor failure publishes the build status and wait without a
  catalog-check failure event.
- The descriptor wait is a time hold applied by the UI clock and Native
  admission, not package ineligibility, so Install returns at the deadline.
- NightlyStatus carries the signed reconciliation as a lower eligibility bound.
- A job compares its exact build/package selection again after its download
  turn, before any package request.

* test: add second-round follow-up regressions before fixes

Compile-compatible with the ff250ccb production code: expiry coalescing, the held
catalog deadline in check completion, a real descriptor Retry-After keeping the current
offer (with its next click verifying again), blocked-failure controls, and the card's
Install naming the build it shows. Expected to fail until the second fix lands.

* Bind Developer Build installs to the shown offer; finish wait and hold recovery

- Command::InstallOffer carries the exact release a card shows; Native refuses it
  visibly, before any reservation, descriptor or package request, when the one
  exact capture differs. App-only Install keeps its meaning for headless callers;
  Stable refuses the new command.
- A server's descriptor Retry-After on the recorded build keeps the current listing
  eligible (time hold only); malformed/other verification failures, an expired or
  replaced listing and a storage failure stay blocked; the next click after the
  deadline verifies the descriptor again.
- The ArtCraft throttle's catalog hold reaches CheckFinished (catalog deadline only),
  and the page's hold line uses the neutral "Next check at" wording.
- Signed-expiry revalidation never shortens the one-minute coalescing window, in
  Native and in the UI's mirrored request gate.
- Native test-support feature (test-only, off by default) and a non-wasm UI
  dev-dependency let UI tests run on events a real Native backend produces.

* Address catalog replay, retry reporting and test transport review nits

---------

Co-authored-by: Dylan M. Taylor <[email protected]>
2026-11-28 22:53:59 -05:00

6.3 KiB
Raw Permalink Blame History

Signed hosted catalog

The launcher bundles crates/core/catalog.toml, containing the website's launcher-catalog.toml data from storytold/artcraft-services#205 with the latest compiled display order. The signed website fixture is kept separately under crates/core/tests/fixtures/ with byte-preserving Git attributes for Windows. The core build script generates the existing static app/details types from it, keeping first launch and offline operation independent of the website.

On the first release check of each process, desktop and web fetch:

  • https://getartcraft.com/launcher-catalog.toml
  • https://getartcraft.com/launcher-catalog.toml.sig

The signature is base64 encoding of a 64-byte Ed25519 signature over the exact TOML bytes, with optional surrounding whitespace. Verification uses the SPKI PEM public key in crates/core/assets/launcher-catalog-public-key.pem before parsing. The corresponding private key belongs only in the website's Cloudflare build secret LAUNCHER_CATALOG_SIGNING_KEY. It is never read or bundled by the launcher. The checked-in signature fixture is public test data, not a secret.

Desktop stores the TOML and signature together in an atomic launcher-catalog.json beside the release-feed cache. Web uses the browser's local storage (artcraft-launcher.signed-catalog.v1). Every cache read verifies the signature again. Network failures, missing signatures, invalid signatures, invalid documents or unavailable storage preserve the verified cache, then the bundled list. The bundled list is visible while the background check runs.

The active catalog is immutable for the process lifetime. Existing install jobs keep their static handles; restarting refreshes the catalog again. Only one bounded snapshot is interned per process. This avoids accumulating leaked strings on repeated checks. Missing bundled apps are appended to the hosted list so an installed copy remains manageable after the hosted entry disappears.

The signed file updates app copy, colors, details, desktop categories, window class, icons and display order. Invalid rows are skipped, unknown fields ignored, and a document with no valid rows is rejected. New official apps can be added without a launcher release, within the existing source policy: a lowercase safe ID, its matching storytold/<id> repository, ArtCraft publisher/team, default bundle ID and no legacy aliases. Existing app names, aliases, bundle IDs, repositories, publishers and macOS signing teams stay pinned to the bundled entry. A signature cannot add an unapproved community app or change an existing install identity. Community onboarding and identity changes still require maintainer review and a launcher release.

Icons must use the website's app-ID/hash filenames and pass SHA-256 and PNG size/dimension checks before decoding. Desktop caches them by hash; web uses its HTTP cache. Missing icons do not block a valid catalog. Screenshots remain JPEGs at the launcher's pinned assets tag, with existing byte/pixel checks. The currently supported installer code still derives package/binary IDs from app IDs; arbitrary installer identities in unknown manifest fields do not change installation behavior.

Limits: 1 MiB catalog, 128-byte encoded signature, 64 hosted apps, 16 features and screenshots per app, 256 KiB/512×512 PNG icons. Desktop HTTP uses its existing bounded reader and timeouts. Browser catalog/icon requests stream with actual byte limits and a 20-second abort signal; redirects are refused on both platforms.

This is a single pinned key. Rotation requires a launcher update; there is no manifest-authorized next key, signed expiry or rollback counter in this schema. The signature authenticates content, not freshness. The existing package checksum and macOS/Windows publisher checks continue to apply to installations.

Validation includes a real signed website-format fixture, wrong-key/tampering rejection, malformed rows, install-identity restrictions, new official app policy, icon hashes/dimensions, and reverified cache fallback. The private signing key is not required to run any test.

To validate the published catalog through the desktop HTTP/cache/activation path without installing any app:

cargo test -p artcraft-launcher-native live_catalog_is_verified_cached_and_activated -- --ignored

This opt-in network test uses temporary storage and checks the pinned signature, all accepted entries, activation and icon hashes. Normal CI stays offline.

Announcements and alerts use the same key and checks from their own signed file: see announcements.md.

Developer Builds

Developer Builds list the signed ArtCraft catalog, including a reverified disk snapshot before network refresh. Opening the page, scheduled checks and Refresh never ask GitHub for releases, release pages or isolation descriptors. Missing, stale, invalid or offline catalog answers do not fall back to GitHub. Stale cached listings remain visible but cannot start an install. When a listing's signed freshness ends, the next scheduled check revalidates it rather than waiting for the app's usual cadence (never sooner than a minute after the last check); a catalog request the ArtCraft throttle holds back costs no app its turn, and the page asks again when the hold ends.

A listing is not an installation token. A card's Install and Update name the exact release it shows (Command::InstallOffer); if the current offer differs in any way, the click is refused visibly before anything is reserved or fetched. Install and Update capture the selected exact catalog release and consent generation before reserving their job. Only that release's NIGHTLY.json is fetched on demand and verified against the signed catalog hash, the descriptor's exact release identity and the source-owned platform/profile/package row. No other apps or releases are enumerated. Missing or changed evidence fails without requesting a payload, and a job that waited for its download turn compares the selected build and package again first. A server's Retry-After on the descriptor holds only that build's Install, by its deadline: the listing stays current, and the next click after the deadline verifies the descriptor again. The existing payload checksum, platform signature, private destination and transaction checks still run before installation; opting out continues to leave owned copies and their data available.

Stable release checks retain their existing fallback policy.