This repo shipped its own scripts/ci/auto-merge-sweep.sh: 297 lines against the
canonical's 446, differing on 149. Every fix that landed in bitbaum/fleet since
the copy was taken reached here never — which is the whole reason SHARED.md
tracks this duplication as a ratchet rather than as advice.
Auto-merge did not appear broken, and that is the point: a sweep merges what it
can and exits 0, so a copy missing a third of the canonical looks exactly like a
working one until the missing third is what you needed.
The concrete gain is the DEPLOY RECONCILER. The old copy listed deploy.yml in
REARM_WORKFLOWS, which dispatches it once and cannot tell whether the deploy
actually landed. The canonical compares main's tip against the last successful
deploy and re-dispatches when they differ, so a deploy that never fired — or
fired and failed — is retried on the next sweep instead of leaving a commit
merged-but-not-live. That failure is invisible without it: CI green, PR merged,
box unchanged.
Also gained: checks:read + statuses:read on the caller. Public repos do not need
them, so their absence is silent here — but the caller is now identical to every
other repo's, which is what makes the next fix a one-file change.
What stays local is only what genuinely varies: the workflow_run trigger must
name the CI workflow exactly as its own `name:` field spells it, and the
schedule. Everything else is inputs.
Verified: the generated YAML parses, resolves to
bitbaum/fleet/.github/workflows/auto-merge-sweep.yml@main, and passes
base_branch / ci_workflow / rearm_workflows / deploy_workflow — all four
confirmed against the reusable workflow's declared inputs. No file outside the
workflow still references the removed script.
NOTE: this PR touches .github/workflows, which GITHUB_TOKEN cannot merge, and
scheduled sweeps read the workflow from the default branch. It needs one
hand-merge; after that the sweep here is the shared one.
Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* chore: add a formatter, matching the style this repo already writes
singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.
Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* style: format with prettier (252 files)
Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: teach git blame to skip the reformat
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The account was renamed to `catomean` and the repos then moved to the
`bitbaum` org, so `maonakamoto` now names nothing: github.com/maonakamoto
and maonakamoto.github.io both return 404, and @maonakamoto no longer
resolves as a user.
Three different targets, because these are not the same reference:
repo links -> bitbaum/<repo> (the repos live in the org)
the person -> catomean (profile links, @mentions, CODEOWNERS)
pages site -> bitbaum.github.io
Deliberately NOT changed:
.mailmap keeps the old noreply address as an ALIAS. It is what maps
historical commits onto the current identity; deleting it would
silently unmap them. Only the canonical side moved to catomean.
Files that explain the outage by naming the old account keep it,
since the name is the content.
Files: .github/workflows/deploy.yml, .mailmap, scripts/ci/auto-merge-sweep.sh
Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The public storefront was a brochure. It shipped a Product/Offer JSON-LD so
search engines treat it as purchasable, then the only buy path was
"Sign up to buy" -> /register?returnTo=/portal/shop, which both forced
registration before a first purchase and dropped the product the visitor came
for. Cold traffic could not buy anything.
A visitor can now add to cart on the catalogue and the product page, check out
in one page with an email and an address, and read their order back from a
receipt link. No account anywhere in that path.
orders.userId becomes nullable, alongside guestEmail and an unguessable
publicToken. A CHECK constraint enforces exactly one of userId / guestEmail,
because an order with no reachable buyer cannot be repaired after the fact.
The token is the guest's only handle on their order: it is emailed, never
listed, and authorises resuming payment and cancelling while pending.
Order placement moves to placeOrder() in lib/domain/orders.ts so the authed
cart and the guest checkout share one implementation -- the stock reservation
and its compensation must not exist twice. setOrderStatus() joins it for the
same reason: a cancellation that forgot to restore stock destroys inventory,
and that happens when one route remembers and another does not.
Two joins were fixed before any UI existed. app/api/orders/seller and
app/api/admin/orders inner-joined users on orders.userId; with a nullable
column that drops every guest order from the views of the people who have to
ship them -- real revenue, invisible, nothing appearing broken. Both are now
leftJoin + COALESCE onto the address the buyer typed.
Also fixed while reviewing:
- toLocale() used `value in LOCALE_CONFIG`, true for inherited keys like
"constructor", and the result goes straight into a URL path.
- orderShippingSchema accepted any two letters as a country, so "XX" could be
stored and printed on an undeliverable label. Checked against a new ISO-3166
SSOT whose names come from Intl.DisplayNames, so all nine locales are
translated with no message files to maintain.
- Guest input (shippingName, notes) reaches a seller's inbox unauthenticated;
email templates now escape it.
Guards, not just fixes: locale parity across all nine message files is now a
test rather than a convention, and the prod walkthrough places a real guest
order and asserts the seller can see the buyer's email -- the check that goes
red if anyone reintroduces an inner join there.
The public endpoints are deliberately outside PRIVATE_API_PREFIXES; a session
guard there would silently delete the feature. They are rate limited per
client, and the payment and cancel routes require the order token.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Publishing meant editing a TypeScript array in lib/content/blog.ts, opening a
PR, and waiting for a deploy. That is not a blog anyone will actually write in —
and it made every post a developer task. There was exactly one post.
Posts now live in the database, written and published at /admin/blog. A post
goes live the moment it is published; nothing is rebuilt or redeployed.
Authoring markup is a deliberately tiny subset of Markdown:
## Subheading
- bullet
anything else is a paragraph
No Markdown dependency. A full parser would buy inline HTML we would then have
to sanitise — an XSS surface in exchange for syntax nobody asked for. Parsing
to the closed block set the post page already styles means untrusted text can
never become markup, which a test pins with a <script> tag rendering as literal
text. The editor previews the parsed blocks live, so a mistyped bullet is
visible before publishing rather than after.
Body is stored as written and parsed at render, so the author's source stays
the single truth and the renderer can improve without a data migration.
Publish dates are stamped once, on the first publish, and preserved after that.
Unpublishing to fix a typo and publishing again must not silently re-date the
post and reshuffle the index — tested in both directions.
Drafts 404 publicly rather than merely being unlisted, so guessing a slug does
not reveal unpublished writing.
The migration carries the existing post across. Its URL
(/[locale]/blog/a-platform-for-both-sides-of-pet-care) is already public, so
losing the row would 404 an indexed page; the insert is dollar-quoted for the
apostrophes and ON CONFLICT DO NOTHING so it is safe to re-run.
Deleting is a two-step inline confirm rather than a confirm() dialog: deleting a
published post breaks its URL, and a browser dialog is both easy to click
through and impossible to drive from a test.
Both public pages are force-dynamic — content that an editor changes must not be
frozen into the build.
The walkthrough now fetches a real post and asserts its prose, which exercises
the table, the content migration and the renderer together. It fetches the body
itself rather than reading $LAST_BODY, which page() never sets — asserting on it
would have grepped whatever the previous request happened to leave behind.
27 new tests; pnpm verify green (678 tests / 75 files).
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
next/font/google downloaded the faces from fonts.gstatic.com **at build time**,
which put a third party on the critical path of every CI run and every deploy.
It failed twice in one week — module-not-found on the generated @font-face for
Jost — blocking a merge each time, both on changes that had nothing to do with
typography. A build that only succeeds when Google is reachable cannot be
trusted to ship an urgent fix, and re-running until it passes is not a fix.
The four .woff2 files are now vendored in lib/font-files/ and declared with
next/font/local. 82 KB total, which also removes a render-blocking third-party
connection for every visitor.
Only the `latin` subset is vendored, matching the previous `subsets: ["latin"]`
exactly — ja/zh/ko/ar and the Turkish latin-ext glyphs fell back to system
faces before and still do. Plus Jakarta Sans (400–800) and Jost (200–400) are
variable fonts, so each is a single file; IBM Plex Mono ships no variable axis
and keeps its two static weights.
scripts/fetch-fonts.mjs regenerates the files and documents where they came
from. It is deliberately NOT wired into the build — doing so would reintroduce
the exact network dependency this removes.
Verified rendering is unchanged, not merely similar: measured actual glyph
advance widths with a Range over the live hero text on prod (Google-hosted) and
on the local build (self-hosted). Identical to three decimals — h1 669.688px,
eyebrow 222.641px — and the screenshots are pixel-identical. The emitted
@font-face URLs are now local ../media/*.woff2 with no gstatic reference in the
build output.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Both checks grepped the shared literal "E2E Clinic", so they read whatever any
other run had left in Zurich rather than their own row.
It went red for real: a walkthrough interrupted mid-run left a *complete* vet
profile behind, and the next run's "incomplete vet stays unlisted" check found
that stranger's clinic in the browse response and reported the readiness gate
broken. The gate was fine — the assertion was looking at someone else's data.
The same literal made the positive check worse than useless in the other
direction: "vet visible in browse" would have passed on a leftover row even if
this run's vet had never been listed at all. A gate that can go green for the
wrong reason is not a gate.
The clinic name now carries the run stamp, so both assertions can only match
the row this run created. Verified against prod: 171/171, exit 0.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Found by the render checks added in #40, on their first run against prod:
/portal/pets/[id]/edit answered 200 and painted no heading at all — just a
centred "Loading…" line, no title, no way back, no indication of which pet was
about to be edited.
Same shape as the blank /portal/settings in #37, and it is the third time this
class has shipped, so this fixes the rest of it rather than the one instance.
A client page server-renders with its data still empty; a header placed inside
the loaded branch is therefore absent from the first paint entirely. Vaccinations,
medications and records all stood their heading in with grey blocks for the same
reason.
The heading on these pages does not depend on the fetch, so it now renders
immediately and only the data below it waits. Where the header's action needs
the rows (the search box and add button), that part still appears with the data
- it is the title, the purpose line and the way back that had no reason to wait.
Deliberately not changed: /portal/adopt/[id] and
/portal/pets/[id]/list-for-adoption title themselves with the fetched pet's
name. There is no honest heading to show before the fetch, so a skeleton is
correct there, and the walkthrough comment records why they are excluded rather
than leaving them looking overlooked.
The walkthrough now covers all eight statically-titled pages for both a title
and a purpose line.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The header sweep missed the nested pages. Check-in, add-pet, edit-pet, health
and health-log still hand-rolled their own <h1>, and had drifted apart exactly
the way the sweep was meant to stop: font-bold vs font-semibold, mb-1 vs mb-2
vs mb-6, three spellings of the same back link. Two of them never said what
they were for at all.
All five now use PageHeader. Add-pet and health-log already had a subtitle, so
those are structural only; check-in, edit-pet and health needed a purpose line,
added in all nine locales.
The dashboard read "All 1 pets checked in today" for anyone with one pet — the
common case for a new owner, and the first sentence the demo shows. The string
had no plural form. Now pluralised via ICU for the six languages with
grammatical number; ja/zh/ko keep a single form, which is how every other count
string in those files is already written.
While fixing it, the same sentence turned out to exist twice — checkinAllDone /
checkinProgress on the check-in page and allCheckedIn / partialCheckedIn on the
dashboard, identical in meaning and already drifted in wording ("{done} /
{total}" vs "{done} of {total}"). Fixing the plural in one would have left the
other wrong, so the pair is consolidated onto the better-worded one and the
duplicates are deleted from all nine locales.
Verified the ICU by parsing every message in every locale (13914 messages, 0
malformed) and by formatting allCheckedIn at n=1 and n=3 in all six pluralised
languages. The walkthrough now covers all five pages for both a title and a
purpose line, so "every page opens the same way" is checked rather than assumed.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Clicking "Sign out" sent every user to https://localhost:4013/login. The
session was cleared, but the page they landed on did not exist.
Auth.js's Next adapter rewrites the request origin in reqWithEnvURL(), which
is a no-op unless AUTH_URL/NEXTAUTH_URL is set. Without it, relative redirects
resolve against req.nextUrl.origin - in a standalone server behind Caddy that
is localhost:$PORT. AUTH_TRUST_HOST=true was already set and does not cover
this path, which is what made it look configured. Reproduced against the app
directly with a correct Host and X-Forwarded-Host, so it was never a proxy
header problem.
Fixed on the box by pinning AUTH_URL in /opt/petvity/shared/.env (app/.env is
a symlink to it, so the value survives deploys). Verified: the signout endpoint
now answers https://petvity.orangecat.ch/login, and all six role logins still
work.
Since the value lives in the environment rather than the repo, the guard is
what keeps it fixed: the walkthrough now asserts the sign-out redirect is on
the public origin, so a rebuilt box fails the check instead of shipping a dead
link. Documented as gotcha 9, alongside gotcha 10 for the pinned demo id.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The demo account is the no-account way into the product. Its reset deletes
the user row so the FK graph cascades away whatever a visitor touched, then
inserts it again — but the insert let the id be generated, so every run minted
a NEW identity.
Sessions last 30 days. The reset runs every 2 hours. So within at most two
hours of signing in, a demo visitor was holding a session for a user that no
longer existed: every owner-scoped query returned nothing and the demo read as
an empty product, while writes failed the owner FK outright. Observed live —
two consecutive resets produced 8ffb17c5... then dab16518..., and a session
minted one minute before a reset was already dead.
Pinning the id keeps the cascade (still a real wipe) while letting the identity
survive it, so any session ever issued stays valid.
The demo had no test coverage at all, which is how this went unnoticed:
- a route test asserts the reseed carries the pinned id (it fails if the id
goes back to being generated - verified by reverting the fix)
- the prod walkthrough gains a demo section: the session id is the pinned one
(the mechanism), and the demo actually has its seeded pet (the symptom).
The symptom check alone is timing-dependent - it passes right after a reset
either way - so both are needed.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
/portal/settings is a client component that read the session with
useSession() and returned null for the entire page until it arrived. Server
rendering therefore produced an empty page: a person clicking Settings saw
nothing at all, with no title, no explanation, and no sign anything was
loading. It is the only portal page that did this — the others resolve the
session on the server.
The header is static, so it now renders immediately and only the account
cards wait, as two skeleton cards marked aria-busy.
A status code cannot see this failure — the page answered 200 the whole
time — so the walkthrough gains a section that asserts the header vocabulary
is actually present in the HTML of eleven portal pages, not merely that they
respond.
Also fixes the test suite double-counting itself. `next build` copies the
whole project into .next/standalone/, test files included, and vitest's
default excludes do not cover .next — so running the suite after a build
collected every test twice and the totals depended on whether you had built
first. That is where the "1220 tests / 137 files" figure in the last two PR
descriptions came from; the real suite is 614 tests across 69 files, and it
was passing under both readings. CI runs verify before build on a fresh
checkout, so it always saw the true number.
Verified: lint clean · tsc --noEmit exit 0 · 614/614 tests across 69 files.
The readiness checklist required `isAcceptingClients` before calling a profile
live, but the directory queries treat it as an optional filter — a professional
who was temporarily full appeared in search results while their own dashboard
told them they were invisible. The directory behaviour is the correct one: a
full pro is worth showing, badged as not accepting, so owners can find them and
come back. The checklist now matches, and the dead `readyStep_accepting` string
is removed from all nine locales.
The production walkthrough caught this: it created professionals with partial
profiles and asserted they were browsable, which the gate correctly refused.
It now completes each profile before expecting a listing, and — more usefully —
asserts the negative first: an incomplete vet must NOT appear in browse. That
turns the readiness gate itself into a permanent regression check rather than
something only asserted in unit tests.
135/135 checks pass against production.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Three things made the marketplace a demo rather than a business.
1. Orders had no delivery address. A seller could receive an order and have
nowhere to send it. Orders now carry a required address (migration 0004,
additive); the API rejects an order without one, and both the seller and
admin order views expose it so fulfilment is actually possible.
2. The directory was populated by five invented businesses. Dr. Brunner,
Sam Keller, Nadia Roth, Pfoten & Co. and Tierheim Sonnenhof do not exist —
a customer in Zurich searching for a groomer would have found a fiction.
They are removed from lib/config/resident-pet.ts, and ensureCommunity is
gone from the resident-checkin cron so nothing recreates them.
3. Nothing replaced them. lib/domain/profile-readiness.ts is now the single
rule for when a professional or seller is real enough to be listed:
identity, services, price, location, a 40-character intro, contact, and
the pro's own "accepting clients" switch. The same predicate drives the
ProfileReadiness checklist the pro sees and the SQL conditions the public
directory queries use — so the listing is earned, never hand-curated.
Selling was already open to any account (products.sellerId = userId) but was
undiscoverable; /portal/become-a-pro now says so and links to the store setup,
which shows the seller's own readiness checklist including "list your first
product".
Also: deleting a pet was reachable only by guessing it lived inside the edit
form — the pet profile now links straight to the danger zone. Professionals
could not accept a booking from /portal/bookings, and groomers were missing
from the booking role union entirely.
E2E gains two checks: an order without an address must be rejected, and the
seller must be able to see where to ship.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* fix(orders): cancelled orders restore stock; sellers can delete their account
Found by an exhaustive 129-check production walkthrough of every user path:
1. Cancelling an order never released the stock it reserved at creation —
every cancellation permanently destroyed inventory. Cancellation (user
or admin) now restores stock for finite-stock items, guarded against
double-restore.
2. A seller who had ever sold anything could not delete their account
(GDPR erasure 500'd): order_items.product_id was ON DELETE RESTRICT.
Order items now snapshot the product NAME at purchase time (they
already snapshot price), product_id is nullable ON DELETE SET NULL,
and all order reads use the snapshot — the buyer's order history
survives the seller's erasure intact. Migration backfills existing
rows from the products table.
verify + build green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(e2e): permanent full-path production walkthrough (129 checks)
bash scripts/e2e-walkthrough.sh [base-url] — registers throwaway users for
every persona (owner, vet, sitter, groomer, seller, adopter), walks every
feature lifecycle end to end with assertions, and deletes all of its
accounts via the GDPR endpoint. Zero residue, safe to run against prod.
This is the check that caught the stock-leak and seller-deletion bugs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
PR #20 removed the editorial tokens (--gold*, --cream*, .section-warm-dark,
.section-cream) but only reskinned the marketing pages — all 6 (auth) pages
and 4 (public) pages still referenced them and rendered with unresolved
var() styling. Repaired and hardened:
- (auth) layout: brand panel re-expressed on the obsidian/champagne surface
(the same language visitors arrive from), form panel on the light product
surface; all 6 auth pages now use only live tokens
- (public) shop/adopt/pets/pros pages swept to live tokens
- New verify gate scripts/ci/check-css-vars.mjs: any var(--x) referenced in
app/, components/, lib/ that globals.css doesn't define fails the build —
this class of regression can't ship again (2nd occurrence; never-twice)
- DRY/SSOT: .form-label replaces 86 identical label-class repeats across 19
files; .link-accent replaces repeated link styling; register role labels
derive from USER_ROLE_CONFIG; password hint derives from
PASSWORD_MIN_LENGTH; POST_LOGIN_PATH centralized in lib/config/auth.ts
(login, demo, proxy, email templates); Terms/Privacy now link to the
actual legal pages
- Settings: display-name field no longer renders empty when the session
loads after mount (profile editing bug found in browser testing)
- Root layout <html> now carries dir="ltr" — fixes the hydration attribute
mismatch with the [locale] layout's dir
- .gitignore no longer hides scripts/ (verify depends on scripts/ci/)
Browser-verified on desktop (1280px) and mobile (390px): login (credentials
+ demo), registration end-to-end, forgot/reset password, profile edit save,
sign-out, marketing nav megamenu + mobile drawer, footer, portal sidebar +
bottom tabs. verify green: lint + typecheck + css-gate + 1181 tests; build
green.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
`gh pr list` returns newest-first, and the sweep merges the first eligible PR
then stops. So the newest green PR wins every sweep, and an older one can wait
indefinitely.
Observed in maonakamoto/fleetcrown on 2026-08-06: two consecutive sweeps merged
the two newest PRs while three older green ones sat untouched and were never
even evaluated. With several agent sessions opening PRs continuously that is
starvation — and it starves the worst candidate, since the longest-waiting PR
is the one whose checks were proven against the most now-stale base.
PR numbers increase monotonically with creation, so sorting ascending is FIFO.
The ordering was never a decision, just whatever gh happened to return.
Fixed upstream first (fleetcrown #182) and verified in production there: the
sweep immediately after it landed correctly took the oldest open PR rather than
the newest. This is that one-line change, applied to the fleet.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* ci: add the auto-merge sweep policy
* ci: green PRs merge and deploy themselves
* ci: allow deploy to be dispatched so an automated merge still ships