mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 12:07:11 +01:00
The profile page counted a visitor-visible wallet by calling an RPC named
`get_entity_wallets`. That function appears in no migration and returns
PGRST202 in production — it has never existed. The call sat inside a
try/catch whose comment read "if it errs we just show 0", so the error
path was not a fallback, it was the only path, for as long as the code
has been there.
The count is not cosmetic. ProfileLayout hides the Wallets tab from
visitors unless walletCount > 0 or the profile still carries a legacy
bitcoin_address/lightning_address. A profile whose receive methods live
in the modern wallets table therefore showed a visitor no way to pay it.
Confirmed on the live site: testuser123 has an active on-chain wallet and
their public profile offers only Overview / Timeline / Info.
Measured 2026-08-26: 3 of 83 profiles have an active wallet and only 1
has a legacy address, so 2 profiles are affected today. Small only
because wallet adoption is small — it scales with exactly the number we
want to grow, and would have quietly blunted any push to grow it.
Counted through the same admin-client path GET /api/wallets already uses
rather than by writing the missing function. That route's comment states
the intent — "the API is the one public surface, so raw PostgREST can no
longer enumerate balances or other wallet internals" — and a SECURITY
DEFINER function would open a second public surface over a table holding
nwc_connection_uri, a write-only secret. Counting adds no surface: it
returns a number, never a row. Failures are logged rather than swallowed,
so a permanently-broken count cannot hide again.
Asking production which functions PostgREST exposes turned up three more
RPCs that do not exist: update_presence and set_typing_indicator (so
presence and typing indicators are inert), and create_timeline_event on a
fallback branch. Four instances is a class, so check:rpc-exists joins
`verify`: every `.rpc('name')` must have a CREATE FUNCTION in
supabase/migrations. The three remaining are baselined with their
consequence written down — each needs its own migration and design.
The gate is parser-based so CI needs no database, and `--verify` proves
the parser against the live one: 37 called names checked against 80 live
functions, migrations and database agreeing on every one. Proven by
mutation too — re-adding the removed call turns it red.
Its own first run said "RPCs called: 0" and passed. It had reached for
blankNonCode, which blanks string CONTENTS, so it had erased every name
it was looking for — green because blind, the exact failure it exists to
catch. The shared tokenizer now offers blankComments for the case where
the string literal IS the thing you are looking for.
Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>