0238. Pluggable sources and a static sparse index
- Status: Accepted (maintainer, 2026-11-15); replaces the index layout of the v1 registry plan and narrow 0207 for read-only registry GETs
- Date: 2026-11-15
- Plan: M15.5; RG1.1, RG1.2, RG2.2
- Review: Data, schemas and wire formats
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
- v1 snapshot chain with signed HEAD — couples every read to signing and a single writer; per-package files avoid both.
- Full index download or git-backed index — Cargo moved away from it; git-backed index also conflicts with keeping the registry independent of git.
- Wait for the VR7 Harness HTTP helper (0207) — blocks goal 1 on unbuilt VC remotes; the hosted service keeps 0207's helper.
- TOML index lines — workable via
toml.rs; JSON lines append more cleanly, at the cost of a small in-tree line reader (json.rstoday only escapes strings).
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.