On this page

0253. Discovered pkg sources and git-backed registry entries

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:

  1. A project or user registry rule wins, with project precedence. Otherwise built-in hosts github.com, gitlab.com, and codeberg.org use git at https://<pkg>.
  2. Otherwise, unless private, probe GET https://<host>/harness-registry.toml at most once per host per fetch, capped at 64 KiB. A valid format = 1 selects index+https://<host>/; 404 or 410 selects git at https://<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.
  3. On fetch, reuse the locked source kind for a matching pkg unless 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

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.