Commit Graph
116 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 Opus 5.5 5ea4dab4fa fix(copy): every public claim matches the code — contact, legal, pricing, pros, 9 locales (#106)
* fix(copy): contact mail goes to a mailbox that exists

hello@ and support@petvity.com sat on the footer, every legal page, the
structured data and every email template. petvity.com is not ours (it is a
Netlify site with Zoho MX; lib/config/email.ts already lists it as "not
ours"), so privacy and support mail went to a stranger. APP.email is now
cato@orangecat.ch, the one address on the receiving apex, and supportEmail
is folded into it. lib/config/app.test.ts fails if it leaves the apex.

The pet-edit form also showed "petvity.com/pets/" as the share prefix; it
now derives the host from APP_URL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): privacy and cookie policies describe the running system

Privacy: Neon was decommissioned in 2026-06 (the database is PostgreSQL on
the same Hetzner box, listening on 127.0.0.1 only), Google sign-in is not
configured in production while OrangeCat sign-in is, groomers and guest
checkout were missing, and "database connections use TLS" did not hold for
a localhost connection.

Cookies: Auth.js v5 sets authjs.* cookies, not next-auth.*, plus PKCE/state
cookies during OrangeCat sign-in; NEXT_LOCALE is a session cookie set on any
locale page, not a one-year cookie set only by the switcher.

Effective dates moved to October 2, 2026.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): marketing pages say only what the product does, in all 9 languages

- pricing: Pro and Clinic cards cut. Their buttons were href="#", neither
  plan is on ROADMAP.md, yet the FAQ called them "next".
- pros: cut vets reading clients' health history and sitters logging health
  during stays (records are owner-scoped; "Vet-facing records" is 0% on the
  roadmap), the unmeasured "growing community" card, and a sitter card that
  repeated its heading. Reviews tie to completed bookings, not confirmed ones.
- features: no refill tracking exists; charts span 30 days, not months; the
  twin is not built from 30 days on the dashboard (7); unverified pros are
  listed; cross-border adoption and "any language" were not true; handle host
  is the live one; groomers added.
- about: the "Behind the project" section was empty in 4 locales and claimed
  "a team of software engineers" in 5; cut.
- ar/ja/ko/tr/zh: the features, pricing, pros and about pages carried an
  older, differently ordered copy (stats swapped, "data export coming soon",
  "VitaReba"); retranslated from the current English.
- CHANGELOG: removed "health metrics that matter per species" (the
  observations config is not wired into any screen) and the Stripe claim;
  added 2026-10-02. ROADMAP: OrangeCat sign-in shipped, Google item dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): close the gaps the verifier found, in all 9 languages

- Cookie policy names both ways NEXT_LOCALE is set: a session cookie per
  page, one year when picked with the language switcher.
