On this page

0238. Pluggable sources and a static sparse index

Context

The v1 plan (PLAN-registry.md §3) stored a HEAD → snapshot → entries chain plus hvc objects, needing a snapshot read before every lookup and a writer lock on publish, and fetched over HTTP only after VR7 and hosting H6. Maintainer wants a folder, a static HTTPS server or an S3 bucket to work as a registry. Cargo's sparse index (RFC 2789), Go's GOPROXY and Hex's mix hex.registry build show static per-package files scale and need no server API. The package client already shells out to git (crates/harness/src/packages.rs:485). crates/harness/src/json.rs today only escapes strings.

Decision

Every source implements three calls: versions(pkg) (version, yanked, hash), manifest(pkg, version) (dependency table) and content(hash) (bytes). Three sources implement them: git (0242), a static index (directory, file://, HTTPS, S3 via its HTTPS endpoint or a synced folder), and the future VCS host, which serves the static layout (0244).

Static layout: harness-registry.toml (format, name), index/<path> with one sorted-key JSON line per version (v, hash, deps, edition, yanked), and releases/<tree-hash>.hvp packs (0241). Index files are append-only except the yanked flag. Version coordinates are create-once; identical re-publish is a no-op, different bytes fail. There is no unpublish.

harness registry build <dir> imports packs from incoming/, writes index lines from each pack's manifest, verifies every line against its pack under an OS lock, and writes atomically. harness publish --to file://… is pack plus build. Remote self-hosting is rsync or aws s3 sync; no upload protocol before the VCS host.

Discovery from a source path: config rules, then built-in git hosts, then https://<host>/harness-registry.toml, else git at https://<path>. The result is recorded in the lock, so builds never rediscover. The Rust client fetches static files with a fixed-argv curl subprocess (--proto =https, --fail, size cap, output file, -q, tokens via stdin config), like its git subprocess. GETs carry no request body, so ADR-0181's body limits do not apply.

Alternatives considered

Consequences

A registry is files any server can host. Publishing to a remote static host is an operator sync step. Index files grow with versions; per-package sparseness keeps reads small. Phase 3 adds an optional signed snapshot on top without changing this layout (0243). Maintainer decides the 0207 narrowing.