On this page

0072. Lockfile and explicit fetch

Context

Builds need reproducible dependency graphs while remaining offline and avoiding surprise writes. Path dependencies are local source owned by the caller; git dependencies need pinned, verifiable content.

Decision

harness.lock has lock_version = 1 and sorted entries for every reachable package, including the root. Each records version, source and direct dependencies. The root source is path:.; retaining its direct-edge list detects edge removal even when that package remains transitively reachable. The root version is informational: changing it alone never makes the lock stale. A package with no dependencies neither requires nor checks a lock, even if one already exists.

The root module package identity is deliberately "", not its manifest name (ADR-0071). Dependency identity is manifest [package].name, with E0938 on a dependency key mismatch; keys must be lowercase importable names, not keywords.

Absolute dependency paths are rejected with E0933. Path sources are the lexically normalized declared paths relative to the root package directory, e.g. path:deps/util, without canonicalizing or resolving symlinks. A dependency's own path dependencies are also recorded relative to the root, by composing its declared directory with its dependency paths. Canonical directories identify equal sources and supply manifest/source reads, separately from display paths. Thus moving a checkout to a different depth or symlinking a dependency directory does not change lock bytes. Path sources are unhashed.

fetch is the only command that writes the lock or accesses the network; build commands with dependencies require a current lock and never fetch. A dependency's own lock is ignored. Step 3 implements path dependencies only. Step 4 adds pinned git dependencies, .harness/deps storage and git tree hashes: regular files in bytewise relative-path order, framed as relpath NUL decimal-length NUL bytes.

Alternatives considered

Consequences

Locks are reviewable and reproducible, while users must fetch explicitly after graph changes. Step 4 adds pinned git acquisition under the same lock contract.