mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 00:28:14 +01:00
* feat(ci): internal packages get a reconciler, not another report
THE HOLE
`version-currency.mjs` judges a dependency by its MAJOR — `blessed-versions
.json` is literally called `majors`. That is the right instrument for `next`
and `react`, where a major is the event, and the wrong one for our own
packages, where we ship features in MINORS.
Measured 2026-09-21, `@bitbaum/ai-kit` was published at 1.10.0 and read:
heidi ^1.10.0 · loki ^1.8.0 · substrata ^1.7.0 · orangecat ^1.6.0
aoz-begleitung, botsmann, evig, hirnli, surf-your-life, truthseeker,
vitareba ^1.4.0
kivvi (packages/ai) ^0.15.0 · sbb-fundbuero ^0.15.0 · datacat (backend) ^0.13.0
Eleven of fourteen behind. TEN of those on major 1 — so the ratchet reported
zero gaps while the fleet spanned seven minor versions of the package that owns
model ids, failover, the three kinds of 429 and now vision routing. A fix
published for everyone reached two repos.
REPORTING IS WHAT ALREADY FAILED
SHARED.md has said "version spread is the metric to watch" and "getting a repo
current is the cheapest work in this file and nobody schedules it" since before
the spread was measured. Both true. Neither moved a version. This file's own
history is explicit that adoption has only ever moved as a side effect of
repairing an outage.
So the reconciler opens the pull request. Everything downstream already exists:
PR → the repo's CI → auto-merge-sweep → CD → box. A green bump ships itself. A
red bump is the useful outcome — it names the repo that cannot take the new
version, which nothing in the fleet tells a package author today.
WHAT IT WILL NOT DO
`@bitbaum/*` only. Auto-bumping someone else's major across the fleet on a
schedule is a different risk and our CI is not a safety net for it; third-party
majors stay with version-currency.mjs and a human.
It never fails a pipeline for being behind. A gate that FIXES what it measures
has nothing to gain from also going red, and a red nobody can clear by hand is
the dead end this fleet's doctrine forbids.
It does not hand-patch a manifest. Every repo installs frozen, so an
API-patched package.json without its lockfile is a PR that fails CI in every
repo every week for a reason unrelated to the bump — and a bot whose PRs are
always red gets muted, taking the real signal with it. The workflow checks the
repo out and lets pnpm write both files.
Capped at 12 PRs per run: a whole fleet going stale at once is likelier a bug
in the predicate than twelve stale repos.
DOCUMENTATION THAT HAD GONE FALSE
Three claims in SHARED.md were still being read as current:
- "kivvi, orangecat and evig already own model REGISTRIES ... which ai-kit
does not model" — it does. src/registry.ts carries contextWindow,
capabilities incl. vision, inputCostPer1M and a live-probed toolProtocol.
- "ai-kit has no streaming API" — completeStream() + ai-kit/sse shipped in
v1.9, and src/stream.ts opens by quoting that very row.
- the transcription row — transcribe() shipped; heidi migrated.
Three reasons repos gave for keeping their own AI layer, all built into the
package and left unclaimed, because the consumers are pinned below the fix.
Corrected in place with what is genuinely still missing (embeddings, a local
provider, image generation, anything not JavaScript) marked deliberate.
The general lesson is recorded there: a reason a repo gave for not adopting
something becomes a FACT in that file the moment it is written, and nothing
re-reads it when the reason expires. Date a reason, or it outlives its subject.
45 self-test checks, no network, no token, no checkout. Both sides pinned: the
same-major drift is caught, a current repo stays silent, and `workspace:*`, a
git pin and `>=1.2 <2` come back untouched — quietly rewriting a range somebody
chose deliberately is the worst bug this script could have.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RpRyAd15YvFmQ1c1p1Rsk
* ci: run the reconciler's self-test, like every other audit's
Caught reviewing my own diff. This repo's CI names each audit's self-test
explicitly rather than globbing, which is the right call — a glob quietly
covers a file that does not exist yet and quietly stops covering one that is
renamed. It also means a NEW audit is uncovered until someone adds the line,
and I had not.
That matters more here than for most: this is the one audit that WRITES.
A scheduled run pushes a branch and opens a pull request in up to twelve
repositories, so its predicates are the last ones that should reach a schedule
unproven. They are pure precisely so they can be proved without a network, and
the proof has to actually run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RpRyAd15YvFmQ1c1p1Rsk
* fix(ci): the re-arm gate asked a wider question than its own name
It went red on this PR, correctly as written and wrongly as intended:
internal-currency.yml pushes to main but never re-arms CI
internal-currency.yml re-arms CI but lacks 'actions: write'
That workflow pushes a FEATURE branch, to a DIFFERENT repository, with a PAT.
Three independent reasons it cannot strand this repo's merge queue, which is
the invariant the gate is named for. What it was actually keyed on was
`grep -q 'git push'`.
The gate is not wrong and is not weakened here. It indexed more than it was
trusted to cover — this file's own recurring shape, recorded about
version-currency and the hosted-supabase sweep in the same table — and the
remedy is the one this repo keeps arriving at rather than an exemption:
narrow the predicate to the invariant, and put it where fixtures can reach it.
Satisfying it literally was the alternative and would have been worse: adding
`actions: write` and a `gh workflow run ci.yml` to a workflow that has no
business dispatching fleet's CI, purely so a grep would pass. A gate answered
that way stops meaning anything.
WHAT NOW COUNTS AS PUSHING TO MAIN
git push the CURRENT branch — on a scheduled run
here that is main. COUNTS
git push origin main says so. COUNTS
git push origin HEAD:main same. COUNTS
git push origin "$BRANCH" an explicit non-main ref does not,
UNLESS the file sets that variable to main
That last clause is the doorway, and it is pinned: naming your target $BRANCH
must not buy an exemption while `BRANCH: main` sits ten lines above it. Both
the YAML-env and shell-assignment spellings are fixtures.
A comment is also no longer a push. Without that the gate reported ITSELF —
ci.yml quotes the old predicate in the comment explaining it, and was listed
as a pushing workflow.
MOVED OUT OF ci.yml, because a rule that can only be exercised by editing a
real workflow is a rule nobody re-tests after changing its regex. Same
reasoning that put the verify-contract rules in verify-predicates.sh.
Eleven fixtures, no network, red half written first. And the claim the old
inline comment made — "proven by mutation: deleting any of the three re-arms
turns this red" — re-run against the real readings.yml: deleted, red; restored,
green.
The remaining limit is stated in the script rather than implied: a workflow
pushing to ANOTHER repo's default branch is not covered, because it cannot
strand THIS queue, and a gate for it belongs with whatever owns that queue.
All 27 of this repo's CI self-tests pass locally.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RpRyAd15YvFmQ1c1p1Rsk
* fix(ci): the reconciler workflow was invalid YAML and would never have run
I shipped it broken in #120 and the repo had no way to tell me.
`internal-currency.yml` merged to main unparseable. A `run: |` block is a YAML
block scalar, and the multi-line `git commit -m "…"` inside it continued at
column 0, which ends the scalar mid-command. The `gh pr create --body "$(cat
<<'BODY' …)"` heredoc had the same shape.
THE FAILURE MODE IS THE WHOLE POINT. A workflow GitHub cannot parse does not go
red. It does not warn. It is registered with its FILE PATH where its name
should be, and it never runs — not on dispatch, not on its weekly schedule. The
only symptom was `run_workflow` replying "Workflow does not have
'workflow_dispatch' trigger" about a file that plainly declares one, because
GitHub had not managed to read the `on:` block either. Had I not tried to
dispatch it, the first sign would have been a Tuesday cron that quietly did
nothing, forever.
FIXED: both message bodies now go through INDENTED heredocs into files, read
back with `git commit -F` and `gh pr create --body-file`. YAML strips the
block's common indentation, so the bodies and their terminators reach bash at
column 0 as it requires.
AND THE GAP THAT LET IT SHIP. CI validates `templates/ci/*.yml` — on the
reasoning that a broken template fails in another repo, far from here — and
validated nothing in `.github/workflows/`. The repo's own automation, which
defends every other repo's branch, was the unchecked part.
`scripts/ci/check-workflows.sh` now asserts both halves, because they fail
independently:
1. every workflow parses, and `name:`/`on:`/`jobs:` survive the parse;
2. every `run:` block is valid shell, extracted exactly as the runner
receives it.
The second half is not optional. A file can parse as YAML and still hand the
runner something that cannot execute, and the extraction is the only way to see
a `run:` block the way bash will.
TWO BUGS THIS SCRIPT'S OWN TEST FOUND, both worth naming:
· `out="$(python3 - <<'PY' … PY)"` — a heredoc inside a command substitution
is not the same thing. Bash warns "unterminated here-document" and quietly
runs nothing. The gate was passing because it was doing nothing.
· `bash -n` EXITS 0 on an unterminated heredoc and only warns. Checking the
exit code alone would have let this exact defect class through a second
time. It now fails on any stderr, since a clean script prints nothing.
The second one is the reason the test exists. I would have shipped a checker
that could not catch the bug it was written for.
Ten fixtures, no network, red half first — the real flush-left heredoc, valid
YAML with invalid shell, an unterminated heredoc, a missing `on:`, a missing
`name:`; and quiet for an indented heredoc, a `uses:`-only workflow, and
`${{ }}` expressions, which are not shell and must never be parsed as such.
Plus this repo's real 25 workflows and 101 run blocks.
30 of 31 CI checks pass locally; the exception is org-drift-audit.sh, which
needs the `gh` CLI this sandbox lacks and which CI has.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RpRyAd15YvFmQ1c1p1Rsk
---------
Co-authored-by: Claude <noreply@anthropic.com>
208 lines
4.6 KiB
Bash
Executable File
208 lines
4.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Self-test for check-workflows.sh. No network, no checkout.
|
|
#
|
|
# The first fixture is the real defect, reproduced exactly: a flush-left
|
|
# heredoc inside a `run: |` block, which is how `internal-currency.yml` merged
|
|
# to main unparseable on 2026-09-21. If that case ever goes green again, this
|
|
# check is decorative.
|
|
#
|
|
# bash scripts/ci/test-check-workflows.sh
|
|
set -euo pipefail
|
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
gate="$here/check-workflows.sh"
|
|
|
|
failures=0
|
|
pass() { echo " ok $1"; }
|
|
fail() {
|
|
echo " FAIL $1 — $2"
|
|
failures=$((failures + 1))
|
|
}
|
|
|
|
work="$(mktemp -d)"
|
|
trap 'rm -rf "$work"' EXIT
|
|
|
|
# Callers read as (what this case is, which directory) — so the gate runs
|
|
# against $2 and the label is $1. Reversed, every case silently ran the gate
|
|
# against its own description, which is a directory that does not exist: the
|
|
# red half "passed" for the wrong reason and the green half failed. Caught by
|
|
# running it.
|
|
expect_red() {
|
|
if bash "$gate" "$2" >/dev/null 2>&1; then
|
|
fail "$1" "gate stayed GREEN"
|
|
else
|
|
pass "$1"
|
|
fi
|
|
}
|
|
|
|
expect_green() {
|
|
local out
|
|
if out="$(bash "$gate" "$2" 2>&1)"; then
|
|
pass "$1"
|
|
else
|
|
fail "$1" "gate went RED: $out"
|
|
fi
|
|
}
|
|
|
|
echo "check-workflows self-test"
|
|
echo
|
|
echo " — must go red —"
|
|
|
|
# 1. THE REAL DEFECT. A heredoc at column 0 ends the block scalar, and the file
|
|
# stops being parseable from that point on.
|
|
d="$work/flush_heredoc"
|
|
mkdir -p "$d"
|
|
cat >"$d/broken.yml" <<'YAML'
|
|
name: Broken
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- run: |
|
|
git commit -m "a title
|
|
|
|
Body flush left, which ends the YAML block scalar right here.
|
|
"
|
|
echo after
|
|
YAML
|
|
expect_red "a flush-left heredoc inside a run: block" "$d"
|
|
|
|
# 2. Parses, but hands the runner something bash cannot run. yaml.safe_load
|
|
# alone would call this file fine.
|
|
d="$work/bad_shell"
|
|
mkdir -p "$d"
|
|
cat >"$d/badshell.yml" <<'YAML'
|
|
name: Bad shell
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- run: |
|
|
if [ -z "$X" ]; then
|
|
echo missing
|
|
YAML
|
|
expect_red "valid YAML whose run: block is not valid shell" "$d"
|
|
|
|
d="$work/unterminated"
|
|
mkdir -p "$d"
|
|
cat >"$d/heredoc.yml" <<'YAML'
|
|
name: Unterminated
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- run: |
|
|
cat <<'EOT'
|
|
never closed
|
|
YAML
|
|
expect_red "an unterminated heredoc" "$d"
|
|
|
|
# 3. The two keys without which a workflow silently never fires. A missing
|
|
# name is the exact tell GitHub gave: the path shown where the name goes.
|
|
d="$work/no_on"
|
|
mkdir -p "$d"
|
|
cat >"$d/noon.yml" <<'YAML'
|
|
name: No trigger
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- run: echo hi
|
|
YAML
|
|
expect_red "no \`on:\` — it can never be triggered" "$d"
|
|
|
|
d="$work/no_name"
|
|
mkdir -p "$d"
|
|
cat >"$d/noname.yml" <<'YAML'
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- run: echo hi
|
|
YAML
|
|
expect_red "no \`name:\`" "$d"
|
|
|
|
echo
|
|
echo " — must stay quiet —"
|
|
|
|
# 4. The corrected shape: an INDENTED heredoc. YAML strips the block's common
|
|
# indentation, so the body and terminator reach bash at column 0.
|
|
d="$work/indented_heredoc"
|
|
mkdir -p "$d"
|
|
cat >"$d/good.yml" <<'YAML'
|
|
name: Good
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- run: |
|
|
cat >/tmp/msg.txt <<'MSG'
|
|
a title
|
|
|
|
a body, indented in the file and flush-left by the time bash sees it
|
|
MSG
|
|
git commit -F /tmp/msg.txt
|
|
YAML
|
|
expect_green "an indented heredoc" "$d"
|
|
|
|
# 5. Steps with no `run:` at all must not be mistaken for empty scripts.
|
|
d="$work/uses_only"
|
|
mkdir -p "$d"
|
|
cat >"$d/uses.yml" <<'YAML'
|
|
name: Uses only
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 24
|
|
YAML
|
|
expect_green "a workflow of only \`uses:\` steps" "$d"
|
|
|
|
# 6. `${{ }}` is not shell and must not be parsed as it. A step full of
|
|
# expressions is ordinary and must never be flagged.
|
|
d="$work/expressions"
|
|
mkdir -p "$d"
|
|
cat >"$d/expr.yml" <<'YAML'
|
|
name: Expressions
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
go:
|
|
steps:
|
|
- env:
|
|
B: ${{ toJSON(matrix.target.bumps) }}
|
|
run: |
|
|
echo "${{ github.sha }}"
|
|
echo "$B" | head -1
|
|
YAML
|
|
expect_green "GitHub expressions inside a run: block" "$d"
|
|
|
|
echo
|
|
echo " — the floor —"
|
|
|
|
d="$work/empty"
|
|
mkdir -p "$d"
|
|
expect_red "a directory with no workflows at all" "$d"
|
|
|
|
echo
|
|
echo " — the real thing —"
|
|
|
|
if [ -d "$here/../../.github/workflows" ]; then
|
|
expect_green "this repo's own workflows" "$here/../../.github/workflows"
|
|
fi
|
|
|
|
echo
|
|
if [ "$failures" -gt 0 ]; then
|
|
echo "$failures check(s) FAILED" >&2
|
|
exit 1
|
|
fi
|
|
echo "all checks passed"
|