Commit Graph
97 Commits
Author SHA1 Message Date
Cato 53eee511ce feat(agents): one org-rules block in every repo's AGENTS.md, generated here, with an audit that fails a repo that starts without it
Problem: the org rules were restated by hand in CLAUDE.md essays (aoz-begleitung 1,850 lines), AGENTS.md intros and three differently worded starter templates; the starter said accounts are the app's own above a rule saying accountkit owns them. Nothing checked any of it, and 18 agent files import a personal ~/.claude file.

Change: templates/agent-rules.md is the only place the rules are written. sync-agent-rules.mjs opens one pull request per code repo putting it between fleet:rules markers (and a CLAUDE.md pointer where there is no CLAUDE.md; an existing CLAUDE.md is never rewritten). agent-files-audit.mjs fails on a finding not in agent-files.baseline; a baselined finding that has been fixed, or a block that is merely out of date, never fails it (the org-drift ratchet went red twice on 26 Oct because a file in another repo improved). All three templates carry the block and a test pins that. Own workflow, so a finding in another repo cannot hold this repo's merges.

Validation: 27 + 4 + 3 self-tests pass; the audit read 46 repositories and found 77 findings, all baselined; docs-truth-audit reports the same result on solon, petvity, aoz-begleitung and skif with and without the block.
2026-10-28 02:37:32 +01:00
Cato 74f42f1ce5 ci: wake the merge sweeps when a canary deploys, and on the box's 15-minute tick (#306)
The shared-package rollout gate clears when a canary deploys and passes its checks, but nothing woke the held PR's sweep: it waited for the next CI completion in its own repo or for a per-repo hourly cron GitHub does not honour. sweep-wake.mjs dispatches each repo's own auto-merge.yml where a green dependency PR is open; sweep-wake.yml is the reusable entry for canaries and deploy-reconciler.yml runs it on the box timer tick.
2026-10-27 23:51:35 +01:00
Cato 875f30d089 fix(ci): preserve mirror ownership and restore Fleet sweep writes (#294)
* fix(ci): update governed starter mirrors through their owner

* fix(ci): supply Fleet sweep write identity
2026-10-27 17:18:27 +00:00
Cato 5da9886a52 fix(ci): attest nested lock roots and verify live release receipts (#293)
* feat(ci): verify live receipts against staged releases

* fix(ci): resolve nested receipt importers against their lock root
2026-10-27 18:05:41 +01:00
Catoandgithub-actions[bot] 6efb8328d1 fix(packages): reconcile repository auto-merge settings (#286)
* fix(packages): reconcile repository auto-merge settings

* fix(packages): align head-branch cleanup settings

* fix(ci): trigger checks when refreshing PR branches

* fix(packages): report only missing repo settings

* ci: schedule org-wide drift audit

* docs: clarify package merge settings

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-27 12:07:33 +00:00
Cato 382738ac16 fix(ci): format generated package workspace config (#283) 2026-10-27 11:24:01 +00:00
Cato 00215923f3 fix(ci): reduce shared GitHub API pressure (#282)
* fix(ci): isolate auto-merge API quota

* fix(ci): preserve drift audit read diagnostics

* fix(ci): cut package census API fanout

* fix(ci): retain organization audit read errors
2026-10-27 11:16:21 +00:00
Cato 07f28a6e71 fix: admit automatic shared inventory checks (#281) 2026-10-27 10:52:57 +00:00
Cato c41da960e9 fix: re-arm package updates and inventory (#280)
* fix: admit automatic currency reconciliation events

* fix: re-arm package inventory after registry merges
2026-10-27 10:39:18 +00:00
Cato f673e33554 Fail closed on unavailable organization drift evidence (#272)
* chore: retire resolved AOZ documentation drift exception

* fix: fail closed on unavailable organization drift evidence

* fix: retain local no-checkout skips and bound transient audit retries
2026-10-27 08:58:47 +00:00
Cato cfea2a2971 fix: plan representative package updates before ordinary consumers (#269) 2026-10-27 08:17:07 +00:00
Cato 487ecf6a1d fix: enforce Fleet checks after verifying generated PR writers (#268) 2026-10-27 08:09:50 +00:00
Cato 02f5071ac4 fix: create generated PRs through permitted GitHub CLI path (#263) 2026-10-27 05:09:23 +00:00
Cato 9b104f0422 fix: route generated Fleet updates through normal pull request gates (#262) 2026-10-27 05:00:52 +00:00
Cato 0ac79869d5 Enforce verified Causius and Heidi checks through maintenance policy (#261)
* fix: enforce verified app checks through maintenance policy

* test: inspect app protection prerequisites with maintenance identity
2026-10-27 04:54:33 +00:00
Cato 3dc21a48b8 fix(registry): recover concurrent refreshes without losing publication (#258)
* fix(registry): recompute after concurrent main changes and recover dispatches

* test(registry): refuse to reset tracked checkout changes
2026-10-27 03:51:53 +00:00
Cato fd6693a4aa feat(rollout): verify distinct chat layouts in authenticated app canaries (#249) 2026-10-26 18:23:13 +00:00
Cato 7ac3e6deb5 fix(releases): refresh registry and consumers after verified releases (#247) 2026-10-26 18:07:18 +00:00
Cato e359fac11d feat(ci): collect read-only branch protection evidence (#246)
* feat(ci): inspect required-check protections with maintenance identity

* fix(ci): distinguish protection lookup status from absent rulesets
2026-10-26 17:10:05 +00:00
Cato 912857993d fix(automation): rearm currency after registry merges (#239) 2026-10-26 10:41:41 +01:00
Cato db23761d81 fix(currency): reconcile when package registry changes (#238) 2026-10-26 09:31:39 +00:00
Cato 9e0a23fa6c fix: serialize cross-repo currency updates (#235) 2026-10-26 09:17:49 +01:00
Cato 05275b98e6 fix(ci): keep routine audits off the owner API quota (#227)
* fix(ci): fetch public business facts without API quota

* fix(ci): use repository token for local auto-merge
2026-10-26 06:48:25 +01:00
Cato 9350549481 test(auth): require passkey and cross-method second-factor journeys (#211)
* test(auth): exercise shared passkey and second-factor account journeys

* fix(rollouts): block the reproduced AccountKit 0.6.2 MFA regression
2026-10-26 01:07:04 +01:00
Cato 53334582e0 fix(rollouts): enforce deployed receipts in root and starter promotion (#210) 2026-10-26 00:53:03 +01:00
Cato 8f6166e3e3 fix(packages): report failed update jobs without cancelling siblings (#208) 2026-10-25 19:25:56 +01:00
Cato 506198f9bd fix(packages): select the actual nested project toolchain (#206) 2026-10-25 19:15:25 +01:00
Cato 7c3c677cc7 fix(packages): reconcile preferred releases from complete locked project snapshots (#205) 2026-10-25 18:55:55 +01:00
Cato 4c954952a8 fix(auth): resolve browser from consumer Playwright package (#204) 2026-10-25 15:41:41 +01:00
Cato 8868691dd5 feat(rollout): verify live package release receipts (#203) 2026-10-25 14:36:51 +01:00
Cato 7f95c390d3 fix(registry): derive complete, verified package release targets (#202) 2026-10-25 14:06:07 +01:00
Cato 619e4a8042 test(auth): verify real consumer account journeys (#201) 2026-10-25 10:08:40 +01:00
Cato cdc3a95762 fix(packages): reconcile verified Git releases and validate canary bindings (#200) 2026-10-25 09:29:50 +01:00
Cato f78b02658f Stage shared package updates through tested consumer and canary deployments (#193)
* Gate shared dependency promotion on consumer checks and a deployed canary

* Import workflow evidence helper in regression tests

* Keep artifact publication separate from consumer deployment evidence
2026-10-24 15:47:12 +02:00
Cato 6d637c7f48 Make shared packages the default product foundation (#192)
* Make shared packages the default product foundation

* Support the fleet CI runner Node version
2026-10-24 14:59:48 +02:00
Catoandcatomean 2277ce42b7 ci: cut scheduled CI minutes (CI audit) (#187)
* ci: cut scheduled CI minutes (CI audit)

* ci: cut scheduled CI minutes (CI audit)

---------

Co-authored-by: catomean <catomean@users.noreply.github.com>
2026-10-21 20:41:20 +02:00
Catoandcatomean 2fbac8cce0 fix(registers): RevampIT is not a client; Kivvi is a product; business-facts check (#188)
Co-authored-by: catomean <catomean@users.noreply.github.com>
2026-10-21 20:31:05 +02:00
CatoandClaude 498e0dd13e feat(repo-metadata): write a faulted description from the venture's own words (#181)
The reconciler fixed homepages but only reported descriptions, so
bitbaum/bitbaum kept calling itself an "AI-first product studio" behind
FleetCrown — a forbidden claim and a retired name — with nobody able to edit
it. A description that is missing, names a retired form or makes a forbidden
claim is now replaced by whole sentences of that venture's "what" in Loki's
fleet map, the text the studio site already shows, provided the replacement is
itself clean. A description nobody faulted is never touched.

Also: AGENTS.md said the audit runs on every fleet PR; it has been daily since
#179.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 14:17:56 +02:00
CatoandClaude Opus 5.5 9d2af89bdc feat(audits): hold every doc, page and repo page to what is true — and gate new drift in the sweep (#179)
* docs(agents): Loki is the execution plane, not engineering

The plane was renamed 2026-09-20 (orangecat src/config/ecosystem.ts
ECOSYSTEM_PILLARS); this sentence still carried the old label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* feat(audits): hold every doc and every live page to what is true

Agents read README / CLAUDE.md / AGENTS.md / .claude/ before code and act on
them; visitors read pages rendered from components nobody greps. Both drifted
silently: one pass over nine repos on 2026-10-19 found a merge policy said to
live in a repo that no longer holds it, dozens of paths to deleted files,
scripts not in package.json, "Next 15 / TS 5.8 / Tailwind 3.3" in a repo on
16 / 6 / 4, and a retired host presented as production in forty files.

- docs-truth-audit.mjs: holds each repo's docs to its OWN tree — backticked
  paths, relative links, `pnpm run X`, stack majors vs package.json, retired
  names. Never judges prose; a line saying the thing is gone is history.
  Modes: --dir (working tree), --repo, --repo --pr (only what a PR adds),
  --sweep --check (every repo, ratcheted by docs-truth.baseline).
- auto-merge sweep: the docs gate. A PR that ADDS docs drift — including by
  deleting a file a doc still names — is held with one comment per head
  commit naming each line and the fix. Exit 2 (could not look) never holds a
  merge. The sweep is the one workflow every repo calls, so this needs no
  per-repo copy. DOCS_TRUTH=0 opts a repo out.
- live-claims-audit.mjs: fetches every live site in Loki's map (home + the
  pages it links first) and flags retired names/hosts, forbidden claims, a
  past copyright year and dead same-site links. Daily, ratcheted.
- repo-metadata-audit: a GitHub description may not carry a retired name or
  a forbidden claim.
- registers/org.json gains forbiddenClaims; org-drift-audit.sh reads it, so
  the document and served-page gates share one list.
- Workflows docs-truth.yml and live-claims.yml (daily); both test suites run
  per-PR in ci.yml. AGENTS.md states the four gates once; README lists them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* feat(audits): fewer false positives, and homepages follow the register

docs-truth: a removal stated across a line break is history; `cd sub &&
pnpm run x` reads the sub-package; an example path (e.g. …) is not a claim;
a file that describes other repos by design (dotfiles' global CLAUDE.md)
opts its paths out with <!-- docs-truth: paths-elsewhere -->. All four came
from the first cleanup pass over the fleet.

repo-metadata: --fix writes a homepage the register already holds, and
repo-metadata.yml runs it daily with FLEET_PAT before the report — five
homepages were missing or wrong on 2026-10-19 and every fleet PR inherited
the red. Descriptions are prose and stay reported, never written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* feat(docs-truth): a name kept on purpose is marked on its line

<!-- docs-truth: keep — why --> records a deliberate exception (a JWT issuer
that still carries a retired name because changing it signs everyone out)
instead of leaving it as drift the gate cannot tell apart from a mistake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* fix(docs-truth): links in code spans are markup; /file links resolve under public/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* docs(templates): AGENTS.md pointer names the local docs check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

* ci: judge live repo metadata on its own schedule, not per PR

The per-PR --check reads live GitHub state no PR can change; on 2026-10-19 it
was red on every fleet PR over five untouched repos, including the PR adding
the reconciler that repairs them. repo-metadata.yml (daily) fixes homepages
from the register, then reports; the unit test stays per-PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 14:01:23 +02:00
CatoandClaude e821c5058d feat(packages): release a package version from one button, and carry new template files to existing repos (#176)
templates/package gains release.yml: workflow_dispatch with bump
(patch|minor|major) or an exact version. It refuses unless main's CI
finished green on the commit it starts from, raises package.json with
`npm version --no-git-tag-version`, runs the package's own verify
(rebuilding the committed dist/), commits "release vX.Y.Z", tags it,
pushes both atomically with FLEET_PAT (a GITHUB_TOKEN push starts no
workflow, so publish.yml would never fire on the tag), and writes a
GitHub release with generated notes. Loki's package page starts it.

Existing package repos never received files added to the template after
they were created. scripts/packages/sync-package-template.mjs offers each
declared repo the template files it lacks as one non-draft pull request
on fleet/template-sync — never overwriting a file the repo has, never
pushing the same content twice, and never reopening a set a person
closed. package-repos.yml runs it after creation.

create-package-repos.mjs now exports templateFiles()/checkTemplate(), and
both scripts refuse a template missing a required file (release.yml
included). CI checks the template's workflows parse with valid shell and
runs the new self-test.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-14 03:50:07 -07:00
CatoandClaude 011106513d feat(packages): a package repo is created by declaring it (#170)
registers/package-repos.json lists the package repos that must exist. On
merge (and daily as a retry) .github/workflows/package-repos.yml creates
each missing one with FLEET_PAT: it copies the declared source folder,
makes it standalone from templates/package (CI, auto-merge, publish,
Dependabot, licence), runs the package's own verify, and only then creates
bitbaum/<name> and tags v<version>. An existing repo is never touched.

An agent session's GitHub integration may not create org repos, which kept
searchkit inside orangecat's packages/ folder: consumers pinned to commits,
no Dependabot, every release hand-edited into five lockfiles. The first
declaration is searchkit.

The self-test pins the refusals (bad names, a path that escapes its repo,
a package with no verify or no version) and that existing repos are never
targets. Rehearsed locally: the standalone searchkit installs, passes its
own 32 tests, and builds a byte-identical dist/.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-14 01:17:27 -07:00
CatoandClaude 131bac3475 templates/app: the one starter every new product is created from (#165)
A complete, tested Next.js 16 app — next-intl (en/de/fr, localePrefix
"always", parity test, Swiss spelling), better-auth accounts on Drizzle + pg
(email+password with verification, magic link via mail-kit, passkeys, TOTP
2FA, the shared bitbaum sign-in and OrangeCat as env-gated OIDC with
client_secret_post + PKCE, roles in the app's own users table), nonce CSP with
strict-dynamic and connect-src 'self', limitkit on every auth path keyed on the
proxy's hop, secrets sealed with ai-kit seal, ai-kit complete() example route,
own-model settings, bip-kit roadmap/changelog, /api/health asserting the app
can read its own tables, and CI/deploy/live-check/CodeQL/gitleaks/audit
workflows.

scripts/templates/render-app.sh fills the placeholders;
scripts/templates/test-app-template.sh holds the render to the fleet's own
judges (version-currency gapsFor, verify-floor predicates, cicd-hygiene audit)
on every PR, and the new app-template CI job installs it, runs verify and
drives sign-up/sign-in against a real Postgres.

STACK.md records the owner's 2026-10-11 sign-in decision: every app owns its
accounts and offers every method; it supersedes the 2026-09-11 federate-only
rule. SHARED.md and README point new products at templates/app. The
duplication ratchet skips the starter itself (the one canonical copy).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 12:49:22 -07:00
Claude 81f5d25b71 name-check: is a name free as .com and .ch, asked of the registries
Every new project starts with a name, and the check was redone by hand each
time. RDAP from a runner, with a nonsense control name so a registry outage
cannot read as 'everything is taken'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EJFFkKhmaVnnH8E3mHnaZ
2026-10-11 20:42:26 +02:00
CatoandClaude Opus 5.5 672b0e32c5 revert(auth): remove the OrangeCat-only sign-in gate — it enforced the wrong rule (#156)
fleet#139 shipped a daily check that treated every sign-in method other
than OrangeCat on our own products as a deviation, built from STACK.md's
2026-09-01 row. George's actual requirement (2026-10-02): every app offers
working sign-up and sign-in with email + password, Google, GitHub, X,
Facebook/Meta AND OrangeCat. The gate would have raised a Telegram alert
the moment an app ADDED Google or GitHub — fighting exactly what he wants.

Removed: the audit, its baseline, its self-test, both workflow steps, the
SHARED.md row. The origin audit in the same workflow is untouched and
its alert text is back to describing only itself.

STACK.md's auth row no longer claims enforcement and records the new
requirement as under revision; the mechanism (methods hosted once at
OrangeCat, or per app) is George's call and is being decided.

check-workflows: 26 workflows parse; origin self-test passes.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 09:04:05 -07:00
CatoandClaude Opus 5.5 792c2d2731 ci(auth): own products may only sign in via OrangeCat — enforced, not just written (#139)
STACK.md decided on 2026-09-01 that our own products federate to
OrangeCat and keep no users, passwords or reset flows. The rule lived in
prose, and prose does not stop drift. Measured 2026-09-24 from each
product's live /api/auth/providers:

  loki            OrangeCat + email-password, github, google, local,
                  user-password, x-1a  (seven ways in)
  datacat         + credentials
  evig            + credentials
  petvity         + credentials, google
  surf-your-life  + credentials, google
  solon, heidi, substrata   OrangeCat only

Each extra path is a second identity for the same person, a second reset
flow to secure, and a second place for a sign-out to miss.

own-product-signin-audit.mjs reads the same public endpoint the origin
audit already probes, so it judges what is DEPLOYED — no source parsing,
no secret, no quota. Who counts as ours comes from loki's /api/fleet/map
(owner = org, live, not a demo, not OrangeCat itself). The first draft
read apps.conf and could not see Loki at all: apps.conf omits the
handcrafted services, which is the same reason product-identity-audit
moved to the map. Client apps are never judged — their users belong to
the client, and STACK.md gives them their own auth.

Today's deviations are a RATCHET (own-product-signin.baseline):
- HELD rows print on every run, never read as a pass;
- a NEW provider fails even beside a baselined one;
- a baselined provider that is gone fails until its row is deleted;
- a row for something no longer an own product fails too.

Non-next-auth products SKIP and say this check cannot see them (today:
revamp-info, wild-spirit) — a stated blind spot, not a pass. A 5xx SKIPs
here because nextauth-origin-audit already fails it; paging twice for one
fault teaches people to ignore one of the two.

Runs daily as two steps in nextauth-origin.yml (if: !cancelled(), so a
red origin audit cannot hide it); its self-test also runs in ci.yml.
The Telegram alert text now names both findings.

Self-test: 17 checks, no network. Proved by mutation — tolerating every
extra provider turns three of them red. check-workflows.sh: 25 workflows
parse, 105 run blocks are shell.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 04:58:46 -07:00
CatoandClaude Opus 5.5 621878300b feat(ci): render sweep — painted layout defects on every live site, ratcheted (#147)
* feat(ci): render sweep - painted layout defects on every live site, ratcheted

scripts/ci/render-sweep.mjs renders home + key pages of every served site
(loki apps.conf + extraSites; pages in render-sweep.pages.json) at
390/834/1440 and counts per site: nav contract rules 3/7/8 (reusing
ui-defect-audit's MEASURE - openButtonMenus is now exported for it),
other controls crossing the viewport, fixed/sticky controls on top of each
other (incl. the Loki launcher, clip-aware), empty headings and orphan caps
labels, numbers split across lines in cells/stats, and uncaught page errors
(console errors counted, not ratcheted). Markdown + JSON report.

render-sweep.baseline is a ratchet (site x check may fall, never rise),
seeded from the first full run 2026-09-25 with substrata at 0 after
bitbaum/substrata#112. Public GET pages only: DENY refuses
api/admin/auth/cron/job paths before any request; auth walls are reported
as not measured. No AI calls.

test-render-sweep.mjs pins every check firing AND silent (48 assertions);
each core condition was mutated out and failed its fixture. It runs before
the sweep in render-sweep.yml (weekly + dispatch). SHARED.md: new section
with the sweep and the widget's host contract.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* ci(org-drift): baseline bip-kit README's link to Solon (a reference, not a door claim)

bip-kit#40 (merged 14:57 today) links https://solon.orangecat.ch as where
bitbaum products take votes; the door check reads any README mention of
another app's host as a claim to be it, which turned fleet main's CI red
for every open PR. Baselined with the reason, per the audit's own
instruction.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

---------

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 09:36:05 -07:00
CatoandClaude Opus 5.5 809e2bae03 fix(sweep): reconcile against the LIVE commit, not a run label (opt-in) (#145)
GitHub labels a workflow_run-triggered run with the default branch's
CURRENT tip. On loki 2026-09-25, Deploy run 36135832127 shipped f2f6206
(the box served it) but its headSha read 4622869 (#913, merged
meanwhile). The reconciler read that label as the truth, believed
4622869 was live and never dispatched: merged-but-not-live, invisible to
the one mechanism meant to catch it.

New optional LIVE_COMMIT_URL (reusable input live_commit_url): a URL
answering JSON with a 40-char `commit`. When set, the reconciler compares
the base tip against that. Missing, malformed or unreachable is UNKNOWN,
treated as not deployed: dispatch, still behind the in-flight and
green-base guards. Unset keeps the run-label behaviour exactly. The
source used is logged (live vs last run label).

Tests: 7 new sweep cases (live == tip, the incident, unreachable, short
sha, unknown + in-flight, unknown + red base, unset). Mutation: making the
live branch read the label's value fails 4 of them, the incident included.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 05:54:07 -07:00
CatoandClaude Opus 5.5 31de29870b fix(scripts): grep -q is never the reader of a pipe under pipefail (#140)
* fix(scripts): grep -q is never the reader of a pipe under pipefail

`echo "$x" | grep -q PAT` under `set -o pipefail` can report "not found"
for text that IS there: grep -q exits on its first match and closes the
pipe, the writer takes SIGPIPE (141), and pipefail makes the pipeline
status 141, so an `if` takes the else branch on a successful match.

It is not confined to payloads past the ~4KB pipe buffer. Measured in
loki (loki#874) on a real 1,158-byte output, 3,000 calls: 2/3000 false
misses for a phrase near the top, 0/3000 via a here-string. Rare per
call; a suite makes hundreds. loki's retire-site suite went red on
exactly those phrases twice this week.

48 copies in 14 scripts here, rewritten to `grep -q PAT <<<"$x"`,
including:
- auto-merge-sweep.sh: the required-check coverage test. A false miss
  marks a green job "uncovered".
- gc-merged-worktrees.sh: `in_use`. A false miss reads a live session's
  worktree as unused. The pushed / clean / MERGED guards still stand, so
  it cannot lose work, but it can remove a directory from under a live
  session.
- cicd-hygiene, nav-contract, org-drift, verify-floor audits and
  verify-predicates: false passes and false findings.

Checked: all 14 files pass `bash -n`; every file is a 1:1 line swap (48
lines); the 8 line-continuation sites keep the here-string before the
trailing backslash; fleet's 30 CI test scripts pass before and after
(30/30 -> 30/30); workflows still parse.

Gate: scripts/ci/test-no-grep-q-in-a-pipe.sh, wired into ci.yml. Scans
scripts/ and templates/, self-tests its detector both ways, and was
proven by restoring the original auto-merge-sweep.sh line.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* fix(ci): main was red on a ratchet that fell, and a sweep test lied

Two failures on fleet main that were blocking every PR, including this
one. Neither was caused by the grep -q rewrite: main (7ed94a2, the base
of this branch) failed CI on the same step for the same reason.

1. org-drift ratchet fell. `org-drift-audit.sh --check` failed on main
   since c43464d with "baseline entries with no matching violation - the
   ratchet fell: bitbaum/README.md". Good news: someone fixed that drift.
   Nobody lowered the baseline, so main stayed red and the auto-merge
   sweep refused everything. Line removed; --check now passes (44 repos
   swept, 3 known violations, no new contradictions).

2. test-auto-merge-sweep.sh lied. Its verdict `[ "$FAIL" -eq 0 ]` sat at
   line 400 of 473, with ~70 lines of tests appended after it. A bash
   script exits with its LAST command's status, so the verdict was
   discarded: the suite exited 0 while printing "27 passed, 1 failed",
   and its later tests were not even counted. Verdict moved to the end;
   the suite now counts 38.

   The hidden failure was real and was mine: test 13 asserted the sweep
   always "waits for CI to catch up" when the newest base run is for an
   older commit. The deadlock fix changed that - it waits only while a
   run is in flight, and otherwise dispatches CI. Test 13 now asserts
   both cases (13a waits and dispatches nothing; 13b dispatches and does
   not merge). `rearms()` moved above its first use.

Proven by mutation: an injected late failure now fails the suite;
reverting the sweep to always-wait fails 13b; making it never wait fails
13a.

Gate: scripts/ci/test-verdict-is-last.sh, wired into ci.yml, requires
every suite's verdict to be its file's last command. Proven by restoring
the old mid-file verdict. All 34 fleet CI commands are now green, and
none exits 0 while reporting a failure.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

---------

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 11:58:34 -07:00
Cato 496f4265f9 fix(currency): update nested pnpm lockfiles (#138)
* fix(currency): rely on PR CI instead of pre-push hooks

* fix(currency): update nested pnpm lockfiles
2026-09-23 16:53:03 -07:00
Cato 62f3bf4951 fix(currency): rely on PR CI instead of pre-push hooks (#137) 2026-09-23 16:48:59 -07:00