0241. One pack per release, identified by its tree hash
- Status: Accepted (maintainer, 2026-11-15); supersedes 0208
- Date: 2026-11-15
- Plan: M15.5; RG1.1, RG1.2, RG4.1
- Review: Data, schemas and wire formats
Context
ADR-0208
proposed storing release payloads as exact hvc objects
(objects/<2hex>/<62hex>) with three
digest domains (semantic, hvc object, package tree hash). Static
hosting then needs one GET per object through a curl subprocess.
crates/harness/src/sha256.rs:215
tree_hash already hashes a tree as
relpath NUL decimal-length NUL bytes per regular file
in bytewise path order; git dependencies are locked by it today.
It does not cover modes or empty directories.
Decision
A release is one file,
releases/<tree-hash>.hvp. Its format is the
header line harness-pack 1\n followed by exactly the
tree_hash framing stream, entries in strictly
ascending path order. The sha256 of the body equals
tree_hash of the extracted tree, so the file name,
the index hash and the lock hash are one
value, and git and index sources pin the same digest for the same
files.
Extraction rejects absolute paths, .., empty or
duplicate components, non-ascending order, ASCII-case collisions,
.git and .harness components and
oversized totals; it writes to private staging and renames into
.harness/deps. Modes are not carried, matching
tree_hash; process packages keep
exec_hash. Packing includes a declared file set and
never .harness/ or the package's lock. Semantic item
hashes may ship as an optional file inside the pack; they are
never identity.
Alternatives considered
- hvc objects per file (0208) — exact and deduplicating, but many requests per release and a second digest domain the lock does not use.
- tar/zip — adds a format with its own path and metadata pitfalls; the framing stream is already specified and implemented for hashing.
- Mode-bearing format now — needs a new hash
domain and changes git lock hashes; defer to
harness-pack 2if a package needs modes.
Consequences
One GET per package, cacheable forever by name. No new hash domain. Packs do not deduplicate across versions; measure before adding deltas. The VCS host can produce packs from hvc trees by materializing them (0244).