Skip to content

fix(start-os): show a sideloaded package as soon as its upload begins - #4592

Closed
MattDHill wants to merge 1 commit into
fix/pcp-v6-link-local-gatewayfrom
fix/sideload-entry-before-trailer
Closed

MattDHill wants to merge 1 commit into
fix/pcp-v6-link-local-gatewayfrom
fix/sideload-entry-before-trailer

Conversation

@MattDHill

Copy link
Copy Markdown
Member

Stacked on #4589, which carries the 0.4.1.3 bump. Retarget to master once that merges.

Problem

Since #4535, clicking Install on the sideload page navigates to Installed services, but the package doesn't appear (and shows no upload progress) until the whole upload has finished.

#4535 switched load_with_signers from S9pk::deserialize to S9pk::deserialize_local, which also reads the supplemental-signature trailer that sits after the archive. During a sideload the source is the upload stream, so that read blocks until the last byte arrives. ServiceMap::install inserts the Installing entry only after its loader returns, so the entry is written at upload end. Reproduced on a dev box: the first packageData patch for the package arrived with Uploading already at 100% and Validating Headers complete.

Change

  • s9pk::load_deferring_signers reads only the header. When a signer policy applies, it returns the trailer read plus policy check as a deferred SignerCheck future. load_with_signers keeps its full read and immediate check for every other caller (CLI, tests).
  • S9pk::read_trailer splits the trailer read out of deserialize_local.
  • ServiceMap::install accepts a loader that returns either an S9pk or an (S9pk, Option<SignerCheck>) (the LoadedS9pk trait), so the other install callers don't change. It runs the check inside the reload guard before unpacking, so a rejected signer still fails the install with the usual "Installing failed" notification and rollback.
  • Sideload uses the deferred loader.

One behaviour change: an untrusted sideload now appears as installing for the length of its upload before failing, instead of failing before it appears.

Verification

  • New test s9pk_trailer_deferred_signer_check_waits_for_the_trailer_but_the_header_does_not: a source that blocks every read past the archive. The header load must return, and the check must stay pending until the gate opens, then accept a pinned endorser and reject an unpinned one.
  • make start-core-format-check passes. start-core was not compiled locally; compile and tests run in CI.

🤖 Generated with Claude Code

#4535 made sideload load the package with deserialize_local, which reads
the supplemental-signature trailer at the end of the file. On an upload
that blocks until the last byte arrives, and services.install only
inserts the Installing entry after the loader returns, so the package
never appeared (nor showed upload progress) until the upload finished.

Sideload now loads only the header via load_deferring_signers, which
returns the trailer read and signer-policy check as a deferred future.
install() runs it inside the reload guard before unpacking, so a
rejected signer still fails the install with the usual notification and
rollback. load_with_signers keeps its full read for every other caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two changes needed in shared-libs/crates/start-core/src/service/service_map.rs:

  • P1 — Declare the loader result type parameter. install uses L in Future<Output = Result<L, Error>> and L: LoadedS9pk<S>, but its generic parameter list still declares only F, Fut, and S. This prevents start-core from compiling. The proposal adds L to the declaration.
  • P1 — Start progress syncing before awaiting signer verification. With a signer policy, check.await reads the footer and therefore waits for the upload to finish. The sync_to_db task is spawned only after that await, leaving the newly inserted Installed services entry frozen at its initial upload snapshot for the rest of the upload. The proposal starts the existing guarded sync task first, retaining signer verification before any unpacking. Its local NonDetachingJoinHandle still cleans up on rejection or cancellation. Please extend regression coverage to assert that package-data progress advances while the trailer remains gated; the added loader test cannot catch this ordering bug.

Proposed changes: f8a19ec...proposal/4592

Reviewed the diff, loader callers, trailer reading, upload source, and install rollback/cancellation paths. The reviewed head merges cleanly into fix/pcp-v6-link-local-gateway. Only the successful Conflict Markers check is reported; no compile/test evidence is present. No builds or tests run during review.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white

Copy link
Copy Markdown
Member

Closing at @dr-bonez's request. A separate counter-PR will send supplemental signature candidates in the sideload request and verify them against the uploaded archive's commitment, rather than defer a backend trailer read.

@helix-white

Copy link
Copy Markdown
Member

Replacement counter-PR: #4594. It sends signature candidates up front from the browser and CLI and leaves the install/progress lifecycle unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants