4 Commits
Author SHA1 Message Date
CatoandClaude 56f7d2e62e feat(pay): one payment flow; a purchase is an order; a service is booked first; the Cat answers when alone (#1754)
* fix(community): a QA run's posts and listings stay off the public shelves

Live after #1736, /community opened with "QA test post from A" by
"QA Grok A", and Discover's first product, "Old Road Bike", was that QA
account's too, its share card reading "by QA Grok A".

- The community feed drops posts whose author's display name is a fixture
  name (NOT_A_FIXTURE_AUTHOR, the People directory's rule on the view's
  actor_data); checked read-only against production.
- 20261113201500 marks the QA account's remaining products, services,
  projects and causes is_test (matched by id and its QA name; nothing
  deleted; rollback in the file).

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

* fix(timeline): sign every post author through one byline helper

A minted user_<hex> handle was still printed as name and @handle on
/community, in quotes, reposts, the reply placeholder and the post's
share text. postAuthor() (src/utils/byline.ts) is now the one rule:
chosen name, else chosen handle, else the neutral phrase; no @line for
a minted handle; the avatar plate shows a person glyph, not its letter.

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

* fix(companions): no bot face is orange; check:one-orange covers the pigments

orange and amber are replaced in place by two shared map-scale token
values (indigo, steel), so every other name keeps the face it had. A
stored face URL with hue=orange/amber resolves to its replacement.

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

* feat(cat): one face for the Cat, used everywhere it is drawn

CatAvatar draws the brand icon tile; CAT_AVATAR_PATH is the same drawing
for slots that only take a URL. Feed, quotes, the answering row, the
mention menu, the profile, follow lists, Messages (list, picker, thread)
and the profile share card all use it. The answering row's AI chip is
neutral like the post header's, not orange.

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

* feat(not-found): one not-found page for every kind

components/ui/NotFound.tsx is the only 404 design: 'This {kind} isn't
here', one sentence, a search that goes to Discover, the kind's own
shelf and Home. Every public detail route has a not-found.tsx naming
its kind (products, services, events and others fell through to 'Page
Not Found'), wallets no longer have their own layout, and tab titles
come from notFoundTitle() in sentence case with registry names.

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

* refactor(cat): name the Cat's picture a src, not a path

audit:routes reads a *_PATH string constant as a page link and failed on
the static icon. It is an image source.

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

* feat(legal): read the operator from one unset constant

LEGAL_OPERATOR (src/config/legal.ts) is null: the legal entity is not
known and is not guessed. While null, /terms and /privacy say what they
said before and stay marked Draft. Once filled in, the opening sentence
and Contact section of both carry the legal name, address and contact.

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

* style(projects): merge a duplicate import to stay inside the size limit

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

* test(ci): cover the bot-face check in the one-orange gate fixtures

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

* feat(cat): one real answer for a visitor, and a pay-link name check

POST /api/cat/first-answer answers a visitor's own sentence before they
have an account, on the visitor budget (general per-IP, then 3 an hour of
its own), for the page's own origin only. Nothing is stored.
GET /api/pay/name says whether a pay-link name is free to claim.
The door helpers carry a typed sentence through sign-up to the Cat.

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

* fix(faq): say about Cat Credits what the pricing card says

The FAQ offered credits as open while /pricing badged them "Not open
yet". Both sentences are now built in cat-plans.ts from
CAT_CREDITS_ON_SALE. The free plan no longer calls Gemini open-source.

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

* feat(home): the home page sells the outcome, in one promise

The hero is the promise and one action: claim orangecat.ch/pay/<name>,
with the page that name makes shown as it is typed. Under it, Discover's
own "Just listed" rows instead of the studio grid and the small counts,
then the Cat's door, which answers a visitor's sentence once and invites
them to sign up with the sentence kept (the account screen shows it).

The promise is written once in config/brand.ts and read by the hero, the
titles and descriptions, the share card, the sign-in panel, About and the
footer. /pricing opens on "0% to sell"; the Cat plans follow.
The start action is named for what you get: "Get your page".

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

* feat(entities): one cover picture for every kind, in every create and edit form

ENTITY_COVER (src/config/entity-cover.ts) names each kind's cover column
once. base-config-factory puts the same picture field under the description
of every form (and into the wizard step that shows the description), the
schemas accept it, creates write it through coverColumn and updates through
coverFieldMapping, which also lets a removed picture clear the column.

Five kinds had no column to keep a picture in (service, cause, asset, loan,
research): one migration adds a nullable cover_image_url to each and makes
public_documents() read every kind's cover first, so Discover and search
show it. Rollback is in the migration.

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

* feat(discover): the cover is the hero, the card and the share picture; no picture shows the kind's icon

The public page's hero, the Discover and search card, the dashboard card, a
profile's shelves and the share card all read the kind's cover through
entityCoverImages. Without a picture a listing shows its kind's icon on a
token surface (EntityCoverPlaceholder) on every list, replacing three
different letter plates; a bot wears the face its name picks and a person
keeps a round initial.

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

* docs(changelog): home sells the outcome, a picture for every kind, one byline

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

* fix(messages): the Cat answers every message in a conversation with only the Cat

A one-to-one with the Cat stayed silent unless the message tagged @cat: only
a tag queued a reply. Alone with it there is nobody else a message could be
for, so a message there is owed an answer without a tag. In company the Cat
still waits to be tagged.

- isAloneWithCat(): one person and the Cat, asked by the write path and by
  the reply.
- The reply is worded for it (nothing was tagged) and carries no
  requested_by: there is nobody else it answered for.
- A message of only files asks nothing.

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

* feat(messages): New opens on the Cat, your bots, recent people and people you follow

The New message sheet opened on the viewer's own bots only, so for anyone
without a bot it was empty until they typed. It now offers the Cat first, then
their bots, the people of their latest one-to-one conversations and the people
they follow (eight people at most, nobody twice, no unnamed placeholder
accounts). Typing still replaces the list with the search.

- The Cat found by search is shown as an agent, with its own face.
- Alone with the Cat, a sent message shows it writing and looks for its
  answer, as with a bot.

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

* feat(payments): one payment flow, purchases as orders, services booked first

One flow. Paying a person, supporting a page, investing, buying and paying a
booking now share /pay's words, steps and receipt:
- src/config/payment-flow.ts and pay-words.ts are the one vocabulary (the verb
  and the figure, "Waiting for the payment…", "Change amount", "Paid").
- PaySteps draws the code, the claim, expired and failed once; PayFlow, the
  support card, the purchase dialog, the ticket card and the booking use it.
- Every success is MoneyReceipt (To / For / When). "Tip" becomes "Support".

A purchase is an order. A signed-out buyer was shown the seller's bare address
and typed the price by hand; nothing recorded the sale. Now they give a name
and get a code for the price, minted on the seller's wallet, with an order row
(buyer_id NULL). Orders have a page (/dashboard/orders) for seller and buyer.

A service is booked first. The service page has no purchase; once the provider
accepts, the booking asks for the payment through the same flow, and settlement
marks the booking paid (orders.booking_id). No escrow: the money goes straight
to the provider's wallet.

Who is paid and what is charged are unchanged: resolveSellerWallet and
resolveAmount (the booking's own price_btc for a booking).

Migration 20261114091700: orders.buyer_id nullable, orders.booking_id.

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

* fix(bookings): a booking's money is server-written, paid once, and never "paid" by the customer's own hand

- Migration 20261114104100: clients lose INSERT and table-wide UPDATE on
  bookings and keep UPDATE on the five columns confirm/reject/complete/cancel
  write; the customer's policy only allows cancelling. createBooking inserts
  through the service role.
- Paying a booking reads the price with the service role and what is paid
  from the booking's paid orders, never from the client-visible row.
- One live invoice: an open request is checked against its rail and handed
  back instead of minting a second; nothing is minted while a claim or an
  on-chain confirmation is pending.
- Settlement recomputes total_paid_btc from the paid orders (no read-then-add).
  A payment landing on a cancelled, declined or no-show booking is recorded on
  the order, not applied to the booking, and both sides are told.
- An unpaid booking can still be paid after it is marked complete.

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

* fix(payments): a pass is not sold without an account

A Supporter or Loki pass is granted to the buyer's account at settlement; a
guest has none, so the money arrived and nothing was granted. The guest
purchase refuses such products before any invoice, and the page offers
sign-in in place of the guest panel, saying why.

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

* fix(payments): booked-first holds on the server; a guest buyer is named; a request never made is not a failed payment

- POST /api/payments refuses a service and points to the booking; so does
  /api/v1/payments for a person's session. A key or OIDC caller keeps it:
  Loki pays a builder booked on its own side through a service.
- The seller's email names a buyer without an account instead of looking a
  profile up by a null id; a claimed purchase is "a buyer", not "a supporter".
- An initiation error (no wallet, nothing left to pay) is titled "This could
  not be started", not "This payment did not go through".

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

* docs(changelog): one way to pay, guest orders, booked first, the Cat alone

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

* fix(migrations): say why dropping NOT NULL on orders.buyer_id is rollback-safe

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

* fix(messages): suggestions read the follow list through the shared reader

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

* fix(discover): a person's card never prints a minted handle

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-14 12:16:13 +01:00
CatoandClaude 4187188712 feat(events): buy a paid ticket without an account; listing pages open again on phones (#1313)
A paid event sent every signed-out visitor to sign up. For Bitcoin the
account-free rail already existed (public support, tips), so a guest now
gives a name and pays the organizer's own wallet directly:

- guestTicketPurchase: publication gate, sold-out refusal before payment,
  server-side price, an intent carrying guest_name and a bearer status token.
- Settlement issues the ticket to that name (issue_paid_guest_ticket,
  idempotent on the payment); the public status poll returns the ticket page.
- usePublicPayment + PublicPaymentProgress: the poll/acknowledge/resume loop
  once, shared by the support panel and the ticket purchase.
- A paid ticket can't be given back from its page; the organizer refunds a
  guest "another way" (no wallet on record), recorded with a null recipient.
- Migration 20261011220000: payment_intents.guest_name, the issue function,
  guest_ticket returns payment_status, claim_guest_ticket points at the
  purchase, event_payouts.recipient_user_id nullable.

Also fixes a crash from #1311: MobileStickyCTA (a server component) called
the client hook useMobileActionBar, so public listing pages with a sticky
buy bar switched to "Something went wrong" after loading. The bar is now its
own client component.

Verified: every migration replayed on Supabase Postgres 15 and the new
functions exercised as anon/service_role/organizer; the purchase driven in
Chromium at 390px from name to QR to ticket page.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 15:56:05 -07:00
CatoandClaude Opus 5.5 b3b33f3d74 feat(money): decide where money paid to you goes, in order (#1300)
* feat(money): decide where money paid to you goes, in order

A person lists their wallets in the order money should cover them: a
share of everything that comes in (taxes first), then amounts to fill —
once (a debt) or every calendar month (rent, insurance). When someone pays
them, the WHOLE payment goes to the first line still behind; over many
payments the totals converge on the rule. OrangeCat never holds or splits
money: the payer's wallet pays the chosen wallet directly.

- money_routes (owner-only RLS; the row AND the wallet it names must be
  the caller's; nothing for anon). Keyed by profile_id like the personal
  wallets it routes between.
- domain/money-routes/routing.ts: pure decision. Shares compare in BTC
  (no rate needed); fills compare at each payment's price on arrival
  (rates_at_paid, #1295), today's rate if none, and never count money
  nobody can value as filling a line.
- resolveUserWallet asks the rule first. No rule, a satisfied rule, an
  unreadable rule or an unpayable destination all fall through to the
  usual choice — a rule can never make a person unpayable.
- GET/PUT /api/money-routes; saving keeps each kept line's start, so
  reordering or correcting an amount never resets its progress.
- "Where your money goes" on Your money: the order, each line's progress,
  the line the next payment lands in, "Covered" markers, and an editor.
  Screenshotted at 390px and 1280px (no horizontal overflow).

Tests: routing as a table (incl. convergence: a 25% share of 200 equal
payments lands 50 ±1), resolution end to end on the fake DB (gains a real
`gte`), saving and validation. Proved by mutation: disabling the hook (3
red) and the date window (2 red); the DB date filter is a redundant
optimisation and mutating it alone is correctly not caught.

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

* refactor(money): split the waterfall screen and the address minting under the size limits

CI's check:sizes refused two files (no new exceptions allowed):
- MoneyRoutes.tsx (407 > 300): the editor is its own component
  (MoneyRoutesEditor owns the draft and the save, hands back the server's
  answer) and the shared shapes/formatting live in moneyRoutesFormat.ts.
- walletResolutionService.ts (516 > 500): materializeOnchainAddress — the
  one step that WRITES (claims a derivation index at invoice creation) —
  moves to onchainAddressMaterialization.ts, apart from resolution, which
  only decides. Its importers point at the new module; no re-export, so
  there is one path to it.

And the changelog's {#money-routes} anchor is declared on the roadmap, with
the Solon-suggested tax line as the open next step.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 09:05:47 -07:00
e99115c3bd feat(money): amount entry people can use, and payment logic the tests actually constrain (#615)
* test(payments): constrain who gets paid and when money counts as settled

Mutation testing showed the payment tests executed this code without
checking it: 65% of mutants in wallet resolution and 60% in settlement
survived the whole suite. Two shapes of hole.

First, the query WAS the logic. Deciding who receives money is mostly
filters and orderings — is_active, profile_id, group_id, primary-first —
and the old doubles returned a fixed row for any query, so every filter
could be deleted with the suite still green. Tests now run against a fake
that applies the query (test-utils/fakeSupabase), with a deactivated
wallet and a stranger's wallet present in the fixtures so a missing
filter changes who gets paid.

Second, two exported functions had no tests at all: the address the owner
is SHOWN as their receiving address, and who gets credited when money
arrives. Same for the token-authenticated path a payer with no account
uses to poll and to report "I've paid" — so nothing checked that a wrong
token reveals nothing, or that a payer's word is refused on rails that
answer for themselves.

Also pins settlement dispatch: each method asks its own authority and no
other, no rail is asked without the field it needs, mempool is not money,
and expiry is only the truth after the rail has said nothing arrived.

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

* feat(money): enter the amount like a person, and know you can send before you type

Two problems, both found by using the screens rather than reading them.

The amount input had the priority backwards: a row of preset pills in BTC
decimals, with typing your own amount hidden behind a "Custom" button that
only committed on blur. Every money app people already use opens on an
amount you type first, in the currency you think in. AmountField does
that — big tap-to-type value in your display currency, the BTC figure
always visible underneath because Bitcoin is what actually moves, and
presets demoted to suggestions.

Three rules it will not break: a missing exchange rate switches to BTC
entry rather than silently converting your "20" into 0 BTC; an
out-of-range amount says so instead of being quietly clamped to
something you did not type; and `inputMode="decimal"` gives phones the
plain number pad and accepts the comma half of Europe types.

Driving the real page found two more. The suggestions were round in the
wrong unit — a CHF user saw "CHF 0.52 · CHF 2.59 · CHF 5.18", arithmetic
noise — so the ladder is now round in whichever unit is being typed. And
the field arrives pre-filled with a suggestion, so typing APPENDED to it:
"27.50" over a suggested "5.18" became "27.51850", an amount the payer
never chose. It now selects on focus.

Second problem: /send let you fill in a recipient, an amount and a note
before telling you, on the final tap, that you have no wallet to send
from — the worst moment to say it, and knowable before a keystroke. It
now asks the same resolution the payment runs (GET /api/send) and shows
the connect-wallet state instead of a form that ends in a refusal.
Requests got the matching fix: the payer is resolved while you type, so
asking someone who does not exist fails visibly rather than on submit.

Also: the committing button sticks to the bottom on phones, where these
forms are taller than the viewport.

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

* test(payments): pin which group wallet receives when several could

group_wallets has no is_primary, so creation order is the entire
tie-break — and nothing constrained it. Two equally capable treasury
wallets would receive in whatever order Postgres happened to return.

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

---------

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 10:05:30 +00:00