* 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>
Replace the bespoke Resend-SDK transport in lib/email/index.ts with the
fleet's shared @bitbaum/mail-kit. Contract preserved: {sent:false} when
mail is unconfigured or the recipient is an undeliverable fixture, throw
on provider API errors so the cron can mark queue rows failed. The
unconfigured gate is now mail-kit's isMailConfigured, which also rejects
placeholder keys and sandbox senders in production. Module-load FROM
replaced by call-time RESEND_FROM with the fleet-conventional fallback.
Transport tests now mock global fetch. Removes the resend dependency.
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* chore: add a formatter, matching the style this repo already writes
singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.
Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* style: format with prettier (252 files)
Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: teach git blame to skip the reformat
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
- 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>
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>
Adds sellerOrderNotification template + wires it into POST /api/orders.
On checkout, group order items by sellerId, look up sellers in one
query, send each one a notification with their items and subtotal,
linking to /portal/my-products/orders.
Sellers no longer have to poll the fulfillment page — they get
notified the moment a buyer orders. Hoisted the buyer lookup out
of the buyer-confirmation try block since it's now reused for the
buyerName in seller emails (one DB query instead of two).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sends owner a reminder the day before each confirmed booking.
Adds bookingReminder() email template; schedules cron at 0 11 * * *.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sends a one-day-ahead email when a pet's active medication ends tomorrow.
Follows the same single-JOIN / fire-and-forget pattern as
vaccination-reminders. Adds medicationEndingReminder() email template.
5 unit tests cover: auth, empty result, send, skip-null-email.
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>
- Add ## Mission section to CLAUDE.md (who the user is, what success looks like)
- Fix docs bug: createPetSlug() → createPetHandle() in lib/domain section
- Add "Find a vet near you" secondary CTA to petHealthAlert email — the
alert told owners their pet needs attention but gave no path to act;
now it links directly to /portal/find to close the monitor→understand→act loop
- Commit drizzle/ migration metadata (was untracked)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- orderConfirmation: sent to customer on POST /api/orders
- orderStatusUpdate: sent to customer on PATCH /api/orders/[orderId]
(confirmed / shipped / delivered / cancelled only — not pending)
- adoptionApplicationReceived: sent to listing owner on application submit
- adoptionApplicationStatusChanged: sent to applicant on approve/reject
- register page: honour ?returnTo param so adopt → register → apply flow works
- All emails fire-and-forget; never block the API response; gracefully
skip when RESEND_API_KEY is not set
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add bookingRequestReceived template — sent to professional on new booking
- Add bookingStatusChanged template — sent to owner on confirm/cancel/complete
- Wire sendEmail (fire-and-forget) into POST /api/bookings and PATCH handler
- Email failures never block booking creation or status updates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- forgot-password: only write reset URL to stderr in non-production and
only when RESEND_API_KEY is absent — prevents token exposure in Vercel
logs while RESEND is unconfigured (current production state)
- email/index.ts: suppress recipient address from warn log in production;
keep dev-only stderr notice for missing key
- records/page.tsx: add missing startTransition(router.refresh()) after
delete (consistent with medications + vaccinations pages)
- CLAUDE.md: correct species count (4, not 10)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Full Phase 1 scaffold:
- Next.js 16 + TypeScript strict + Tailwind 4 + Neon/Drizzle + NextAuth 5
- 9-language i18n (EN DE FR ES JA ZH KO TR AR) with RTL support for Arabic
- SSOT config: species (10 types), health metrics (7 KPIs), pet signal system
- DB schema: pets, healthMetrics (unique per pet+day), vaccinations, medications,
healthRecords, emailQueue
- Numeric storage: weight=grams, temperature=centidegrees (no float drift)
- computePetSignal() — pure domain function, 9 unit tests passing
- API routes: auth, account, pets CRUD, health metrics (upsert), records,
vaccinations, medications, public pet profiles (no auth)
- Cron: health-alerts, vaccination-reminders, email queue (all Bearer-protected)
- Portal UI: dashboard, pet list, add pet, health tracking, log page, vaccinations
- Public influencer pet profiles at /[locale]/pets/[handle]
- Email templates: welcome sequence, health alert, vaccination reminder
pnpm build ✓ pnpm test ✓ (9/9)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>