ADR-051: Configuration Is a Git Source — a canopy-Owned Fetcher Publishes a Verified Commit, Services Load It at Boot and Stamp Its SHA

Status: Accepted (2026-11-07) with plan config-git-source
Issue: #3254
Ruling: the maintainer, 2026-11-06: a deployment points at a configuration git repository and tracks a branch (branches as channels) or stays on main and selects by tag; every determination is stamped with the resolved commit; canopy and craig share the design, not the code.
Amends: ADR-003 and ADR-006 (the packs' home) when the plan’s U4 lands; ADR-002 and ADR-028 (the stamp) when its U3 lands.
Relates to: craig’s ADR-087 (gadhs/application/ccwis/craig), the same design implemented separately.

Context

canopy’s repository holds its source and its configuration: every jurisdiction’s pack under rulesets/<slug>/ and the federal tables under rulesets/federal/. A state will not consume canopy that way; it runs released canopy against its own configuration. Nothing makes a misplaced item fail: source that reads a jurisdiction value, or configuration that carries logic, passes today.

Policy decides eligibility, so a deployment’s configuration must be authenticated, and the exact revision behind every determination must be recorded. Today a signed determination carries content digests (the rules corpus_hash, the SNAP params_digest) and the pack’s [meta].version, but no commit: "which revision of which repository decided this" is answered only by someone who can reproduce the hash.

Decision

  1. Configuration is ordered layers. CANOPY_CONFIG_SOURCE lists sources lowest precedence first: a federal base, a jurisdiction, optionally a deployment layer. Each is a git+https:// or git+ssh:// repository tracking a branch or a tag, or a path: working copy. A file resolves to the highest layer holding it; a directory lists the union of the layers' entries; nothing is merged inside a file. Each layer’s root carries a canopy-config.toml manifest naming its schema major and kind; the jurisdiction layer names the deployment’s jurisdiction, which is no longer a setting.

  2. canopy owns the fetcher, canopy-config-fetch. resolve pins each ref to a commit once per rollout, so replicas move together; sync fetches, checks the commit out into a new worktree, verifies it, and publishes it by renaming a SHA-named directory into place and flipping current with rename(2).

  3. Verification gates publication. git verify-commit and/or git verify-tag (the modes head, tag and tag-and-head, after Flux), and the signer read from the raw status must be on the layer’s trust root (an SSH allowed_signers file or an OpenPGP fingerprint list), which the deployment mounts and the configuration repository never carries. A refusal leaves current on the last good commit, exits non-zero and writes a status file. A service with no good tree refuses to start; one running on the last good tree reports itself unready.

  4. Services load at boot and stamp what they loaded. One immutable snapshot per process, each layer’s current resolved once to its commit directory, so a flip during a rollout cannot give a process two trees. Every service answers GET /version with its build and the layer SHAs; every signed determination and its input snapshot carry them.

  5. Git is the authority. A policy change is a signed commit on a configuration repository and a rollout; rolling back is moving the branch or the tag. There is no hot reload in this decision.

  6. Credentials never ride in the source string, which is logged and shown on /version: a URL carrying userinfo is refused, and private repositories authenticate through the standard git credential environment.

  7. Working copies are a development mode. A path: source is never verified and is stamped path; it loads only when every source is path: and CANOPY_CONFIG_ALLOW_UNVERIFIED=true, and the flag beside a git source refuses boot.

Alternatives considered

Researched from primary sources on 2026-11-06 (#3254), independently by canopy and craig, converging.

  • Runtime pull in each service (Salt gitfs, Spring Cloud Config). Rejected: every service would carry git, the credentials and the verification; replicas would drift independently; a pull mid-request invites a determination against a half-updated tree.

  • Bake at build time (configuration copied into the images, as today). Rejected: it couples the configuration’s cadence to image builds, multiplies images per jurisdiction and keeps source and configuration one artefact.

  • A GitOps operator (Flux, Argo CD). Rejected as the primary path: Kubernetes-only, while canopy runs in compose for the devstack and for some installs. Flux’s verification modes are adopted as the model.

  • git-sync v4 with a verify hook. Rejected on evidence: 4.5.1, the latest release, has no pre-publish hook (the flag exists only in the README on master); its one hook runs after the flip; a failing hook only logs; unsigned and untrusted heads were published; the image lacks ssh-keygen (canopy’s spike, recorded on #3254).

  • OCI artifacts signed with cosign. Not chosen as the primary path, since git gives history, review and branch channels for free; kept as a future path for air-gapped installs (#3267).

  • A fetcher shared with craig. Ruled out by the maintainer (2026-11-06): each project owns its implementation; the design and the must-pass refusal test are shared.

Consequences

  • rulesets/georgia and rulesets/federal leave source (the plan’s U4); the fixture packs (default, test-min, test-max) and the neutral notice templates stay in source as layers under fixtures/config/, so unit tests and a fresh checkout need no network.

  • CI fetches pinned Georgia and Texas configuration through a lock file, so a misplaced item fails the merge train, and a pin bump is a car.

  • A configuration change is a signed commit plus a rollout; nothing changes a running service’s configuration.

  • Determinations become traceable to a signed commit, and every service reports what it runs.

  • canopy maintains a small fetcher (fetch, worktree, verify, flip) and its refusal tests.

Verification

The must-pass test, shared with craig: an unsigned head and an untrusted-key head each leave current on the last good commit, the fetcher exits non-zero and its status file says why; a good head flips. Plus each unit’s tests in the plan.

Edit this page · default