Repository navigation
feat(registry): mirror another registry with mirror-of - #4732
Conversation
Proposed changes for #4732. Reject signed icon redirects, bound icon requests independently of the subscription, and document private-access onboarding. Regression cases are proposed, not executed. Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol
helix-white
left a comment
There was a problem hiding this comment.
Request changes on fa5f0cb34fec10cb4e9332e6df6c26dd9ea9bb3e:
-
[P1] Keep signed icon requests on the configured upstream.
shared-libs/crates/start-core/src/registry/context.rs:212–214builds the icon client with reqwest's default redirect policy.copy_iconattachesX-Start-Auth-Sig, which reqwest retains across cross-host/port redirects. An upstream or reverse-proxy redirect therefore forwards the mirror's signed proof to another origin. Checking the downloaded content hash cannot protect the request header. Use the non-redirecting policy already required by StartOS's signed icon proxy. -
[P2] Bound icon downloads before awaiting them in the index follower.
shared-libs/crates/start-core/src/registry/upstream.rs:124–130awaits every icon before committing the index, but the HTTP client has no request deadline. A peer that keeps an icon response body open indefinitely freezes metadata synchronization, including the follower's heartbeat/reconnection loop. Even a closed subscription cannot release that HTTP wait. Apply a total request deadline covering headers and body, retaining the existing skip-and-retry-on-update behavior.
The proposal centralizes the existing upstream client construction so regression cases exercise its production redirect/deadline policies, while reusing the existing Tor proxy builder. It adds unexecuted cases for redirected icon requests and successful index replacement despite a stalled icon body.
It also clarifies the inherited public-only subscription contract: after logging the mirror key and granting private access/admin status upstream, a public-only mirror needs restarting. Reader-only mirrors receive redacted reader lists; preserving those lists for private-package failover requires upstream admin access. This documents the existing limitation rather than adding another refresh mechanism. The architecture text also stops calling MirrorGuard the first request middleware; rpc-toolkit processes request middleware in reverse registration order.
git merge-tree --write-tree origin/feat/registry-live-cache HEAD was clean for the reviewed head. The only current-head check reported is successful Conflict Markers; no build/test success is inferred. This was a code-only review: proposal tests were not executed and adopted changes remain author-verified.
Proposed changes: fa5f0cb...proposal/4732
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
Adopted the proposal as-is in 63ba9de.
Verification: the |
helix-white
left a comment
There was a problem hiding this comment.
Approved 63ba9de34ea88e0abbd360c19d4cab6c85c192e4.
Re-reviewed the changes since fa5f0cb34; the committed tree matches the published proposal. Both findings are resolved:
- Production upstream clients refuse redirects, confining signed icon requests to the configured upstream.
- The icon client's 30-second total deadline covers response headers and body. A stalled icon becomes a skipped download rather than indefinitely blocking index replacement.
The regression cases use the production client constructor. The identity-filtered index, public-only restart requirement, private-reader-list limitation, and middleware ordering are documented accurately. No remaining correctness findings.
The fresh git merge-tree --write-tree origin/feat/registry-live-cache HEAD check is clean. I read the author's report of 5 upstream and 22 registry tests passing, with one browser probe ignored, plus clean formatting. This re-review was code-only; I did not execute tests or builds. Current-head CI reports successful Conflict Markers only, not full build/test coverage.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Dismissed by Helix: the changes require a substantive PR brief update. Signed mirror icon requests now refuse redirects and have a 30-second total deadline; redirected or stalled icons are skipped rather than forwarding authentication proofs or indefinitely blocking synchronization. These substantive exposure and failure-behavior changes require the brief to explain request confinement and bounded best-effort icon copying.
|
Merged #4583 landed on master as a squash, while this branch still carried #4583's original commits, so Git reported conflicts in files both sides touched. The merge commit takes master's tree and reapplies only this PR's own diff (e5b359f..63ba9de). That diff applied without conflicts. The result differs from Verification on the merged tree, in the repository's test container: |
helix-white
left a comment
There was a problem hiding this comment.
Approved c242630370d02d28948317b71fa914dccdf811b1.
Re-reviewed after the base moved to master, where #4583 landed as squash 2f845e5c4. The only change since my approval of 63ba9de34 is the merge of origin/master in c24263037:
git merge-tree --write-tree origin/master HEADis clean.- The merge commit's tree is identical to an independent replay of the PR's three commits onto
master(b923d6497..63ba9de34, including thee5b359fc8refactor). The conflict resolution adds nothing. git diff origin/master...HEAD(25 files, +867/−112) is byte-identical to the change I approved against617de624c. Both earlier findings stay fixed: the upstream clients refuse redirects, and icon downloads have a 30-second total deadline.master's other commits since #4583's fork point (#4701, #4721, #4723, #4728 and the StartWRT changelog compilation) touch none of the PR's files or registry code.mirror_ofis a plainUrlonRegistryConfig, outside #4723's CLI profile parsing.- start-registry 1.6.0 still follows from the v1.5.0 tag plus minor fragments. No generated man page covers the daemon's flags, so
--mirror-ofadds no generated-artifact drift.
No remaining correctness findings. This re-review was code-only; I did not build or test. CI on this head is pending, now running the full suite against master.
Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
|
Added a separate commit at @dr-bonez's request: |
helix-white
left a comment
There was a problem hiding this comment.
Approved 303dc54e9cfe579abf7797ded31560f4abf9a8ac.
Since my approval of c24263037, the only change is 303dc54e9. It bumps startwrt-core from 1.4.0 to 1.4.1 in projects/start-wrt/backend/ctrl/Cargo.toml and its Cargo.lock entry. That file is start-wrt's canonical manifest in MANIFESTS. git merge-tree --write-tree origin/master HEAD is clean.
- The bump is correct.
start-wrt/v1.4.0(9cef87c9b) predates #4583's squash merge. The four start-wrt fragments pending at this head are all #4583's patch-tier entries.check-version's rule (latest stable origin tag plus the highest pending tier) therefore expects 1.4.1, somaster's 1.4.0 failed and 1.4.1 matches. - No other product needs the same fix. By the same rule, start-os 0.4.3, start-sdk 4.2.0, start-cli 3.0.0, start-tunnel 1.5.2 and start-registry 1.6.0 all match at this head. I derived these from the tags and fragments by reading; I did not run the script.
- Nothing else needs to move with it. The image build takes
STARTWRT_VERSIONfrom that manifest (build.mk), and the backend readsCARGO_PKG_VERSION. Migrations use the version only in their summary text, so no migration entry is needed. The web mock's'1.4.0'is mock data, not a release-tracked value; it read'1.0.0'at v1.3.0. - The rest of the PR is unchanged from what I approved, and the description's additional-fix line matches the commit.
Non-blocking: the PR still has no labels. The root AGENTS.md asks for a label for each product whose files or behavior it changes (start-registry, and now StartWRT) and an impact tier (minor).
No correctness findings. This re-review was code-only; I did not build or test. CI on this head is pending, with no failures so far.
Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
…d icon request Extract SubscriptionFollower (dump/revision application, heartbeat and initial deadline), db_subscribe_request and next_retry from StartOS's registry cache sync, and request_icon from the StartOS icon proxy, so a registry mirror can reuse them. Behavior is unchanged. Helix-Harness: claude-code Helix-Model: claude-opus-5-5
A registry started with mirror-of follows the upstream's /index over an encrypted db.subscribe stream under its server identity, copies the stored icons the index refers to (verifying their blake3 names), and replaces its local index on every update. Handlers that write the index carry WRITES_INDEX metadata; MirrorGuard rejects them while mirroring. Admins, metrics and the server identity stay local. Removing mirror-of and restarting promotes the mirror with its synchronized index. Helix-Harness: claude-code Helix-Model: claude-opus-5-5
Signed icon requests no longer follow redirects, so the mirror's signature header cannot reach another origin, and each icon download has a 30-second total deadline so a stalled body cannot freeze index synchronization. Document that a public-only mirror needs a restart after private-access grants. Adopted from @helix-white's review. Helix-Harness: claude-code Helix-Model: claude-opus-5-5
303dc54 to
4373fb5
Compare
|
Rebased onto |
Builds on #4583 (merged), which provides the encrypted
/rpc/v2sessions,db.subscribestreaming and server identity it uses. Targetsmaster.Settled constraints
@dr-bonez accepted each of these as implemented.
db.subscribestream. An upstream older than feat: synchronized registry caches, private packages and encrypted RPC #4583 (registry 1.6.0) fails to connect and is retried with backoff; the mirror's index stays as last synchronized. No polling fallback exists, unlike StartOS's registry caches. Start9's production registries must run 1.6.0 before anything can mirror them. A polling fallback would need the legacyindexcall plus separate icon handling, roughly a second sync path.keywhen mirroring starts..s9pkand OS image files remain at the URLs the index lists, so failover covers browsing, metadata and signer trust but not downloads hosted solely by the failed party. Copying assets would require new storage and a download route on the registry.mirror-ofand restarting turns the mirror into a normal writable registry with the last synchronized index. Admins are local, so the upstream's admins must be added on the mirror by signer ID. Clients are failed over by DNS or registry URL; StartOS does not fall back to a mirror automatically.Summary
New setting:
mirror-of: <url>in the config file, or--mirror-ofon the command line, read at daemon startup. While it is set, one background task:/indexstream;indexafter each dump or revision.Read-only index: while mirroring, the registry rejects every RPC that writes the index with
This registry mirrors <url>; make index changes there. That covers package and OS publishing, signing and removal, signers, categories, package access, registry info anddb apply. Index reads, admin management (admin add/remove), metrics and the server identity are unaffected, because they live outsideindex.Icon failures: an icon the upstream refuses, redirects, mismatches or does not finish within 30 seconds is skipped and retried on the next update. Index synchronization continues.
Reconnection: connection loss reconnects with the existing jittered 30–300 second backoff, and the mirror keeps serving its last index.
Additional fix (StartWRT version): bumps start-wrt to 1.4.1 (
projects/start-wrt/backend/ctrl/Cargo.tomland itsCargo.lockentry), as @dr-bonez requested. start-wrt 1.4.0 was tagged before feat: synchronized registry caches, private packages and encrypted RPC #4583 merged, leaving four patch fragments pending against a released version.check-versiontherefore failed for start-wrt onmasterand on every PR whose diff includes start-wrt.Implementation diff: +510 / −109 lines in 19 files (excludes lockfiles, tests, docs, release notes, and changelog).
Approach
SubscriptionFollowerinregistry/sync/connection.rs, and both StartOS and the mirror use it. StartOS behavior is unchanged.next_retry) and the signed icon request (request_icon) are shared the same way. The latter is extracted from StartOS's private-icon proxy. Icon storage shares one atomic write withstore_icon.session_client::connectwith the registry's identity, rather than StartOS's always-SOCKS WebSocket client. The registry dials clearnet directly and only.onionthrough itstor-proxy. Both mirror HTTP clients reuse that proxy policy, refuse redirects, and the icon client has a 30-second total deadline. @helix-white's review added the redirect refusal, so the signature header cannot reach another origin, and the deadline, so a stalled icon body cannot freeze synchronization.MirrorGuard, keyed on awrites_indexhandler-metadata tag (26 handlers, plus the OS asset add/remove/sign subtrees by inheritance). It is not checked in each handler. The alternative was allow-listing reads. A handler that writes the index but lacks the tag is accepted and then overwritten by the next upstream update. The tagging rule is recorded in start-registry'sAGENTS.md.FullIndexdeserialization, so an upstream index this version cannot parse is rejected rather than stored. A new revision on a mirror whose upstream has removed packages also removes them locally; nothing is merged.Testing
Run on Debian 13 in the repository's
start-core-testenvcontainer, filtered withcargo test --features=test,ts -p start-core --lib:End to end against a real upstream registry, from feat: synchronized registry caches, private packages and encrypted RPC #4583's test fixture over its encrypted session:
Read-only enforcement: with an upstream configured,
info.set-name,package.access.set-private,os.asset.sign.iso(tag inherited from its subtree) anddb.applyare rejected and leave the index unchanged.indexreads andadmin.addstill work.Icon safety:
The last two fail on the pre-review head.
No regressions: all 153
registry::tests (including feat: synchronized registry caches, private packages and encrypted RPC #4583's StartOS sync tests now running throughSubscriptionFollower) and the StartOS icon-proxy tests pass. A releasecargo check -p start-registryis warning-free, Rust formatting and prettier are clean, andcheck-versionaccepts start-registry 1.6.0, which already carries feat: synchronized registry caches, private packages and encrypted RPC #4583's minor fragment, and start-wrt 1.4.1.Not exercised: a deployed mirror against a production registry, and the failover itself (DNS or URL switch, promotion). The rebased head keeps the same diff against
master. The focused suites passed on the merged tree (155 registry, 34 static-server); CI re-runs on the rebased head. Full CI passed on 303dc54, before the branch was rebased ontomasterto drop #4583's original (partly unsigned) commits: Run Automated Tests, Changelog fragments & versions, Formatting & Lockfiles, Generated Artifacts, Prettier, Dependency Licenses, the registry Docker image, Debian packages and binaries for every target. Image builds and deploys for unchanged products were skipped.Helix-Harness: claude-code
Helix-Model: claude-opus-5-5