Commit Graph
5 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 ab0d407c44 feat(ci): internal packages get a reconciler, not another report (#120)
* 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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-21 06:03:42 -07:00
CatoandClaude Opus 5 c8c0c6077a feat(fleet): make throwaway repos disposable, and point the audits inward (#58)
* feat(fleet): make throwaway repos disposable, and point the audits inward

Six scaffolded repos appeared in two days and nobody created them carelessly —
FleetCrown provisions one per project and agents scaffold sites to test that
path. Together they were 15 of the 26 gaps that were about to turn the
version-currency ratchet red against a committed baseline of 0. That is how a
ratchet dies: not disputed, drowned. A gate whose number is mostly noise gets
muted, and every true finding inside it is muted with it.

The house rule (CLAUDE.md, "Clean up the experiment when the experiment is
over") already says an experiment is torn down in the session that created it,
repo included. This adds the backstop, because that rule covers the session
that creates a repo and nothing covers the session that dies, is interrupted,
or forgets — which is how all six survived.

  scripts/local/prune-ephemeral-repos.sh

A throwaway repo carries the GitHub topic `fleet-ephemeral` from birth: on the
repo, not in a list somebody must remember to update, so a later sweep can find
it without recognising the name. The script lists by default, deletes on
--delete --yes, and refuses anything unmarked — "it is obviously a test repo"
is the reasoning that eventually deletes something real. Deletion is the
intended action, per the house rule; --archive is only a holding position.

Its selector is pinned in both directions on every fixture and its --yes guard
runs through the script itself via an injected repo list, so no assertion is a
re-implementation of the thing it checks. Four mutants were each confirmed to
turn the test red before this shipped: selector ignores the topic, substring
instead of exact match, guard removed, empty result reported silently.

  scripts/ci/shared-registry-audit.mjs

Every audit in this repo sweeps the OTHER repos. None asked whether SHARED.md —
the file whose first line is "check this file, if it is here, install it" —
matches the dependency graph. It did not: bip-kit had eight adopters and no
row. This derives the adopter count from package.json across the org and fails
when a package with 2+ adopters has no registry row. It resolves the npm: and
github: aliases half the fleet installs under, because a key-only reader
reports zero adopters for a package with five, and it counts a row only from
the registry TABLE — bip-kit was mentioned in the prose the whole time, and a
substring search over the file would have called that covered.

It does not judge the content of a row. A gate that guesses at prose gets muted.

  scripts/ci/blessed-versions.json

@bitbaum/ai-kit fell through the seam between `internal_tags` (deleted when it
graduated to npm, correctly) and `majors` (never added — it was 0.x that day).
It shipped 1.0.0 and nothing noticed, because the comment explaining its
absence still described it as a 0.x package. Seven of thirteen consumers sat on
0.x carets while the package was at 1.4.1 and no gate said so. Both it and
design-tokens are now tracked, and the stale exemption is rewritten to say what
actually happened: a version-tracking exemption must be re-read when the
version moves.

  scripts/ci/org-drift-audit.sh

The only org sweep that did not pass --no-archived, so a retired repo still had
its README judged against the org register.

The baseline is raised in the same commit, as the process requires. It covers
real staleness on real repos (causius, diplodoctor, heidi, sbb-fundbuero) plus
the ai-kit gaps that were previously unmeasurable — not the six scaffolds,
which are already deleted.

Known and deliberately not fixed here: version-currency reads only each repo's
ROOT package.json, so kivvi/packages/ai (^0.15.0) and datacat/backend (^0.13.0)
remain invisible to it. Attributing a gap to repo-vs-path changes the report
shape and the fixtures, and folding it in would make this baseline number
un-reviewable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2

* fix(shared-inventory): one red ratchet must not hide the other

Both reports now run before either ratchet, and each ratchet carries
`!cancelled()`. Without it the first failing check ends the job and the second
never runs — reporting green by absence, which is worse than not having the
gate at all.

This was the live case, not a hypothetical: the duplication ratchet was already
red (ai-provider-client 17 -> 19) when the registry gate was added below it, so
the new gate would have been masked from its first scheduled run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 10:03:13 -07:00
CatoandClaude Opus 5 35c0758696 docs(stack): one way to do auth — federate, or better-auth locally (#54)
The fleet had six auth approaches across eleven repos: next-auth v5
beta (7, two of them on different betas), Supabase Auth (3), Better
Auth (1), next-auth v4 (1), and two hand-rolled. Five repos have no
auth at all, which is the correct amount for a brochure site.

The same bug got written twice independently: petvity and
surf-your-life both shipped a cron guard that failed OPEN when
CRON_SECRET was unset, both comparing against the literal string
"Bearer undefined". That is what N implementations guarantees.

THE RULE

Two populations, and conflating them is the mistake:

  Our own products federate to OrangeCat. Its OIDC provider shipped
  2026-06-17; FleetCrown, Solon and now Heidi consume it. A federated
  app keeps NO users table, no password, no reset flow, no session
  table — it reads id_token.sub and stops. The identity-bridge
  instruction generalises: do not rebuild profiles, payments or
  presence locally.

  Client-owned apps never federate — aoz-housing's residents belong to
  AOZ, not to us. They keep local auth, and the blessed library for
  new local auth is better-auth 1.x.

WHY NOT next-auth

Because it could not be enforced, and this file's premise is that
unenforced choices drift. blessed-versions.json said so itself —
"next-auth is deliberately absent while v5 is beta" — so
version-currency.mjs, the audit that turns every other drift into a
number, was structurally blind to the one technology where
inconsistency costs most. The row said "v5 when stable"; it has been
beta ~3 years, npm latest is still 4.x, and six repos shipped the beta
regardless.

better-auth has a real semver major, so it is now IN
blessed-versions.json and the existing audit measures it for free. No
new machinery. It also uses the blessed ORM, its magic-link plugin
takes our own sender so mail-kit slots in unchanged, and hirnli has
run it in production since 2026-09.

NO AUTH PACKAGE

SHARED.md already lists auth under what must NOT be centralized, and
sitekit is the evidence: centralizing nav markup centralized the bug,
and it serves 2 of 20. Share the decisions and the checks, never the
implementation. Existing apps migrate on contact, never on a schedule
— ADR-0002 sat at Proposed for seven months while its count went 2→4.


Claude-Session: https://claude.ai/code/session_01BUfvtBc4ycbYRRjb9eBmuB

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 14:13:16 -07:00
955e2484d1 chore(ci): retire the ai-kit git-tag pin — it lives on npm now (#18)
ai-kit is published as @bitbaum/ai-kit@0.6.2 and all 7 consumers
(orangecat, fleetcrown, aoz-housing, botsmann, evig, hirnli, truthseeker)
have "^0.6.2" from the registry on their mains (verified 2026-09-04). The
internal_tags entry that policed the github-tag pins has nothing left to
police, so it graduates exactly the way blessed-versions.json always said
it would: delete the entry. As a 0.x package it joins drizzle-orm and
@anthropic-ai/sdk in the "no meaningful major, not listed" convention —
no new mechanism.

- blessed-versions.json: internal_tags now {}, comment records the
  graduation path and the 0.x convention
- test-version-currency.mjs: two new checks pin the now-live config shape
  (absent internal_tags counts only major gaps; empty internal_tags does
  not judge a leftover git pin) — the || {} in gapsFor is proven, not
  assumed
- STACK.md: AI row now names @bitbaum/ai-kit from npm; package-manager
  row and "still open" note say the npm bootstrap is DONE but the pnpm
  sweep is still in progress (5 repos converting) — NOT marked done

Measured before and after: TOTAL GAPS 1 with both main's config and this
one — identical, the ratchet does not move. That 1 is sbb-lost-found's
eslint ^8.57.1 < blessed 10, a pre-existing regression on main (baseline
is 0) that the weekly ratchet will flag; it belongs to sbb-lost-found,
not this PR.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 09:33:42 +00:00
503f476efa feat(ci): staleness is measured, and the measurement is a ratchet (#10)
The 2026-08-31 fleet audit found the box on an EOL Node, aoz-housing a full
framework generation behind on every axis, and ai-kit pinned at three tags
across seven consumers — one at the pre-org-move OWNER. None of it hidden,
all of it unmeasured. Same lesson shared-inventory encodes for duplication:
writing 'stay current' in a doc is what already failed.

blessed-versions.json is the SSOT (blessed major per key package + the tag
every internal git pin must carry); version-currency.mjs measures every
default branch against it, reports UNCHECKED for anything it could not read
rather than counting it clean, and --check ratchets the total: fall or hold,
never rise. Baseline seeded at the audit's real number: 80.

Self-test pins both sides with the audit's own fixtures (the aoz manifest,
the dead-owner pin) and runs in ci.yml beside the other detector tests.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 08:48:06 +00:00