Skip to content

feat(fleet): check that make ci is each repository's local CI gate (ADR-0083) - #253

Merged
bketelsen merged 7 commits into
mainfrom
lucilla/make-ci-local-gate
Nov 14, 2026
Merged

bketelsen merged 7 commits into
mainfrom
lucilla/make-ci-local-gate

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

ADR-0083 makes make ci the 1 local entry point to the CI gate in every frostyard code repository and in the bketelsen repositories that ADR-0076 names:

  • make ci runs every check that ci.yml runs on pull requests, lint and format included; only a check that needs network access or a credential (govulncheck, a GitHub API read, a pip install inside a test) stays in a job of its own.
  • No pull-request workflow runs a lint or format check that make ci does not run.
  • AGENTS.md names make ci.
  • A change rolled out to many repositories runs make ci in each clone before it pushes there.

Why: of the 552 pull requests that frostyard-machines opened from 2026-11-07 to 2026-11-14, 28 had a real CI failure. 6 of them failed only on lint or format (shellcheck SC2034 in apt-publisher, bootc-debian and omarchy-apps; golangci-lint ST1018 in repogen; ansible-lint line length in bketelsen/fleet), and 5 of those 6 came from rollouts to many repositories.

Changes:

  • scripts/lib/ci-gate.mjs (new): the B12 readers workflowCommands and ciCoverageGaps, moved verbatim from test/repository-baseline.test.mjs (which re-exports them), plus new hand-written readers: runsOnPullRequest (top-level on: only), workflowActions, makeRules/makeCalls/makeReach (prerequisites, recipe make/$(MAKE) calls in command position, outside quotes), npmScripts, scriptPaths, workflowLintChecks, lintGaps, lintScriptPaths, namesMakeCi. LINT_TOOLS and LINT_ACTIONS list the tools and actions the check knows. One B12 change: make a b in a run: command now counts both targets (frostmail runs make desktop-build desktop-build-windows).
  • scripts/check-fleet-conventions.mjs / scripts/lib/fleet-conventions.mjs: beside the B4 presence part, check B12: (ci.yml exists and runs every part of make ci) and B19: (AGENTS.md names make ci; no lint or format check outside make ci in a pull-request workflow). With OWNER/REPO arguments, it checks those repositories instead of the enabled declarations; a bad argument exits 2.
  • Docs: baseline row B19 and the B12 note in docs/specs/repository-baseline.md; the local CI gate and the rollout rule in docs/design/quality-loop.md; AGENTS.md; docs/org-adrs.md; the ADR index; link-only back-links in ADR-0044, ADR-0071 and ADR-0073.
  • Tests: test/ci-gate.test.mjs (input shapes of each reader: YAML forms of on:, comments, quoted and block values, CRLF, BOM, empty file, continuation lines, inline recipes, target-specific variables, pattern rules, quoted make, -C/-f, cycles, bad package.json, globs, URLs, matches inside longer words); new cases in test/fleet-conventions.test.mjs and test/repository-baseline.test.mjs (B12 multi-target case; B19 for core itself).

The enabled declarations (clix, core, firn, std, updex) pass the new checks, so the required fleet-conventions job stays green.

Survey on 2026-11-13 (node scripts/check-fleet-conventions.mjs over the 29 non-archived, non-fork frostyard repositories without hotedge, Logomenu and incus, plus the 6 bketelsen repositories): 6 fail.

Repository Failure
frostyard/apt-publisher B19: AGENTS.md does not name make ci
frostyard/caddyscope no mise.toml, mise.lock, Makefile, ci.yml; B19 AGENTS.md
frostyard/snosi B19: shellcheck in validate.yml is outside make ci
frostyard/frostnotes B12: ci.yml does not run make desktop-build
frostyard/pilothouse B12: ci.yml does not run make verify and 4 commands of the ci recipe
bketelsen/truenas-mcp B12: ci.yml does not run 8 commands of the ci recipe (race, cross build, echo lines)

Risk tier