- Privacy policy lists the Loki feedback widget as a service provider.
- /pros no longer says owners share pet records or Digital Twin data with
  vets and sitters (a booking shows them only the pet's name): rewrote
  metaDesc, heroDesc, vet/sitter hero copy; cut vb1 ("months of structured
  health history"); dropped 72 unrendered pros keys that still shipped the
  same claims in every page's message payload.
- Cut unmeasured timings: home heroSub ("30-second check-in"),
  benefitTrackDesc ("in 30 seconds"), "set up in minutes", "a few minutes".
- Species guide CTA: a record to show your vet, not one shared with them.
- ROADMAP/CHANGELOG: email+password sign-up still works for new users;
  changelog line lists what was cut instead of claiming all copy is true.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): privacy names what an OrangeCat sign-in stores; drop a dead features key

- Privacy, "Data we collect": an OrangeCat sign-in also stores the name and
  profile picture from the OrangeCat account (accountkit's orangecatProfile
  maps name and picture onto users.name and users.image), not only the id.
- features.heroSubtitle is rendered nowhere but still shipped in every page's
  message payload, carrying "cross-border adoption" and "in any language" —
  both cut elsewhere in this PR. Removed from all nine locales.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-29 17:45:53 +01:00
Cato b9c4899ee7 feat(auth): one password rule from accountkit (non-empty, up to 128); no local minimum or hint text (#123) 2026-10-28 03:53:21 +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.5 3209d7d74b refactor(auth): OrangeCat sign-in through @bitbaum/accountkit; no reset link for an OrangeCat-created account (#108)
lib/auth/orangecat.ts (provider, profile without email, placeholder email,
the sub-keyed adapter wrapper) moves to @bitbaum/accountkit/orangecat v0.2.1,
which took it as one of its sources; its tests went with it. The
ADMIN_EMAILS guard is accountkit's emailEarnsPromotion.

Fixes a gap: forgot-password emailed a reset link to an account OrangeCat
had created. That address came from OrangeCat unverified, so the link would
have given whoever owns it a password on the OrangeCat person's account.
It now gets the same generic answer (mayReceivePasswordReset); a person
with a password of their own can still reset it. Two route tests.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 05:19:24 -07:00
CatoandClaude Fable 5.1 18776a4251 refactor: one definition per concern — shared forms, one directory handler, limitkit, zero lint noise (#95)
* fix(lint): anchor the ignore patterns so eslint stops linting build output

`eslint` reported 18 unparseable files and 2 `no-explicit-any` errors that
exist in no source file. They came from `.claude/worktrees/*/.next/**` —
generated, minified code inside the repo. The default ignores of
eslint-config-next are unanchored (`.next/**`), which only matches at the
config root, so nested build output was walked.

Every pattern is now `**/`-prefixed, and `.claude/**` is ignored outright:
a worktree's files are linted on its own branch, never as a copy of this one.

Before: 2 errors, 36 warnings. After: 0 errors, 16 warnings — and the same
result whether you run it from the checkout or from a worktree.

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

* refactor(pets): one set of pet fields for both add and edit

"Add a pet" and "edit a pet" rendered the same ~120 lines twice — name,
species, breed, birth date, sex, bio, public toggle — so a new field or a
fixed label had to be applied in two places, and the two only stayed
identical by luck.

The fields now live in `components/portal/PetFormFields.tsx`. Each takes the
whole form plus a patch callback rather than a value and a setter, because
the pages hold one `useState` object (the edit page's also carries `handle`)
and a patch is what they can actually apply. The pages keep what genuinely
differs: one creates and can send you on to the first health log, the other
uploads an avatar, owns a handle and a delete zone.

Two primitives came out with it: `ToggleSwitch` (the peer-checkbox switch is
easy to get subtly wrong in a copy — the knob detaches from the track and
nobody sees it until they toggle) and `UploadedImage` (the plain `<img>` for
user-uploaded files, with the reason `next/image` is wrong for them written
down once instead of thirteen bare `eslint-disable` lines).

Render output is unchanged.

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

* refactor(api): one handler behind /api/vets, /api/sitters and /api/groomers

The three directory routes differed in a role string, a table and a list of
columns — and agreed, character for character, on everything that decides
what a caller sees: the session guard, the completeness rule, the city
filter, the 50-row page, the review aggregate and the response envelope.
Three copies of a paging rule is three chances for one directory to quietly
start answering a different question from its siblings.

`createProfessionalDirectoryRoute` in `lib/api/professional-directory.ts`
now owns that shared half. Each route file declares only what it publishes:
its role, its table, the extra columns a profile must have filled to be
listed at all, and its SELECT list — because that list IS the contract the
directory offers (a sitter has a day rate, a vet has a clinic).

Responses are byte-identical: 106 + 103 + 106 lines became three ~35-line
declarations over one handler.

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

* refactor(products): the add/edit-a-product state machine, once

`/admin/products` and `/portal/my-products` look nothing alike — a table with
an inline panel versus a grid with a modal, and only one of them is
translated — but underneath they ran the same 55 lines: the same form shape,
the same "blank stock means unlimited", the same dollars-to-cents rounding,
the same POST-or-PATCH decision, the same optimistic list update.

The arithmetic is the part worth having in one place. `parseFloat * 100` is
where a product silently goes on sale for the wrong money, and it was
written twice.

`useProductEditor` takes the create URL (the admin page appends
`?platform=true` — the one behavioural difference), the two messages it may
need to show, and a callback for the saved row. The pages keep their markup,
their copy, and ownership of their list.

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

* refactor(portal): one labelled input and one contact block for the profile forms

`ProfessionalProfileForm` carried the same four-field grid twice — once for a
vet's practice, once for a sitter's or groomer's services — which jscpd
reported as a 40-line clone of the file against itself. Two copies inside ONE
file is the worst kind: a reviewer reads the first, recognises it, and skims
the second, which is exactly where "city" kept its label and lost its
placeholder.

`ProfileTextField` is that labelled input; `ContactFields` is the
city/country/phone trio as a fragment, so the caller still owns the grid the
cells sit in. `country` is passed through as typed — the route takes the
first two characters and upper-cases them on submit, and normalising here
would be a second opinion about the same value. `SellerProfileForm` uses
both, and its on/off row is now the shared `ToggleSwitch`.

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

* fix(security): key the guest rate limits on the hop Caddy wrote, via limitkit

The hand-rolled limiter in `lib/utils/rate-limit.ts` keyed on the FIRST entry
of `X-Forwarded-For`, with a comment asserting that was the original client
and a test pinning it. Both were wrong in the same direction: a reverse proxy
APPENDS to that header, so the first entry is a string the caller typed. Any
client could send a different `X-Forwarded-For` with each request, mint a
fresh bucket every time and never trip the limit at all — the guest checkout,
which reserves stock without a session, was effectively unlimited. A limiter
that cannot be tripped is not a limiter.

The same bug was found in three sibling repos during this migration, and in
limitkit itself before v0.2.0 (bitbaum/orangecat#563, finding 2). It is
exactly the kind of thing one shared implementation exists to fix once.

So the mechanism is now `limitkit` (fleet/SHARED.md; it replaces 12 copies of
this across 9 repos) and the local copy is deleted: window arithmetic, the
bounded store, the refusal shape and the client-IP dance all come from the
package. What stays local is what is genuinely ours — the limit VALUES, still
declared at each route next to the reason for them, and the proxy depth,
stated once in `rate-limit.ts` because it is a fact about our deployment
(Caddy on the box is the single proxy, so `trustedProxies: 1`).

Behaviour otherwise unchanged: same 429s, same copy, same `Retry-After`, same
per-key allowances. `slidingWindow` (not `fixedWindow`) because the local
implementation started its window at the first hit, which is what sliding
means — the old test expecting 45s of wait after 15s still describes it.

The window-arithmetic tests moved with the code they tested; what this repo
keeps is a test of the part that was broken, including one that a caller
cannot split its bucket by varying the hops it sends.

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

* fix(portal): give the page loaders a stable identity instead of muting the rule

Eight portal pages declared a `loadX()` that fetches the page's list, then ran
it from a `useEffect` with an empty dependency array and an
`eslint-disable-next-line react-hooks/exhaustive-deps` above the `useEffect(`
line. The directive did nothing: the rule reports on the dependency array two
lines down, so every one of these files produced BOTH an "unused
eslint-disable" warning and the exhaustive-deps warning it was meant to
silence. Sixteen warnings from eight disables that never applied.

The cause is that `loadX` was redefined on every render, so listing it as a
dependency would have refetched forever. `useCallback` fixes that at the
source: each loader is now stable over the translation function (plus the
route param where there is one), the effect depends on the loader like the
rule asks, and the disables are gone. The retry buttons already called these
same loaders and keep working.

Lint: 16 warnings → 0. `pnpm run lint` now passes with nothing to say, so the
next real warning will be visible instead of arriving in a crowd.

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

* refactor(ui): one uploaded-image component, and a no-console rule so it stays that way

Thirteen components carried their own `<img>` for user-uploaded files, each
with its own `// eslint-disable-next-line @next/next/no-img-element` above it
and none with the reason written down. Thirteen places for that reasoning to
rot and thirteen exemptions a reviewer has to re-audit independently.

They now all render `<UploadedImage>`, which holds the exemption once and
explains it: these URLs are written by the upload routes at request time
(`/uploads/…` on the box, or an `object:` URL while a preview is in flight),
so `next/image` would need the path known at build time or matched by a
configured pattern — and a missing pattern fails the whole render, not just
the picture. The optimizer has nothing to add either; the upload route already
resized the file.

The last `any` went with them: `TSignal` in `lib/i18n/signal-reason.ts` now
says `Record<string, string | number>`, which is what a reason actually
interpolates — counts, days, formatted measurements, nested translations. The
loose shape is still structural rather than next-intl's own type, because the
key is composed at runtime (`metric_${id}`) and the real literal-keyed type
rejects that by design; that reason is now in the file.

eslint-disable directives: 25 → 1 (the one inside `UploadedImage`).

And `no-console` is on, allowing `warn` and `error`. There were no stray
`console.log`s to remove — `error` is how these routes report a failure they
swallowed, and it is what `journalctl -u petvity-app` shows at 2am — so this
is the ratchet rather than a cleanup: a forgotten debug line on a server
writes a stranger's data into the journal forever. `scripts/**` is exempt,
where stdout IS the output. Verified by mutation: a planted `console.log`
fails the lint.

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

* style: wrap the two UploadedImage calls prettier wanted on four lines

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

* fix(deps): install limitkit from npm, not from git

CI refused the git-hosted form: a package fetched from a tarball has no
`dist/`, so pnpm must run its `prepare` build, and pnpm 11 will not run a
git dependency's build scripts unless the exact resolved URL is listed in
`allowBuilds`. The local install had it cached from before that rule, which is
why this was green on the laptop and red the moment CI installed from scratch.

limitkit has been published to npm since, so the fix is the npm form rather
than an allowlist entry pinned to a commit sha that has to be re-edited every
time the version moves. fleet/SHARED.md still shows the github install line;
the published tarball ships `dist/` and needs no build here.

Same version, same resolution: 0.2.0.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 02:09:23 -07: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 3d6ac9bed3 fix: prices were 100x wrong for zero-decimal currencies (#58)
Two real defects in the repo I can actually reach, found by auditing my own
work rather than someone else's.

formatPrice divided by 100 unconditionally. That assumes every currency has two
decimals, and several have none: with NEXT_PUBLIC_APP_CURRENCY=JPY a 2999-unit
product rendered as ¥30 instead of ¥2,999 — a hundredfold error, silently, on
every price in the shop. KRW, VND and ISK behave the same way, and KWD errs in
the other direction with three decimals. APP_CURRENCY is an environment
variable, so this was one deployment away from being real.

It now delegates to commercekit's money module, which takes the exponent from
the currency. That also removes a second money formatter from a repo that had
just adopted the first — exactly the duplication this whole exercise is about,
introduced by me.

TEMPLATE_MAP typed its payload as `any`, so the cron dispatching welcome emails
could hand a template the wrong shape and the compiler would agree — on mail
that goes to real users, built from a jsonb column nothing else validates. All
four templates take the same WelcomePayload, so the `any` bought nothing.

Typing it immediately produced an error, which turned out to be a typing gap
rather than a live bug: the cron spread `item.payload as object`, erasing the
shape, while enqueueWelcomeSequence does write { name, email }. So the emails
were correct and the types were lying about why. The cast now narrows to
WelcomePayload and the compiler can see it.

Verification: lint, tsc, css-vars, 901 tests / 87 files (8 new, including the
JPY case that would have caught the price bug).

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 16:07:54 +00:00
GandClaude Opus 5 b59101b0e2 fix(security): a missing CRON_SECRET must deny, not accept "Bearer undefined" (#57)
Found while inventorying what repeats across the fleet. Cron auth appears in 43
files across 9 repos, and the copies have diverged into two behaviours:

  petvity      if (auth !== `Bearer ${process.env.CRON_SECRET}`)          OPEN
  evig         if (authHeader !== `Bearer ${cronSecret}`)                 OPEN
  kivvi        if (!cronSecret) { ... }                                   guarded
  aoz-housing  if (!cronSecret || authHeader !== `Bearer ${cronSecret}`)  guarded

With CRON_SECRET unset, the template literal evaluates to the string
"Bearer undefined", so a request carrying exactly that header is authorised.
All 8 cron routes here had the open version.

Behind that gate: /api/cron/reset-demo wipes and reseeds the demo account, and
weekly-digest, health-alerts, vaccination-reminders, medication-reminders and
booking-reminders each email every opted-in owner. So the blast radius of a
missing environment variable was a stranger mass-mailing the userbase and
destroying demo data.

Not exploitable today — CRON_SECRET is set in production. It is a gate that
fails open on an absent secret, which is a normal thing to happen on a new
environment or a typo, and the failure is silent.

requireCronAuth() denies everything when the secret is absent or blank, logs why
so a broken deployment is loud rather than quiet, requires the Bearer scheme,
and compares with timingSafeEqual. The timing part is close to unexploitable
over TLS and is not the point; a helper that is obviously correct removes the
need for anyone to reason about whether it matters.

Two test files, and the second is the one that matters. cron.test.ts pins the
helper's behaviour, including that "Bearer undefined" is refused when
unconfigured. cron-routes.test.ts asserts against the directory that every cron
route calls requireCronAuth and no route mentions process.env.CRON_SECRET —
because fixing eight routes fixes eight routes, while checking the directory
fixes the ninth one nobody has written yet.

Also adds docs/repeatable-across-projects.md: the full measured inventory of
what repeats across 25 repos, and a first-principles rule for what to do with
each. The short version is that copy count is the wrong question — it measures
typing, which is free. The right question is what divergence costs, which sorts
duplication into four classes with four different correct answers, of which
"leave it alone" is one.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 15:03:03 +00:00
GandClaude Opus 5 02d847a016 feat(commerce): extract commercekit, and adopt it here (#53)
* feat(health): track what actually matters, per species

The seven metrics in health-metrics.ts are applied uniformly to all ten
species. That is tidy and, for several of them, wrong in ways that matter.

Body temperature is not a property a fish or a reptile has in the sense the
field implies. They are ectotherms: a fish's body temperature IS the water
temperature, and a reptile's depends on where it is sitting in a thermal
gradient. Heart rate is not measurable at home for a bird, a fish or a hamster.
Asking for either produces an empty field, and empty fields teach owners to
skip — a habit that generalises to the field that mattered.

Worse, none of the seven capture what actually kills these animals. A rabbit
that has not eaten and produced no droppings for twelve hours is a medical
emergency; gut stasis is the leading cause of death in pet rabbits. A male cat
straining without producing urine is fatal in 24-48 hours. A horse whose manure
output drops is the earliest practical warning of colic. A UVB bulb keeps
emitting visible light long after its UVB output has decayed, so the enclosure
looks fine while the animal develops metabolic bone disease.

lib/config/observations.ts is the SSOT for what is worth observing and for
which species. Each observation declares its species, cadence, whether an owner
can actually produce the answer, why it earns a tap, and what answer means
"call a vet" — with the reason, because an alert nobody believes is an alert
everybody dismisses. Records (microchip, parasite schedule, diet, farrier,
water changes) are modelled separately, since they are durable facts rather
than things that changed today.

The daily set is capped at five and the cap is a test that FAILS rather than a
slice that truncates. Printing the sets caught three real design faults that
the first round of tests passed: fish had an empty daily check-in because water
temperature is device-sourced and I was filtering device readings out; dogs and
cats had seven candidates silently cut to five by array order; and reptiles were
being asked about mood while the enclosure gradient that actually kills them was
excluded. Priority is now explicit and cadence can be overridden per species —
a snake fed weekly should not be asked daily whether it ate.

Clinical values are typical published ranges compiled for product design, NOT
clinically reviewed. REVIEW_STATUS records that, so it cannot quietly be
presented to an owner as authority.

Also adds docs/pet-health-science.md (the reasoning, species by species),
docs/digital-twin-and-legacy.md (twin staging, memorialisation, gamification
and revenue, including an explicit list of what not to build), and a first blog
draft. Nothing is published — that is a deliberate decision, not a side effect.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(commerce): extract commercekit, and adopt it here

Three shops in the fleet: evig, petvity and fitfoot. Before proposing anything
shared I checked what is actually duplicated rather than assuming — revampit
turned out to be a second clone of evig, so it is three codebases, not four,
which is exactly the rule of three.

They have three incompatible foundations, so a single shared "webshop" adopted
by all of them would be a rewrite of two. What IS shared is narrower and is the
part every shop rewrites and gets subtly wrong. That is what this extracts.

packages/commercekit — zero runtime dependencies, framework-free core, React
bindings behind a separate entry point.

  money      Integer minor units. `12.55 * 100` is 1254.9999999999998, so
             fromDecimal works on digits. The currency carries its own exponent,
             so JPY has no decimals and KWD has three without a special case.
             allocate() is largest-remainder: splitting 100 three ways gives
             [34,33,33] and never loses or invents a unit — asserted across 200
             amounts x 5 weight patterns. percent() takes an explicit rounding
             mode, because a marketplace computing its own commission should
             round down rather than over-charge a seller.

  cart       A line is an id and a quantity. Never a price — a cart open for a
             week would otherwise show one number and charge another. Cross-tab
             sync, clamping, and corrupt storage yielding an empty cart rather
             than a crashed shop. Stable snapshot reference, which is what
             useSyncExternalStore needs to avoid an infinite render loop.

  inventory  Conditional decrement, all-or-nothing, with compensation on partial
             failure and sorted lock order so opposite carts cannot deadlock.
             Duplicate lines are merged, or the availability check for the
             second is made against stock the first already took. The test
             suite demonstrates the bug it prevents: a read-then-write adapter
             tells 50 buyers "yes" against 10 units while recorded stock falls
             by one.

  buyer      Account XOR guest as a discriminated union rather than two nullable
             columns, so an order belonging to nobody cannot be represented. A
             type is a claim, so the matching Postgres CHECK ships beside it.
             Receipt tokens use the platform CSPRNG and refuse to run without
             one.

  address    ISO-3166 codes with names from Intl.DisplayNames — every locale the
             runtime supports, no translation files, no way for the German list
             to drift from the English one.

Petvity adopts all of it, which is the proof: lib/shop/cart.ts and
lib/config/countries.ts become thin bindings, and placeOrder's hand-rolled
reservation is replaced by reserveAll over a Drizzle adapter that is the only
Petvity-specific part. Cancellation goes through releaseAll, so there is now one
implementation of giving stock back instead of two.

One behaviour change worth naming: the old code skipped the UPDATE entirely for
unlimited-stock products, so the shared db mock's default empty return was never
exercised on that path. The new adapter always issues the conditional update
(`stock IS NULL OR stock >= n`, and NULL - n stays NULL), which is correct
against a real database but made the mock read as "sold out". The mock was
modelling an UPDATE that matches nothing; two tests now say what a matching
UPDATE returns.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 13:24:41 +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 c2b5f392c1 fix(blog): a taken URL is a 409 the author can fix, not a 500 (#49)
Caught by exercising the live endpoint as an admin rather than trusting the
unit test: creating a second post with an existing slug answered 500.

Drizzle wraps driver errors, so the pg error carrying `code: 23505` is the
`cause` of what the route catches, not the error itself. Reading only the
top-level `code` looks correct in a test — where the error is hand-built with
the code right on it — and is wrong against a real database. The test passed
and production returned 500 for a mistake the author can fix in two seconds.

isUniqueViolation now walks the cause chain, bounded, with a guard against a
self-referencing chain hanging the request.

Both tests now use the wrapped shape production actually throws, which is the
point: the old test asserted the shape I assumed, not the shape reality
produces.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 13:13:11 +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 abb693b7f3 fix(uploads): store images with an extension so they are served with a type (#46)
Found by probing the live endpoint rather than trusting the green deploy: the
upload succeeded, the file came back at HTTP 200 with the right byte count —
and an empty Content-Type.

Caddy serves the uploads directory with `file_server`, which derives
Content-Type from the file extension. Both uploaders stored a bare UUID, so
there was nothing to derive from. Chrome sniffs the bytes and renders the image
anyway, which is exactly why this would have shipped unnoticed; sniffing is a
browser courtesy, not a guarantee, and it defeats correct caching.

Both routes now append the extension for the (already validated) image type.
The mapping is SSOT in lib/config/uploads.ts next to the type allowlist it
mirrors — the two must agree, so they live together.

Pinned with a test per accepted type, since the symptom is invisible from
inside the app: every assertion about the response passes while the header the
browser needs is missing.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 12:13:27 +00:00
GandClaude Opus 5 12438d36e3 feat(shop): list a product with a photo from your phone, not a URL (#45)
Listing a product required pasting an image URL, which quietly assumed the
seller already hosted the picture somewhere. Everyone who sells has photos on
their phone; nobody has a CDN. That single field is why a real listing could
not be created without leaving the product first — and prod currently has zero
products.

Both product forms (seller's /portal/my-products and /admin/products) now take
a file: pick, preview, replace, remove.

The upload endpoint is deliberately not scoped to a product id. The seller
chooses the photo while filling in the "new product" form, before a row exists;
scoping it would force create-then-upload and leave a product visibly imageless
whenever the second call failed. It returns a URL the form submits as imageUrl,
so create and edit take the identical path.

Files land in UPLOADS_DIR (/opt/petvity/uploads on the box, outside the app
directory so they survive deploys) and Caddy serves them from /uploads/*.

Also fixes a drift this would have made worse: the upload limits lived inline
in the avatar route, and its file picker offered JPEG/PNG/WebP while the API
also accepted GIF — so a GIF was rejectable by the UI and acceptable to the
API. Limits are now SSOT in lib/config/uploads.ts, used by both routes, both
pickers and the hint text, so they cannot disagree again.

/api/uploads is added to PRIVATE_API_PREFIXES — it writes files to disk and
must never be reachable without a session.

8 tests cover the endpoint: stores and returns the URL, keys uploads by
uploader, refuses anonymous callers, no file, over-cap, exactly-at-cap,
non-image type, and a storage failure reported instead of a fake success. The
size gate needed real bytes — FormData rebuilds the File from its content, so a
patched `size` property is discarded in transit and the gate would never fire.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:03:18 +02: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
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 2a46bced71 fix(orders): cancelled orders restore stock; sellers can delete their account (#29)
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>
2026-08-13 17:37:14 +00:00
GandClaude Fable 5 8a4b4fe58b fix(honesty): remove every fabricated trust signal — nothing on the site lies (#28)
- Homepage: the invented testimonials ('Sarah M.', 'James T.', 'Amara O.'
  with fake 5-star rows) are gone, replaced by a section that is TRUE and
  verifiable in one click: Milo and Rosie's live public profiles, tracked
  daily in the open
- Seller CTA no longer claims 'thousands of pet owners'
- Resident professionals (Dr. Brunner, Sam Keller, Nadia Roth) keep their
  seeded profiles (per policy: profiles OK for testing) but lose the
  unearned Verified badges and ALL fabricated bookings + 5-star reviews;
  the cron no longer seeds reviews at all — ratings now only ever come
  from real completed bookings
- Prod data surgery accompanies this deploy (fake reviews/bookings deleted,
  residents de-verified)

verify + build green; homepage section browser-verified.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 16:17:34 +00:00
GandClaude Fable 5 300fe1cdc2 feat(groomers): grooming as a first-class professional vertical (#27)
Groomer joins vet and sitter everywhere a professional exists:
- user_role enum + groomer_profiles (salon, services, from-price) + migration
- /api/groomers browse + /api/groomers/me CRUD; role plumbed through
  registration (?role=groomer), become-a-pro, availability, bookings,
  conflict guard, admin verification, dashboards, sidebar
- Find a Pro gains a Groomers tab; booking modal books grooming as a
  one-hour session with the salon's from-price in the header
- Public pro profile renders groomers (salon, services, starting price)
- Resident groomer Nadia Roth / Salon Pfotenschick seeds via the daily
  cron with a completed booking + 5-star review, so the tab ships alive
- 6 grooming services in the professionals SSOT; role badge tokens in
  globals.css; ~25 strings x 9 locales

Verified end-to-end locally: register groomer -> profile -> visible in
browse -> booked 201 -> overlap 409. verify + build green.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 15:36:56 +00:00
GandClaude Fable 5 763d55daea feat(ux): humane booking flow, self-serve pro upgrade, role-aware dashboard (#26)
* chore: nudge CI (pull_request event was never delivered)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(ux): humane booking flow, self-serve pro upgrade, role-aware dashboard

Booking modal rebuilt around how people actually book:
- Sitter: drop-off/pick-up dates (no datetime-local minute-picking), live
  'N nights × rate = total' before any commitment
- Vet: one date + tap-a-time-slot chips (1h appointments)
- Availability surfaced BEFORE submit: busy ranges fetched from the new
  /api/bookings/busy (privacy-safe date ranges), clashing dates disable the
  button with a plain-words warning instead of a post-submit 409
- One pet -> stated, not asked; request-not-final explainer under the CTA

True multi-tenancy path: existing owners can now become professionals —
/portal/become-a-pro (sidebar 'Offer your services') POSTs the new
/api/account/role (pet_owner -> vet/sitter only, trust-first like
registration), session refreshes in place via the update trigger.

Dashboard attention strip now spans every role: pending booking requests
(pros) and open orders (sellers) join adoption applications and vaccines.

24 new strings x 9 locales. verify green (1212 tests), build green,
modal + clash state + sidebar verified in the browser.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 14:49:13 +00:00
GandClaude Fable 5 bb5615c0fa feat(bookings,shop): calendar conflict blocking + Stripe payment integration (#25)
* feat(bookings,shop): calendar conflict blocking + Stripe payment integration

Tier-1 scheduling: the booking API now rejects (409) any request that
overlaps a professional's active bookings or their self-declared blocked
dates; vets/sitters manage blocked ranges at /portal/professional-profile
(new professional_blocked_dates table + /api/availability CRUD).

Payments: full Stripe Checkout flow, env-gated like Resend — without
STRIPE_SECRET_KEY nothing changes; with it, checkout redirects to Stripe,
the signed webhook (/api/payments/webhook) marks orders paid, and unpaid
orders stay payable from /portal/orders (Pay now + paid/awaiting badges).
orders gains paid_at + checkout_session_id.

Critical bug found by the smoke test: the login JWT callback wrote
resolveRole(email) back to the DB, silently DEMOTING every vet/sitter to
pet_owner at their next sign-in (residents were safe only because they
never log in). ADMIN_EMAILS now only promotes; professional roles survive.

Verified end-to-end locally: sitter registers → blocks dates → owner
booking overlap 409, blocked-dates 409, disjoint 201; checkout w/o keys
falls back to recorded orders. verify green (1209 tests incl. 12 new).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: nudge CI (pull_request event was never delivered)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 13:49:47 +00:00
GandClaude Fable 5 d2fcae9824 feat(shop): branded category art — no product ever renders as a placeholder box (#24)
New ProductArt component: uploaded photo when present, otherwise a per-category
line illustration in the brand palette (CSS-var driven, re-themes with
globals.css). Wired into every product surface: portal shop grid + cart drawer,
public shop grid + product detail, buyer/seller/admin order items, seller
product list. Order APIs now expose productCategory for the fallback.

Also: public shop hero title was invisible — .ed-title is platinum-on-dark
marketing typography and PR #22 placed it on the light cream hero; now matches
the adopt page's ink title (surfaces stay unmixed per AGENTS.md).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 12:27:10 +00:00
GandClaude Fable 5 acabbdf4f4 feat(resident): full resident ecosystem — every user type represented with living data (#21)
Rosie the Beagle joins Milo as a second daily-tracked resident pet (28-day
deterministic backfill on bootstrap so charts start alive), and the same
cron now idempotently seeds one of every user type: a verified vet and
sitter (Find-a-Pro), a seller with a stocked 7-product shop, a rescue with
an adoption listing, and completed bookings with 5-star reviews so ratings
render on pro profiles. Check-in generation is parametrized per pet
(CheckinProfile) with Milo's series continuing unchanged (salt 0).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 16:38:06 +00:00
GandClaude Fable 5 226a775196 feat(resident): Milo — a real pet tracked for real, one day at a time (#19)
The demo account is wiped and reseeded daily, so nothing on it ever
truly ages. Milo is the opposite: a persistent resident cat whose
morning check-in is logged by a daily cron exactly the way a real
owner would — one row per day, accumulating genuine history. Charts
lengthen, trends emerge, vaccination due-dates actually approach,
and roughly every eleventh day is an anxious one (vacuum day), so
the wellness signal earns the occasional honest 'watch'.

Values are date-seeded and deterministic (re-running a day yields the
same row; the year-long series stays inside cat normal ranges — tested
across 365 generated days). The route bootstraps the account (no
password: machine-only), pet, vaccinations, and first vet record on
first run, then is a one-row-per-day idempotent logger.

Publicly watchable at /pets/milo.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 22:31:50 +00:00
GandClaude Fable 5 9ed916af14 feat(system): healthz, one-click /demo funnel, public demo profile, new-pet grace, score labeling (#17)
- /api/healthz: public DB-pinging healthcheck. /api/health is the auth-gated
  pet-data API, so deploys and uptime monitors had nothing honest to probe.
- /demo: signs a visitor into the shared demo account in one click; linked
  from the marketing hero ('Try the live demo') and nav across all locales.
  Also fixes two hardcoded English strings in HeroCTA.
- Demo seed claims the public handle /pets/luna (when free), so the
  public-influencer-profile feature has a live showcase.
- New-pet grace: a profile younger than the 7-day alert window with no data
  and nothing overdue reads healthy/'new profile' instead of an alarming
  Watch badge seconds after creation. Overdue vaccinations still escalate.
- Digital-twin score is labeled 'Emotional wellness' (9 locales) so it stops
  reading as a contradiction of the all-metric wellness % on the health page.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 21:00:07 +00:00
GandClaude Fable 5 e9b48a84a9 feat(auth): no-account demo access + honest password-reset failures (#16)
A real user (Manuel) got locked out: wrong password 3×, and the
forgot-password flow answered 'success' while prod had no
RESEND_API_KEY — the reset email silently never sent. Two fixes:

1. Forgot-password now returns 503 with a support address for EVERY
   request when email is unconfigured (uniform before any user lookup,
   so it stays enumeration-safe). No more silent lockouts.

2. 'Explore the demo — no account needed' on the login page signs
   visitors into a shared, seeded demo account (Luna the Golden
   Retriever: 30 days of check-ins, vaccinations, medication, records —
   charts and digital twin look alive). The account can't be locked
   out: password changes and resets are refused for it, and the
   CRON_SECRET-gated /api/cron/reset-demo wipes and reseeds it daily
   (user-row delete cascades every drive-by edit).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 20:28:29 +00:00
GandClaude Fable 5 53350e722c fix: user-walkthrough bug sweep + editorial design for marketing subpages (#15)
* fix(api): accept the form wire format on medical-history create routes

The portal forms serialize every empty optional input as null
(buildBody: `form.notes.trim() || null`), but the create schemas for
vaccinations, medications, and health records modeled optionals as
.optional() alone — which rejects null. Every save from the UI failed
with 400 'Invalid input', making the entire medical-history feature
set unusable in production. Unit tests stayed green because they
omitted the keys instead of sending null.

Schemas now use .nullish() for optional fields (the update routes were
already nullable-aware), and a new test posts the exact UI payload —
nulls included — against all three routes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(marketing): species guide pages no longer 500 in production

/[locale]/species/[id] was the only page declaring generateStaticParams,
but the locale layout's getMessages() needs request context — the static
prerender attempt threw DYNAMIC_SERVER_USAGE at runtime (500 in prod,
invisible in dev, where everything renders dynamically). Render it
dynamically like every other marketing page.

Also reskins the page to the editorial design system (cream/gold/serif),
matching the landing page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(i18n): resolve 7 missing message keys and end the class with an audit test

The public adopt page rendered raw keys ('public.adoptFilterAll',
'public.adoptSearch', …) to users: its filter-bar labels live in the
portal namespace, and four more keys (adoptNoResults, adoptClearFilters,
adoptFree, portal.loading) existed in no locale at all. The page now
reads the shared filter labels from the portal namespace, and the four
genuinely missing keys are added to all 9 locales.

New test statically extracts every literal t("key") per translator
namespace and asserts it resolves in messages/en.json — tsc and eslint
are both blind to this class; this test is not (it found 4 of the 7).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(i18n): substitute {app} once at message-load time

47 message keys reference {app}; requiring each t() call site to pass
{ app: APP.name } shipped literal '{app}' into rendered copy on the
features page (heroDesc, ccDesc). next-intl v4 removed
defaultTranslationValues, so the request config now deep-replaces the
placeholder when messages load (memoized per locale). Call sites that
still pass the value are harmless; APP.name stays the SSOT.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(proxy): null-safe role access in the auth redirect

session?.user.role crashes the middleware — and with it every route,
turned into a 500 — whenever NextAuth yields a session without a user
(observed locally with auth misconfiguration). One optional chain makes
the failure mode 'treated as logged out' instead of 'site down'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* design(marketing): extend the editorial system to all marketing subpages

/features, /about, /pricing, and /pros still wore the old teal-SaaS
look (teal gradient heroes, multicolor icon chips, teal CTA bands) while
the landing page had moved to the petvity.com editorial brand. All four
now use the same language: cream sections, gold ed-icon chips, Cormorant
ed-title headlines, pill btn-editorial CTAs, warm-dark closing bands.
Presentation classes only — copy, translation keys, and structure are
untouched. (The species guide moved in the previous commit.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 22:07:31 +02:00
GandClaude Opus 4.8 f79ae9772d chore(infra): remove Vercel references — self-hosted now (#8)
Vercel is decommissioned; petvity runs self-hosted on the Hetzner box
behind Caddy at petvity.orangecat.ch. Repoint every current-setup Vercel
reference to that reality:

- Remove vercel.json (Vercel Cron is gone; CLAUDE.md cron table is the
  schedule SSOT, driven by host cron/systemd timers).
- Privacy page: Vercel hosting -> Hetzner; drop "Vercel Blob" vendor
  (avatars now on local disk, not a third party).
- Cookies page: drop the Vercel Analytics claim (no analytics package is
  installed) -> state no third-party analytics.
- FAQ (de/en/es/fr): "Vercel's global edge infrastructure" -> self-hosted
  European infrastructure.
- schema.ts / avatar route / forgot-password: comments no longer say
  "Vercel Blob"/"Vercel logs".
- .gitignore: drop the .vercel ignore.

Kept: lib/storage.ts "replaces @vercel/blob" narrative and the CLAUDE.md
"there is no Vercel Cron" guardrail. Lockfile transitive deps untouched.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 21:51:16 +02:00
GandClaude Opus 4.8 7e9a281952 test: cross-owner data isolation regression net (#6)
Existing route tests mock DB results, so they stay green even if the
eq(pets.ownerId, session.user.id) scoping is deleted from a WHERE/ON
clause. This net captures the actual Drizzle condition each route hands
to the DB, renders it to SQL via PgDialect, and asserts it is scoped by
owner_id bound to the session user id.

Covers /api/pets/[petId] (GET/PATCH/DELETE), /api/health/metrics/[petId]
(GET/POST), and /api/health/records/[recordId] (PATCH/DELETE via the
ownership JOIN helper). Mutation-verified: removing ownership scoping
from any of the three mechanisms (update/delete WHERE, findFirst where,
innerJoin ON) fails the corresponding tests.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 14:04:04 +02:00
Mao NakamotoandClaude Fable 5 94882211f2 feat(selfhost): migrate to self-hosted Hetzner (Vercel/Neon/Supabase exit 2026-06-12)
Standalone output, portable Postgres driver, proxy-aware fixes as needed.
Runbook: fleetcrown/docs/infrastructure/hetzner-migration.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 19:48:13 +02:00
g-butandClaude Sonnet 4.6 03981e7326 fix(security): add Zod validation to sellers/me POST and PATCH
Validate country as 2-char uppercase ISO code, website as valid URL,
enforce column length limits (displayName ≤200, city ≤100, phone ≤50,
website ≤500) and boolean type on isActive. Prevents malformed data
from reaching the DB and closes the unvalidated-body gap flagged in
pre-deploy audit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 13:34:28 +02:00
g-butandClaude Sonnet 4.6 2ff092aaaf feat(seller): seller profile CRUD + i18n in 9 locales + improved registration onboarding
- lib/db/schema.ts: add sellerProfiles table (displayName, bio, city, country, phone, website, isActive)
- app/api/sellers/me: GET / POST / PATCH handler with requireSession() guard
- proxy.ts: add /api/sellers to PRIVATE_API_PREFIXES
- app/(portal)/layout.tsx: query sellerProfiles, pass hasSeller to SidebarNav
- app/(portal)/portal/seller-profile/: page.tsx (server) + SellerProfileForm.tsx (client, full i18n)
- messages/*.json: add 17 seller i18n keys to all 9 locales (EN DE FR ES JA ZH KO TR AR)
- register/page.tsx: redirect pet owners to /portal/pets/new?from=registration after sign-up
- portal/pets/new/page.tsx: show welcome banner + redirect to health log on first pet creation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 12:39:20 +02:00
g-butandClaude Sonnet 4.6 91825d386e perf: add LIMIT + server-side city filtering to vets/sitters/products APIs
/api/vets, /api/sitters: city filter moved from client-side JS into SQL
WHERE ILIKE so the LIMIT applies AFTER filtering (not before). Returns
meta.hasMore=true when there are >50 matching results.

/api/products (public): hard LIMIT 100 prevents full-table scans as
product catalog grows.

find/page.tsx: city input now debounces 300ms then refetches from the
API with ?city=X instead of filtering all-loaded results in memory.
Shows "Showing top 50" note when meta.hasMore is true.

Fixes: unbounded full-table-scan queries on every Find a Pro page visit;
eliminates the case where LIMIT could hide city matches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 18:52:04 +02:00
g-butandClaude Sonnet 4.6 0709b56879 fix(security): eliminate race conditions in orders and adoption applications
orders/route.ts — stock decrement was read-modify-write using a stale snapshot,
two concurrent requests could both pass the stock check and oversell the last unit.
Fix: atomically decrement each product using
  UPDATE products SET stock = stock - qty WHERE id = ? AND stock >= qty
before inserting the order record. If any decrement returns 0 rows (stock gone),
we compensate by re-incrementing the products that already decremented and return 409.

schema.ts — adoptionApplications had no DB-level uniqueness for (listingId, applicantId);
the API-only check-then-insert was vulnerable to concurrent duplicate submissions.
Fix: add UNIQUE INDEX on (listing_id, applicant_id). Migration applied via pnpm db:push.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 18:32:01 +02:00
g-butandClaude Sonnet 4.6 8b6526b89e feat(adopt): surface owner contact info to approved applicants
After an application is approved, the applicant now sees the owner's
name and a mailto link on the listing detail page, closing the contact
gap where users were told 'the owner will be in touch' with no way to
reach them. On the owner side, approved applications now show an email
button for the applicant. All 9 locales updated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 16:39:58 +02:00
g-butandClaude Sonnet 4.6 c5085874bd feat(i18n): persist SignalReasonData in DB and translate signal history
Add reason_data jsonb column to pet_signal_history; write reasonData in
signal-cache.ts and health-alerts cron; update SignalHistoryTimeline to
call translateSignalReason() for new rows, falling back to stored English
text for legacy rows (graceful degradation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 13:30:28 +02:00
g-butandClaude Sonnet 4.6 7cc2b77252 refactor(health): replace inline signal timeline with SignalHistoryTimeline component
The health page was duplicating the SignalHistoryTimeline component that already
existed on the pet profile page. Replaced 28 lines of inline JSX with a single
component import and call-site, removing unused History icon, SIGNAL_LABELS,
SIGNAL_BG_CLASSES, PetWellnessSignal, and formatIsoDate imports.

Also fixes TS2345 in weekly-digest route test: mockResolvedValueOnce(undefined)
→ mockResolvedValueOnce({ sent: true }) to match sendEmail's Promise<{sent:boolean}>.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:47:28 +02:00
g-butandClaude Sonnet 4.6 266e8e8114 test(weekly-digest): add 9 tests for cron route — suite grows 553→562
Covers: 401 on missing/wrong secret, 0 sent when no rows, 1 email per
owner (not per pet), separate emails for different owners, null-email
skip, non-fatal sendEmail failure, null-signal default fallback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:25:15 +02:00
g-butandClaude Sonnet 4.6 6eee85c50b feat(email): weekly wellness digest cron — Sundays 9am
Add /api/cron/weekly-digest POST route that emails every opted-in owner
a per-pet signal summary (healthy/watch/concern) once a week. One batch
JOIN query groups pets by owner; no N+1 reads. Respects users.digestOptOut.

- lib/email/templates.ts: weeklyDigest() template with signal-coloured pet cards
- lib/email/i18n.ts: weeklyDigest strings for all 9 locales (EN/DE/FR/ES/JA/ZH/KO/TR/AR)
- vercel.json: schedule "0 9 * * 0" (every Sunday)
- CLAUDE.md: add medication-reminders, booking-reminders, weekly-digest to cron tables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:45:47 +02:00
g-butandClaude Sonnet 4.6 dced92979e refactor(ssot): consolidate price formatting to lib/utils/format.ts
Add formatAdoptionFee(feeCents: number | null): string — returns "Free"
for null/0, whole-dollar amount ("$25") otherwise. Eliminates 7 copies
of the same null-check + division + toFixed pattern scattered across
adoption pages and the admin panel.

Also wire formatPrice() in orders/route.ts and orders/[orderId]/route.ts
(5 instances) instead of inlining the dollar/cent division idiom.

No behavior change; all 534 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 14:05:49 +02:00
g-butandClaude Opus 4.7 11d31f7a01 feat(professionals): email notification on verification status change
When an admin verifies or unverifies a professional, the professional
now receives a localized email in their chosen language.

- lib/email/i18n.ts: adds professionalVerification.{verified,unverified}
  strings in all 9 locales (en de fr es ja zh ko tr ar) with Arabic RTL.
- lib/email/templates.ts: professionalVerified() + professionalUnverified()
  template functions using getEmailStrings/t interpolation.
- app/api/admin/professionals/[userId]/route.ts: user select now fetches
  name/email/locale; notifyProfessional() helper sends fire-and-forget
  email after each successful isVerified toggle.
- Tests: 3 new assertions — verified vet gets zh-locale email, unverified
  sitter gets en fallback, null-email user skips send silently.
  i18n namespace coverage test updated to include professionalVerification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:16:59 +02:00
g-butandClaude Opus 4.7 dd0599bdec feat(i18n): translate all email templates into 9 locales
- lib/email/i18n.ts: new SSOT with locale-keyed strings for every email
  template (ownerWelcome/AddPet/HealthTracking/WeekOne, passwordReset,
  petHealthAlert, vaccinationReminder, medicationEndingReminder,
  bookingReminder, bookingRequestReceived, bookingStatusChanged,
  orderConfirmation, orderStatusUpdate, sellerOrderNotification,
  adoptionApplicationReceived, adoptionApplicationStatusChanged) in all
  9 locales (en de fr es ja zh ko tr ar). Arabic sets dir=rtl; base()
  injects lang/dir on <html> and rtl inline styles for Arabic.
- lib/email/templates.ts: all template functions accept locale? and
  delegate to getEmailStrings(); t() handles {{key}} interpolation.
- Cron routes: cron/emails now fetches users.locale; cron/health-alerts
  adds locale to owner query; vaccination/medication/booking reminders
  pass ownerLocale to template calls (was only used for date formatting).
- API routes: all transactional email sends (bookings, orders, adoptions,
  forgot-password) add locale to their user selects and pass to templates.
- lib/email/i18n.test.ts: 12 tests covering locale resolution, RTL flag,
  translation completeness for all 9 locales, bullet count, and t().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 09:51:18 +02:00
g-butandClaude Opus 4.7 75112d479a fix(avatar): graceful errors instead of opaque 500s
Pet avatar upload throws when BLOB_READ_WRITE_TOKEN is unset (which
it is in production right now per CLAUDE.md), and Next.js converts
the throw into a generic 500 with no body. Users clicking "upload"
saw a useless "Upload failed" toast with no recovery path.

- Detect missing BLOB token up-front, return 503 + clear message:
  "Photo uploads aren't configured for this deployment yet."
  Short-circuits before any DB or Blob work.
- Validate file size (5 MB cap) — return 413 with explicit limit
- Validate file type (JPEG/PNG/WebP/GIF only) — return 415
- Wrap put() in try/catch; on failure return 502 with retry copy
  ("Upload failed. Please try again in a moment.") instead of
  opaque 500. Logs the underlying error server-side.

Same pattern as the existing email send chain, which gracefully
handles missing RESEND_API_KEY by returning {sent:false}. Apps
that depend on optional infra should degrade visibly, not silently
throw.

5 new tests cover all four error paths (missing token, oversized,
wrong type, blob throws) + verify each short-circuits before
calling DB / Blob / etc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 10:45:04 +02:00
g-butandClaude Opus 4.7 0034da48fc feat(account): GDPR Article 15 — data export + fix loggedBy cascade
Pairs with yesterday's account-deletion (0ce5192) to complete the
core GDPR data-rights story (right of access + right to erasure).

- GET /api/account/export: bundles every row the current user owns or
  authored into a downloadable JSON file (Content-Disposition:
  attachment, no-store cache). Sections: account profile (sanitized —
  no password hash), pets, health metrics/records/vaccinations/
  medications, signal history, bookings, reviews written, orders +
  items, products listed, adoption listings + applications submitted.
  Schema-versioned so future format changes don't break old downloads.
- Settings page: "Your data" card with a Download button above the
  Danger zone — the natural pairing (back up, then delete).
- 4 tests cover auth gate, missing-account 404, full payload shape +
  filename + cache headers, and the load-bearing assertion that the
  password hash is NEVER included in the account section.

Also: healthMetrics.loggedBy now SET NULL on user delete instead of
the previous (unset) NO ACTION default. The metric belongs to the
pet (owner cascade handles its lifecycle) — deleting the *logger*
(e.g. a vet who entered it on the owner's behalf) must not erase
the owner's history. Latent under single-actor flows; a footgun the
moment multi-user logging ships. Fixed proactively.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 10:13:24 +02:00
g-butandClaude Opus 4.7 0ce5192b77 feat(account): GDPR-compliant account deletion
Users could register but had no way to leave — a real GDPR Article 17
gap and a trust issue. Now end-to-end:

- DELETE /api/account: requires session + double confirmation (current
  password + literal "DELETE" string in the body). OAuth accounts skip
  the password check (no local password to verify). Single db.delete()
  cascades through every users.id FK that already had ON DELETE CASCADE
  — pets, health metrics, vaccinations, medications, records, bookings,
  reviews, orders, products listed, adoption listings/applications,
  signal history, email queue. (loggedBy on healthMetrics has no
  cascade rule but is unreachable in single-actor flows; noted as a
  latent issue if multi-user logging ships later.)
- Settings page: red-bordered "Danger zone" card with explicit copy
  about what gets deleted. Delete button opens a confirmation modal
  requiring both the password and typing DELETE; submit button stays
  disabled until both are filled. On success, signOut redirects to
  /en home (account is gone — can't bounce them to dashboard).
- 6 tests: auth gate, missing/wrong confirm string, missing password
  for credentials accounts, wrong password, OAuth bypass of password
  check, success path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:56:33 +02:00
g-butandClaude Opus 4.7 6a3d806ffd feat(email): one-click unsubscribe link in welcome emails
Yesterday's commit (00627fb) shipped a settings toggle for the
welcome series, but users had no way to discover it from the email
itself. Closing the loop with a tokenized unsubscribe URL — works
for logged-out recipients (the common case for marketing email).

- lib/auth/unsubscribe-token.ts: HMAC-SHA256 over userId, signed with
  NEXTAUTH_SECRET. Constant-time verification, length-checked before
  timingSafeEqual to avoid throws on shorter inputs. Returns undefined
  (not throws) when secret is missing so test/dev environments don't
  break — production has the secret because NextAuth requires it.
- lib/email/templates.ts: base() takes optional unsubscribeUrl;
  rendered as a footer link only when supplied. The 4 welcome
  templates accept it via the WelcomePayload type. Transactional
  templates (vaccination/medication/health/order) intentionally have
  no opt-out — they're necessary for the service.
- /api/cron/emails + POST /api/account: build the URL from user.id at
  send time (not enqueue time, so existing queued items get the link
  retroactively, and the token-rotation point stays in one helper).
- /unsubscribe page (app/unsubscribe/page.tsx): server component,
  GET shows confirmation form, server action verifies+flips
  digestOptOut+redirects with done=1 to render the success card.
  Three states: invalid link, confirm, done.
- proxy.ts: new PUBLIC_BYPASS_PATHS list for /unsubscribe — bypasses
  intl routing AND skips the AUTH_PATHS redirect-when-logged-in (so
  the email link works whether the recipient is logged in or not).
- 9 token-helper tests cover sign/verify, tampering, wrong-length,
  missing-secret, URL-encoding, determinism, and secret-rotation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:38:21 +02:00
g-butandClaude Opus 4.7 a5941be818 test: cover three recently-shipped routes that lacked tests
Backfilled tests for endpoints added during the marketplace + i18n
work where rapid iteration outpaced test coverage:

- PATCH /api/account/locale: auth gate, missing-locale 400, invalid-
  locale 400, valid-locale success, parametric coverage of every
  locale in routing.locales (so a new locale added to routing won't
  silently break this endpoint).
- GET /api/orders/seller: auth gate, empty-state, multi-order grouping
  with per-seller subtotal computation, and the load-bearing assertion
  that sellerSubtotalCents covers ONLY the seller's items even when
  the buyer's order spans other sellers.
- GET /api/admin/products: admin gate, empty state, LEFT JOIN payload
  shape (platform product → null seller fields; user-listed product →
  populated sellerName/sellerEmail).

12 new tests, suite at 426 pass · 0 fail. No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:15:37 +02:00
g-butandClaude Opus 4.7 00627fbce4 feat(email): wire end-to-end welcome-email opt-out
users.digestOptOut existed in the schema (on the never-used
ownerProfiles table) but had no UI, no API, and no cron enforcement —
fully dead. Closing the loop:

- Schema: moved digestOptOut from ownerProfiles → users (where every
  user already has a row, no parallel-table juggling). pnpm db:push
  applied; ownerProfiles is still dead but tidier.
- API: extended PATCH /api/account to accept digestOptOut: boolean.
  New GET /api/account returns { name, email, locale, digestOptOut }
  so the settings page can hydrate without session-token changes.
- Cron: /api/cron/emails now reads users.digestOptOut and DELETEs
  pending welcome items for opted-out users instead of sending them.
  Returns { sent, failed, skipped } for visibility.
- Settings UI: new "Email preferences" card between Profile and
  Password with a clear checkbox; copy makes explicit that
  transactional emails (vaccination reminders, health alerts, order
  confirmations) are not affected.

Users who don't want the day-1/3/7 onboarding series can finally
turn it off without losing transactional notifications.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 18:47:56 +02:00
g-butandClaude Opus 4.7 14fdb9a847 feat(i18n): persist users.locale so cron emails match the user's choice
The LocaleSwitcher set a cookie but cron jobs (running outside any
session) had no way to know what language each recipient wanted —
so vaccination/medication/booking reminders were always English.

- Schema: add users.locale (varchar(5), nullable; null = default).
  pnpm db:push applied to Neon.
- New PATCH /api/account/locale: requireSession-guarded, validates
  against routing.locales, updates the user row.
- LocaleSwitcher: best-effort PATCH the new endpoint when picking a
  language (anonymous 401 is fine — cookie still drives portal/marketing).
- Reminder crons (vaccination, medication, booking): include
  ownerLocale in the join projection and pass it to formatDateShort
  / toLocaleDateString. Booking reminder also stops hardcoding "en-US".

Side-effects in LocaleSwitcher extracted to module-scope persistLocale()
so React Compiler's immutability rule doesn't flag the cookie write.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 18:27:59 +02:00