Skip to content
2 changes: 1 addition & 1 deletion AUDIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Run [`WORKFLOW.md`][workflow]'s methodology against the repo's **own** Actions,

## 6. Validate Settings, Rulesets, and Secrets

- **General settings, labels, and rulesets** - fetch the hub and check out `main`. Run `repo-config/configure.sh check <owner>/<repo> release|operational` from that checkout. Pass the target repository and its registry `workflowModel` explicitly. The command checks what `configure.sh apply` writes: the declared settings, the derived settings and the registry description, the declared labels, the Dependabot security features, the shared `main` ruleset, and the `develop` ruleset the model selects. It preserves and reports `bypass_actors` without asserting them because bypass authority is a per-repository human decision.
- **General settings, labels, rulesets, and deployment environments** - fetch the hub and check out `main`. Run `repo-config/configure.sh check <owner>/<repo> release|operational` from that checkout. Pass the target repository and its registry `workflowModel` explicitly. The command checks what `configure.sh apply` writes: the declared settings, the derived settings and the registry description, the declared labels, the Dependabot security features, the shared `main` ruleset, and the `develop` ruleset the model selects. It preserves and reports `bypass_actors` without asserting them because bypass authority is a per-repository human decision. It also checks one group apply never writes, the deployment environments the registry's `environments` declares for the repo: each one exists, its deployment-branch policy is the form declared, and under a `custom` policy the entries it allows are exactly the declared branches, so anything added by hand reads as drift. An environment the registry declares nothing about is reported rather than asserted, since GitHub creates some on its own. Neither this command nor the **Secrets** bullet below queries an environment's own secret and variable stores, where the API exposes a secret's name but not its value and a variable's name and value both, so a clean run says nothing about whether an environment holds what a deploy needs.

- **Secrets** - from the same hub checkout, run [`spec/audit.py`][audit-runner] `[repo]` and read its Secrets section. It resolves the required set from the hub's own [`spec/secrets.json`][secrets] plus the registry entry's `publish[]`/`types[]`/`requiredSecrets[]`, confirming each required name exists (name only, not the values) in the Actions store and, where the mechanism needs it (Docker Hub, codegen App), the Dependabot store too.

Expand Down
2 changes: 1 addition & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Every fleet repo is a standard-style repo the hub audits **downward** against it

The fleet's tooling lives in the hub once and a repository runs it from there rather than holding a copy. A carried script is current only until the next fix to it, and a repository that misses the sweep does not fail loudly, it audits itself with an older gate while reporting the same command in its output. Removing the copy removes the sweep, the stale-copy detection, and the disposition each stale copy earns, all at once. The hub is the repository [`AGENTS.md`](./AGENTS.md) "Fleet Bootstrap" names, and that section is the entry point whenever nothing else present says where it is.

**What a repository carries and what it reaches is decided by what the content is.** It carries the content it is audited against and the configuration that describes it, meaning its rule text, the files the manifest declares, and the ruleset payloads its own audit diffs the live configuration against. It reaches machinery whose content is identical in every repository, meaning the prose and repository gates, the review digest, and the configuration script, because a file holding no per-repo content is a copy whose only future is to go stale. A tool named in a carried rule is therefore named as the hub's, since the alternative is a pointer to a path the reader does not have, and a pointer that resolves nowhere teaches the reader that a pointer in carried text is decorative.
**What a repository carries and what it reaches is decided by what the content is.** It carries the content it is audited against and the configuration that describes it, meaning its rule text and the files the manifest declares. It reaches machinery whose content is identical in every repository, meaning the prose and repository gates, the review digest, and the configuration script, because a file holding no per-repo content is a copy whose only future is to go stale. A tool named in a carried rule is therefore named as the hub's, since the alternative is a pointer to a path the reader does not have, and a pointer that resolves nowhere teaches the reader that a pointer in carried text is decorative.

