4 Commits
Author SHA1 Message Date
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
CatoandClaude Opus 5 144855dea6 chore(aoz): rename the repo to aoz-begleitung, and record why (#94)
* chore(aoz): rename the repo to aoz-begleitung, and record why

`bitbaum/aoz-housing` is now `bitbaum/aoz-begleitung`. It was the last public
place the product was still called Housing: registers/retired.json retired "AOZ
Housing" as the PRODUCT name on 2026-09-10, but the repo kept it, and the repo
is PUBLIC — so the retired name sat on the org page, in every clone URL, and in
~55 references across this repo alone.

The deploy name `aoz-wohnen` is deliberately NOT renamed with it, and that is the
decision, not an omission. It is an infrastructure identifier — systemd unit,
/opt path, database — and nothing on the box keys on the repo name; renaming it
would touch a live site for no visible gain. Two names now instead of three.

The registers are DERIVED and were regenerated, not hand-edited:
origin.json (aoz's `stamped` and `swh` drop to null, correctly and temporarily —
Software Heritage archived the old origin URL and the OpenTimestamps manifest
names the old repo; the nightly origin-proof re-stamps) and packages.json.

proofs/origin/*.json are untouched on purpose. They are hash-chained and
append-only, so a past proof naming bitbaum/aoz-housing is correct history;
rewriting one would both falsify the record and break the chain.

retired.json gains the `repo` row, which is what makes the old name traceable —
and what makes org-drift-audit.sh start flagging documents that still use it.
Three were flagged: this repo's AGENTS.md (fixed here), the renamed repo's
README (fixed in aoz-begleitung#243) and its CLAUDE.md, which is BASELINED with
a reason rather than fixed: `JWT_ISSUER` is still the literal string
`aoz-housing` and must stay so — src/proxy.ts and src/lib/auth/config.ts pass it
as the JWT issuer, and changing it invalidates every live session. A live auth
value, not a name.

Verified across the rename: bitbaum/aoz-housing redirects to the new repo,
https://aoz.orangecat.ch still 200, aoz-wohnen-app still active, and the new
clone URL resolves to 431bae7 — the same tip as before.

Tests green: deploy-freshness 24, deploy-reconciler 34, repo-metadata 17,
model-pin, version-currency, product-identity 45, verify-predicates 29.

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

* chore(aoz): defer the retired-name row until the docs it polices have landed

org-drift-audit.sh reads the org's DEFAULT BRANCHES, not the working tree. So
adding the `aoz-housing -> aoz-begleitung` row to retired.json in the same PR
that fixes AGENTS.md is a deadlock by construction: the audit judges main, where
AGENTS.md is still unfixed, so `--check` fails — and the fix cannot merge while
it fails.

The row is a POST-condition, not a co-requisite. Fix the documents first, let
them reach the default branches, then declare the name retired and let the audit
hold the line from there. The row returns in its own PR once this and loki#732
are on main.

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

* chore(aoz): the baseline exception belongs with the row that creates it

Same sequencing lesson, mirrored. Without the retired-name row nothing flags
aoz-begleitung/CLAUDE.md, so a baseline entry for it matches no violation — and
org-drift rejects that correctly: "baseline entries with no matching violation —
the ratchet fell". A baseline full of entries that match nothing is a ratchet
that cannot fall, which the file's own header already says.

So the row and its one exception land together, in the PR after this one.

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-15 06:37:48 -07:00
CatoandClaude Fable 5.1 231ad50706 chore: rename FleetCrown to Loki (#65)
The product was renamed on 2026-09-14: bitbaum/loki, loki.orangecat.ch,
LOKI_* env keys, loki-* units. This repo referenced the old name in
38 files changed, 119 insertions(+), 119 deletions(-).
Email addresses at the old sending domain stay until the new domain is
verified in Resend.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:23:38 -07:00
Mao NakamotoandClaude Opus 5 f1d5549a36 feat: the fleet's central automation, moved out of dotfiles
The audits, the golden CI templates, the shared-package registry and the
reusable auto-merge sweep now live in a repo whose only job is gating the
fleet. dotfiles goes back to being the environment — a repo holding a .bashrc
is the wrong place for machinery that 16 repos call as a reusable workflow,
and keeping them together made every fleet change look like an environment
change and vice versa (three sessions and the owner collided there in one
week).

Layout is unchanged (SHARED.md, scripts/{ci,fleet,audit}, templates/ci,
.github/workflows), so every script's relative paths still hold. The
reusable sweep now checks out bitbaum/fleet; dotfiles keeps a forwarding
shim so its 16 existing callers keep working unchanged.

All six test suites pass in the new location: shared-inventory 7,
verify-predicates 29, auto-merge-sweep 17, stranded-work 24, worktree-gc 9,
model-pin-audit 102.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZCNYHwjEeqxNpYCUk6Yna
2026-08-28 10:10:21 +02:00