Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AUDIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ flowchart TD

This audit is not occasional. Run it whenever you **create, adopt, or materially change** a fleet repo, and on demand for any known repo:

- **A full sweep opens with a fleet membership check, not a per-repo one.** `spec/audit.py`, run with no repo names, first lists every non-fork repository the registry `owner` actually owns on GitHub and diffs it against `registry/repos.json`. A repo that exists but carries no entry is invisible to every other check in this file. That is because all of them iterate the registry and never look past it. So this is the only place that gap is caught. The check also reconciles one field: a registry `status: "archived"` must agree with GitHub's own archived flag, in either direction. A name-filtered run or `--issue` skips it, since those are scoped to repos already known to the registry. Run this as `gh auth login` for the owner's own account. That is because a fine-grained PAT scoped to "selected repositories" returns an incomplete list with no error. So the sweep would read clean while some repos were never inspected.
- **Onboarding a repo is complete only when it either passes this audit or has a hub-committed `reports/<repo>/audit.md` plus a tracking issue** enumerating every residual delta. Passing means operational on every applicable check. A repo that is partially set up but never audited is itself a **defect**, the exact state this process prevents. The create-to-conformance counterpart is [`STANDUP.md`][standup]. Because both read the same manifests, a repo stood up by that file passes this audit by construction.
- **Touching a repo** (any conformance-affecting change) ends by re-running the applicable checks and **reconciling the registry entry to reality**: `status`, `types`, `releaseTrigger`, `workflowModel`, `driftNotes`. The registry records reality, not intent. [`spec/validate.py`][validate] proves the catalog is self-consistent, not that it matches the live repo. Closing that gap is this audit's job. The deterministic subset is mechanized in [`spec/audit.py`][audit-runner]. It covers settings, rulesets, secret names, file presence, and file names. It also covers per-scope Markdown section presence, workflow interface conformance, verbatim content, hub-hosted files a repo carries, and branch facts. The runner is owner-initiated, run on demand when onboarding a repo, on suspected drift, or before fleet-wide changes. A required section missing from a carried Markdown file is a **drift finding**, not a letter. That is because a heading rename reads as missing and equivalence is judged by hand. A carried `interface` workflow (spec/fidelity-model.md) is checked by name and wiring (required jobs, the ruleset-bound check name, the artifact-name handoff, and the forbidden `artifact-ids:` fork). All of those checks are at **drift**, since the body is owned and a rename is a hint to verify. A carried `verbatim` unit is content-hashed against the hub's canonical after line-ending normalization. Such a unit is either a whole file (`.markdownlint-cli2.jsonc`) or a canonical workflow job region (the `github-release` job). A mismatch is classified **stale** (matches a past hub revision, re-vendor) or **modified** (matches none, the repo changed fixed content). Both are at **drift**, since equivalence is intent-governed and a byte diff is a hint to review. A carried `intent` unit gets one advisory beyond presence, a last-modified comparison. That advisory marks a copy as possibly trailing, at **drift**, and `spec/fidelity-model.md` states which changes raise it. That is a hint rather than proof, since a copy touched without reconciling reads current and content is never judged. A plain-JSON copy of a unit declaring `repoOwnedKeys` is the exception, judged by the leaves it does not own and reported whatever the dates read. A content scan also looks for a version literal. Such a literal is a three-part version, a full 40-character commit SHA, or an abbreviated one of 7 to 12 characters mixing digits and letters. One found in `AGENTS.md`, `GOVERNANCE.md`, `CODESTYLE.md`, or `WORKFLOW.md`, outside the verbatim sections downstream and across the whole file in the hub, is a **drift** finding. That is because a pin's value in prose goes stale at the next bump and every other literal reads like one.
- **A full sweep opens with a fleet membership check, not a per-repo one.** `spec/audit.py`, run with no repo names, first lists every non-fork repository the registry `owner` actually owns on GitHub and diffs it against `registry/repos.json`. A repo that exists but carries no entry is invisible to every other check in this file. That is because all of them iterate the registry and never look past it. So this is the only place that gap is caught. The check also reconciles one field: a registry `status: "archived"` must agree with GitHub's own archived flag, in either direction. A name-filtered run or `--issue` skips it, since those are scoped to repos already known to the registry. Authenticate `gh` with a token that reaches every repository the owner has, never a fine-grained PAT scoped to "selected repositories". Such a token returns an incomplete list with no error, so the sweep would read clean while some repos were never inspected. The runner refuses a login other than the registry owner, but it cannot see a token's scope.
- **Onboarding a repo is complete only when it either passes this audit or has a hub-committed `reports/<repo>/audit.md` plus a tracking issue** enumerating every residual delta. Section 8 defines `<repo>` in that path. Passing means operational on every applicable check. A repo that is partially set up but never audited is itself a **defect**, the exact state this process prevents. The create-to-conformance counterpart is [`STANDUP.md`][standup]. Because both read the same manifests, a repo stood up by that file passes this audit by construction.
- **Touching a repo** (any conformance-affecting change) ends by re-running the applicable checks and **reconciling the registry entry to reality**: `status`, `types`, `releaseTrigger`, `workflowModel`, `driftNotes`. The registry records reality, not intent. [`spec/validate.py`][validate] proves the catalog is self-consistent, not that it matches the live repo. Closing that gap is this audit's job. The deterministic subset is mechanized in [`spec/audit.py`][audit-runner]. It covers settings, rulesets, secret names, file presence, and file names. It also covers per-scope Markdown section presence, workflow interface conformance, verbatim content, hub-hosted files a repo carries, and branch facts. The runner is owner-initiated, run on demand when onboarding a repo, on suspected drift, or before fleet-wide changes. A required section missing from a carried Markdown file is a **drift finding**, not a letter. That is because a heading rename reads as missing and equivalence is judged by hand. A carried `interface` workflow (`spec/fidelity-model.md`) is checked by name and wiring. That covers its required jobs, the ruleset-bound check name, and the tokens and event types its [`spec/files.json`][files] contract names. Where they apply, the checks also cover the workflow's `concurrency:` block and the `workflow-model` and `python-directories` inputs it passes its hub task. All of those checks are at **drift**, since the body is owned and a rename is a hint to verify. A carried `verbatim` unit is content-hashed against the hub's canonical after line-ending, action-pin, and job-`needs:` normalization. Such a unit is either a whole file (`.markdownlint-cli2.jsonc`) or a `## heading` section of a carried Markdown file (the verbatim sections of `AGENTS.md` and `GOVERNANCE.md`). A mismatch is classified **stale** (matches a past hub revision, re-vendor) or **modified** (matches none, the repo changed fixed content). Both are at **drift**, since equivalence is intent-governed and a byte diff is a hint to review. A carried `intent` unit gets one advisory beyond presence, a last-modified comparison. That advisory marks a copy as possibly trailing, at **drift**, and `spec/fidelity-model.md` states which changes raise it. That is a hint rather than proof, since a copy touched without reconciling reads current. Content only ever clears a copy, since one hashing equal to the hub's file for it is current however old its last commit. A plain-JSON copy of a unit declaring `repoOwnedKeys` is the exception, judged by the leaves it does not own and reported whatever the dates read. The advisory does not run against the hub itself. A content scan also looks for a version literal. Such a literal is a three-part version, a full 40-character commit SHA, or an abbreviated one of 7 to 12 characters mixing digits and letters. One found in `AGENTS.md`, `GOVERNANCE.md`, `CODESTYLE.md`, or `WORKFLOW.md`, outside the verbatim sections downstream and across the whole file in the hub, is a **drift** finding. That is because a pin's value in prose goes stale at the next bump and every other literal reads like one.

**Verify the host before running any hub tool.** The tools carry version floors. A host below one answers `--version`, looks healthy, and produces a wrong answer. So a clean audit run from a broken host is a clean-looking result rather than a result.

```shell
python3 scripts/host_gate.py --repo "<path-to-target-checkout>" # run from a hub checkout, floors from spec/host-tools.json
```

Pass `--repo`, since the gate reads the target's own `host-tools.json` relative to it and defaults to the working directory. Omitting it does not read the target's declaration at all, so every floor that repo adds goes unapplied. The run reports nothing about the omission. A finding is a **host** misconfiguration rather than a repo one, and [`docs/host-setup.md`][host-setup] is the contract it checks.
Pass `--repo`, since the gate reads the target's own `host-tools.json` relative to it and defaults to the working directory. Omitting it does not read the target's declaration at all, so every floor that repo adds goes unapplied. The run reports nothing about the omission. A `--repo` naming a path that is not the target's checkout is just as silent. So check that the run prints a `layered N local entry(s)` note naming the target's own `host-tools.json`, the only sign its declaration was read. A finding is a **host** misconfiguration rather than a repo one, and [`docs/host-setup.md`][host-setup] is the contract it checks.

## 1. Scope and Ground-Truth Branch

Expand Down
Loading
Loading