0240. One lock format for every source
- Status: Accepted (maintainer, 2026-11-15); supersedes 0203
- Date: 2026-11-15
- Plan: M15.5; RG0.1, RG1.2, RG2.1, RG2.2
- Review: Data, schemas and wire formats
- Amended by: 0250 (entry shape)
Context
harness.lock v1 (ADR-0072) has
[package.<name>] tables with
version, source, deps,
optional hash and exec_hash (ADR-0099).
Sources are path:…,
git+<url>#<rev> and
edition:<e>. ADR-0203 proposed v2
only for registry graphs, adding release,
tree, signatures and trust
fields. Cargo notes that storing a registry URL in the lock means
a registry should not offer two protocols. Goldens and existing
locks must stay byte-identical.
Decision
One entry shape for every source: version,
source, deps, hash,
optional exec_hash, and tag for git tag
dependencies only. hash is the existing
tree_hash (sha256: + 64 hex) and is
mandatory for every non-path entry. Path entries stay unhashed.
Source strings: path:…,
edition:<e>,
git+<url>#<commit> and
index+<canonical-url>/<path>. The VCS
host uses index+ because it serves the same layout
(0244).
lock_version = 2 is written only when the graph
needs tag or index+; graphs v1 can
express keep writing lock_version = 1
byte-identically. Readers accept both. No release, signature,
trust, mirror, endpoint or credential data is ever stored in the
lock.
fetch is the only lock writer and only networked
command; add edits only the manifest. A locked
version whose index hash changed, or a git tag that moved from the
locked commit, is an error, never a silent update. Offline builds
verify cached content against the lock without network or writes,
as today.
Alternatives considered
- v2 only for registry graphs with extra digest fields (0203) — two entry shapes and signature data in the lock; signatures belong to the index, verified at fetch time.
- Migrate every lock to v2 — churns fixtures and goldens for no behavior change.
- Separate
vc+source kind — a second protocol string for the same layout.
Consequences
The lock is about integrity, not selection (0239). Mirrors can be swapped without changing lock bytes. Older toolchains reject v2 locks cleanly. Phase 3 signatures do not touch the lock.