Commit Graph
26 Commits
Author SHA1 Message Date
CatoandClaude 2d3609c13e feat(auth): stage AccountKit beside Auth.js, switch off (#156)
Petvity moves from Auth.js to @bitbaum/accountkit one reversible step at a
time, as evig and kivvi do. Nothing changes while AUTH_RUNTIME is unset.

- Migration 0008: AccountKit's tables under an `auth_` prefix, plus the
  users <-> auth_users mirror functions, inert until attached.
- scripts/db/accountkit-import.sql: accounts under their own ids, bcrypt
  hashes byte for byte, verification kept, orangecat_sub as an `orangecat`
  account row; refuses collisions, drift or a live shared runtime, then
  attaches the triggers. The rehearsal CLI always rolls back.
- lib/auth/shared/: the runtime (ids: 'uuid', legacy bcrypt, AccountKit
  0.16.0), a session reader re-read from `users` on every request, a bridge
  that answers next-auth/react including "Sign in with OrangeCat", and a
  Petvity row for a person AccountKit creates itself. AccountKit's own
  credential endpoints stay closed; Petvity's writers stay the only ones.
- lib/auth/claims.ts: the ADMIN_EMAILS promotion rule, written once.
- The proxy has one routing function and two session sources.
- browser-smoke.yml runs the account journey once per runtime; the
  AccountKit leg first runs the rehearsal and the real-database journeys.

docs/ACCOUNTKIT-MIGRATION.md records what is left before switching.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 08:31:55 +01:00
CatoandClaude 5664c79595 fix(db): commit the 0000 baseline and build browser-smoke from migrations (#147)
drizzle/0000_pretty_cammi.sql was in the journal but never committed, and
the objects between it and 0001 (adoption, seller profiles, signal history,
16 indexes) were reconciled with db:push, so the chain could not build an
empty database. The baseline is generated from 0001's snapshot minus what
0001 itself adds, and 0000_snapshot.json now records that state, so every
step's snapshot diff matches its SQL.

Every baseline statement is guarded (CREATE TABLE/INDEX IF NOT EXISTS,
CREATE TYPE and foreign keys in a block that ignores duplicate_object), so
loki apply-schema.sh, which will see 0000_pretty_cammi as pending on prod,
applies it as a no-op there. Checked against a tip-state database with
0001..0007 in its ledger: no error and an identical shape afterwards.

browser-smoke now replays the migrations the way the deploy batches them
(scripts/ci/migrations-replay.sh) and fails when the result differs from
drizzle-kit push.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 11:35:13 +01:00
CatoandClaude 202e01fb40 ci(browser-smoke): run the recovery-page check, matched to the one-field reset form (#145)
recovery-browser-check.mjs still filled "Repeat new password", a field
@bitbaum/accountkit removed in 0.9.1: the reset form now asks once, in the
same PasswordField with a show/hide eye as sign-up. The page was right and
the script was stale, unnoticed because no workflow ran it.

The script now checks the password is asked for once and the eye reveals
it, and browser-smoke.yml runs it as its own step so it cannot rot again.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 11:24:51 +01:00
CatoandClaude f0d9e01cb3 ci(browser-smoke): account journey in Chromium, and sign-out that sticks (#144)
* fix(auth): the proxy no longer re-issues the session cookie

Auth.js's auth() proxy wrapper appends a fresh session cookie to every
response it handles, Link prefetches included. A prefetch that left the
browser before Sign out came back after it and set the old, still-valid
JWT again, so the person stayed signed in. The new browser journey hit
this in about one sign-out in three.

The proxy now drops only the session-token Set-Cookie it would add; the
session still rolls through /api/auth/*, which SessionProvider calls on
every page load.

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

* ci(browser-smoke): register, sign out, sign in and no stray Google button

browser-smoke.yml runs scripts/ci/account-journey.mjs in Chromium against
the production build and a throwaway Postgres 17: register through
/register, see the portal, sign out from the sidebar, a wrong password
refused, the right one accepted, no sideways scroll on /login and
/register at 390px. With no GOOGLE_* pair it checks that no Google
provider is mounted and no Google button is drawn, the guard for the
invalid_client sign-in of 2026-10-30.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 11:13:15 +01:00
Cato 6a3044927b feat(auth): password recovery uses the shared accountkit form (#122)
Forgot/reset pages render PasswordRecoveryForm from @bitbaum/accountkit 0.8.1
through a small adapter over Petvity's own routes, so users, bcrypt passwords,
roles and Auth.js sessions are untouched. The hand-written pages could stay
stuck after a network error; the shared form leaves its busy state and says so.
The reset route now answers an invalid link with code INVALID_TOKEN.
2026-10-28 01:29:57 +01:00
CatoandClaude Opus 5 f66c95f3ab ci(auto-merge): call the fleet sweep instead of carrying a stale copy of it (#81)
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>
2026-09-07 14:28:10 +00:00
GandClaude Opus 5 c65ac4b7d7 chore: add a formatter (#71)
* 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>
2026-08-29 10:05:01 +00:00
GandClaude Opus 5 43839dda7e chore: retire the maonakamoto handle (#60)
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>
2026-08-28 08:24:54 +00:00
GandClaude Opus 5 37b1f59ed7 feat(shop): sell to visitors who don't have an account (#50)
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>
2026-08-16 08:56:48 +00:00
GandClaude Opus 5 cd591aef27 feat(blog): publish posts from the admin instead of editing code (#48)
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>
2026-08-15 14:59:57 +02:00
GandClaude Opus 5 fd5ea90729 fix(build): vendor the fonts so the build stops depending on Google (#44)
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>
2026-08-15 11:24:27 +00:00
GandClaude Opus 5 ae7d5acbcf fix(e2e): scope the vet browse assertions to the run that made them (#43)
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>
2026-08-15 12:20:33 +02:00
GandClaude Opus 5 e409d111f5 fix(portal): the heading paints before the fetch, not after it (#41)
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>
2026-08-14 16:22:24 +00:00
GandClaude Opus 5 57ccd09d16 fix(portal): the last five pages open like the rest, and stop saying "All 1 pets" (#40)
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>
2026-08-14 16:04:57 +00:00
GandClaude Opus 5 82aafae182 fix(auth): sign-out returns to the site instead of a dead localhost URL (#39)
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>
2026-08-14 15:25:31 +00:00
GandClaude Opus 5 c2f86a0377 fix(demo): the shared demo keeps its identity across the reset (#38)
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>
2026-08-14 16:43:30 +02:00
G c218456aeb fix(portal): settings paints its header instead of a blank page (#37)
/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.
2026-08-14 13:16:07 +02:00
GandClaude Opus 5 dadbe7e4a5 fix(readiness): a full profile is live even while not accepting clients (#35)
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>
2026-08-14 12:24:46 +02:00
GandClaude Opus 5 42bcc47ff4 feat(marketplace): real onboarding replaces fake profiles; orders become shippable (#33)
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>
2026-08-14 01:10:42 +00:00
GandClaude Fable 5 00d346590b test(e2e): permanent full-path production walkthrough (129 checks) (#30)
* 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>
2026-08-13 17:48:38 +00:00
GandClaude Fable 5 68991544ed fix(auth): config-driven auth surface, dead-token repair, css-var CI gate (#22)
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>
2026-08-13 13:01:04 +02:00
G e3f9083ce5 fix(ci): declare the failing-job list before the branch that can skip it (#14) 2026-08-07 09:55:21 +00:00
G 94aca2de79 fix(ci): a red base must not trap the PR that repairs it (#13) 2026-08-07 09:37:05 +00:00
G 7cb31c3131 fix(ci): stop skipping conflicts, and keep branches current (#12) 2026-08-07 07:16:04 +00:00
GandClaude Opus 5 a363df6a72 fix(ci): drain the merge queue oldest-first, not newest-first (#11)
`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>
2026-08-06 13:45:06 +00:00
G 40af1fce20 ci: green PRs merge and deploy themselves (#10)
* 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
2026-08-05 19:17:10 +02:00