Commit Graph
287 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 c10ee6b98f fix(wallets): a wallet link is deleted with its entity, whatever deletes it (#1570)
entity_wallets is polymorphic, so only the CRUD handler's DELETE cleaned it
and every other path leaked. The 2026-11-06 data-invariant gate found three
links (a project, two AI assistants) whose entities were deleted with no audit
row, i.e. outside the app. An AFTER DELETE trigger on each entity table
removes the links in the database, and the migration clears the existing
orphans so the gate is green on apply.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 06:34:42 +01:00
Cato 0b970d0f18 Protect learned offerings and keep Cat recovery controls usable (#1558)
* Require owner consent before publishing learned economic offerings

* Honor the feedback host hiding contract in chats and overlays

* Wait for authenticated DOM before responsive layout checks

* Report safe sign-in lifecycle metadata when responsive checks fail

* Consolidate the remaining Cat privacy and recovery release handoff

* Prevent caching of the owner-only offerings response

* Use and verify the actual no-store policy for private offerings

* Reload sharing state safely after an uncertain write result
2026-11-04 16:51:35 +01:00
Cato 702d5593de fix(cat): preserve failed turns and expose safe diagnostics (#1543) 2026-11-04 14:52:20 +01:00
Catoandcatomean 705056ac9f fix(messages): members can see each other's read state, so read receipts show (#1549)
Co-authored-by: catomean <catomean@users.noreply.github.com>
2026-11-04 13:01:11 +01:00
Catoandcatomean 1b64f443b9 fix(profile): uploads work, Cat on the profile editor, sidebar name opens your profile (#1544)
* fix(profile): avatar/banner uploads, Cat on profile editor, sidebar name opens your profile

* fix(profile): avatar/banner uploads, Cat on profile editor, sidebar name opens your profile

* test: sidebar avatar links to profile; ci: supabase CLI renamed [inbucket] to [local_smtp]

---------

Co-authored-by: catomean <catomean@users.noreply.github.com>
2026-11-04 12:22:49 +01:00
CatoandClaude 09862475c3 feat(oauth): accept AccountKit's callback for petvity, surf-your-life and loki (#1508)
AccountKit returns from "Sign in with OrangeCat" to
/api/auth/oauth2/callback/orangecat. This data migration adds that URI
beside each client's Auth.js one, as 20261101120000 did for evig.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 08:49:57 +01:00
CatoandClaude Fable 5.1 30ed087aef feat(bots): a bot writes first on the person's own key, and can ask Loki as them (#1503)
* feat(bots): a bot writes first, on the person's own key

A person can tell one of their bots to write first, every day at a time
they pick, with a prompt they wrote. The run happens on the person's own
OpenRouter key only; without a key the routine is kept, shown as waiting,
and skipped with the reason, so no platform key is ever spent by a timer
(fleet standing rule 2026-09-25).

- companion_routines table (one per person per bot, owner-only RLS),
  routines-store (time validation, next run in the person's zone) and the
  runner behind a cron route + 15-minute systemd timer, registered as a
  person-asked timer in the no-background-ai gate with a marker check.
- GET/PUT/DELETE /api/ai-assistants/[id]/routine for the owner.
- RoutineRow in a bot's own chat: "Writes first, every day", time and
  prompt inline, a line to Settings when a key is missing.
- Hands: the proposal line names what will be set up, never only "Sure";
  a created event's outcome carries its link.

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

* feat(bots): a bot can ask Loki, as the person — the first connector

ask_loki: a Cat action (communication, low risk, confirmed) in the hands
launch set. The bot relays a question over the signed OrangeCat → Loki rail
to Loki's POST /api/orangecat/ask, which runs a read-only turn as the Loki
user linked to the actor; Loki's own sentence is the outcome the person
reads, and a refusal (no linked account, a spent budget) is relayed as
written. A relayed question can never dispatch, approve or spend: that stays
with send_task_to_loki, and the two verbs name each other so a question is
never dispatched as a task.

ADR-0013: D6 first connector and D7 recorded as shipped.

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

* fix(bots): the routine's day-in-zone comes from the timezone helper

check:app-locale (new on main) refuses a literal locale handed to Intl; the
routine's next-run computation now takes the day in the person's zone from
instantToWallTime, the one rendering the app already trusts.

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

* fix(bots): the chip knows the verb of ask_loki

The tool-label table of leading verbs gains ask → Asking / Asked, so the
chip for a bot's question to Loki never falls back to the generic label.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 07:40:33 +01:00
CatoandClaude 5db77333fb feat(oauth): accept evig's AccountKit callback beside its Auth.js one (#1501)
evig is staging its move to @bitbaum/accountkit, which returns from "Sign in
with OrangeCat" to /api/auth/oauth2/callback/orangecat. Redirect URIs match
exactly, so the new path is added beside the old one; both work whichever
evig release is live. Same shape as the Substrata migration of 2026-10-29.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 06:01:57 +01:00
CatoandClaude a06b0b0808 feat(companions): one home where companions talk, together and with the fleet (#1474)
/companions/talk is the messaging-app home for every companion: one list of
bots and group chats, newest first, with face, "Name · job", last line and
when; "+" offers New companion (name, shape, colour — the job is defined in
chat) and New group chat (two to six members, @-mentions, bot-to-bot
handoff, six bot turns a round, every line says who said it). The fleet's
own bots (Diplodoctor, Causius) sit in the same list and the same rooms over
one /api/ask contract, their identity from the fleet map; a 1:1 chat with
them stays in the browser. Members can be added and removed from the
details sheet. Companions is in the sidebar's More section.

Three owner-only tables (companion_rooms, _members, _messages) under RLS;
room services for mentions, planning, prompts, the fleet contract and
rounds; faces as a static SVG route. ADR-0013 records the decisions and
what is deferred (connectors = MCP + skills, routines, voice). The Grok Bot
screenshots that shaped this live in docs/research/grok-bot/ with an index.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 09:16:12 +01:00
CatoandClaude 6819379afe fix(oauth): accept Substrata's AccountKit callback beside its old one (#1471)
Substrata's sign-in moves onto @bitbaum/accountkit, whose OrangeCat button
returns to /api/auth/oauth2/callback/orangecat. Redirect URIs match exactly,
so the new one is added beside the old: both work whichever release is live.
Data only, idempotent.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-29 10:44:41 +01:00
CatoandClaude 45b68d6da8 feat(requests): a request stays in the currency it was asked in (#1427)
"Lena asks Marco for CHF 20" was frozen as a BTC decimal when asked, so the
person asked could open the link days later and be shown a different number of
francs. The request now keeps ask_amount / ask_currency beside amount_btc.

- The server prices the ask itself (never the browser's BTC) and refuses to
  send it when there is no rate, rather than guess a figure.
- The pay page opens on what the ask comes to in Bitcoin today, not on the
  number frozen into the link.
- Settlement counts the request paid when the payment covers the ask at
  today's rate, with 2% of room for the rate moving between invoice and
  payment. Requests in BTC keep the tighter tolerance.
- Lists, the notification and the receipt word the amount as it was asked.
- AmountField reports what was typed, in the currency it was typed in.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-24 07:47:45 +02:00
CatoandClaude Fable 5.1 7be4d2dd1e feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#1398)
* feat(chat): the answer feedback loop — thumbs, transcript export, nightly review

Under every Cat answer, chatkit 0.14's thumb up and thumb down (one shape in
every fleet product): a thumb down asks why in one tap and takes a few words,
and the app posts it to POST /api/chat/feedback, stored in the new
chat_feedback table beside the conversation (RLS: insert by the owner, no
read through the API keys). A thumb on an answer still on screen resolves to
the conversation's newest stored answer, since the thread never learns the
row id of a live turn.

GET /api/chat/review-export serves the day's conversations to the fleet's
nightly reviewer (Loki) as chatkit's ChatTranscript[]: bearer
CHAT_REVIEW_TOKEN compared in constant time (401 wrong, 503 unset), never a
temporary chat, newest first, at most 50, 30 turns each, 4000 chars a turn,
the tool steps Cat took, a failed flag on a turn that died, and the thumbs —
with no name, email, user or actor id. The scope sentence is derived from
Cat's own system prompt and tool list, never typed twice.

- @bitbaum/chatkit ^0.14.0
- .env.example names CHAT_REVIEW_TOKEN; docs/reference/api/chat.md has the loop
- the export's bare {product, scope, transcripts} is a fleet wire format, so
  the envelope lint rule carves it out like LNURL
- unit tests for the token check, the export shape and the feedback schema

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

* chore(deps): next 16.4.2 — the audit's critical and high advisories

The dependency audit failed on this PR's head with two Next.js advisories
(>=16.0.0 <=16.4.0: unauthenticated RCE, App Router DoS), published after
main last went green. Not this PR's change; the fix is upstream, so it
rides here. `pnpm audit --audit-level=high --prod` is clean again.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 14:19:26 +02:00
CatoandClaude a12fdc18ac fix(money): a paid request says Paid; a timed-out send is not a retry (#1406)
Review of the money surface through the people who use it found four places
where it told the wrong story:

- A request never became Paid. The table held the place for the answer but
  the pay link carried no request, so Marco paid and still saw Pending with a
  Pay button, as did Lena. The link now names the request; the invoice mint
  checks it is open and addressed to the recipient and stamps it on the intent
  (new payment_intents.payment_request_id); settlement marks it paid only when
  the payment covers the ask, and tells Lena who paid. Opening the link of a
  paid request says so instead of offering the form.
- A send that timed out put the person back on the filled-in form with the
  button live, though the server had said it may still go through. It now has
  its own screen with nothing primed.
- Send accepted your own name, and promised payment to someone who only
  receives on-chain, refusing after the review step. Both are said up front.
- The pay page dead end got the same reason and message nudge as Send, and
  notifications count in the reader's currency instead of BTC decimals.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 11:45:39 +02:00
Cato 4ad63c1187 Enforce authenticated author identity in the legacy post writer (#1396) 2026-10-22 20:30:32 +02:00
Cato 8b4a3c7a80 fix(money): a phone number is shared on request, whatever the caller sends (#1380)
- paymentMethodsService.visibilityFor forces on_request for every rail whose
  registry entry reveals 'phone' (Twint, Bizum, Wero, Swish, MobilePay,
  PayNow, M-Pesa). An API call that omits visibility, or sends public, can no
  longer print a phone number on the public pay page. Other rails keep the
  caller's choice, public by default.
- Migration moves rows already saved as public to on_request (rows from
  #1372 before #1375, or any caller that omitted the field).
- Test covers every phone rail and every other rail from the registry.
2026-10-22 01:11:26 +02:00
Cato 7090e2f189 fix(money): payment_methods grants match money_routes — nothing for anon (#1381)
Default privileges gave anon and authenticated ALL on payment_methods. RLS
kept rows owner-only, but anon had no reason to hold any grant (the pay page
reads through the server). Revoke, then grant authenticated the four row
operations RLS governs, as money_routes does.
2026-10-22 00:51:21 +02:00
CatoandClaude 54dc1c6a20 feat(money): a way to be paid states its identity cost, can be shared on request, and comes from everywhere (#1375)
The first version printed a Twint row's phone number on the public pay page
for anyone with the link (owner: "do I really need to make my phone number
public?"). Pseudonymous by default means no.

- The registry is rebuilt on the three axes every rail actually differs on
  — identity (what the payer learns), custody (who holds it), reach (where
  and in what unit) — and docs/architecture/MONEY_RAILS.md says why once.
  `payerLearns(reveals)` builds the one sentence; the add sheet shows it
  above Save, and every row repeats it, the Bitcoin row included ("only
  @cato"), so the difference is a visible property.
- `visibility` column: `public` or `on_request`. An on-request row's
  handle is stripped on the server (toPublicPaymentMethod); the page shows
  the rail by name and an Ask button that opens a message to the owner
  (ROUTES.MESSAGES_TO, now also the profile's Message button). Phone-shaped
  rails default to on request.
- Rails from everywhere: Pix, UPI, M-Pesa, Alipay, WeChat Pay, PayNow,
  Swish, MobilePay, Bizum, Wero, Tikkie, Zelle, Interac e-Transfer, Monero.
  Validation is by handle kind (phone, username, IBAN, UPI id, Pix key,
  address, …), so a new rail is one registry entry. The sheet groups by
  region, worldwide first.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 07:28:41 +02:00
CatoandClaude Fable 5.1 dbe9caaa49 feat(cat): temporary chat — never listed, never remembered, gone when you leave (#1374)
* feat(cat): temporary chat — never listed, never remembered, gone when you leave

"Temporary chat" in the conversations rail: the row the first send creates
is `ephemeral` (cat_conversations.ephemeral, migration 20261021120000). It is
never in the list, the Cat learns no memories from it, and it is deleted the
moment the person leaves it — a new chat, another thread, a closed tab (the
delete goes with keepalive). The daily cleanup cron sweeps any left behind
by a dead phone. The toolbar says "Temporary chat" while one is open or
armed. src/lib/chat/temporary-chat.ts holds the leave rule, pure and tested.

The cleanup cron's tasks moved to services/maintenance/cleanup-tasks.ts to
keep the route under its size limit.

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

* test(cron): the cleanup test knows the temporary-chat sweep; unique migration timestamp

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

* fix(cat): the answer row sits under the answer, not inside the provenance line

It was inserted inside the provider · model span (#1373); CodeQL flagged
the guard that misplacement made always-true. Now it follows the
provenance block, on every assistant answer with content.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 07:23:34 +02:00
CatoandClaude ed65865a06 feat(money): one payment surface — a scannable code, every way to be paid, one Send field (#1372)
Receive opens on what the bottom bar's QR icon promises: a QR of the pay
link with the owner's name on it, the link under it, Copy link · Share as
two equal cells, and "Add an amount" that the code and the link then
carry. Under it, every way the account is paid, as one list: Bitcoin first
(the Lightning name and the wallet it lands in), then any other app the
owner adds — Twint, PayPal, Revolut, Cash App, Venmo, Wise, a bank, a link.
OrangeCat is currency-agnostic by principle; this is the first surface that
is.

- payment_methods table + registry (src/config/payment-methods.ts) + domain
  service + /api/payment-methods. Handles are normalised per method (an
  IBAN passes mod-97, a pasted paypal.me link becomes the name).
- /pay/<username> shows the other ways under the Bitcoin flow, each with
  the one action its service has: open with the amount filled in when the
  service takes that currency, or copy. A page with no Bitcoin wallet but a
  Twint number is still payable. These settle outside OrangeCat and the
  copy says so.
- Send is one field: username, Lightning address, invoice, or a scanned
  code — someone's Receive QR included, amount prefilled. The person /
  invoice tab row is gone.
- Receive, Send and Request share one frame (MoneyPage lost its icon prop
  on purpose); in-app actions are monochrome primary; the note is a button
  that says "Add a note"; amount suggestions are four equal cells.
- Design discipline written down: CLAUDE.md → "Design discipline: one
  shape per kind" (instances, gates, pre-PR checklist), pointing at the
  fleet-wide rule. New gate check:choice-rows fails a wrapping box of
  choices; it found two (weekday picker, help-wanted tags), both fixed.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 06:49:12 +02:00
CatoandClaude 13fee583e4 fix(services): portfolio links name the live hosts (#1352)
A service's portfolio_links still listed https://sink.orangecat.ch (retired;
the client's site is sinktattoo.com) and https://fleetcrown.orangecat.ch,
which only redirects to loki.orangecat.ch. Data-only migration rewriting
those two elements in place.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 14:46:24 +02:00
CatoandClaude 81dc3601f7 fix(services): Sink is published at sinktattoo.com (#1350)
A service description still named the retired host sink.orangecat.ch
(retired 2026-08-20 in bitbaum/fleet registers/retired.json). Data-only
migration replacing the host.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 14:17:33 +02:00
CatoandClaude Opus 5.5 b774f06de7 docs: correct drift in agent instructions, README and ops docs (#1348)
* docs: correct drift in agent instructions, README and ops docs

- Auto-merge sweep lives in bitbaum/fleet, not bitbaum/dotfiles; cd.yml is
  dispatch-only (handed off by ci.yml post-main), not a workflow_run listener
- Design-system docs match globals.css / tailwind.config.ts: warm accent
  #ff5c00, bg-bitcoinOrange (no bitcoin-orange utility), tiffany/orange are
  legacy; display typography is shipped
- .claude rules: real paths (src/lib/validation/, entityCrudHandler.ts,
  standardResponse.ts, withZod/withRateLimit/withRequestId, services/actors),
  real Button/Alert APIs, real rate limits, search via @bitbaum/searchkit,
  real payment modules, PostgREST instead of the POSTGRES_URL tunnel,
  lint-staged pre-commit, eslint.config.mjs
- README/AGENTS/REVIEW: Next 16 / TS 6 / Tailwind 4, pnpm, messaging is not
  E2E-encrypted yet, beta not Live, CD deploys, migrations apply on deploy
- docs/: deploy process, CI/CD, migrations guide, moved docs/ paths, stale
  CLI-entity and edge-function docs flagged

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

* style(docs): prettier on the docs touched by the drift fix

lint-staged would have run this; the commit was made without hooks.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 12:07:09 +02:00
CatoandClaude 753b042a4d feat(search): @bitbaum/searchkit — one slip in a name never loses it (#1322)
The SoundCloud failure, fixed and made shared. Postgres trigram similarity
cannot promise it (cqto/cato share 2 of 5 trigrams; kanye/kayne score 0.2)
and fuzzystrmatch counts a swap as two edits, so typos are now decided by
counting edits in a fleet package:

- packages/searchkit (@bitbaum/searchkit, zero deps, React optional):
  folding (accents, ß, umlauts spelled out, camelCase, joined/split words),
  bounded optimal-string-alignment distance, typo budget 0/1/2 at <4/4/8
  letters (budget of the MEANT word when a short word matches nothing),
  prefix-while-typing with typos, Algolia-order tie-break ranking, highlight
  ranges, vocabulary corrections for any database, did-you-mean, generated
  typo regression suites, and useSearchAsYouType/Highlight for React.
- Migration: search_public takes p_terms (corrections any of which make a
  row a candidate); public_search_text feeds the vocabulary.
- /api/search + services/search/find.ts: vocabulary → corrections →
  search_public → searchkit ranking, behind ⌘K and Discover alike;
  Discover offers "Did you mean …?".
- The palette's own lists (pages, things, create) rank with searchkit too,
  and page matches come before the actions, so Enter on "setings" opens
  Settings.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 08:31:51 -07:00
CatoandClaude 91f368f4b7 fix(discover): people appear once they have shown up; marks start at words (#1321)
- Migration: public_documents() lists a profile only with a bio, a picture
  or a name of its own. "Start instantly" accounts with a generated handle
  and nothing else filled the new Discover's "Just listed" row and most of
  its People count on launch day.
- "Just listed" shows listings, not sign-ups.
- Search highlights mark matches at word starts only, as the engine
  matches ("lo" no longer marks the middle of "technological").


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 07:15:30 -07:00
CatoandClaude Opus 5.5 534f7e0085 Discover you can finish, and one search engine behind ⌘K and Discover (#1320)
* design(profile): an unfunded project invites backing instead of saying "No funds yet"

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

* feat(discover,search): one search engine, and a Discover you can finish

Search
- New migration: public_documents() holds the public rules for every type
  once (inlinable, so each predicate reaches each table's GIN index);
  search_public() ranks with prefix matching, indexable typo tolerance (<%)
  and exact/leading-title boosts, or browses newest first; public_counts()
  counts the same rows; global_search() becomes a wrapper. Rows created
  with a test integration key (is_test) are excluded everywhere.
- Fixture patterns are passed as RPC arguments from public-directory.ts.
- ⌘K palette: one instance for both header triggers (one keystroke used to
  open two dialogs), results grouped by kind with matched words marked,
  recent searches, full-screen on phones, "Ask your Cat" when nothing
  public matches.

Discover
- Server-rendered from the URL (?q, ?type, ?page): search field, chips with
  counts, "Just listed", one rail per kind, an end. Equal cards with the one
  fact that matters. Replaces a client app that ran up to 14 browser
  queries per keystroke against three engines and re-sorted by date.
- Removes the old discover hooks/components, the dead search UI, unused
  entity card variants and the old search service.

Also: profile cards invite backing instead of "No funds yet"; cause pages
show their category; broken listing images fall back to the initial.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 07:02:28 -07:00
CatoandClaude Sonnet 5.5 12bd7fe64e feat(oauth): a person chooses what each app is shown — name, username, picture (#1319)
* feat(oauth): a person chooses what each app is shown — name, username, picture

Until now every connected app received the same name, handle and picture.
That made "use Solon or Loki without an OrangeCat face" impossible, though
the identity (sub) is all an app needs to recognise someone.

- oauth_user_grants.withheld_claims: the profile claims one person keeps back
  from one app. Empty by default, so nothing changes until someone opts out.
- profileClaims takes the client and leaves a withheld claim ABSENT (not null)
  from the id token and from userinfo. sub and the email scope are untouched.
- Consent screen: three ticked boxes ("Show <app>: Name, Username, Picture"),
  one tap to untick. A hidden marker means an old or replayed form keeps the
  stored choice instead of hiding everything.
- Connected apps: the same three boxes per app, optimistic, with PATCH
  /api/connected-apps/[clientId]; unknown claim names are a 400.
- Developer page and ADR-0009 say the three claims can be missing.

Tests: the new claims cases fail against the old provider and pass now.

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

* docs(oauth): a change to what an app is shown applies at its next sign-in

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

* refactor(oauth): profile claims get their own module

oauthProvider.ts grew past the 500-line service limit with the withheld-claims
logic (check:sizes). The OIDC profile-claims builder moves, unchanged, to
oidcProfileClaims.ts so the file-size exception list does not grow. The name
avoids the unrelated "profile claims" feature (claiming unclaimed profiles).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 06:45:08 -07: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 5aecd3ea6b fix(reputation): the record cannot be bent from outside the app (#1312)
A review of the shipped reputation schema found ways a signed-in person
could bend the record by writing to the database API directly:

- A seller could bury their own track record. Deals are filed against a
  person's OLDEST actor, and anyone could insert an actor for themselves
  with any created_at; a back-dated empty actor became "primary". The
  server now sets actors.created_at for API writers (inserts get now(),
  updates keep the old value). The app's tie-break matches the SQL's.
- A buyer could publish text moderation cannot hide, as keys of the
  yes/no answers object. The database now accepts only the reviewer's
  side's question ids (pinned to the config by a test) and requires the
  headline; the UI never prints a key nobody asked.
- The stored SHA-256 of a review or reply was the writer's claim. The
  database computes it now.

Also: the nudge cron read only the first 500 open deals, so past that a
newer deal never got its first ask; it pages through all of them, and a
failed read of the nudge log now fails the run instead of re-sending.
Track records list cancelled deals beside refunded ones.

Every attack was attempted on scratch Postgres as `authenticated` and
refused; valid reviews and replies still go through. Unit suite: 4938
pass; type-check clean.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 14:41:59 -07:00
CatoandClaude Opus 5.5 c9e4608f9c feat(cat): search and watch the people you follow (#1307)
* feat(cat): search and watch the people you follow

The Cat can now scope discovery and standing watches to the user's own
follow graph — "search the people I follow".

Search:
- search_platform and explore_topic take scope "following" (+ days).
  It reads only the public, non-deleted timeline posts and the public
  listings (per-type discovery public gate, test rows dropped) of people
  the user follows, newest first, with a constant number of queries
  (services/cat/following-scope.ts).

Watch:
- create_watch gains two standing kinds: person_posts (a named person
  posts, optional keyword) and following_topic (anyone the user follows
  posts about a topic). Evaluated in one batched pass by the cat-watches
  timer (services/cat/social-watches.ts): a last_seen_at cursor is
  compare-and-set BEFORE notifying, so a post fires a watch at most once;
  idle cursors catch up so one quiet person cannot pin the read window.
- Migration adds cat_watches.subject_user_id + last_seen_at, widens the
  kind CHECK, and indexes timeline_events (actor_id, created_at).
- Low-risk/no-confirmation like the other watches, so "@cat watch her
  posts for me" works under a post; username stays grounded, and the
  public reply names only the handle.

Also: tokenizer shared via search-tokens.ts; platform tool definitions
split out of tool-use-detection.ts (size limit, re-exported); unknown
watch kinds no longer fall through to the booking check.

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

* fix(changelog): drop roadmap ids the roadmap does not declare

record-links.test.ts requires every {#id} a changelog line cites to be
declared in ROADMAP.md; these two features are not roadmap milestones.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 09:42:41 -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
CatoandClaude Opus 5.5 ca51acc05d feat(deck): presentations as data — @bitbaum/deckkit, and a deck in every investor room (#1299)
* feat(deck): presentations as data — @bitbaum/deckkit, and a deck in every investor room

George: "generate a beautiful presentation, remember the tools and package
them — people should generate whatever presentation they want and change it."
Built from first principles and from a study of evig's hand-written decks
(public/presentations/*): good design language, but only a developer could
edit them, the engine was copied into every deck and drifted, the PDF was a
raster, numbers were typed, nothing linked to one slide.

packages/deckkit (@bitbaum/deckkit 0.1.0, workspace package):
- A deck is data: 9 layouts (cover, statement, points, numbers, chart,
  compare, columns, image, closing), stable slide ids, notes, sources.
- normalizeDeck: anything stored → a deck that renders; https-only links;
  enforced LIMITS keep slides short.
- generateDeck: drafts the investor arc from a source — nothing invented;
  bindDeck fills `bind: facts | pace | roadmap` slides from live data.
- /react: Slide (one frame, identical at any size via container units) and
  DeckPresenter (keys, swipe, #3 deep links, notes on S, print to PDF).
- styles.css: evig's design language as --dk-* tokens, dark + light.
- README: the writing rules (claim titles, one accent, no fabrication).

OrangeCat:
- project_rooms.deck (migration, expand-only).
- /projects/<id>/room/deck: generate a first draft, edit every slide
  (layout, words, figures, order), theme + accent, present with notes.
- /room/<token>/deck: the reader's presenter, live-bound; counts as a deck
  open by the one rule (countsAsOpen). "Open the deck" goes there.

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

* fix(deckkit): linear text scans, not backtracking patterns, over slide text

CodeQL js/polynomial-redos flagged the sentence splitter and the
"Lead: rest" parser: user text through /[^.!?]+[.!?]+(?=\s|$)/ runs in
polynomial time on a crafted string. Replaced with plain linear scans
(sentences, squash, an indexOf for the lead, a loop for trailing
punctuation); a test feeds 50k-character hostile strings and requires
under 500ms.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 08:43:48 -07:00
CatoandClaude Opus 5.5 9022ce4dc2 feat(money): a payment remembers what it was worth; Your money counts each sale once (#1295)
* wip(wallets): tax and debt as wallet purposes

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

* feat(money): a payment remembers what it was worth; Your money counts each sale once

Foundation for "where my money goes" (taxes first, then debt, rent...),
which needs to know what each payment was worth in fiat when it arrived.

- payment_intents.rates_at_paid (jsonb): the BTC price per currency at the
  moment a payment counts as paid. Written in the same update that sets
  status and paid_at (claimPaidTransition) and on the Cat's fund_project
  record. Currency-agnostic: one fact, every currency we price in. Null =
  unknown — never a placeholder, never a reason to fail a paid payment.
- Your money income now reads payment intents only. A purchase writes an
  intent AND an order and settlement marks both paid, so income summed
  both: every sale counted twice, and the tax estimate with it (latent —
  production has no paid sale yet). Windowed on paid_at.
- Each payment is valued at its own recorded price; an unpriced one is
  valued at today's rate and the page SAYS how many; with no rate at all
  there is no total rather than a partial one.
- Wallet purposes gain `tax` and `debt`.

Tests: valueIncome, income reads no orders, settlement records the price
in the paid update and still settles with null. Proved by mutation
(dropping rates_at_paid, pricing everything at today's rate).

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 07:22:01 -07:00
CatoandClaude Opus 5.5 7ed32a054d fix(payments): money records are written by the server only (#1278)
payment_intents, orders and contributions are created, settled and refunded
by the server through the service role. Client roles still carried the
baseline's table-level write grants and five write policies that no code
path needs any more. Withdraw them, so the server is the only writer.

Reads are untouched: SELECT grants and SELECT policies stay as they are.

A test replays every migration in deploy order and fails if a later one
gives anon/authenticated a write on these tables or adds a write policy —
proved by removing this migration (9 assertions go red). The parser is
proved first on the statement shapes this repo uses, and the test checks
the baseline SELECT survives, so a clean result is never an empty parse.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 06:09:44 -07:00
CatoandClaude Opus 5.5 0daa9b59ee feat(projects): an investor room on every project (ADR-0012) (#1272)
* feat(projects): an investor room on every project (ADR-0012)

A project's private page for the investors its owner chooses: headline,
the story in sections, dated numbers with how to check each, the deck,
documents and the Loki build record. One link per person (no account, no
password), switchable off; the owner sees who opened what — the room,
the deck, each document — and is notified on each link's first open.

- project_rooms / project_room_links / project_room_opens, service-role
  only; token is the credential, id stays internal (profile_claims lesson).
- /room/<token> for the reader; /room/<token>/open/<what> follows only
  what the room lists (no open redirect) and records the open.
- /projects/<id>/room for the owner, from an "Investor room" button in
  the owner bar (new ownerActions slot); ownership is checkOwnership on
  the project's actor, so group projects work too.
- room_opened notification: in-app + preference-aware email.
- Link-preview fetchers (WhatsApp, Telegram, Slack, iMessage…) are not
  counted as opens — here and on profile claim links, which counted them.
- ADR-0012, ROADMAP #investor-rooms (door, live numbers, files, offering,
  Cat still to come), CHANGELOG.

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

* fix(room): the counted-on date uses the app locale

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:09:40 -07:00
CatoandClaude Fable 5.1 c128d84a04 fix(events): the form fills from the words even when the AI is silent; a concert is a concert; "Report this" is written for you (#1266)
* fix(events): the form fills from the words even when the AI is silent; a concert is a concert; "Report this" is written for you

Watched on a phone, 2026-10-07 19:45: "Konzert heute Abend in der Roten
Fabrik. Beginn: 19:00 Uhr. Eintritt: 1 CHF." → Fill with AI → "The AI service
did not respond" → an empty form with Meetup preselected → "Report this" →
an empty feedback box asking the person to type out the failure the product
had just watched happen. Four things, each fixed where it lives:

- The words carry the facts. event-draft reads when (19:00, in the venue's
  zone), where ("in der Roten Fabrik", "at Rote Fabrik, Zürich"), what it
  costs ("1 CHF", "CHF 20", "€5", "free") and what kind, with no model. The
  prefill service applies those first; the model adds the prose and never
  overrules a stated fact; and when the model is silent the form still fills
  with the facts, the words as title and description, and a notice that says
  what is missing — instead of an error over an empty form.
- The model is told what day it is, in the person's zone, so "heute" means
  something to it.
- "concert" joins EVENT_TYPES (migration 20261007190000 extends the table's
  check). A concert was filed under Other.
- "Report this" carries the error and its diagnostics in the link; /feedback
  lands with the box already written. Send is one tap.

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

* chore(migrations): acknowledge the concert-type constraint swap for the safety lint

The new check is a superset of the old one; every row stays valid and the
previous release never writes 'concert', so a rollback keeps working.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 12:10:27 -07:00
CatoandClaude Opus 5.5 7e37e20616 fix: invitations that work (and are safe), one project payment section, AI fill keeps your edits, events on their own clock (#1262)
* fix(wallets): an extended public key never lands in a public address column

Linking an xpub wallet copied the key into the entity's bitcoin_address,
which public pages render as a payable address. A key on a public page
reveals every address the wallet will ever derive, and wallets reject it.
The selector now leaves the column empty (payers get a fresh address from
the linked wallet), and the entity schemas refuse a key server-side so the
Cat and the API cannot write one either.

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

* fix(create): AI fill never undoes an edit, a template keeps what was typed, success says live when it is live

- handleAIPrefill merged the whole echoed snapshot, so a field typed while
  the AI was thinking went back to its old value. It now applies only the
  fields the AI changed, and skips any the person edited since the send.
- A template pick (Previous → template) replaced the whole form. On create a
  dirty form now takes template values only for untouched fields.
- The success screen called every new item a draft and offered Publish Now,
  which 400s on an already-live assistant, circle or active wishlist. It now
  reads the created row: live items say so and link to themselves.
- A new group linked to the literal /groups/[slug]. One fillUrlTemplate
  fills every placeholder for both the success screen and the redirect.

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

* fix(dates): real date pickers, events on their own clock, availability names its zone

- 'date' fields fell through to a text box: no picker, and edit forms showed
  the raw stored timestamp. They are date inputs now; events get a
  datetime-local input instead of 'Format: YYYY-MM-DDTHH:mm' text.
- Events defaulted to UTC, so a creator in Zurich typing 19:00 published
  21:00. A new event starts on the browser's zone, picked from a list of
  real zones; stored instants and template defaults are shown as that zone's
  wall time, so an edit cannot keep a stray +00:00 and move the night.
- The availability editor dropped the schedule's zone on every change and
  the public page printed hours with no clock. The zone is kept (the
  browser's for a new schedule) and shown: '09:00–17:00 (Zurich time)'.
- Bookings send the booker's zone instead of being stored as UTC.
- A wishlist's event date read a day early west of Greenwich.
- zoneLabel moves to utils/timezone (re-exported from domain/events/time).

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

* fix(projects): one payment section — a project's own address becomes its linked wallet

The project page rendered a second payment box from the legacy
projects.bitcoin_address, beside the shared section that never reads it:
the page could show one address and pay another, a project whose owner had
no wallet showed a pay button that could not pay, and the box claimed the
address was 'verified and monitored'.

- Migration: each project's legacy address (on-chain, Lightning, or an xpub)
  becomes a wallet linked to that project, which payment resolution already
  prefers. Skips projects with an explicit link, group-owned projects and
  unclaimed owners; per-row savepoints so one odd row cannot abort a
  deploy; idempotent. Verified against Postgres 16.
- ProjectDonationSection, BitcoinPaymentButton and useProjectDonation are
  gone; ProjectFavoriteButton keeps the favourite (neutral, not error red).
  Wishlist tiers move beside the payment section.
- The floating mobile 'Support' button scrolled to an element that only
  existed on legacy-address projects; it targets #pay.

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

* fix(groups): invitations reach the invitee, can be accepted, and only by them

Three implementations wrote group_invitations and none worked end to end:
- Accepting inserted into group_members as the invitee, which that table's
  policy forbids to non-admins, so no invitation could be accepted.
- Nobody was told: no notification type existed, and the only live writer
  (the Cat) did a raw insert with no admin, member or duplicate checks.
- Security: 'Token invitations are viewable' let anyone read pending link
  invitations, and accept_group_invitation (SECURITY DEFINER, granted to
  anon) skipped its owner check for them — anyone could join such a group.

Now:
- Migration: drop that policy; both answer functions require the invitation
  to name the caller, lock the row, pin search_path and are not callable by
  anon; group_invite joins the notification type CHECK. Verified on Postgres
  16 (stranger refused, invitee joins once, anon cannot execute).
- The domain answers through those functions, notifies the invitee on
  create, and is the one implementation: the Cat uses it, the dead browser
  copy is removed. Link/e-mail invitations (undeliverable, 404 link) are no
  longer offered.
- /dashboard/invitations/[id]: the invitee sees who invited them into what,
  and joins or declines — a private group is unreadable on its own page to
  someone not yet a member.

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

* fix(groups): 'Invite' invites — nobody is added to a group without saying yes

The member dialog's Invite button called addMember and put the person in
the group outright, unasked. It now sends an invitation (notification +
answer page), shows who is already invited, and says they join once they
accept.

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

* fix(search): one escape for search terms — commas and brackets no longer rewrite the filter

A dozen copies of term.replace(/[%_]/g, ...) fed user text into PostgREST
.or('a.ilike.%x%,b.ilike.%x%') filters. None escaped LIKE's own backslash,
and none quoted the value, so a comma in a search ('Smith, J') ended the
condition and parentheses opened a group the caller never wrote.

lib/db/likePattern: escapeLike, containsPattern for .ilike(), and ilikeAny
for .or(), which double-quotes the value as PostgREST reads it. Every copy
now uses it; sanitizeQuery is gone. The profile search's in-memory city
filter compared against the escaped term and missed cities with _ or %.

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

* refactor(create): date inputs in their own field component; app locale for wall time

FormField went over the 300-line component limit with the date and
datetime cases; they move to fields/DateInputs, and a redundant fragment
around the textarea goes. instantToWallTime reads numeric parts in
APP_LOCALE, as check:app-locale requires.

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

* refactor(create): one Pay-into group for every entity that receives money

Seven configs carried their own copy of the wallet group (two ids, two
shapes). walletFieldGroup() is the one definition; tables that still have
address columns opt into declaring them, which a wizard needs to place the
group on the right step — a group with no fields shows on every step.

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

* refactor(bitcoin): one explorer link builder; the unused bitcoin service goes

Explorer links were built by hand in three places — two on mempool.space,
one on blockstream.info — and none followed NEXT_PUBLIC_BITCOIN_NETWORK.
lib/bitcoin/explorer builds them all. src/services/bitcoin/index.ts (347
lines, no importers) is removed and the docs that named it point at the
modules that do the work.

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

* fix(a11y): a button-styled link is one control, not a button inside a link

94 places wrapped <Button> in <Link>: a <button> inside an <a> — invalid
HTML, two tab stops for one action, announced twice. <Button href> already
renders the link itself, but dropped aria-label, title, id and disabled,
which is why callers avoided it. It now carries them (a disabled link is
announced and inert) and passes onClick through.

52 sites converted mechanically (plain href on the link, no handler on the
button); 42 put a class or target on the outer link and need a look each,
held by a ratchet test that may only fall. The signed-out purchase line no
longer promises 'a Lightning invoice' — an xpub wallet issues a fresh
on-chain address.

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

* refactor(bitcoin): one address-balance fetcher — refresh reports rate limits and is never stale

Three fetchers read an address balance. services/blockchain (used by the
wallet and project refresh) had no timeout, threw errors that matched none
of the codes its caller maps, and was cached by Next for five minutes, so
'refresh' could return the old number. The treasury's had no timeout and
counted confirmed funds only. lib/bitcoin/addressBalance is the one: timeout,
RATE_LIMITED / API_ERROR_<status> codes, confirmed plus unconfirmed, no
cache, testnet-aware. services/blockchain.ts is removed.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 10:30:40 -07:00
CatoandClaude 213a1c382c feat(events): guests don't need an account — a free ticket with just a name (#1256)
The roadmap's open item {#event-rsvp-guests}: claim_free_ticket refused
anyone signed out, so the link a host sends to the group chat only worked
for people who'd make an OrangeCat account first — most of them won't.

- Migration 20261007160000: event_attendees.user_id nullable + guest_name,
  a row has a person or a name (CHECK). claim_guest_ticket (free events
  only, same row lock + capacity rule), guest_ticket(code) and
  cancel_guest_ticket(code), granted to anon. The ticket code (32 hex) is
  the guest's key; a signed-in person's ticket is never readable by code.
  Name only, no email — pseudonymous by default.
- Exercised on Postgres 16 as anon/authenticated after the ticket
  migration: claim, last seat, full, empty/long name, paid and draft
  refused, no direct read or insert, code reads only its own guest ticket,
  give-back frees the seat and re-opens a full event, checked-in ticket
  cannot be given back, signed-in claims unchanged. Re-run is clean.
- POST/DELETE /api/events/[id]/ticket: signed out, a name claims a guest
  ticket (rate-limited 10/hour/IP) and returns the ticket page; ?code=
  gives it back. Signed-in path unchanged.
- /events/[id]/ticket/[code]: the ticket — QR, time in the venue's zone,
  place, give it back. noindex.
- Event page: signed out on a free event shows the name form instead of
  "Sign in to get a free ticket"; the ticket link is remembered on the
  device. Door list and scan verdict name guests by the name they gave.
- Cat playbook: share the link with everyone; publish first (a draft
  takes no tickets).
- ROADMAP ticks {#event-rsvp-guests}; paid tickets without an account
  stay open under the rails item. CHANGELOG, events doc, article updated.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 08:06:08 -07:00
CatoandClaude Opus 5.5 292f3b3551 feat(events): run a night end to end — one sentence, the place, tickets and the door, crew and their pay; roadmap ↔ changelog (#1255)
* feat(events): a party in one sentence — mapped, with its music, vibe and crew

Tell the Cat "a party at Langstrasse 120 on Saturday at 10, house and
disco, I need a DJ and two bartenders, 20 CHF" and, after confirming, it
creates the whole event: address geocoded onto the map, genres and vibe
on the page, ticket priced in a real currency, crew posted as open roles.

Added
- events.music_genres / events.vibe; Music & Vibe fields on the form.
- event_roles (crew wanted): owner-only write, readable when the event is.
  Public "Crew wanted" card with an "I can do this" message to the
  organizer; owner card to add ("DJ, 2 bartenders"), fill and remove roles.
- Geocoding (Nominatim) fills latitude/longitude on create, from the Cat
  and the form. search_events_nearby RPC + /api/events/nearby + a
  "What's on near you" section on /events (near me / a place, by genre).
- create_event takes end_date, event_type, music_genres, vibe, crew,
  ticket_price, currency.

Fixed
- Cat create_event wrote a `location` column events never had, and left
  currency to a 'SATS' default the CHECK rejects: every Cat event failed.
- Public event pages filtered on status 'active', which events never
  have: published events 404'd for everyone but the organizer; metadata
  also read `location`, so previews said "Event Not Found".
- Ticket checkout read a `price` column events don't have; registry now
  declares priceColumn: 'ticket_price'.

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

* feat(events): the pin follows an edited address; the Cat finds events nearby

- PUT /api/events/[id] re-geocodes when the venue changed (or the event
  never had a pin), keeps the pin on unrelated edits even if the form sent
  it back as null, and clears it when the new address cannot be placed.
  Via a new optional async refineUpdatePayload hook on the shared PUT
  handler.
- find_events_near(place, genre?, radius_km?) Cat tool: geocodes the
  place and runs search_events_nearby as the user, returning only real
  events with their links.

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

* feat(events): tickets with a QR the door scans; private guest lists

- event_attendees (in the baseline, never written) becomes the ticket:
  ticket_code added; free seats via claim_free_ticket (row-locked, so the
  last seat goes to one person) and cancel_free_ticket; paid tickets only
  via issue_paid_ticket, granted to service_role and called by settlement
  (idempotent per payment intent; a second purchase adds a seat);
  check_in_ticket for the organizer alone. current_attendees and the
  full/open status follow the seats.
- Checkout refuses a sold-out event before anyone pays.
- Event page: ticket card (QR to /events/[id]/door?code=…, seats left,
  free claim/cancel, door link for the organizer). Door page checks the
  scanned ticket in and lists guests with name search + manual check-in.
- Signed-out visitors are asked to sign in to buy a ticket instead of
  being shown the organizer's bare address (which left no ticket).

Fixed: the baseline policies let anyone read every attendee of a public
event and write their own row as paid/attended. Replaced with own-row
read, organizer read/write, and the functions above.

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

* feat(venues): a bar's page with its door on the map, and its events on it

- groups gain street_address, postal_code, latitude, longitude; the
  organization form asks for them and create/update geocode the pin.
- events.venue_group_id links an event to the organization whose place it
  is at (ON DELETE SET NULL). A trigger lets only that organization's
  members set it, so the form, API and Cat meet one rule.
- Event page sidebar: "At Espresso Bar" card. Organization page: the
  address with a map link and "What's on at …" (upcoming public events).
- Cat: create_event takes `venue` — matched only among the user's own
  organizations (exact name, or one unambiguous close name) and uses the
  venue's address and pin; otherwise it says how to make the page.
  create_organization takes `address` (resolved to a complete place +
  pin) and never stores an invented kind ("bar" -> company).

Fixed: updateGroup accepted country/region/locality and never wrote them.

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

* fix(merge): the event re-pin hook reads the row from main's loadForWrite

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

* fix(events): one model for venues (assets), and what a real run found

Venues
- main (#1237) made the place an event is at an asset (events.asset_id,
  "Happening here"). This branch had a second model (organizations +
  venue_group_id); it is gone before it ever shipped, and the group
  changes with it — except the real bug fix: updateGroup accepted
  country/region/locality and never wrote them.
- 20261007100000: an event can be listed at a place only by whoever runs
  it — its person, its organization's members, or the steward of a place
  set up for someone not here yet (rights follow actor_id, like
  stewardship.ts; owner_id stays with the steward after a claim).
  places_i_can_list_events_at() exposes the same rule as a list.
- Event form: a venue picker replaces the "paste the asset's UUID" box.
  Event page: "At Espresso Bar" card linking the place's page.
- Cat: create_venue (a page for a bar/club/studio, optionally set up for
  an owner who is not on OrangeCat, with the hand-over link);
  create_event's `venue` resolves among the places the user runs.

Found by replaying every migration on supabase/postgres:15.8.1.060 and
driving the app in Chromium at 390px
- 20261007090000: a database built from the migrations created accounts
  with no profile (the auth.users triggers live outside the dump), and
  every write to a search-indexed table failed (private.reindex_config
  missing). Both created only where missing — no-ops on the box.
- Permissions-Policy sent geolocation=(), so "Near me" could never ask.
  Now geolocation=(self), pinned by a test with microphone and camera.
- Cat create_asset never set owner_id or type (both required): every
  asset it tried to register failed.
- The ticket migration's widened CHECK is acknowledged for the
  migration-safety gate. Event endpoints come from API_ROUTES.EVENTS.

Plan and audit: docs/features/events-end-to-end.md.

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

* fix(events): times on the venue's clock, everywhere

A Landquart night at 22:00 read "8:00 PM" (pages formatted in the
server's zone), and the Cat stored "Friday 22:00" as 22:00 UTC (its clock
says UTC; Postgres reads an offset-less time as UTC too — the form had
the same bug).

- src/utils/timezone.ts (+ src/config/time-zones.ts): no-dependency
  zone conversion on Intl — wallTimeToUtc (DST-safe), formatInZone,
  isValidTimeZone, and timeZoneForPlace (country; longitude/latitude for
  the countries spanning several zones; null rather than a guess).
- src/domain/events/time.ts: resolveEventTimes for writers (zone from the
  organizer's choice, else the place, else UTC; offset-less times are
  wall-clock there) and formatters for readers.
- Writers: form create + edit and the Cat's create_event; geocoding a
  venue now settles its zone. The Cat is told to send venue-local times
  and says which zone it used (or that it fell back to UTC).
- Readers: event page (day, time range + "Zurich time", RSVP), metadata,
  "near you", "Happening here", the door's check-in times, the Cat's
  find_events_near.
- "Near me" names the kind of geolocation failure instead of always
  saying "not shared".

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

* feat(events): the crew is real people, the door crew checks guests in

- event_roles hold people (assignee_user_ids, at most the head-count —
  the table refuses more) and say whether the role works the door
  (can_check_in: the Door and Security presets).
- can_check_in_at(event, user): the organizer or door crew. check_in_ticket
  and the guest-list read use it, so the bartender on the door no longer
  needs the organizer's phone.
- Organizer's crew card: add people by @username, take them off; a role
  fills when full. Crew members see "You're on the crew" and, on the door,
  a link to the door list. Public "Crew wanted" shows what is still open.
- Notifications: "Your ticket: …" when a ticket is issued (paid at
  settlement, free at claim) and "You're on the crew" when assigned, with
  times on the venue's clock.

Fixed, found inserting each dispatched type into the replayed database:
notifications_type_check lacked booking_request, booking_update and
deal_review, so those in-app notifications were rejected and only
logged — booking requests and deal-review reminders reached nobody.
config/notification-types.ts is now the one list: the dispatcher's and
NotificationService's `type` check against it, migration 20261007110000
sets the CHECK from it, and a test fails if the two ever differ again.

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

* feat(events): pay the crew and refund tickets, on the event's record

The organizer pays each crew member their role's fee in one click from
their own connected wallet (the Send rail), or records paying them another
way (Twint, cash). From the door list the organizer refunds a paid ticket:
the money goes back the same way, the ticket is cancelled and its seat freed.

- event_payouts: the event's account of every payout; one sent payment per
  person per role and one refund per ticket (partial unique indexes); read by
  the organizer and the person paid
- refund_ticket(event, attendee): organizer-only cancel + free the seat
- a failed send is recorded as failed and reported, never hidden
- crew fee editable per role

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

* feat(events): cover pictures — on the form, from the chat photo, or generated

The event form had no picture field. It has one now, so a Cat draft made
from a photo carries it (imageFieldOf). The shared ImageField — every entity
form with a picture — can also find an openly licensed photo or generate one
with the person's own AI key, not only upload.

The Cat's create_event takes cover: chat_photo (the photo just sent, made
public only now) or generate (BYOK, never the platform's key). It adds the
cover after the event exists, so a slow or failed generation never costs the
event, and says where to add one when it cannot.

Generation + storage moved out of the API route into
services/images/generate-and-store.ts so the route and the Cat share it.

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

* fix(events): what the browser walkthrough found after payouts and covers

- The image picker nested a <form> inside every entity form (a hydration
  error, and Enter in its search box could submit the outer form). It is
  a search region with an Enter handler now — fixed once for every form.
- A form's picture field searched for its own label ('cover picture');
  it now searches for what the person typed as the title and description.
- A ticket refunded outside OrangeCat told the buyer 'the organizer
  recorded paying you'. Refund and crew notifications now say which.

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

* feat(roadmap, changelog): each points at the other, from the shared kit

/roadmap: every milestone with an id links to the changelog days that
delivered it, and each goal says when it was worked on. /changelog: every
line that delivered a milestone says which, linked to its place on the
roadmap; each day has an anchor. The model is bip-kit's linkDevelopment,
shared by every fleet site, so the local roadmap-journey copy and the
changelog helpers it duplicated are gone.

The record: an 'Events, end to end' goal in ROADMAP.md with an id per
milestone, and today's changelog entries citing them. The event work that
sat under 2026-10-03/05 never shipped; it is written under the day it does.
record-links.test.ts holds the two files to each other (no dangling or
duplicate ids, every ticked id delivered by some line).

Needs bip-kit 0.6.0 (bitbaum/bip-kit, same branch).

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

* docs(blog): one night at Espresso Bar — running an event end to end

What the end-to-end test of an event found, what works now (one sentence,
the place page, venue time, tickets and the door, the crew and their pay,
covers), what is still not built, and the roadmap/changelog links.

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

* chore(deps): bip-kit 0.6.0 — roadmap and changelog link to each other

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

* fix(types): this branch adds no strict-mode errors (818 vs main's 822)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 07:28:05 -07:00
CatoandClaude Opus 5.5 487f94772c fix(copy): public pages give a real mailbox and stop claiming what is not true (#1214)
* fix(copy): public pages give a real mailbox and stop claiming what is not true

- FAQ, /status, /security, privacy, terms and the OpenAPI spec named
  hello@, support@, security@ and integrations@orangecat.ch; cato@ is the
  only mailbox on the domain. One CONTACT_EMAIL in brand.ts now.
- /company/careers listed four full-time jobs with salaries, health cover
  and unlimited PTO that do not exist; it now lists the real ways in.
  /company/about drops the invented "passionate team".
- Footer said "All rights reserved" and the OpenAPI spec "Proprietary";
  the code is MIT.
- /technology hand-typed "Next.js 15" (app is on 16); reads STACK now.
- /docs claimed BTCPay; Lightning runs on NWC + LNURL.
- /security claimed encryption at rest "provided by Supabase" (self-hosted,
  no encrypted volume on the box) and a bug-bounty channel; both cut.
- bitbaum.com (does not resolve) -> bitbaum.orangecat.ch; partners
  "Talk to the studio" went to the donation page, now the hire page, and
  drops "clients". Solon's /api/v1/decisions index 404s -> /proposals.
- README: 15 entity types (was 13), Next.js 16.
- Guard: public-copy-claims.test.ts fails on a role address, a literal
  mailto, or a hand-typed framework version (mutation-checked).

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

* fix(copy): SDK is MIT, no dead address in emails or security docs, no partner course that does not exist

The guard now also scans packages/, supabase/templates, legal/, content/,
docs/security and the root README/SECURITY/package.json for dead role
addresses and a non-MIT licence claim.

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

* fix(copy): verified-client link opens mail, not the backing page; cut unmeasured security and member claims

- /docs/sign-in-with-orangecat: "ask for a verified client" and "Questions,
  or a verified client" linked ROUTES.SUPPORT (the Bitcoin backing page);
  both now mailto CONTACT_EMAIL.
- docs/security/README.md: cut the security score, "0 Critical, 0 High",
  the passed pentest, the review cadence and nine links to files that do
  not exist; it is now an index of the documents that do.
- audit-report.md: cut the "coming soon" bug bounty and the unverified
  "platform messaging" report channel.
- Reset email templates: cut "10,000+ Bitcoin innovators" and
  "bank-grade security".
- Guard: public-copy-claims now fails on a question/contact link to
  ROUTES.SUPPORT and on "N+ members/users" or "bug bounty" in prose
  outside the app (both mutation-checked).

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

* docs(changelog): move this PR's entries under 2026-10-07

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 04:59:30 -07:00
CatoandClaude Opus 5.5 9d283f904c fix(reputation): private where it matters — reviews, track records, emails (#1241)
* fix(reputation): private where it matters — reviews, track records, emails

The first version published more than OrangeCat's principles allow. This
keeps what makes reviews trustworthy (only parties review, one per side,
blind until both write, never edited) and changes who sees what.

- Sales volume and purchase counts are off profiles. actor_track_record()
  returns deal and distinct-customer counts, outcomes and the "would deal
  again" tally only. Past sales had been published by the backfill.
- Reviews belong to the two parties: anon can no longer read deal_reviews.
  The public sees public_deal_reviews(): customers' revealed reviews of
  sellers. Reviews of buyers are never public, so a seller reviewing you
  cannot put your purchase on your profile.
- Reviewers are anonymous ("a verified buyer") unless they tick "show my
  name". Existing reviews became anonymous.
- Report and hide: anyone signed in can report a public review (once); the
  operator is alerted with the review id only and hides text via
  deal_review_moderation. The record and hash stay. Reports alone never
  hide anything.
- Reply: the seller can answer each public review once (append-only).
- Emails: deal_review goes through NotificationEmailService (respects the
  "Progress & digests" switch, at most two a day) instead of the generic
  path that ignored preferences. The cron sends one message per person per
  run.

Verified on scratch Postgres (anon refused, buyer reviews private,
anonymity, reply/report rules, moderation, track record counts). Full unit
suite: 4389 tests pass.

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

* fix(deps): clear two high advisories failing the security gate

CI's security job (pnpm audit --audit-level=high --prod) started failing
on every branch when two advisories were published:

- sharp < 0.35.5 (GHSA-wq5f-xc86-pv6w) -> ^0.35.5
- @modelcontextprotocol/sdk < 1.31.0 (GHSA-6qxp-vccf-f47h) -> ^1.31.0

Both are pinned in package.json and in the workspace overrides so a
transitive copy cannot pull the vulnerable range back in. The lockfile
diff is only these two packages and sharp's platform binaries.

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

* fix(deps): keep the GitHub-hosted lockfile entries exactly as on main

The previous commit's lockfile carried integrity hashes for listkit and
@bitbaum/geo-kit computed from archives rebuilt with git archive, not
from codeload's own tarballs, so CI's frozen install refused them.
Those two entries go back to main's form (no integrity), as they were.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 00:29:07 -07:00
CatoandClaude 72a107760e feat(reputation): ask people to review their deals (ADR-0010 D9) (#1229)
Most people never review unless asked, and a track record nobody writes
stays empty.

- review-nudges cron (hourly systemd timer, deterministic, no model):
  asks each side that has not reviewed once 3 days after the deal
  settles, and once more in the last 5 days of the window. Sent in-app
  and by email (notification type deal_review).
- deal_review_nudges records each nudge BEFORE sending, so a crash loses
  one and never sends a second.
- When one side reviews, the other is told that it happened, never what
  was said.
- The Cat's dashboard suggestions carry the most urgent unreviewed deal,
  using the same timing rule as the cron (EN + DE copy).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 10:41:55 -07:00
CatoandClaude Opus 5.5 8700419bdf feat(reputation): deal reviews and profile track records (ADR-0010) (#1226)
* feat(reputation): deals and two-sided blind deal reviews (ADR-0010)

Reputation built from what the platform observed, not from opinions anyone
can post. A review can only be written about a deal the writer was part of.

- deals: one row per deal between a provider and a customer actor,
  fleet-wide (source = orangecat.order | evig.it_hilfe |
  loki.crew_assignment). Nobody can insert one by hand. OrangeCat orders
  become deals by trigger when they settle, and existing paid orders are
  backfilled with a fresh review window. Self-dealing is refused. A failure
  while recording a deal can never fail the payment. Tips never become
  deals.
- deal_reviews: one per side, yes/no answers (no stars), optional body
  with SHA-256, append-only. Blind until both sides have written or the
  30-day window (deal_review_window(), defined once) closes, after which
  nobody can write. The reviewer's side and subject are derived from the
  deal, for service-role writers too.
- actor_track_record(): public counts only, including distinct customers.
- src/config/reputation.ts: deal sources and per-side questions, plus the
  zod schemas for submitting a review.

Verified against a scratch Postgres 16 with Supabase role stubs: applies
twice cleanly, and every rule was exercised (stranger, impersonation,
duplicate, edit, closed window, non-boolean answers, self order, reveal).

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

* fix(reputation): rename REVIEW_LIMITS to DEAL_REVIEW_LIMITS

open-science.ts already exports REVIEW_LIMITS for research reviews, and
one-name-one-meaning forbids one exported config name meaning two things.

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

* feat(reputation): review deals at /dashboard/deals, show a track record on profiles

Builds the person-facing half of ADR-0010 on top of the deals migration.

- /dashboard/deals ("Your deals" in the sidebar): every deal you were part
  of, with a yes/no review form per deal. Your review stays hidden until the
  other side writes too or the window closes; the card says which.
- POST /api/deals/:id/reviews checks the answers against your side's
  questions. The database's refusals (second review, closed window, not a
  party) come back as sentences.
- GET /api/deals lists your own deals. GET /api/actors/:id/track-record is
  public.
- Profiles gain a Track record section: observed counts (deals, distinct
  people, refunds, settled volume) and the share of revealed reviews saying
  "would deal again". It is read through a sessionless client, so every
  visitor sees the same record and never a still-blind review.

Migration fix (unmerged, so edited in place): users can hold duplicate
actors, and the order trigger picked one with an unordered LIMIT 1. Deals
now go to the oldest actor via primary_user_actor(), the same rule as
lookupUserActor. lookupUserActor also returns every actor id, so your own
deal list reads across all of them.

The private actor-name helper from research reviews moved to
domain/actors/names.ts, and both features use it.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 10:31:05 -07:00
CatoandClaude b8dc4e4071 feat(search): global_search finds every public type — and events at all (#1219)
The ⌘K palette and type-ahead read one RPC, global_search. It covered
seven types. Missing: investments, assets, research, wishlists,
organisations (groups), circles, companions (ai_assistants). And its
events branch filtered on status = 'active', which events_status_check
has never allowed, so no event was ever returned.

Migration 20261003120000:
- seven new branches in the same index-friendly shape, plus fts + trgm
  expression indexes for the seven tables that lacked them;
- each branch's visibility rule comes from the table's public SELECT
  policy, because the function is SECURITY DEFINER and bypasses RLS.
  It is narrowed where a search should find less than a link opens:
  unlisted wishlists, draft/cancelled research. Assets go by status
  (public_visibility is never set; see discoverCounts.ts);
- events: published/open/full/ongoing;
- new path_key column (profile username, group slug). Return type
  changes, so DROP + CREATE + the three GRANTs are restated. Rollback is
  in the header.

App: GlobalSearchHit gains path_key, the generated types follow, and
hrefForHit derives every link from the registry's publicBasePath
(groups by slug, profiles by username, with the old '@username'
subtitle as fallback in case the code ships before the migration).

Verified: ran the migration on a scratch Postgres 16 (unaccent + pg_trgm,
minimal tables). "zurich" returned one public row of each new type plus
the event; every private, draft, unlisted and archived row stayed out;
anon can execute; accents fold both ways. migration-safety lint clean;
tsc clean; 866 tests pass, including a new link test for every type.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-03 04:17:25 -07:00
CatoandClaude Opus 5.5 c8bc3d6e15 feat(oauth): consent screen says which account, how long, and what is risky (#1208)
Compared against X's "Authorize app" screen, ours listed scopes more
precisely but left out five things a person needs before clicking Allow:

- Which account: "Signed in as <name> · @user · email" with "Not you?"
  (signs out and returns to this same request via the sign-in hand-off).
- How long + undo: "until you remove it", linked to Settings → Connected
  apps; OrangeCat's Terms and Privacy linked. Links open in a new tab so
  the request is not abandoned.
- Risky permissions first: OAUTH_SCOPES gains `sensitive` (every write/act
  scope plus wallet.read and messages.read), listed under a warning heading.
- The app's own privacy policy / terms: new oauth_clients.policy_uri /
  tos_uri (additive migration). /oauth/register accepts the RFC 7591
  fields, https only; a bad link is dropped, never a refusal. Loki gets
  both, Heidi privacy only (the pages that exist). Without them the screen
  says the app has published neither.
- Redirect host now shown for verified apps too, not only self-registered.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 08:33:52 -07:00
CatoandClaude Opus 5.5 4b57a1e792 feat(research): open science — licence, outputs, locked pre-registration, peer review, Nostr (#1178)
* feat(research): open science — licence, public outputs, locked pre-registration

Research could be funded but gave backers no promise about the answer:
no terms, no place the outputs live, and nothing stopping a hypothesis
from moving after the data came in. For a pseudonymous researcher with
no institution behind them, that commitment is the credibility.

- Licence (SSOT src/config/open-science.ts): CC BY by default in the
  form, one tap to change, and "all rights reserved" stays sayable.
- Output links: https, ipfs, ipns, ar. Kind derived from the host,
  never guessed; ipfs:// and ar:// shown as content-addressed.
- Pre-registration: server hashes (SHA-256) and timestamps it on first
  write; after that it can't be edited. The API explains why, and a
  DB trigger enforces it for every writer.
- Public research page gets an Open Science card that shows when
  something is missing instead of hiding it.
- Cat create_research takes the same three fields with the same
  validation. Its field list is now derived from RESEARCH_FIELDS; it
  listed "physics", which the table's CHECK rejects.
- Lead researcher copy: a name or a pseudonym, never required.

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

* feat(research): open peer review — pseudonymous, append-only, hashed

Open science needs someone other than the author to look at the work.
On OrangeCat that reviewer may be pseudonymous, like the researcher: a
review stands on what it says and on the reviewer's public record.

- research_reviews table: verdict (reproduced / supports / concerns /
  refutes / retracted, SSOT in config/open-science.ts), body, SHA-256
  of the body, optional output reviewed. A trigger makes it append-
  only: a changed mind is a new review, never an edit. The insert
  policy refuses self-review and private research.
- GET/POST /api/research/:id/reviews (thin; rules in domain/research/
  reviews.ts, which explains refusals in words).
- Research page: Peer review card with each review's hash, and a form
  for signed-in non-owners that says "permanent" before the button.
- Cat review_research action, through the same domain call, signed by
  the person's own actor even in a group context.

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

* feat(research): publish research to Nostr, signed by the researcher's own key

OrangeCat is one server; a commitment kept only here is only as durable
as this server. The researcher now signs their research as an
addressable NIP-23 event (kind 30023, d = research id) with their own
NIP-07 extension; the browser publishes it to relays; the server only
verifies (signature, kind, d tag, committed pre-registration hash) and
records the event id and pubkey. OrangeCat never holds the key.

The public Open Science card says whether the research is on Nostr and
links an njump naddr; the owner gets Publish/Republish.

Verification rebuilds the event from its wire fields: nostr-tools
caches a "verified" flag on the checked object, and a spread copy of a
signed event carried it, so an edited copy passed. The test that caught
this stays.

Also drops the DROP CONSTRAINT IF EXISTS lines from these migrations —
the constraints are new, and safety-lint (rightly) flags any DROP.

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

* chore: restore files an over-broad prettier run reformatted

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

* chore(migrations): renumber research migrations after main's 20260928140000

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-29 01:39:48 -07:00
CatoandClaude Opus 5.5 f287c0e590 feat(oauth,mcp): connect AI apps to OrangeCat and Loki with one OrangeCat sign-in (#1179)
* feat(oauth,mcp): connect AI apps to OrangeCat and Loki with one OrangeCat sign-in

OrangeCat becomes a full MCP-grade authorization server, and gets its own
MCP server.

Authorization server
- RFC 8707 resource indicators: OAUTH_RESOURCES (config.ts) names OrangeCat's
  MCP server (${OAUTH_ISSUER}/api/mcp) and Loki's (LOKI_MCP_RESOURCE, default
  https://loki.orangecat.ch/api/mcp), each with the scopes it honours.
  /oauth/authorize takes `resource` (unknown -> invalid_target), binds it to
  the code and refresh token, and the access token's aud becomes it. No scope
  + a resource defaults to that resource's scopes; always intersected with the
  client's ceiling. /oauth/token accepts a repeated `resource` and answers
  invalid_target on mismatch before a code is burned or a refresh token
  revoked. Access tokens now carry a client_id claim.
- New scopes loki.chat and loki.act (minted here, honoured by Loki).
- RFC 7591 Dynamic Client Registration at POST /oauth/register: public
  clients only, PKCE, https or loopback redirects, <= 5, no fragments or
  userinfo, cleaned name <= 80 chars, dcr_ client ids, never trusted, rate
  limited 10/hour per IP. The consent screen says a self-registered app is
  unverified and names the host it returns to.
- RFC 8414 /.well-known/oauth-authorization-server serves the same document
  as the OIDC discovery route (one builder), now with registration_endpoint.
- RFC 9728 protected-resource metadata at /.well-known/oauth-protected-resource
  (and the /api/mcp path-suffixed form).
- /api/v1 now refuses OrangeCat tokens whose aud is Loki's resource, so a token
  handed to Loki cannot be replayed here. Other tokens are unaffected.
- Migration: resource on oauth_auth_codes and oauth_refresh_tokens,
  registered_via (admin | dcr) on oauth_clients.

MCP server (POST /api/mcp, stateless Streamable HTTP, JSON responses)
- Accepts an OrangeCat token whose aud is this server (audience checked) or
  an ock_ integration key; otherwise 401 with WWW-Authenticate
  resource_metadata=... (plus error="invalid_token" for a refused token).
- Tools: orangecat_whoami, orangecat_search, orangecat_my_entities,
  orangecat_create_project, orangecat_post_update. Writes run the /api/v1
  handlers in-process with the caller's own bearer, so scope, rate limit,
  validation, idempotency, audit and webhooks are the same code. A missing
  scope is a tool error naming the scope. Per-person limit of 120 req/min.
- CORS on the MCP, metadata, register and token endpoints.

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

* fix(oauth): say on the consent screen that approving through Loki runs the action

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 14:44:57 -07:00
CatoandClaude Fable 5.1 cfa1e40e65 feat(groups): organisations are collective kinds, with a place and a legal status (#1162)
* feat(map): "What you can do" — every capability in plain words, from one source

A newcomer had no page that said what this place does. The registry knew
fifteen types by noun; the landing page carried a second, hand-written list
that had drifted from it; the create hub offered a grid of nouns. None of
them said "sell something", "raise money for a goal", "lend a friend 500".

- Every entity type in the registry now carries `plain` copy (verb, what,
  example, three steps) and declares the intent it serves. `INTENTS` in
  src/config/intents.ts is the grouping: earn, fund, borrow, together,
  money, cat.
- src/config/capability-map.ts derives the map from the registry plus five
  non-entity capabilities (receive, send, request, civic split, the Cat).
  One shape whatever backs a card.
- /what-you-can-do renders it, public, with the door on top: a plain GET
  form that hands one sentence to the Cat (`/dashboard/cat?q=`), which
  already auto-sends it into an empty conversation.
- Reachable from the sidebar (signed in or not), the footer, the create hub
  ("Not sure which one?") and How it works, whose hand-written
  SUPER_APP_CATEGORIES grid is deleted in favour of <CapabilityMap compact />.
- __tests__/unit/config/capability-map.test.ts fails when a registry type is
  missing from the map, an intent heading is empty, verbs collide, steps are
  not three, or copy uses a banned word (donate, tip, crypto, campaign…).

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

* feat(nav): fold fifteen entity sections into "My things"; the door on Home

The sidebar carried fifteen kinds of thing behind four chevrons (Create ·
Fund · Coordinate · Finance). Nobody reads a list like that; they want to
know what they have and what they can do.

- /dashboard/things: one list of everything the person made or joined,
  grouped by the intent the registry declares (earn, fund, borrow,
  together, money, cat), each row with its status badge and a link into
  where its owner works on it. `listMyThings` in src/domain/things reads
  every registry type through the registry — table, owner column, title
  column — plus organisations joined but not created.
- The registry gains `detailPath` (and `detailKeyColumn` for slug-keyed
  organisations) so a cross-entity list never guesses `${basePath}/${id}`.
  Declared after apiEndpoint, where audit-routes' parser expects the fixed
  fields to stay adjacent.
- Sidebar main: Cat · Home · My things · Money · Messages · What you can do.
  The People destinations (People, Set up for someone, Your civic split,
  Collaborate) get their own folded section; Timeline and Explore move to
  More. The phone tab bar is unchanged and still agrees with the sidebar.
- navigation-generator.ts and its test are deleted: nothing renders entity
  sections any more, and its ENTITY_GROUPS was a second grouping beside the
  intents on the map.
- Home opens with the door — one sentence to the Cat — above the sections.
- __tests__/unit/config/my-things.test.ts: every type with a dashboard
  detail page declares detailPath, every detailPath resolves to a route
  file, the primary sidebar lists My things and the map and stays at six
  lines, and no entity list is linked one by one any more.

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

* feat(groups): organisations are collective kinds, with a place and a legal status

One list of what kinds of collective exist, shared by OrangeCat, Loki and
Solon: @bitbaum/collective-kinds, a workspace package at
packages/collective-kinds (kinds · place · legal status; data and pure
functions only). OrangeCat's group labels, Solon's governance profiles and
Solon's audiences each restated their own version of this list; copies
drift, imports cannot.

- src/config/group-labels.ts is now keyed by the package's ids and holds
  only what OrangeCat adds per kind (icon, visibility defaults, features,
  governance preset). Name and description come from the kind. `nonprofit`
  is retired for `association` — what the world calls it — and the
  migration renames the rows.
- Three new kinds a group can be: collective, town, local fund. A town or
  a local fund cannot be created without a place; the Zod schema asks the
  package (`kindOf(label).needsPlace`, `placeProblem`) and points at the
  first missing field.
- groups gain where they belong (country_code, region, locality, with
  generated lower(btrim()) keys — the civic split's rule) and what they
  legally are (informal | registered | tax_exempt with the evidence each
  requires; `legalProblem` refuses a status without it, and a kind that
  cannot be tax-exempt cannot claim to be). Migration
  20260928120000_groups_are_collective_kinds_with_a_place.sql.
- Create form gets "Where it belongs"; templates gain a Local fund
  (Witikon first) and Association replaces Non-Profit Foundation.
- The Cat prompt derives the label list from the package instead of
  spelling it; the glance line is dropped to stay inside the prompt budget.
- pnpm-workspace.yaml now declares the package (package.json "workspaces"
  is npm-only and pnpm ignored it); next.config transpiles it.
- Tests: __tests__/unit/packages/collective-kinds.test.ts (the package),
  __tests__/unit/config/group-labels-are-kinds.test.ts (labels == kinds,
  retired word gone, templates valid, place rule enforced, place key ==
  civic split key).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 05:25:18 -07:00
CatoandClaude 54fdaa26b2 feat(civic): declare where your public money should go (#1157)
"Of the money you owe the public, how would you divide it between your
locality, your region and your nation?" Nobody asks. Now a person says it,
and anyone can read what the people of a place would choose.

- civic_splits: one row per actor, three whole percentages that must sum to
  100 (CHECK), place typed by the person and keyed lowercase; RLS own-row;
  civic_splits_public view carries only rows marked public.
- /dashboard/civic-split: three sliders that rebalance to 100, place fields,
  profile toggle, a note; the aggregate for the person's region beside it.
- GET/PUT/DELETE /api/civic-split; public GET /api/civic-split/aggregate
  (mean per locality, k-anonymous at three declarations, cached).
- Shown on the public profile when the owner chose to.
- Cat action set_civic_split: "send 60% of my public money to Witikon"
  merges over the split on file and rebalances the rest.

The caveat travels with every surface and a test pins it: this changes
nothing about what the law takes or where it goes; it says where a person
stands, and it will route what they give voluntarily once local funds exist.

Prompt ratchet raised 3,800 -> 4,100 for the new action, reason in the test.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 02:16:04 -07:00
CatoandClaude Opus 5.5 76671f3cc1 fix(security): project-files bucket can no longer be listed or used as free hosting (#1150)
PrintCraft's bucket on this Supabase held guests' original photos (memorial portraits) and had an anon SELECT policy: the public URL never needed it, but it let anyone with the shipped anon key LIST the bucket and download every photo. Anon upload accepted any file, any size, any path. Dropped the list policy; narrowed anon upload to PrintCraft's exact path shape; bucket now images only, 25 MB. Dry-run on the live DB in a rolled-back transaction: applies cleanly.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 03:06:31 -07:00
CatoandClaude Opus 5.5 da77411696 fix(ai): no timer or page load spends a free-tier AI key (#1146)
* fix(ai): no timer or page load spends a free-tier AI key

Standing rule (2026-09-25): the box's AI keys are free tiers, OpenRouter and
Gemini shared with every app, and may be spent only when a person asks.

- cat-health cron (nightly completion probe of every vendor): route + timer
  removed; the "Check Cat's status" click still runs the probe.
- reindex-embeddings cron (nightly embedding sweep): route + timer removed;
  a save still indexes its own row via the DB trigger -> admin route.
- orangecat-cat-eval.timer (nightly Cat eval + LLM judge on the free pool):
  unit removed; eval-cat.mjs is run by hand.
- cat-watches: topic watches embedded their topic every 15 min. The vector is
  now stored when the user creates the watch (migration adds
  cat_watches.topic_embedding); the timer matches with it via the new
  embed-free discovery-match module.
- GET /api/cat/nudges (dashboard mount + weekly-digest): LLM "smart" nudges
  and the bio embedding removed; rule-based nudges stay.
- GET /api/cat/suggestions (opening the chat): chips were LLM-written on load;
  now deterministic (cat-home-chips.ts deleted).
- deploy-selfhost.sh retires the old units on the box (RETIRED list).

cat-mentions stays: it only answers a message in which a person addressed @cat.

Regression: __tests__/unit/ci/no-background-ai.test.ts walks imports
transitively from every cron route, every page/layout and every GET route to
the model/embedding modules. Proven by mutation: re-importing exploreTopic in
proactive.ts, platform-llm in prompt-suggestions.ts, or platform-search in
nudges.ts each turns it red.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* test(ai): read without a stat-then-read race (CodeQL)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

---------

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 02:08:25 -07:00