Risk tier: 3 — changes the organization gate (CI's required fleet-conventions job) and adds a baseline row; scripts/lib/** and test/** are quality-gates paths at high in policies/agent-governance.json. No path in .github/risk-paths.json and no workflow changes.

Docs housekeeping

  • New docs started from their category's TEMPLATE.md
  • Every new doc indexed in docs/README.md
  • Cross-links added in both directions (ADR ↔ design ↔ spec ↔ plan)
  • New significant decision recorded as an ADR first, in this PR
  • New/edited ADRs are fact-only (context, decision, consequences)
  • Conformance aliases (ADR-0029) untouched — canonical targets edited instead

The ADR amends ADR-0071, ADR-0044 and ADR-0073 in part and lists each statement it makes false. The decision comes from a review of the CI failures of bot pull requests (cause 3, lint or format in rollouts). The owners of the failing repositories were not consulted before this PR; their gaps arrive as sweep issues.

Verification

  • make ci green locally (876 tests pass, docs gate, corrections, risk paths)
  • GITHUB_TOKEN=… npm run check:fleet: ok for clix, core, firn, std, updex
  • node scripts/check-fleet-conventions.mjs bad exits 2 with the usage line
  • Docs-site skill unchanged; no workflow changed

…DR-0083)

ADR-0083 makes make ci the 1 local entry point to the CI gate: it runs
every offline check of ci.yml, lint and format included, no pull-request
workflow lints or formats outside it, and AGENTS.md names it. A change
rolled out to many repositories runs make ci in each clone before it
pushes.

- scripts/lib/ci-gate.mjs: the B12 readers (moved from
  test/repository-baseline.test.mjs, which re-exports them) and new
  readers for workflow triggers, lint actions and tools, Makefile reach,
  npm scripts and script files. make a b now counts both targets in B12.
- scripts/check-fleet-conventions.mjs checks rows B12 and B19 beside the
  B4 presence part, and takes OWNER/REPO arguments to check any
  repository.
- Baseline row B19, the quality-loop design doc, AGENTS.md and
  docs/org-adrs.md; link-only back-links in ADR-0044, ADR-0071 and
  ADR-0073.
@github-actions github-actions Bot added the level:L3 Skim label Nov 14, 2026
Review of the first head found 7 reader gaps. Each now has a targeted
test and a correction record:

- on: events are read at 1 level (indentless lists, flow mappings), not
  from branch names or inputs;
- a uses: line inside a block scalar body is text, not a step;
- a quoted make argument is a target;
- a lint tool counts only when a simple command that make ci reaches
  calls it (commandCalls), after the Makefile variables that the command
  uses are expanded, never from a message, a comment, an installer
  argument or an unused variable;
- npm pre and post scripts are followed, unless --ignore-scripts;
- row B12 needs ci.yml to run on pull_request.
…er options

Re-review found 5 more reader gaps. Each now has a targeted test and a
correction record:

- a quoted string is 1 argument word; only $(...), backquotes and the
  string after -c (or a flag group ending in c, as in sh -lc) are
  command lines;
- npm scripts come from npm invocations (commandCalls), each with its own
  --ignore-scripts;
- a flow on: value is read to its matching bracket and split at the top
  level only;
- the values of xargs, sudo, env, nice, time and timeout options are
  skipped;
- Makefile variables are expanded before prerequisites and recipe make
  calls are followed.

ADR-0083 names the readers' limits.
…hell

Re-review found 2 more gaps in commandCalls. Each now has a targeted
test and a correction record:

- the reader splits a line into shell words first: quotes join their
  word ("golangci-lint", CGO_ENABLED="0"), and a substitution keeps its
  place in its word ($(go env GOPATH)/bin/staticcheck runs staticcheck);
- a -c argument is code only after a shell (sh, bash, dash, zsh, ksh,
  ash; also nsl run ... sh -lc), never after grep -c.
The last review found that echo sh -c 'x' still counted x as a command:
the reader searched every argument for a shell name. A -c argument is
now code only when the command is a shell (after wrappers), or a shell
after nsl run and its options. Targeted tests through toolsCalled and
lintGaps; the correction record names the case.
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record

  • Reviewer: OpenAI GPT family (openai/gpt-6.1-sol), read-only. Coder: anthropic/claude-opus-5-5.
  • Base merge-base: 3d3d5c703fc24db3734408765171938a97840f4c.
  • Reviews: initial at 754e01f (7 blocking findings, fixed in 3ca376e); re-review 1 at 3ca376e (5 blocking, fixed in 9e2d63b); re-review 2 at 9e2d63b (2 blocking, fixed in f18e0eb); re-review 3 at f18e0eb (1 blocking, fixed in 28f4bb7).
  • Last finding: echo sh -c 'shellcheck x.sh' counted shellcheck as a run, because the reader searched every argument for a shell name. 28f4bb7 reads a -c argument as code only when the command itself is a shell (after wrappers), or a shell after nsl run and its options. Guard: test/ci-gate.test.mjs "a shell name in another command's arguments does not make text code", through toolsCalled and lintGaps.
  • Status: Not ready. The review budget (1 review and 3 re-reviews) is used, and 28f4bb7 is not reviewed. This PR does not get ready-for-human until a further review at the head passes.

