ChartKit 0.7.0 closes both gaps recorded in package-plan.json (#140):
LineChart now labels days on a 30-day span, and Meter takes a tone and
showValue={false}.
- HealthTrendChart renders ChartKit's LineChart on the server: one line
per metric, the species' normal range as a reference band, the portal
locale for dates and numbers. A day without a reading is left out of
that line. The trend charts sit one per row: in the portal's 4xl
column, three across left each plot about 190px and the day ticks ran
into each other.
- The twin score and per-metric bars (DigitalTwinCard, public pet page,
portal dashboard) are ChartKit Meters coloured by the twin state's
tone, with the figure printed once by the page.
- The twin score block wraps under the state name on a narrow card; at
390px in German it was clipped ("41 / 1") before this change.
- recharts is removed, with the chart colour config and the tooltip
shadow that only it used. Both exceptions leave package-plan.json; the
bindings are recorded instead.
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
Co-authored-by: Claude <noreply@anthropic.com>
* 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>
The fleet's building-in-public contract puts each product's record in its
own repository as two markdown files and renders it through Loki's fleet map
via bip-kit. Petvity had neither the files nor the pages.
- ROADMAP.md: Now / Next / Later / Shipped, derived from the phases in
AGENTS.md and the merged history. Planned work is written as plans.
- CHANGELOG.md: Keep-a-Changelog dialect, user-facing, newest first, from
merged PRs; today's homepage rewrite is the top entry.
- /[locale]/roadmap and /[locale]/changelog render bip-kit's DevelopmentPage
inside the marketing nav/footer; the records are English by contract, the
chrome and metadata stay localized (keys in all 9 locales, footer links).
- lib/config/development.ts is the SSOT for the map URL, slug and profile;
lib/development/records.ts fetches with revalidate 300 and an 8s ceiling.
- The --bp-* theme scope already mapped for the blog (.pv-longform) covers
the records; the page title and record name take the editorial faces.
- Vitest covers the data path with a fleet-map fixture, no network.
- Sitemap lists both pages.
Verified at 390px in de/en/ar: no horizontal overflow.
Claude-Session: https://claude.ai/code/session_01NJJp6XiUkeEVzjDaBmWjL3
Co-authored-by: Claude <noreply@anthropic.com>
`/portal/dashboard` and `/portal/find` were each hand-typed six times in
SidebarNav.tsx alone — 38 occurrences of thirteen paths across the portal
components, plus `/portal/pets/${petId}/health/log` templated in two files.
Renaming a route meant finding every copy, and a missed one did not fail to
compile: it became a dead link only a visitor would discover.
lib/config/routes.ts is now the one place. Static paths as a const object,
and functions for the two that need an id — a template literal in a component
is a copy like any other.
The guard is the point. routes.test.ts scans components/portal for a quoted
/portal/ literal and fails on one, so this cannot quietly come back. It is
stricter than the first pass of the fix was: it caught QuickActions.tsx and
both dynamic paths that a file-by-file sweep had missed, which is exactly the
job. Recorded in CLAUDE.md's SSOT table and Red Flags list so the rule is
findable without reading this commit.
No behaviour change: every path resolves to the same string it did before.
Typecheck clean, lint clean, 904 tests pass.
Found by a fleet-wide navigation audit across 20 repos, where petvity had the
highest concentration of hand-typed destinations in a single file.
Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore: add a formatter, matching the style this repo already writes
singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.
Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* style: format with prettier (252 files)
Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: teach git blame to skip the reformat
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* 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>
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>
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>
Browsing offered one control — a category pill. Any shopper who knew what they
wanted had to eyeball the grid for it, and there was no way to see the cheapest
option first. That is fine for six products and useless at sixty.
Public storefront (/[locale]/shop) does it server-side, as a plain GET form with
sort as links. Results are therefore a shareable, indexable URL and work with
JavaScript disabled — a storefront that only works with JS is a storefront
Google browses badly. Search matches name OR description, so someone searching
"harness" finds one whose name is a brand they don't know.
Portal shop filters in memory: the whole catalogue is already loaded there, so
round-tripping to the API to filter it would be slower and no more correct.
Results narrow as you type.
Filters compose rather than clobber. Searching and then picking a category
keeps the search — each control rewrites only its own parameter, so no
combination silently discards another. A search that finds nothing offers a way
back to the full catalogue instead of the sign-up prompt, which is the wrong
answer to "no results".
Sort ids are SSOT in lib/config/products.ts. They appear in the URL, so they
are part of the page's public contract — shared links and search engines keep
them; add ids, don't rename them. `?sort=` is attacker-controlled and indexes
an ORDER BY map, so it is narrowed to a known value before use, covered by
tests including __proto__ and constructor.
`newest` is the default and is omitted from the URL, so the canonical
/en/shop stays a clean URL rather than gaining a redundant query string.
13 tests on the config; pnpm verify green (638 tests / 72 files).
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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>
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>
79 of the last 100 sends hard-bounced — an 80% bounce rate against an SES
suspension threshold near 5%, on a Resend key shared with the rest of the
fleet. The reputation that carries real owners' password resets was being
spent on fixtures.
The e2e walkthrough and the smoke timer create ~20 accounts per run at
petvity.orangecat.ch. Those are real rows in the real database, so the app
correctly sends them real welcome, booking, order, adoption and reset mail —
to a domain that serves HTTP and has no MX. Every one bounces. The damage had
already crossed over: a real tester mailbox (proton.me) sits on the
suppression list receiving nothing, which is exactly the silent-lockout
failure mode — reset says "check your email", no email ever arrives.
sendEmail() now drops recipients that provably cannot receive mail, before
anything reaches the wire. Suppression is safe precisely because these domains
have no mailbox: nothing that would otherwise be delivered is lost. It returns
{ sent: false } rather than throwing, so callers behave exactly as they do when
RESEND_API_KEY is unset — a path already covered by tests — and queued items
are not retried forever.
The list is SSOT in lib/config/email.ts: two exact domains that resolve without
a mailbox, plus the RFC 2606 reserved TLDs so any future fixture using
.invalid/.test is suppressed without editing the list.
Verified the guard fails without the fix (6 of 9 tests red), passes with it.
Also refreshes CLAUDE.md, which was stale in three places and would have taught
the next session wrong: all six cron routes are in fact wired to systemd timers
and returning HTTP 200 (it claimed they were unwired); RESEND_API_KEY,
RESEND_FROM and ADMIN_EMAILS are set in production (listed as missing); and
prod env lives in /opt/petvity/shared/.env, not .env.selfhost.local.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The demo account is the no-account way into the product. Its reset deletes
the user row so the FK graph cascades away whatever a visitor touched, then
inserts it again — but the insert let the id be generated, so every run minted
a NEW identity.
Sessions last 30 days. The reset runs every 2 hours. So within at most two
hours of signing in, a demo visitor was holding a session for a user that no
longer existed: every owner-scoped query returned nothing and the demo read as
an empty product, while writes failed the owner FK outright. Observed live —
two consecutive resets produced 8ffb17c5... then dab16518..., and a session
minted one minute before a reset was already dead.
Pinning the id keeps the cascade (still a real wipe) while letting the identity
survive it, so any session ever issued stays valid.
The demo had no test coverage at all, which is how this went unnoticed:
- a route test asserts the reseed carries the pinned id (it fails if the id
goes back to being generated - verified by reverting the fix)
- the prod walkthrough gains a demo section: the session id is the pinned one
(the mechanism), and the demo actually has its seeded pet (the symptom).
The symptom check alone is timing-dependent - it passes right after a reset
either way - so both are needed.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The dashboard answered one question — how are my pets? — and left everything
else the platform does undiscovered behind the sidebar. It now also shows what
is already in motion (the next three appointments, the three most recent
orders) and a role-aware "what would you like to do?" grid: find care, shop,
adopt, and either offer your services or manage your bookings, either set up a
store or manage the one you have.
The greeting was computed from new Date().getHours() during a server render,
which is the box's UTC rather than the reader's clock — an evening visitor in
Zurich could be wished good afternoon. It is now clock-free, and the space it
occupied says what the page is for instead.
Page purpose lines, all nine locales. The worst of them was Find a Pro:
"Connect with verified veterinarians and trusted pet sitters" claimed a
verification most professionals do not have, and omitted groomers entirely
even though grooming has been a first-class vertical since #27. Six others
described what the page contained rather than what you could do on it.
PageHeader replaces the hand-rolled title/subtitle/action markup on bookings,
find, settings, shop and orders — one header instead of five near-copies.
Status badges now resolve to the semantic badge-* tones from globals.css
through a `badge` field on the status config, rather than a parallel set of
arbitrary-value Tailwind strings that happened to render the same colours.
Documented that the liveness probe is /api/healthz: /api/health is the private
prefix for health metrics and records, so it always redirects to /login and can
never report healthy — the runbook pointed at a path that could not work.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Three things made the marketplace a demo rather than a business.
1. Orders had no delivery address. A seller could receive an order and have
nowhere to send it. Orders now carry a required address (migration 0004,
additive); the API rejects an order without one, and both the seller and
admin order views expose it so fulfilment is actually possible.
2. The directory was populated by five invented businesses. Dr. Brunner,
Sam Keller, Nadia Roth, Pfoten & Co. and Tierheim Sonnenhof do not exist —
a customer in Zurich searching for a groomer would have found a fiction.
They are removed from lib/config/resident-pet.ts, and ensureCommunity is
gone from the resident-checkin cron so nothing recreates them.
3. Nothing replaced them. lib/domain/profile-readiness.ts is now the single
rule for when a professional or seller is real enough to be listed:
identity, services, price, location, a 40-character intro, contact, and
the pro's own "accepting clients" switch. The same predicate drives the
ProfileReadiness checklist the pro sees and the SQL conditions the public
directory queries use — so the listing is earned, never hand-curated.
Selling was already open to any account (products.sellerId = userId) but was
undiscoverable; /portal/become-a-pro now says so and links to the store setup,
which shows the seller's own readiness checklist including "list your first
product".
Also: deleting a pet was reachable only by guessing it lived inside the edit
form — the pet profile now links straight to the danger zone. Professionals
could not accept a booking from /portal/bookings, and groomers were missing
from the booking role union entirely.
E2E gains two checks: an order without an address must be rejected, and the
seller must be able to see where to ship.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
- 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>
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>
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>
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>
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>
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>
petvity migrated off Vercel/Neon on 2026-06-12 (commit 9488221).
- CLAUDE.md: Vercel/Neon → self-hosted Hetzner (petvity.orangecat.ch,
service petvity-app, self-hosted PG17, local-disk storage, deploy.sh);
flagged that vercel.json crons no longer fire on the box (need a host
timer) — left vercel.json intact rather than break the schedule
- README.md: replaced create-next-app boilerplate with a real README
- lib/config/app.ts: APP_URL fallback vercel.app → petvity.orangecat.ch
- removed default public/vercel.svg boilerplate asset
- .mailmap: collapse legacy g-but identity into Mao Nakamoto
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add --warm-text, --green-border, --warn-border, --danger-border, --star to globals.css
and matching entries to design-tokens.ts; replace all remaining Tailwind named color classes
and hex literals in app/[locale]/page.tsx (testimonial avatars, signal card borders, star
rating, step-icon shadow, final-CTA shadow). Zero arbitrary hex colors now remain outside
globals.css and design-tokens.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove unused imports (Link in bookings, Package in shop/[productId], SPECIES_OPTIONS in pet edit).
Fix useEffect(fn, []) → useEffect(() => { fn(); }, []) across 9 portal pages.
Remove unused `def` variable in health page emotional metrics block.
Disable react-hooks/set-state-in-effect project-wide: our load functions call setLoading(true)
synchronously so they also work as retry callbacks — the rule generates false positives here.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SIGNAL_TEXT_CLASSES: add to pet-signal.ts config; replace duplicated
ternary (sig==="concern" ? danger-text : warn-text) in dashboard,
health, and checkin pages — was 3 identical inline mappings
formatPrice: admin overview was computing revenue inline
($${(revenue/100).toLocaleString(...)}) — now uses shared formatPrice()
formatDateShort: extend to accept full ISO timestamps (not just
date-only strings); admin users page was calling toLocaleDateString
inline — now uses formatDateShort()
User role colors: veterinarian/pet_sitter/admin used Tailwind named
colors (text-blue-700 etc.) while pet_owner used CSS vars — inconsistent
within the SSOT config; added --role-vet/sitter/admin CSS vars to
globals.css and updated lib/config/users.ts to reference them
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace hardcoded English def.description under each emotional metric
select (e.g. "1 = depleted, 5 = very energetic") with composed strings
from the already-translated tTwin scale labels ("1 = Very low · 5 = Very high"
in en, "1 = Sehr niedrig · 5 = Sehr hoch" in de, etc.).
Also remove unused EMOTIONAL_SCALE_LABELS export from health-metrics.ts —
scale labels are sourced from next-intl translations, not this constant.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
formatPrice and formatAdoptionFee now use Intl.NumberFormat(locale, { style: "currency",
currency: APP_CURRENCY }) so the symbol and number formatting are locale-aware.
APP_CURRENCY reads from NEXT_PUBLIC_APP_CURRENCY env (default "USD"), making the
deployment currency a single config value rather than a hardcoded symbol.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signal labels (Healthy/Watch/Needs attention) and digital twin state/trend
labels (Thriving/Doing Well/Needs Attention/Struggling + Improving/Stable/
Declining) were hardcoded English in config. Now served from the existing
"signal" namespace and a new "twin" namespace in all 9 locale message files.
- Remove SIGNAL_LABELS from lib/config/pet-signal.ts (superseded by "signal" namespace)
- Remove .label from TWIN_STATE_CONFIG and TWIN_TREND_CONFIG in digital-twin.ts
- Add "twin" namespace to messages/{en,de,fr,es,ja,zh,ko,tr,ar}.json
- Update 5 pages (dashboard, pets, checkin, pet detail, public pet profile) to use tSignal()/tTwin() via getTranslations
- Update DigitalTwinCard (client) to use useTranslations("twin")
- Update SignalHistoryTimeline to async server component with getTranslations
- Fix find page: wrap Promise.all in try/finally so loading spinner always clears
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The fallback was 'https://petvity.com' (an aspirational future
domain) so any environment without NEXT_PUBLIC_APP_URL set rendered
links to a non-existent domain — visible in test logs (forgot-password
reset URLs) and in any cron email that ran before the env var was
fully propagated. Production sets NEXT_PUBLIC_APP_URL=https://petvity.vercel.app
so the fallback wasn't observed live, but it was a footgun.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes the admin bottleneck for the pro network. Previously vets/sitters had
no way to self-register — an admin had to change their role manually. Now any
user can select "Veterinarian" or "Pet sitter" during registration and receive
the correct role immediately (trust-first). After sign-up, pros are redirected
straight to /portal/professional-profile to complete their listing.
Also fixes getAdminEmails() to normalize to lowercase, preventing ADMIN_EMAILS
case mismatches. Adds lib/domain/auth.test.ts (8 tests) and 4 new registration
tests covering intendedRole paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extracted in a prior session but left without test coverage. Seven cases
cover empty input, up-to-date, today's boundary, overdue, not_applicable
exclusion, multiple overdue, and null nextDueDate.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Labels and CSS classes for goodWithKids/Dogs/Cats/requiresExperience were
hardcoded across 4 adoption pages. Added LISTING_TRAIT_CONFIG to
lib/config/adoptions.ts (SSOT) and updated all pages to iterate it.
Also derives HealthLogForm emotional scale options from def.scale in
health-metrics config instead of hardcoding [1,2,3,4,5].
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Overdue vaccination count logic was repeated inline in signal-cache,
dashboard, and health-alerts cron (×2). Now sourced from a single
function in lib/config/vaccinations.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 30-day window for health chart display was hardcoded in two files.
Moved to lib/config/health-metrics.ts (SSOT for health metric config)
so changing the window requires one edit instead of two.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The stored status badge was stale — a vaccination logged as "up_to_date"
a year ago with an expired nextDueDate still showed a green "Up to date"
badge. This contradicted the signal computation (which already derives
overdue-ness from dates) and confused owners.
Added computeVaccinationDisplayStatus() to lib/config/vaccinations.ts
(SSOT). The function: propagates "not_applicable" as the only durable
user-intent status; derives overdue/due_soon/up_to_date from nextDueDate
and today for everything else. The vaccinations page now uses this helper
for badge and status-filter — keeping the list in sync with the signal.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously the cron sent an email every day for the full 30-day window
before a vaccination was due. Now reminders are sent only at the three
milestone distances defined in VACCINATION_REMINDER_DAYS (pet-signal.ts
SSOT). Uses UTC midnight comparison to guarantee exact integer day
arithmetic regardless of when the cron fires.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add SexId, SEX_LABELS, SEX_OPTIONS to lib/config/species.ts as the SSOT for
pet sex values. Replace hardcoded option elements in new/edit forms and raw
pet.sex string display in 7 listing/profile pages.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three portal pages hardcoded `/en/` when linking to locale-prefixed public
pages (/en/pros/:id, /en/pets/:handle). Now all three import DEFAULT_LOCALE
from lib/config/locales and build the path from the constant — changing the
default locale requires touching exactly one file.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create lib/config/professionals.ts as single source of truth for sitter
service labels. Fixes "walking" → "Walking" display bug (correct label is
"Dog Walking"). All three consumers now import from config instead of
defining inline or using ad-hoc string capitalization.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
HOUSING_TYPE_LABELS and HOUSING_TYPE_OPTIONS extracted to
lib/config/adoptions.ts (SSOT). Listing detail page and email template
now import from config instead of hardcoding strings.
Also updates week-one onboarding email to mention all 4 live phases.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
health-records.ts: add className (= bg + color) to every entry to match
the established SSOT pattern across all peer configs (orders, adoptions, users, vaccinations).
medications.ts: replace signal-healthy class on active status with the
same inline Tailwind pattern used by completed/discontinued so all three
medication badges render at identical visual size.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Added className (= bg + color) to USER_ROLE_CONFIG matching the pattern
now consistent across all status/role configs. Dropped the ROLE_STYLES
Object.fromEntries map in admin/users. Updated admin/orders badge to use
cfg.className (+ declared it in the local STATUS_CONFIG type).
No remaining bg+color inline interpolations in any page file.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
LISTING_STATUS_CONFIG and APPLICATION_STATUS_CONFIG now carry className
(= bg + color combined), matching the pattern established for orders and
bookings configs. The two helper functions (listingStatusClass /
applicationStatusClass) and the two Object.fromEntries local-map rebuilds
in portal/adoptions/page.tsx are removed. Admin adoptions page updated
to use cfg.className instead of interpolating bg + color separately.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both portal pages were spreading ORDER/BOOKING_STATUS_CONFIG and merging
bg+color into a local STATUS_CONFIG just to get a combined className string.
Added className field (= bg + color) to both configs so pages can reference
it directly. Admin orders page is unaffected — it still uses bg/color
separately and those fields remain unchanged.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Record type labels/colors, vaccination statuses, and medication statuses were
defined as local constants in three client components with a comment saying
'SSOT: config'. This mirrors the violation fixed in earlier commits for
orders, products, adoptions, and users — completing the pattern across all
health-management features.
- lib/config/health-records.ts — HEALTH_RECORD_TYPE_CONFIG + OPTIONS (label, color, bg)
- lib/config/vaccinations.ts — VACCINATION_STATUS_CONFIG (label, className)
- lib/config/medications.ts — MEDICATION_STATUS_CONFIG (label, className)
- Icon maps remain in each component (React components belong in the UI layer)
- CLAUDE.md SSOT table updated with the three new entries
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>