**Reaching it is a checkout of the hub rather than a copy of one file.** A tool reads the payloads, tables, and sibling modules beside it, so a single file lifted out of the tree runs against whatever the caller happens to have, which is the copy problem again in a shorter loop. Read `main`, the promoted and gated state, and fetch immediately before running, because a clone is whatever it last fetched rather than the branch it names, and a stale clone answers confidently instead of failing. Name the tool by its path in that checkout and name the target explicitly, since a tool that defaults to the current directory or the current repository resolves somewhere either way, and a result computed against the wrong repository is well-formed. Which directory the command runs in is the tool's own contract rather than a rule here, so a gate reading a working tree runs in the repository under test while a tool taking its target as an argument runs anywhere and is given one. What the rule forbids is letting a default decide which repository the answer is about.

Expand Down
2 changes: 1 addition & 1 deletion OPERATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ repo-config/configure.sh apply owner/repo release|operational

**Always pass the command, the repository, and the model.** A bare `repo-config/configure.sh` with no arguments defaults to `apply` against the current repo, so an invocation meant to test whether the script runs performs a live write instead. Never run it without a command. An omitted target resolves to the hub repository, and applying fleet configuration there while meaning to configure a downstream repo is a well-formed write to the wrong place. The hub checkout has the registry beside the script, so a repo the registry does not name resolves through `defaults.workflowModel` to `release`. An operational repo outside the registry therefore requires the explicit model argument.

`check` is read-only and exits non-zero on drift. `apply` is idempotent and drives entirely from the committed payloads, so it is a no-op on a conformant repo.
`check` is read-only and exits non-zero on drift. `apply` is idempotent and drives entirely from the committed payloads, so it is a no-op on a conformant repo. `check` also asserts one group `apply` never writes, the existence and deployment-branch policy of every environment the registry's `environments` declares for the repo, so the two are not exact inverses. [docs/repo-config.md](./docs/repo-config.md) "Deployment Environments" says why.

`apply` is not a narrow toggle. One run patches every key in `repo-config/settings.json`, sets the default branch, enables both Dependabot features, creates or updates every label in `repo-config/labels.json`, and creates or updates both branch rulesets. On a repository that has deliberately drifted it silently reasserts the fleet configuration.