Checks at 28f4bb7

  • make ci: exit 0. node --test test/ci-gate.test.mjs test/fleet-conventions.test.mjs test/repository-baseline.test.mjs: 63 pass, 0 fail.
  • npm run check:fleet: ok for clix, core, firn, std, updex; "5 repositories checked".
  • PR checks: docs-gate, fleet-conventions, scaffold-e2e and pr-triage pass.
  • Revert tests in a scratch worktree, tests kept: fleet-conventions.mjs and the CLI at the base fail 4 tests; ci-gate.mjs at 3ca376e fails 9; at 9e2d63b fails 4; at f18e0eb fails 1 (the new guard). All failures are assertion failures.
  • Survey of 35 repositories (node scripts/check-fleet-conventions.mjs OWNER/REPO...): 6 fail today, out of scope for this PR: apt-publisher (B19), caddyscope (B4, B19), frostnotes (B12), pilothouse (B12), snosi (B19: shellcheck in validate.yml), bketelsen/truenas-mcp (B12).

Limits

The readers are line readers, not a YAML parser or a shell; ADR-0083 lists the forms they do not read.

@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record (update)

  • Re-review 4 at 28f4bb793780acfeb43e9def78166802d550b633, same reviewer (openai/gpt-6.1-sol), once only.
  • Closed: a shell name in another command's arguments (echo sh -c 'shellcheck x.sh') no longer makes text code.
  • New blocking finding (regression from 28f4bb7): scripts/lib/ci-gate.mjs skips shell option words between the shell and -c but not their values. bash -o pipefail -c 'shellcheck x.sh' resolves to no tool (confirmed locally: toolsCalled returns []; f18e0eb returned shellcheck). A make ci that runs this form next to a workflow shellcheck step gets a false B19 gap. Needed fix: consume the values of -o and -O (also in combined groups) before -c, with a positive toolsCalled test and an end-to-end lintGaps test.
  • Status: Not ready. No fix in this PR yet; no ready-for-human.

The reader skipped a shell's option words but not their values, so
bash -o pipefail -c 'shellcheck x.sh' ran no tool and a conformant
make ci got a false B19 gap. shellCode now parses the options: -o, -O,
+o, +O (also in a group such as -eo), --rcfile and --init-file take the
next word as their value, and the code is the first word after the
options. Targeted test and correction record.
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Fix for the re-review 4 finding

  • 2a33a276702138f1f79616861903e3944f723743 fixes the -o/-O option-value regression. The new shellCode reads a shell's options before its code: -o, -O, +o and +O (also in a group such as -eo), --rcfile and --init-file take the next word as their value. With -c among the options, the code is the first word after them.
  • Guard: test/ci-gate.test.mjs "a shell's option values do not hide its -c code", through toolsCalled and lintGaps. Correction record: .memory/corrections/2026-11-13-pr-253-shell-option-values.json.
  • Revert test in a scratch worktree, with ci-gate.mjs from 28f4bb7: only the new test fails (assertion failure). 32 of 32 tests in that file pass with the fix.
  • make ci exits 0. check:fleet passes for the 5 enabled repositories. The 35-repository survey fails the same 6 repositories. PR checks pass.
  • Status: Not ready. The review budget is used, and 2a33a27 is not reviewed. No ready-for-human.

@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record (final)

  • Final re-review of the fix diff 28f4bb7..2a33a27, same reviewer (openai/gpt-6.1-sol), at head 2a33a276702138f1f79616861903e3944f723743: Ready. No blocking points and no new findings. The -o/-O finding is closed. No earlier finding regressed.
  • Every blocking finding of the 5 review rounds is fixed with a targeted test and a correction record.
  • At this head: make ci exits 0, check:fleet passes, and the PR checks docs-gate, fleet-conventions, scaffold-e2e and pr-triage pass. The PR is mergeable.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 14, 2026
@bketelsen
bketelsen merged commit 433f9e6 into main Nov 14, 2026
5 checks passed
@bketelsen
bketelsen deleted the lucilla/make-ci-local-gate branch November 14, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L3 Skim ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants