diff --git a/docs/cli/repos.md b/docs/cli/repos.md index 06f34482a0..afe8d6883d 100644 --- a/docs/cli/repos.md +++ b/docs/cli/repos.md @@ -85,6 +85,15 @@ Runs in two phases: 1. **Select** — the repositories to converge are chosen from the entries declared in the manifest (see [Selecting repositories](#selecting-repositories)). Positional arguments only filter declared entries; they never create, copy, or carve out entries. Every selected repository must resolve an [inference authentication selection](#inference-authentication-selection), and its [effective infrastructure values](#effective-infrastructure-values) must be consistent, or that repository fails before any write. 2. **Converge** — all selected repos are converged through a unified probe → diff → apply pipeline. Repos whose shim workflow is not yet on the default branch are freshly installed (scaffold files, variables, secrets, a declared configuration preset as `.fullsend/config.base.yaml`, and a canonical managed `.fullsend/config.yaml`) onto the initialization branch (`fullsend/scaffold-install`). That includes a re-run while the initialization PR/MR is still open: variables and secrets may already exist from the first run, but the installer still updates the same initialization PR rather than opening a competing upgrade PR. Repos whose workflow is already on the default branch are checked for drift (workflow, thin callers, variables, secrets, pipeline schedules, GitLab poller protected-ref pipeline access — repaired automatically, except a disabled GitLab schedule, which is reported as drift and reactivated only with `--reactivate-schedules`; typed GitLab dispatch's required pipeline-variable restriction; legacy variable-based wrappers are refused, and a leftover pipeline variable on a managed schedule is not repaired and must be removed manually), scaffold content drift (repaired automatically, including structural rewrites of `.gitlab/ci/fullsend-pipeline.yml` at an unchanged template ref), declared configuration-preset drift against `.fullsend/config.base.yaml` (replaced wholesale; `.fullsend/config.yaml` is preserved), managed `.fullsend/config.yaml` drift (replaced wholesale; an existing file without the ownership marker stops that repository before any writes until it is adopted, while the other selected repositories still converge), and scaffold ref drift (upgraded automatically). When no configuration preset resolves for a repo, the desired state is no `.fullsend/config.base.yaml`. An existing base file then stops that repo's fresh or repeat install, including `--dry-run`, before any writes, with an error telling you to declare a `config_base` source or remove the file. A declared preset that cannot be loaded (fetch failure, `sha256` mismatch, invalid content) fails only that repository: install reports the error in that repository's result, converges the other selected repositories, and exits non-zero. An HTTPS preset fetch that fails at the transport level (for example, a dropped connection reported as `EOF`) is retried once, and the error names the phase that failed (DNS, connect, TLS handshake, awaiting the response), the remote address, and the elapsed time. +```bash +fullsend repos install -f repos.yaml +fullsend repos install --dry-run +fullsend repos install acme/api acme/web +fullsend repos install "acme/*" --direct --concurrency 8 +``` + +### Managed configuration + `defaults.config`, `github.config`, `gitlab.config`, and per-repository `config` declare a sparse typed managed configuration for `.fullsend/config.yaml` ([ADR 0122](../ADRs/0122-declarative-repo-configuration.md)). Each accepts every @@ -198,12 +207,36 @@ github: - name: acme/plain # no config key: still managed (sparse, marker only) ``` -```bash -fullsend repos install -f repos.yaml -fullsend repos install --dry-run -fullsend repos install acme/api acme/web -fullsend repos install "acme/*" --direct --concurrency 8 -``` +The `# Source manifest:` line becomes part of the target repository's Git +history, which may be public. A file without this line still carries the +ownership marker, so it never requires adoption. + +An existing zero-byte `.fullsend/config.yaml` counts as an existing file +without the marker, so it also requires adoption. When install skips a +repository for adoption, it prints the same guidance as `repos status`: the +proposed `repos.yaml` entry, the difference between the existing file and the +managed file adoption would produce, and the effective layered-configuration +change (see [`repos status` output](#output)). + +The pre-write safety gate reads each compared key through the full overlay → +base → code-defaults chain. Omitted keys fall through rather than being treated +as unset, and an explicit empty `allowed_remote_resources: []` remains +deny-all. A blanket adoption acknowledgement does not satisfy the gate: each +relaxation must be declared in the manifest. Install checks +`.fullsend/config.yaml` and `.fullsend/config.base.yaml` together, before any +manifest or forge write. When the overlay needs adoption and the base needs +action, install reports both problems. The same checks run again inside +convergence. They apply to repositories with an explicit entry and to +glob-covered repositories. A malformed or non-per-repo file, or a read error, +fails with a clear error and is never replaced. + +A manifest is read-only when it is an HTTPS URL, a pipe or FIFO such as +`<(cmd)`, or a local file without write permission or on a read-only file +system. From a read-only manifest, install fails before any manifest write and +prints the exact entry to add to its source. That includes a glob-covered +repository whose first-install `tracker` default needs its own entry. +`--dry-run`, a live install and `repos status` agree. Trace signing keys follow +their own rule; see [Trace signing keys](#trace-signing-keys). ### Configuration schema of a pinned ref diff --git a/docs/guides/getting-started/repo-management.md b/docs/guides/getting-started/repo-management.md index 8f21e096e5..beb0b05e0d 100644 --- a/docs/guides/getting-started/repo-management.md +++ b/docs/guides/getting-started/repo-management.md @@ -375,13 +375,13 @@ repositories it can also supply `inference.wif_audience` and ### Managed configuration -`repos.yaml` can also declare a sparse managed `.fullsend/config.yaml` in -`defaults.config`, `github.config`, `gitlab.config`, and each repository -entry's `config`. Every section uses the same schema as per-repo -`config.yaml`, including `runtime` and `allowed_remote_resources`, except -`trace_context`, which only a concrete repository entry accepts (see -[Config Reference — `trace_context`](../../reference/config-reference.md#trace_context)). -Each section is sparse: declare only the values you want to set. +`repos.yaml` also declares the contents of each repository's +`.fullsend/config.yaml`. Set values in `defaults.config` (all repositories), +`github.config` or `gitlab.config` (repositories of that forge only), and each +repository entry's `config`. Every section uses the same fields as a per-repo +`config.yaml` (see the [Config Reference](../../reference/config-reference.md)), +including `runtime` and `allowed_remote_resources`. Only a concrete repository +entry accepts `trace_context`. Declare only the values you want to set. ```yaml version: 1 @@ -410,56 +410,18 @@ gitlab: - name: group/project ``` -Every repository selected from the manifest has a managed -`.fullsend/config.yaml`; neither `defaults.config` nor a repository -`config` is required. A repository with no `config` gets the sparse file -with only the ownership marker. An existing overlay without the marker -blocks that repository's install (adoption required) even when the -repository has no `config` key; the other selected repositories still -converge. On a first install with no `config_base` preset and no -explicit `tracker` declaration, install records -`config.tracker.github.allowed_targets.repos: [fullsend-ai/fullsend, fullsend-ai/agents]` in the -GitHub repository's manifest entry before rendering the overlay. For GitLab, it -records `config.tracker.gitlab.allowed_targets: {}` instead: additional project -targets must be configured explicitly for the GitLab host. If the manifest is an -HTTPS URL or read-only, install fails with the exact edit to make. -Resolution is code defaults, then `config_base`, then `defaults.config`, -then the repository's forge section `config` (`github.config` or -`gitlab.config`), then the repository entry's `config` (glob entries -included). More specific values win using each field's normal layered -merge rule: scalars are replaced, nested maps merge key by key, a -non-empty `allowed_remote_resources` list is unioned with the inherited -prefixes, and an explicit empty list replaces the inherited value. The -managed file is sparse and cannot record that reset, so validation rejects a -non-empty `allowed_remote_resources` list declared in a more specific layer -than an explicit empty one; declare the full list in a single layer. -Validation also rejects an agent's `harness:` block that is set in more than -one of the `defaults`, forge section and repository `config` layers, because -they render into one `config.yaml`. Set the block in one layer (see the -[config reference](../../reference/config-reference.md#agents)). A -forge section's `config` never affects repositories of the other forge. -The managed configuration contains only explicitly supplied values — -code defaults and `config.base.yaml` are not baked into the file. -Unknown fields and invalid values fail manifest validation with errors -that name the section. `config` is the managed overlay (written to -`.fullsend/config.yaml`); `config_base` is a separate preset copied to -`.fullsend/config.base.yaml`. - -`runtime` and `allowed_remote_resources` are no longer accepted as sibling -keys under `defaults` or a repository entry. A manifest that still uses -them fails to load with the replacement path, and there is no automatic -migration: +The more specific section wins: a repository entry's `config` over the forge +section, and the forge section over `defaults.config`. Values you leave out +come from the `config_base` preset (see +[Configuration presets](#configuration-presets)) and then the code defaults. +Most fields follow the normal layered merge rules described in the +[Layered Configuration Reference](../infrastructure/layered-config-reference.md). +Manifest validation rejects unknown fields and invalid values, naming the +section that holds them. -```yaml -# Invalid — rejected at manifest load: -# defaults.runtime is no longer supported; move it to defaults.config.runtime -defaults: - runtime: pi - allowed_remote_resources: [] -``` - -Every managed `.fullsend/config.yaml` begins with a stable ownership -marker and otherwise contains only the declared values: +Install writes a `.fullsend/config.yaml` to every repository in the manifest, +even one with no `config` key. The file starts with an ownership marker and +contains only the values you declared: ```yaml # This file is managed by 'fullsend repos': repos-config-v1 @@ -470,109 +432,27 @@ inference: region: us-east1 ``` -When the manifest is loaded from an HTTPS URL (`--manifest -https://...`), a third comment line after the marker names that -manifest, so readers of the target repository can find where to change -the file: +Do not edit this file in the repository. Change `repos.yaml`, or use +[`fullsend repos set`](#editing-the-manifest-from-the-command-line), and run +install again. -```yaml -# This file is managed by 'fullsend repos': repos-config-v1 -# Do not edit this file directly; changes will be overwritten. -# Source manifest: https://raw.githubusercontent.com/acme/infra/main/repos.yaml -``` +On a first install, install may add a `config.tracker` default to the +repository's manifest entry. If the manifest cannot be written, for example +because it is an HTTPS URL, install stops and prints the edit to make. + +If a repository already has a `.fullsend/config.yaml` without the ownership +marker, `repos status` reports `managed configuration (adoption required)` and +install skips that repository. The status output shows a proposed `repos.yaml` +entry with the file's current settings. To adopt the file: -The line is recorded only for recognized raw-file URL structures of public -source hosts, where the path is repository coordinates rather than a -credential: `raw.githubusercontent.com////`, -`github.com///raw//` and -`gitlab.com///-/raw//`, with no port and only -letters, digits and `._~-` in each path segment. Only the scheme, host and -path are written: userinfo, query string and fragment are removed. For any -other URL (a self-hosted server, a URL with a port, a percent-escaped or -otherwise non-plain segment) the line is omitted entirely, because a -credential in the path cannot be told apart from a directory name. The -recorded line becomes part of the target repository's Git history, which -may be public, so still do not put a credential in the path of a manifest -URL on a recognized host. A manifest loaded from a local path records -no source line, because its location on the operator's machine is not -meaningful to readers and would differ between operators. The line is -informational: `repos status` and `repos install` ignore it when comparing -the installed file with the managed configuration, so changing the -manifest URL (or switching between a URL and a local path for the same -manifest content) is not reported as drift and does not rewrite the file. -The line is updated the next time a configuration change rewrites the -file. A file without this line still carries the ownership marker, so it -never requires adoption. - -If a config-managed repository already has an existing -`.fullsend/config.yaml` without that marker, `repos status` reports it as -`managed configuration (adoption required)` rather than ordinary drift, -and `repos install`/convergence leave the file untouched until it is -manually adopted (edited to carry the marker, or replaced with the -rendered managed body). An existing zero-byte file counts as an existing -file without the marker. The status output (table and JSON `detail`) also -shows the proposed `repos.yaml` entry that carries every setting the -existing file declares, including values equal to the code defaults, and -the difference between the existing file and the managed file adoption -would produce, followed by the effective layered-configuration change -(existing overlay over the installed base against the managed overlay over -the base layer the run would leave in place), so any setting adoption would -drop, or that changes only through the base layer, is visible first. A -markerless file that is malformed or not a per-repo configuration is -reported by `repos status` as an error instead. Once -a file carries the marker, `repos install` -writes the canonical sparse `.fullsend/config.yaml` (for an explicitly pinned -`fullsend_ref`, rendered in the configuration schema that ref reads, and left -unchanged with an error when that schema cannot be determined; see -[Configuration schema of a pinned ref](../../cli/repos.md#configuration-schema-of-a-pinned-ref)), `repos status` -reports any whole-file difference (including a single-key change) as -drift, and convergence rewrites the file deterministically — unless the -candidate would become less restrictive than the current effective -configuration without an explicit manifest declaration. That pre-write -safety gate compares `kill_switch`, `roles`, `allowed_remote_resources`, -agent `enabled: false` suppressions, `tracker..allowed_targets`, -`inference.gateway.url`, `inference.gateway.audience`, `artifacts.content`, -`artifacts.by_source.`, `progress.verbosity`, and -`progress.by_source.` through the full -overlay → base → code-defaults accessor chain. Omitted -keys fall through rather than being treated as unset; an explicit empty -`allowed_remote_resources: []` remains deny-all. A change to either -`inference.gateway` field, including a preset introducing a gateway where -an established installation has none configured, must be declared in the -manifest. Status and install output -identify the affected keys. A blanket adoption acknowledgement is not -enough. Both files are checked together, before any manifest or forge -write: when the overlay needs adoption and the base needs action, install -reports both problems, and an adoption failure prints the same proposed -`repos.yaml` entry and file and effective-configuration differences that -`repos status` shows. A repository whose only problem is adoption is -skipped: install prints that guidance for it, lists it as `FAILED` in the -summary, converges the other selected repositories and exits non-zero, in -a dry run and a live run alike. Any other problem these checks find stops -the whole run before any write. The same checks run again inside convergence: a fresh -install blocked by adoption or the safety gate stops before any variable, -secret, scaffold file or PR/MR write, in a dry run and a live run alike. -Adding a `config_base` preset to a repository with no base file is compared -like replacing one (the absent base is an empty layer), even when its -managed overlay is unchanged; only a pristine first install, with neither -file present, is exempt because there is no current configuration to relax -and it simply inherits what the preset declares. This applies to repositories with an explicit entry -and to glob-covered repositories. A malformed or -non-per-repo file, or a read error, fails with a clear error and is never -replaced. `.fullsend/config.base.yaml` is managed as described under -[Configuration presets](#configuration-presets). - -When the manifest is read-only (an HTTPS URL, a pipe or FIFO such as `<(cmd)`, -or a local file without write permission or on a read-only file system), -install fails before attempting any manifest write and prints the exact entry -to add to its source, including for a glob-covered repository whose -first-install `tracker` default needs an explicit -entry. `--dry-run`, live install and `repos status` agree. Trace signing keys -follow their own rule on GitHub: from such a manifest, a fresh install without -`--rotate-trace-signing-key` goes ahead without keys and says so, any other -repository that must record a key fails, and `--rotate-trace-signing-key` -stops the run before it writes a key (see -[Trace signing keys](../../cli/repos.md#trace-signing-keys)). +1. Copy the settings you want to keep into the repository's `repos.yaml` entry. +2. Replace the file with the managed version, or add the ownership marker to + it. +3. Run `fullsend repos install` again. + +Install refuses to make a repository's configuration less restrictive, for +example by enabling more roles or allowing more remote resources, unless the +manifest declares that change explicitly. The output names the affected keys. ```bash fullsend repos status -f repos.yaml --json # whole-file managed drift @@ -580,6 +460,15 @@ fullsend repos install -f repos.yaml --dry-run fullsend repos install -f repos.yaml # rewrite the managed file ``` +Manifests that still set `runtime` or `allowed_remote_resources` directly under +`defaults` or a repository entry fail to load. Move them under `config`; see +[`runtime` and `allowed_remote_resources` moved into `config`](../../cli/repos.md#runtime-and-allowed_remote_resources-moved-into-config-breaking). + +For the complete rules, including validation of layered lists and `harness:` +blocks, the `# Source manifest:` comment line, adoption details, the pre-write +safety gate and read-only manifests, see +[`fullsend repos` — Managed configuration](../../cli/repos.md#managed-configuration). + ### Editing the manifest from the command line `fullsend repos set ` edits any field in `repos.yaml` diff --git a/docs/guides/infrastructure/layered-config-reference.md b/docs/guides/infrastructure/layered-config-reference.md index 1297960db2..2a21ece0e4 100644 --- a/docs/guides/infrastructure/layered-config-reference.md +++ b/docs/guides/infrastructure/layered-config-reference.md @@ -93,7 +93,7 @@ the proposed overlay on the proposed (declared) preset rather than the installed base; an absent base is an empty layer, so adding a preset is compared too. A pristine first install (no installation, no overlay and no base) has nothing to compare against and inherits the preset. See -[Repo Management — Managed configuration](../getting-started/repo-management.md#managed-configuration). +[fullsend repos — Managed configuration](../../cli/repos.md#managed-configuration). ### Marshal behavior