Expand Down
2 changes: 1 addition & 1 deletion STANDUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The rename runs unconditionally rather than behind a test of `init.defaultBranch

A repo lacking any entry is exactly what [`AUDIT.md`][audit] section 0's fleet membership check surfaces on a full sweep, a `DEFECT` naming the repo by its GitHub `full_name`. That finding is what should send an agent here in the first place for a repo nobody has stood up yet, rather than the omission sitting unnoticed (ptr727/ProjectTemplate#550).

Resolve the repo's type(s) with the [`AUDIT.md`][audit] section 2 detection rules, then write or repair its [`registry/repos.json`][repos] entry: `status`, `types[]`, `groundTruthBranch`, `hasDevelop`, `publish[]`, `requiredSecrets[]`, `consumerModel`, `releaseTrigger`, `workflowModel` (omit to take the `release` default), `configLayout`, and `driftNotes` that describe what the repo **actually is**. Run [`spec/validate.py`][validate] to confirm it classifies cleanly. The registry is ground truth about reality, not intent, and a `validate.py`-clean entry is still false if it disagrees with the live repo.
Resolve the repo's type(s) with the [`AUDIT.md`][audit] section 2 detection rules, then write or repair its [`registry/repos.json`][repos] entry: `status`, `types[]`, `groundTruthBranch`, `hasDevelop`, `publish[]`, `requiredSecrets[]`, `consumerModel`, `releaseTrigger`, `workflowModel` (omit to take the `release` default), `environments` (only where the repo uses a deployment environment), `configLayout`, and `driftNotes` that describe what the repo **actually is**. Run [`spec/validate.py`][validate] to confirm it classifies cleanly. The registry is ground truth about reality, not intent, and a `validate.py`-clean entry is still false if it disagrees with the live repo.

## 1A. Carry the Instruction Set, Before Authoring Anything

Expand Down
18 changes: 16 additions & 2 deletions docs/repo-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The hub holds all fleet-wide repository configuration:
- `labels.json` declares the fleet label set.
- `configure.sh` applies or checks those payloads through the GitHub API.

Downstream repositories carry no `repo-config/` directory. The registry's `workflowModel` selects the `develop` payload. Commands that operate before registry enrollment pass the model explicitly.
Downstream repositories carry no `repo-config/` directory. The registry's `workflowModel` selects the `develop` payload, and its `environments` declares the deployment environments the check mode asserts, both read from `registry/repos.json` rather than from a payload here. Commands that operate before registry enrollment pass the model explicitly.

The carried `AUDIT.md` reaches the hub at `main` for its configuration check. The fleet-wide `spec/audit.py` reads the same hub payloads directly. Both paths compare live state against one source.

Expand All @@ -31,7 +31,21 @@ Remove all classic branch-protection rules and stray rulesets. Run `configure.sh
repo-config/configure.sh apply owner/repo release|operational
```

Then validate the result with `repo-config/configure.sh check owner/repo release|operational`, run from the same checkout, which asserts every applied ruleset, setting, label, and security feature and exits non-zero on drift (the ruleset and settings checks are driven by the committed payloads, so they stay repo-agnostic). Or import each ruleset by hand with `gh api -X POST repos/<owner>/<repo>/rulesets --input repo-config/<name>.json` (operational repos use `operational/develop.json` for `develop`). `gh ruleset` is read-only, so creation goes through `gh api`. The required check binds by name and only turns green after the repo's PR workflow runs once. To edit a live ruleset, GET it, change the field, and PUT the whole writable subset back (a partial PUT `422`s).
Then validate the result with `repo-config/configure.sh check owner/repo release|operational`, run from the same checkout, which asserts every applied ruleset, setting, label, and security feature, plus the deployment environments described below, and exits non-zero on drift (the ruleset and settings checks are driven by the committed payloads, so they stay repo-agnostic). Or import each ruleset by hand with `gh api -X POST repos/<owner>/<repo>/rulesets --input repo-config/<name>.json` (operational repos use `operational/develop.json` for `develop`). `gh ruleset` is read-only, so creation goes through `gh api`. The required check binds by name and only turns green after the repo's PR workflow runs once. To edit a live ruleset, GET it, change the field, and PUT the whole writable subset back (a partial PUT `422`s).

## Deployment Environments

`check` asserts that every environment the registry entry's `environments` declares exists and carries the declared deployment-branch policy, and `apply` writes none. The asymmetry is deliberate. An environment's secrets and variables are credentials that exist nowhere in the hub, so an `apply` could create the environment and set its policy and still leave it unable to publish, while reporting success. Their names are enumerable through the API, and their values in the case of a variable, but no tool here queries those stores, which is a choice about what this script owns rather than a limit the API imposes. The policy is checkable on its own and worth checking, because it decides which refs may deploy at all, and on an OIDC publish that is half the gate: a ref the policy excludes mints no token.

Each entry names the environment and one of two `branchPolicy` forms. `custom` also declares `branches`, the exact set the environment allows, and the check compares the live set to it in both directions. Branches are the whole vocabulary a `custom` entry has: GitHub's custom policies admit a tag entry too, and one has no declaration here, so an environment allowing a tag under a `custom` policy reads as drift until this field grows a way to say so. `none` admits every ref and declares no branch set, so a repository whose gate lives in its deploy workflow instead records `none` and gets a policy appearing later read as a change rather than as the gate arriving.

GitHub offers a third form, protected branches only, and this field deliberately does not. It counts *classic* branch protection rules, which this document has already told you to remove in favor of rulesets, and no fleet repository has one. Declaring it would assert a gate that does not exist, and a live environment set to it fails the check as the drift it is.

```json
"environments": [{ "name": "pypi", "branchPolicy": "custom", "branches": ["develop", "main"] }]
```

A repository declaring no environment has nothing asserted against it, though the live list is still read and an unreadable one fails the run, and an environment the registry declares nothing about is reported rather than asserted, since GitHub creates some without being asked (the Copilot coding agent's is the one every fleet repository has). What no tool covers either way is whether an environment's secrets and variables are present and valid, so read a clean run as a statement about each declared environment existing and carrying the policy declared for it, and never as one about whether the deploy can succeed.

## Regenerating the Payloads

Expand Down
4 changes: 3 additions & 1 deletion registry/repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"hasDevelop": true,
"publish": [{ "target": "pypi", "mechanism": "oidc" }],
"requiredSecrets": ["CODECOV_TOKEN"],
"environments": [{ "name": "pypi", "branchPolicy": "custom", "branches": ["develop", "main"] }],
"consumerModel": "pull",
"releaseTrigger": "two-phase",
"configLayout": { "rulesetsDir": "repo-config", "pythonConfig": "pyproject.toml" },
Expand Down Expand Up @@ -317,10 +318,11 @@
"hasDevelop": true,
"publish": [{ "target": "github-release", "mechanism": "none" }, { "target": "self-hosted", "mechanism": "static-secret" }],
"requiredSecrets": [],
"environments": [{ "name": "production", "branchPolicy": "none" }, { "name": "staging", "branchPolicy": "none" }],
"consumerModel": "pull",
"releaseTrigger": "dispatch-only",
"configLayout": { "rulesetsDir": "repo-config", "pythonConfig": null },
"driftNotes": ["Hugo static site migrated off WordPress.com, stood up 2026-08-01; release model with a dispatch-only publisher that cuts the tag and a source archive.", "lineEndings lf on a release repo, where the rule grants the native-platform default to operational repos only: every consumer is Linux (the Hugo build, the Caddy container, and the rsync deploy).", "content/ is an imported WordPress archive, so the prose, spelling, and style gates are scoped to exclude it.", "Deploy credentials are per-environment GitHub Environment secrets and variables, which spec/secrets.json has no vocabulary for, so requiredSecrets stays empty and the names are declared in this repo's own secrets.json environments block; listing them here would make the audit demand them in the repository actions store."]
"driftNotes": ["Hugo static site migrated off WordPress.com, stood up 2026-08-01; release model with a dispatch-only publisher that cuts the tag and a source archive.", "lineEndings lf on a release repo, where the rule grants the native-platform default to operational repos only: every consumer is Linux (the Hugo build, the Caddy container, and the rsync deploy).", "content/ is an imported WordPress archive, so the prose, spelling, and style gates are scoped to exclude it.", "Deploy credentials are per-environment GitHub Environment secrets and variables, which spec/secrets.json has no vocabulary for, so requiredSecrets stays empty and the names are declared in this repo's own secrets.json environments block; listing them here would make the audit demand them in the repository actions store.", "Neither deployment environment carries a branch policy, deliberately: the ref gate that admits production from the default branch only runs as a job in the deploy workflow, before anything is installed or written (WORKFLOW.md D2.1). branchPolicy none records that, so a policy appearing later reads as a change rather than as the gate arriving."]
},
{
"name": "DiskSpeedTest",
Expand Down
22 changes: 22 additions & 0 deletions registry/repos.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lineEndings": { "enum": ["lf", "crlf"] },
"mechanism": { "enum": ["oidc", "static-secret", "none"] },
"target": { "enum": ["nuget", "pypi", "docker", "github-release", "self-hosted"] },
"branchPolicy": { "enum": ["custom", "none"] },
"repo": {
"type": "object",
"required": ["name", "url", "status"],
Expand Down Expand Up @@ -76,6 +77,27 @@
}
},
"requiredSecrets": { "type": "array", "items": { "type": "string" } },
"environments": {
"type": "array",
"items": {
"type": "object",
"required": ["name", "branchPolicy"],
"additionalProperties": false,
"allOf": [
{
"$comment": "A custom policy names the exact branch set it allows, and none names no set because it admits every ref. GitHub's third form, protected branches only, is not offered: it counts classic branch protection, which this fleet removes in favor of rulesets, so declaring it would assert a gate that does not exist.",
"if": { "properties": { "branchPolicy": { "const": "custom" } }, "required": ["branchPolicy"] },
"then": { "required": ["branches"] },
"else": { "not": { "required": ["branches"] } }
}
],
"properties": {
"name": { "type": "string", "minLength": 1 },
Comment thread
ptr727 marked this conversation as resolved.
Resolved
"branchPolicy": { "$ref": "#/$defs/branchPolicy" },
"branches": { "type": "array", "items": { "type": "string", "minLength": 1 } }
}
}
},
"consumerModel": { "enum": ["push", "pull"] },
"releaseTrigger": { "$ref": "#/$defs/releaseTrigger" },
"configLayout": {
Expand Down
Loading