Three hardcoded things in a public repo, each of which is someone else's
value baked into the source.
The box address had a literal fallback in five places: the CD workflow and
four operational shell scripts. A fallback literal guarantees the variable
is never exercised — if the variable were missing or wrong, every run would
still succeed against the baked-in address and nobody would find out until
the address changed. So:
- cd.yml takes the address from vars.OC_BOX, or root@ the HETZNER_IP
variable, and a new guard step fails the run with ::error:: when the
result is empty. The ssh-keyscan and ssh-config host now derive from
the host half of OC_BOX instead of repeating the literal, so the two
cannot drift apart silently.
- apply-migrations.sh, db/dump-live-schema.sh, db/gen-types.sh and
deploy-selfhost.sh use ${OC_BOX:?...}: they stop with one clear line
instead of reaching for a default. The two of them invoked by the
deploy script are already passed OC_BOX explicitly, and the workflow
sets it in the job env, so the configured path is unchanged.
An audit log was committed under logs/ in 2025-10 with 14 absolute paths
from a developer's machine. Nothing in the repo reads it (the only mentions
of the filename are inside the file itself). The `logs/` ignore rule was
added five days after the file, so it never applied to it — removed, and
the rule now says why, because ignoring a directory does not untrack what
is already inside it.
scripts/db/setup-db.ts signed in as a personal email address written into
the source. It now reads USER_EMAIL, matching the USER_PASSWORD it already
read, and exits with a clear message when unset.
Verified: bash -n on all four scripts and each one run with OC_BOX unset
(exit 1, clear message); the workflow parses and the guard step is in
place; pnpm run type-check:scripts green; prettier clean; the two unit
tests that read deploy-selfhost.sh pass.
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore(identity): one name — Cato
The retired name and a personal contact address were still in the repo,
including in the documents where a name is load-bearing.
- "Mao Nakamoto" -> "Cato" across 18 files: README, CLAUDE.md, two blog posts,
config, support page, tests, and legal/ (PRIVACY_POLICY, TERMS_OF_SERVICE,
IP_ASSIGNMENT_MEMO plus the legal-content.ts that renders them).
- mao@orangecat.ch -> hello@orangecat.ch in 12 files. The old address is the
GDPR Data Controller contact and the ToS operator contact, so it could not
simply be deleted; hello@ is already published on the public FAQ, which
makes it a route known to work rather than a guess. A role address is also
the better answer here than any personal one.
- Test fixtures using a real first name -> Cato.
**Deliberately NOT swept: the legacy handles `butaeff` and `georgy.butaev`.**
A first pass replaced them and had to be reverted. They are production data,
not name mentions: `.mailmap` uses them to map historical commits onto the
canonical identity, and the mention/lnurl tests carry comments stating those
handles are real rows. Renaming the references does not rename the rows — it
points code at handles that do not exist and turns true comments into false
ones. Retiring them is a data migration, not a find-and-replace.
Also reverted from that first pass: an edit to an applied migration's comment.
Migrations are immutable once applied, and rewriting a bug report to name a
handle that was never involved would have falsified the record. The example in
username-history.ts is now a neutral `legacy+handle` instead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe
* chore(identity): the mailmap was rewriting Cato back into the retired name
Missed by the sweep in the previous commit, which globbed *.md/*.mdx/*.ts/*.tsx
— and .mailmap has no extension.
The effect was worse than a stale file. The raw commit author was already
correct after the git config fix, and the mailmap converted it back on display:
raw: Cato <41178744+catomean@users.noreply.github.com>
mailmapped: Mao Nakamoto <41178744+catomean@users.noreply.github.com>
Every new commit would have kept arriving as Cato and kept being shown as the
old name, which is the least debuggable version of this problem — the config is
right, the commit is right, and the output is wrong.
Canonical name is now Cato, and a name+email rule was added for commits
authored as "G": those carry the canonical email already, so the email-only
rules cannot reach them.
Verified over the last 400 commits: 322 Cato, 78 dependabot, nothing else.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe
* fix(identity): the rename notice legitimately names the OLD handle
CI caught the sweep breaking a correct test, in exactly the way the butaeff
handles would have been broken had they not been reverted.
services/cat/handlers/context.ts builds the notice as
`…and ${oldUsername}@orangecat.ch still reaches you.`
The address is derived from the handle the user is renaming AWAY from — that is
the whole point of the sentence, which promises their old Lightning address
keeps working. The sweep rewrote the test's expectation to hello@ and left the
source producing the old-handle address, so a correct implementation began
failing a now-incorrect assertion.
Fixed by neutralising the fixture rather than the assertion: the old handle is
now 'oldhandle', so the test asserts oldhandle@orangecat.ch and no retired name
appears. The behaviour under test is unchanged.
The rule this keeps proving: a literal that REFERS to the old identity is data,
not a stale reference, and a find-and-replace cannot tell the two apart.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Visitor feedback on /messages: the New Message picker's default
suggestion list showed accounts like "georgy.butaev+ocauth1
@georgy.butaev+ocauth1" — real email local-parts published as public
handles, visible to any logged-in user. This is the leak fixed at the
two known signup paths in 20260826130000_stop_deriving_usernames_from_email.sql
and ProfileServerService.ensureProfile() — but not every account is
through the (deliberately manual, not-automatic) backfill script yet,
and two more write paths still minted the same leak independently:
- scripts/db/setup-db.ts hardcodes a sign-in as butaeff@gmail.com and
upserts username: email.split('@')[0] on every run — almost
certainly the actual source of the "+ocauth1"/"+ocauth2" test
accounts in the report (butaeff is one of them).
- scripts/db/reset-user-password.js upserts username: email verbatim
(the full address, not just the local part) for its fixture account.
Both now use the same neutral-username shape as the fixed paths
(neutralUsernameFor in the .ts script; the equivalent inlined in the
plain .js one, which can't import it).
For accounts already leaked and not yet backfilled: added
isEmailDerivedHandle() (src/config/public-directory.ts, same predicate
and .invalid exception as the SQL side's count_email_derived_usernames())
and wired it into GET /api/profiles to hide a still-leaking handle from
the *default* (no search term) suggestion list — the surface this was
reported from. An explicit search still finds the person; this isn't a
substitute for renaming their handle, which needs
scripts/rename-email-derived-usernames.sql run against production by
someone with DB access (noted in the session handoff, not in scope for
this dispatch — no live Supabase credentials in this sandbox).
Also: NewConversationModal's picker row showed name and @username
duplicated whenever a profile has no display name (title already falls
back to the handle) — pure noise, worse on narrow screens where both
lines truncate. Now the @handle line only renders when it adds
information beyond the title.
Co-authored-by: Mao Nakamoto <maonakamoto@users.noreply.github.com>
Dogfooding report on a project profile, three findings, one root cause between
the first two.
1. "No recent activity yet" on a project with a week of work behind it. The
FleetCrown→OrangeCat link was never broken: timeline_events held 17
published updates for that project. The card read project_updates — a table
with zero rows platform-wide, no writer anywhere in the codebase, and no
migration. Every project on the platform read as idle. Recent Activity now
reads timeline_events, the one store activity lands in, and renders the
publish-bus attribution ("via FleetCrown") with its deep link back.
2. Fourteen days in Draft with nothing on the page saying so. Projects were the
only entity type without the owner bar; products and services have shown
"only visible to you — publish it to go live" all along. Reused that
component rather than adding a second banner.
The status rule behind both — public iff active or completed — was written
out twice and matches the projects_public_read RLS policy, so it is now one
exported predicate the API and the page share.
3. No field for the current status of the work. `status` is the lifecycle and
cannot answer "what is happening right now". Adds projects.work_status
(nullable text, migration applied to the box before this ships), surfaced
under About and editable in the project form. It had to be added to the
update whitelist and the create payload too — the Zod schema alone would
have let it save silently as nothing.
An owner now also sees their own draft's activity; before, the one person who
could act on it was shown the same "idle" as everyone else. Visitors still see
nothing until the project is published, and a draft still 404s for them.
Verified in the running app against production data: owner sees 10 FleetCrown
updates on the reported draft (was empty); a signed-out visitor on an active
project sees 11 with attribution; the bar reads "Preview — this project is
draft and only visible to you. Publish it to go live."; work_status round-trips
PUT → DB → "Current status" on the page, and was cleared again afterwards so no
test content was left behind. Anonymous on the draft: 404, no bar.
npm run verify: exit 0 — tsc clean, lint 0 errors, 223 suites / 2224 tests.
Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(security): SSRF guard for webhook URLs; scrub committed Supabase PATs
- Webhook URLs are fetched server-side and the response body is readable
by the endpoint owner, so internal targets (localhost, RFC1918,
link-local/cloud metadata, CGNAT, reserved) are now rejected at mint
time and re-checked before every delivery (src/lib/security/ssrfGuard.ts,
30 unit tests). Dev keeps localhost receivers working.
- Delete scripts/db/apply-migration.sh (orphaned one-off carrying a
hardcoded sbp_ token for the retired managed-cloud project) and redact
the second dead token in docs/archive. Both tokens are dead — the
managed Supabase Cloud project was retired 2026-06.
- Add .gitleaks.toml: the default ruleset has no Supabase PAT pattern
(why these sat unflagged); new sbp_ rule with the two dead historical
tokens allowlisted so the full-history CI scan stays green.
- Update SECURITY.md and API conventions doc (webhooks section was still
marked "planned — not yet built"; now documents the shipped behavior
including the URL policy).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TxtUEaJPtYviTwrr5Sf7Pn
* perf(timeline): batch feed enrichment; parallelize reply tree and nudges
- getEnrichedUserFeed did up to 3 single-row lookups PER EVENT (~60
round-trips for a 20-item dashboard/timeline page) while the batched
enrichEventsForDisplay (3 queries total, already used elsewhere) sat
unused — switch to it and zip the social counters back in by index.
- getReplies awaited each reply subtree sequentially — now Promise.all,
so thread latency no longer grows linearly with reply count.
- generateNudges queried each entity type serially on the force-dynamic
/api/cat/nudges path — now parallel.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TxtUEaJPtYviTwrr5Sf7Pn
* fix(entities): registry is the one source for ownership columns; guard it in CI
- entityListHandler now derives the ownership column from the entity
registry's userIdField instead of defaulting to 'user_id'; drop the
redundant userIdField:'actor_id' literals from the 8 list routes.
- The profile-entities route kept its own copy of the ownership map,
which had drifted (research: 'user_id') — consolidated onto
getUserIdField().
- createResearch inserted without actor_id even though
research_entities.actor_id is NOT NULL on the live schema — research
creation could not succeed. Dual-write user_id + actor_id, same
pattern as ai_assistants.
- New CI guard: entity-registry-live-schema.test.ts asserts every
registry tableName / userIdField / priceColumn exists in
scripts/db/live-schema.json (the live-DB snapshot the deploy pipeline
refreshes).
- Mark src/types/database.ts as known-stale in its header: it disagrees
with the live schema (missing actor_id on several tables, missing
events/user_documents entirely) and gen:types writes a different file
that nothing imports — do not treat it as schema ground truth.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TxtUEaJPtYviTwrr5Sf7Pn
* test(ci): gate every Jest suite; repair Jest-30-broken scripts; coverage floor
- test:unit only matched __tests__/unit, silently excluding 22 suites /
~280 tests under tests/unit (webhook signature crypto, idempotency
keys, hasScope authorization) plus smoke/create/env — nothing gated
them. The pattern now matches everything Jest discovers (94 suites,
1095 tests, ~5s), so CI and the git hooks run the full fast suite.
- test:security / test:integration / test:performance / test:auth used
the singular --testPathPattern flag that Jest 30 hard-rejects (and
test:auth pointed at a directory that doesn't exist) — all four were
broken; security:scan errored because of it. Repaired with plural
flags, real patterns, and --passWithNoTests where the target set is
currently empty.
- Add a coverage ratchet floor in jest.config.js just below measured
coverage so it can only move up.
- Update developer docs that still showed the removed singular flag.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TxtUEaJPtYviTwrr5Sf7Pn
---------
Co-authored-by: Claude <noreply@anthropic.com>
The shared fromTable() helper (previous commit) was invisible to the schema-drift
guard, which keys on `.from(TABLE)`. That (a) blinded the guard to ~80 converted
queries and (b) mis-attributed the digest builder's dynamic-table columns to a
neighbouring `.from(messages)`, failing the deploy gate on a false positive.
Teach the scanner that `fromTable(client, TABLE)` ≡ `.from(TABLE)`. With that,
the digest query's dynamic tableName correctly resolves to "unverifiable, skip",
and a genuine pre-existing drift surfaces: group_proposals.execution_result is
read+written by services/groups/execution but was never migrated — every
proposal-execution update was failing (PostgREST rejects the whole update, so
executed_at never persisted → proposals could re-run). Add the idempotent
migration; the deploy applies it before the gate. Snapshot updated to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
#385 follow-up now that the migration is applied to the box.
- Regenerate src/types/database.generated.ts from the live box (postgres-meta),
and add the `visibility` column to entity_wallets in the hand-curated
src/types/database.ts (the type the supabase client actually uses).
- Remove the `as any` on the update in the entity-visibility API route — it's
properly typed now.
- Refresh scripts/db/live-schema.json so `npm run audit:schema` sees the column
(deploy already dumps a fresh schema; this keeps the local/committed snapshot
honest). audit:schema green.
Kept ONE narrowing cast in PublicEntityDetailPage — not `as any`, but an explicit
typed shape — because supabase-js's deep select-type inference degrades to `never`
for that dynamic .from().select()…maybeSingle() chain against the large schema
(reproduced even selecting a single known column, so it is not about visibility).
Comment updated to state the real reason.
Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pipeline-reliability batch of the DevOps overhaul:
- deploy-selfhost.sh schema-drift gate no longer fails OPEN: the live-schema
dump is retried, and if the box schema truly can't be read we BLOCK rather
than deploy unguarded (every later step needs ssh anyway, so it's not a
benign hiccup).
- deploy-selfhost.sh keeps the previous release at app-old until the next
deploy, giving a manual-rollback target between deploys (it was deleted on
success, leaving none). Deliberately NOT auto-rolling-back on a failed public
health check: local health already passed, so a public failure is Caddy/DNS,
and reverting a healthy app wouldn't fix it.
- New expand/contract gate: scripts/db/check-migration-safety.mjs flags
unacknowledged contract-phase DDL (DROP/RENAME/TRUNCATE/type-change) in
changed migrations, run as a fast job in migration-replay.yml. Auto-rollback
reverts code but not an applied migration, so a destructive migration the
previous release still uses breaks rollback — acknowledge intentional ones
with "-- migration-safety: contract-ok <reason>".
- ci.yml: concurrency group (cancel superseded runs so only the newest commit's
CI+CD proceed) + Next.js .next/cache reuse across runs for faster builds.
Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Founder-mandated SSOT/DRY/SoC audit + fix pass (report:
docs/audits/2026-07-03-principles-audit.md). Live schema verified on the box.
Live bugs fixed:
- POST /api/research 500s: createResearch + Cat create_research inserted the
9 denormalized counter columns dropped by migration 20260404000005; types
(research.ts, database.ts) and the research dashboard no longer reference
the dead counters either.
- Group-events APIs: profiles!group_events_creator_id_fkey /
group_event_rsvps_user_id_fkey embeds 400 on live (FKs point at auth.users,
not profiles). Split queries fetchEntityOwner-style via new shared
services/groups/eventProfiles.ts across 4 server/browser consumers.
SSOT/DRY fixes:
- Refresh stale scripts/db/live-schema.json from the box (audit:schema clean:
search_queries, user_economic_profile, payment_intents.lnurl_verify_url).
- ROUTES.DASHBOARD.CAT_WELCOME replaces 5x '/dashboard/cat?welcome=true';
exported isCatHubPath() replaces ad-hoc startsWith checks.
- 5 hardcoded fetch('/api/…') moved to API_ROUTES (new WEBHOOK_ENDPOINTS.
DELIVERIES, AUTH.OAUTH_PROVIDERS, DISCOVER.COUNTS).
- contextual-create.ts migrated to ROUTES.* + single COMPOSE_HREF.
- Fix 3 stale tests asserting the retired SATS currency code (failing on main).
Gates: type-check 0 · lint clean · 957/957 tests · audit:routes clean ·
audit:schema clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A circle is a lightweight community structure — lighter than a group (no shared
wallet or governance), just a discoverable community owned by its creator's actor.
Built end-to-end on the registry-driven pattern (most of the entity is generated
from the registry SSOT — only ~2 exhaustive maps needed a manual circle entry).
- Migration 20260628000000: `circles` table (actor-owned, visibility public/
unlisted/private, RLS, updated_at trigger). Applied to the box.
- entity-registry: 'circle' added to ENTITY_TYPES + a registry entry (community
category, no payment).
- validation/circles.ts: circleSchema + CircleFormData.
- API: /api/circles (list+create) and /api/circles/[id] (GET/PUT/DELETE) via the
generic factory handlers (actor ownership).
- Configs: circle-config.ts (create form) + entities/circles.tsx (dashboard list)
registered in get-config/index.
- Pages: dashboard list / create / [id] detail, public /circles (→ discover) and
/circles/[id] detail — all driven by the generic Entity* components + config.
- Cat: 'circle' added to CAT_CREATABLE_ENTITY_TYPES so Cat can propose it.
- routes: ROUTES.CIRCLES.VIEW + dashboard paths.
Type-check clean (0 errors); schema-drift gate green against the box.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Completes the schema-drift remediation. The 5 orphan tables (no create migration
anywhere) are resolved:
- New migration 20260627000002 creates 4 real feature tables with schemas derived
from the code's insert/select and conservative RLS:
- channel_waitlist — append-only, no public read (emails are PII)
- loan_collateral — owner-scoped read/write
- project_updates — public read (route gates by project status), authed write
- audit_logs — append-only, no read policy (service-role only)
Applied to the box; all idempotent / IF-NOT-EXISTS guarded.
- wallet_ownerships: removed the dead fallback in profiles/[username]/page.tsx —
it was a swallowed try/catch behind the current get_entity_wallets RPC, querying
a table that never existed (always contributed 0). Dropped the orphan
DATABASE_TABLES.WALLET_OWNERSHIPS constant too.
audit-schema-drift.mjs: known-drift allowlist is now EMPTY — the deploy gate blocks
on ANY missing table. live-schema.json refreshed from the box (117 tables/views).
All 14 originally-missing tables are now present (or their dead code removed); the
gate is green against the box with zero allowlisted app tables.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The deploy schema-drift gate (PR #297) surfaced 14 tables the code queries that
were missing on the box. This remediates the 9 that have defined create
migrations by applying them to the box, then de-allowlists them so the gate now
actively protects them.
Applied to box (group_invitations, contracts also fixes group_proposals.is_public,
project_support[_stats], research_progress_updates/votes/contributions,
user_presence, typing_indicators). The original create migrations were either
already backfilled-as-applied-but-never-run or conflicted with later renames
(20250107000000 references research_entities.funding_goal_sats, since →_btc), so:
- New migration 20260627000001 creates the 3 research sub-tables at current schema
(amount_btc, not the legacy amount_sats) and completes the sats→btc rename for
project_support/project_support_stats that Phase B (20260404000006) skipped.
Idempotent + fresh-box-safe.
- group_invitations / contracts-retry / the typing_indicators+user_presence slice
of fix_messaging_schema applied directly (all IF-NOT-EXISTS guarded).
audit-schema-drift.mjs: removed the 9 from the known-drift allowlist (gate green
against the box). The remaining 5 (project_updates, audit_logs, loan_collateral,
channel_waitlist, wallet_ownerships) have NO create migration anywhere — net-new
tables needing schema/RLS design — kept allowlisted pending that decision.
live-schema.json refreshed from the box.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The deploy already auto-applies pending migrations, but that's necessary-not-
sufficient: the box can still lack an object the code needs — a migration
backfilled-as-applied-but-never-run (the ai_conversations outage), or a manual
change. Until now that surfaced as silent prod 500s. This makes drift loud.
- scripts/db/dump-live-schema.sh — dump the box's REAL public schema (incl.
views) as the { table: [cols] } JSON the auditor consumes.
- scripts/db/audit-schema-drift.mjs — (1) accept a schema path via
LIVE_SCHEMA_PATH so it can run against a fresh box dump, not just the stale
committed snapshot; (2) NEW missing-table check — a resolvable `.from()` to a
table absent from the live schema is now flagged instead of silently skipped
(the exact gap that hid the ai_conversations drift).
- scripts/deploy-selfhost.sh — after applying migrations and BEFORE the swap,
dump the live schema and run the auditor against it; abort the deploy on drift
(live release untouched). Dump failure is non-fatal (no blocking on ssh flake).
- scripts/db/live-schema.json — refreshed from the box (104 tables/views).
The check surfaced a real backlog: 14 tables the code queries are MISSING on the
box (group_invitations, project_support(_stats), project_updates, research_*,
contracts, user_presence, typing_indicators, audit_logs, loan_collateral,
channel_waitlist, wallet_ownerships) — those features 500 in prod. Allowlisted as
documented KNOWN DRIFT in the auditor so the gate stays green for the backlog
while failing on any NEW drift; remediation = apply each create migration.
Also fixes a bug this check caught in new code: assistant-charge bumped
ai_assistants.total_messages, which isn't a column on the box (only total_revenue
is) — that update silently failed; now only total_revenue is bumped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Production is fully self-hosted on the Hetzner box (bitbaum, behind Caddy)
with self-hosted Supabase. This scrubs the remaining Vercel footprint:
Code (src/ now has zero Vercel references):
- security page: "Hosted on Vercel" → self-hosted infrastructure
- FleetCrown URL fleetcrown.vercel.app → fleetcrown.orangecat.ch (entity
registry + external-publish allowlist; the dead vercel.app subdomain was
also a re-registration risk in an allowlist)
- webhook-secret error + cron/env comments point at the box, not Vercel
- corrected stale "Vercel kills the function on response" comments (false
on a persistent server) to accurate await-before-respond reasoning
Security/config:
- supabase/config.toml: dropped dead *.vercel.app auth redirect URLs
- @vercel/mcp-adapter dependency removed (unused)
Artifacts removed:
- scripts/auth/vercel-login.js, scripts/preview-url.sh,
scripts/dev/merge-env.js, scripts/monitoring/deployment-monitor.js,
scripts/db/setup-env.js, mcp-servers/vercel-openapi.json, .vercel/
- setup_vercel_secrets MCP tool in mcp-servers/github-server.js
- .gitignore Vercel section; env scripts stripped of vercel-login/token
Docs + .claude rules/commands rewritten to the self-host deploy flow
(scripts/deploy-selfhost.sh / .github/workflows/cd.yml; env at
/opt/orangecat/app/.env). Historical/archive records left intact.
Verified: tsc 0 errors, SELF_HOST=1 build green, cron unit tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
events.ticket_price_btc / funding_goal_btc held amounts in the entity's chosen
`currency` (events has a currency column), NOT BTC — like products (price) and
services (fixed_price). The `_btc` suffix lied about the unit and would render a
50 CHF ticket as 50 BTC if any display code trusted it. The architecture doc
already specifies `ticket_price` in currency; the column names were the drift.
- migration: RENAME ticket_price_btc->ticket_price, funding_goal_btc->funding_goal
(atomic, preserves data; events is currency-denominated, matching products/services)
- events route: drop the now-pointless _btc field mapping
- generated types: rename only the events block (research_entities.funding_goal_btc
is genuinely BTC-native — no currency column — and stays)
Convention codified in the migration: prices -> nominal currency + neutral name;
donations/balances -> BTC + _btc suffix. assets.*_btc carry the same mislabel and
are a follow-up (their columns are read by display code -> needs its own change).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The live `transactions` table was the dead legacy funding-page schema
(funding_page_id/transaction_hash NOT NULL, 0 rows, target funding_pages
table gone), but all current code speaks an entity schema no migration
defined — so wallet transfers and project contributions 400'd silently,
and the transfer_between_wallets RPC the transfer path calls didn't exist.
Safe rebuild (0 rows, no inbound FKs):
- recreate transactions with the entity schema both writers agree on
(/api/transactions + domain/wallets/transferService) — verified both
payloads insert cleanly
- RLS: sender must be auth.uid() (profile) or a project wallet they own;
verified real user passes, spoofed sender blocked
- add transfer_between_wallets(uuid,uuid,numeric,uuid): atomic, row-locked,
re-checks balance — verified happy-path moves funds + overdraw raises
Applied to the self-host box; schema-drift audit now green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The schema-drift auditor only checked .select()/filter columns, which is why the
is_test INSERT bug slipped through. Extended it to also validate the top-level keys
of .insert()/.update()/.upsert() object literals against the live schema (depth-1
only; skips spreads and _synthetic keys). Refreshed scripts/db/live-schema.json
from the box (96 tables).
The extended sweep immediately found two real bugs:
1. group_activities (FIXED here): the logger inserted description + related_* as
columns, but the table only has `metadata` (jsonb). Every insert failed and the
catch swallowed it, so the group activity feed never recorded anything. Now folds
those into metadata.
2. transactions / wallet transfers (DOCUMENTED, not fixed): transferService inserts
~12 entity-based columns (from_entity_type, to_entity_type, payment_method, …) but
the live `transactions` table is the legacy funding-page schema (no such columns),
and no migration defines the entity schema. So wallet-to-wallet transfers are
broken. Fixing needs a deliberate transactions-schema reconciliation (other code
may read the legacy columns) — flagged for a careful follow-up, not a blind ALTER.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The genuinely-missing collaboration primitive: a project can post open roles
(needed skills + engagement type); open roles are a public cross-project board;
interested makers reach out via DM. Distinct from /jobs (group proposals).
- migration 20260617000003: project_roles (project_id FK, role_title, skills[],
engagement_type, status) with RLS — public read of OPEN roles, owner-only write
(by projects.user_id = auth.uid(), verified = auth user). Applied to box.
- config/project-roles.ts: SSOT for engagement types + statuses + labels.
- services/collaboration/projectRoles.ts: list-open (skill/engagement filters,
joins project title+owner), per-project, create + status-update with app-layer
ownership checks (RLS is the backstop).
- API: GET/POST /api/project-roles, PATCH /api/project-roles/[id].
- /collaborate board page: browse roles, post a role on your own projects,
"I'm interested" → opens a DM with the owner via /api/messages/open. Added
"Collaborate" to the authenticated nav + ROUTES.COLLABORATE/API_ROUTES.PROJECT_ROLES.
Verified e2e vs box DB: board lists open roles with project+owner+skills;
engagement filter works; POST 401s unauthenticated; /collaborate renders 200.
tsc + lint + 486 unit tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two follow-ups to the schema-drift hardening:
1. groups filtering — `getUserGroups` filtered the dead columns `type` /
`governance_model` / `category` raw (every such request 400'd to empty);
`getAvailableGroups` + `searchGroups` each re-implemented the legacy→live
mapping (drift-prone) and still referenced the nonexistent `member_count`.
Consolidated into one shared `applyGroupFilters()` + `safeGroupSort()`:
type→label, governance_model→governance_preset, category→tags, member_count
ignored (no column), sort guarded to real columns. Removed the now-fixed
entries from the audit allowlist.
2. Regenerable typed schema SSOT — `src/types/database.generated.ts` is generated
straight from the LIVE self-hosted Postgres via postgres-meta (the Supabase
CLI's --db-url mode is broken in 2.67.x). `npm run gen:types`
(scripts/db/gen-types.sh) refreshes it. Kept as the accurate reference; NOT
wired into the `<Database>`-typed singleton clients yet — doing so activates
postgrest-js query validation and surfaces ~268 pre-existing data-layer type
gaps (dynamic .from(), untyped RPCs, loose selects), a dedicated migration.
Until then drift stays guarded by `npm run audit:schema`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Most services use an untyped Supabase client, so selecting a column the live DB
lacks COMPILES but errors at runtime (PostgREST 400s the whole query) — this had
silently broken real features. Added a static auditor that diffs every
resolvable .from().select()/filter against a snapshot of the LIVE schema
(`npm run audit:schema`, scripts/db/audit-schema-drift.mjs + live-schema.json),
with an allowlist for embed false-positives and triaged known-drift.
Fixed the live breakages it found:
- profiles.display_name → aliased `display_name:name` in 13 selects (the DB column
is `name`; alias keeps the response field `display_name` so types/API/frontend
are unchanged). Unbreaks task analytics, seller emails, notification digests,
timeline enrichment.
- document-context fetchWalletsForCat: profiles.eq('user_id') → eq('id') (PK is
the auth id) — the Cat's wallet context was erroring to empty for everyone.
- sendMessage: dropped non-existent ai_assistants.allowed_models/min_model_tier
from the select — AI-assistant chat was erroring "Assistant not found".
- browser dev connection test: select('count') → select('id').
Tracked (allowlisted, need a follow-up/product decision): wishlist_feedback &
proofs use actor_id not user_id; groups filtering references type/category/
member_count/governance_model not in schema; group_proposals.is_public.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete 30 dead scripts that drove the retired managed Supabase Cloud via the
Management API / dashboard (key fetchers, Management-API migration runners,
cloud diagnostics). All were already neutered (banner + exit) in 054204e9 and
referenced nowhere in code/CI — the DB is self-hosted (psql + migration files)
so they have no purpose. Also drop env_tokens_template.txt (redundant with
.env.example). History preserves them.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Curl-based, runs from any host that can reach the HTTPS API (no PG/SSH).
Exercises the real signup path and asserts the new user gets profile +
actor + plan rows (exact count via Content-Range, table-agnostic).
Currently red on bootstrap rows until 20260615000003 is applied box-side;
green gate for confirming registration after the apply.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The managed Supabase Cloud project (ohkueislstxomdjavyhs) is retired; the
self-hosted instance at supabase.orangecat.ch on the Hetzner box is the single
source of truth. Repoint the image host + setup scripts, rewrite the agent/dev
guidance to use the self-host directly (not the Supabase MCP, which only reaches
the retired cloud), update active docs, exit retired cloud-Management-API
scripts behind a RETIRED guard, env-ify direct-connect scripts, gitignore
.env-backups, and add a founder-run DECOMMISSION-CLOUD runbook. No live code
path references the managed project anymore.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Scripts now read from .env.local using dotenv instead of
having hardcoded values or placeholders.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major features:
- AI Chat: Add AI assistant conversations with credit system and ratings
- Wishlists: Complete wishlist feature with tiers, proofs, and feedback
- Notifications: Full notification system with preferences
- Research entities: Research entity framework
Project Page UX fixes:
- SupportModal: Auto-fill logged-in user's name from profile
- SupportModal: Improved anonymous toggle UX (top of form, hide name when on)
- ProjectHeader: Share button now visible to all users, not just owners
- ProjectHeader: Added Contact button for non-owners to message creator
- RLS: Fixed projects policy to allow public viewing of active projects
Infrastructure:
- Claude Code configuration (.claude/ directory with rules, hooks, commands)
- Sidebar improvements with flyout tooltips
- Actor-based messaging support
- Various entity config and navigation updates
Note: Pre-existing ESLint errors (1300+) need cleanup in separate commit
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix currency defaults (SATS → CHF) across forms, configs, and API routes
- Remove @ts-nocheck from socialService.ts and improve type safety
- Replace console.log statements with proper logger utility in production code
- Additional type safety improvements and code quality enhancements
- Documentation updates for improved maintainability
All changes follow DRY, SSOT, and separation of concerns principles.
- Fixed messaging service Supabase insert/update type errors
- Fixed profile hooks (useProfileForm, useAuth, useActiveRoute, useMobileMenu)
- Added missing type exports (UserProduct, UserService, UserCause, Profile with email)
- Fixed messaging API route type errors
- Updated Database types for proper Supabase type safety
Note: Some TypeScript errors remain in non-critical areas (commerce, entity configs, tests) but core messaging and profile functionality is type-safe.
- Replace console.error with structured logging using logger utility
- Extract duplicate error handling into centralized utilities
- Add constants for magic numbers and timeouts
- Improve type safety by eliminating any types and adding proper interfaces
- Standardize error response format across all wallet API endpoints
- Fix timeout cleanup issues and memory leaks
- Add comprehensive error handling for wallet operations
Changes:
- Add WalletManager to ModernProfileEditor for wallet management
- Display categorized wallets on public profile pages with goals
- Fetch wallets via /api/wallets endpoint
- Add CRUD handlers (add, update, delete, refresh)
- Keep legacy Bitcoin address display for backward compatibility
- Install bitcoin-address-validation and bs58check for validation
- Fix missing Clock import in TimelineComponent
Features:
- Users can manage up to 10 wallets per profile
- Each wallet has category (🏠 Rent, 🍔 Food, etc.)
- Goal tracking with progress bars
- Balance display with refresh capability
- Copy address to clipboard
- Empty state prompts users to add wallets
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add public profile route at /profiles/[username] with server-side rendering
- Convert project pages to Server Components with generateMetadata for SEO
- Add Open Graph and Twitter Card metadata for social media previews
- Fix middleware to allow public access to /profiles/ and /projects/ routes
- Add PublicProfileClient and ProjectPageClient components for interactivity
- Update route constants with PROFILES.VIEW(username) for public profiles
- Add 404 pages for profiles and projects
- Deprecate SocialMetaTags component (replaced with generateMetadata API)
- Fix database field name mapping (name vs display_name)
- Add comprehensive testing scripts and documentation
- Fix missing Link import in UnifiedHeader
This enables users to share their profiles and projects on social media
with proper preview cards (no more 'Loading...' on Twitter/Facebook).
Phase 1 complete - ready for production deployment.
- Bump version to 0.1.1 for tracking
- Add webpack-bundle-optimizer script for Next.js config
- Simplify ESLint configuration to resolve missing dependencies
- Prepare for production deployment with proper version control
This deployment includes:
- Profile update fixes with banner_url support
- LN address validation
- Auth cookie fixes for profile updates
- Various documentation and testing improvements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>