0253. Discovered pkg sources and git-backed registry entries
- Status: Accepted (maintainer, 2026-11-16)
- Date: 2026-11-16
- Plan: M15.5, RG2.2 C5–C7
- Review: RG2.2 plan §§1, 4
Context
pkg identifies a source path, but resolving it
requires choosing an index or git source. ADR-0238 leaves
discovery open; ADR-0250 records pkg only on index
lock entries. Git tags do not carry dependency metadata without
reading the tagged manifest.
Decision
Amend ADR-0250's entry shape and fill ADR-0238's discovery policy, as a proposed default:
- A project or user registry rule wins, with project precedence.
Otherwise built-in hosts
github.com,gitlab.com, andcodeberg.orguse git athttps://<pkg>. - Otherwise, unless private, probe
GET https://<host>/harness-registry.tomlat most once per host per fetch, capped at 64 KiB. A validformat = 1selectsindex+https://<host>/; 404 or 410 selects git athttps://<pkg>. Other probe failures are E1079, never git fallback; malformed files are E1069. Private packages skip the probe and use git. Probes never use mirrors; air-gapped users can supply a registry rule. Existing auth rules apply to probes. - On fetch, reuse the locked source kind for a matching
pkgunless a rule now applies; a rule wins. Builds use the lock and never rediscover.
A version 2 git-backed pkg lock entry has
source = "git+https://<pkg>#<commit>",
pkg, required tag = "v<x.y.z>",
version, deps, and hash.
The URL must equal https://<pkg> and
pkg must be valid. Existing v1 locks remain
unchanged. Git versions come from v<x.y.z> tags
listed by git ls-remote --tags. MVS completes a
chosen version lazily: fetch its tag commit and read the tagged
harness.toml for deps and edition, using the tree
hash for hash; reject a manifest version mismatch or
a moved locked tag. Unchosen versions need no manifest fetch.
fetch --update raises git-backed pkg
minimums from tags (RG2.3 B3).
C5 implements the lock schema and resolver completion hook. C6 implements built-in host git-backed resolution, tagged manifest completion and offline locked use; a version mismatch is E0948 and a moved locked tag is E0949. C7 implements registry probing, fallback, and locked-source-kind reuse; builds consume the lock and do not rediscover. This ADR remains Proposed pending maintainer.
Alternatives considered
- Require an explicit registry rule for every host — avoids probing but makes ordinary source-path dependencies require configuration.
- Fall back to git on every probe failure — hides transient failures and can silently change the selected source.
- Fetch every tagged manifest eagerly — obtains metadata up front but wastes network and disk work on versions MVS never chooses.
Consequences
Locks preserve source identity and enable reproducible offline builds; explicit rules still override discovery. Discovery adds bounded network traffic and failure modes, while lazy completion adds resolver complexity and requires tag and tree validation. C7 must implement and test the remaining proposed discovery behavior before it is available.