14 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 6dcae92a78 fix(auth): a deleted account takes its documents, bots and conversations (#292)
* fix(auth): a deleted account takes its documents, bots and conversations

When people were GoTrue users, deleting the auth.users row cascaded through
every botsmann table. Since accounts are AccountKit's (#289), deleting an
account in the account panel removed the account and left the person's
documents, chunks, bots, conversations, context, settings and profile
behind, under an id nobody holds. onAccountDeleted now removes them, and
the person's uploaded files in the documents bucket.

A test reads the migrations and fails when a table that referenced
auth.users is missing from PERSON_ROWS.

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

* ci(auth): a navigation sent on after landing is not a failed journey

The settings page can send a just-signed-in browser on once more while its
session loads; Playwright reports the first navigation as aborted. The
journey now waits for the page to arrive, however it gets there.

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

* fix(auth): ask the server before sending a signed-in visitor to sign in

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 23:51:09 +01:00
CatoandClaude Opus 5.5 ebe51fa38e feat(auth): every way in on AccountKit's own screens (#289)
* feat(auth): every way in on AccountKit's own screens

Botsmann signed people in against OrangeCat's GoTrue (auth.users). It now
runs on AccountKit (@bitbaum/accountkit 0.23) with AccountKit's own forms:
/auth/signin offers email and password, an emailed sign-in link, a
passkey, recovery through the mailed link and the second factor;
/auth/signup is sign-up; /account carries the account panel ("Sign-in and
security" in the account menu). "Continue with OrangeCat" and the shared
sign-in show when their clients are set, the link and recovery when mail
is. The GoTrue routes (/api/auth/signin, signup, forgot-password,
resend-verification, profile) and pages (callback, forgot-password,
reset-password, verify-email) and the cookie-session client are gone.

AccountKit's tables live in a host accounts database (drizzle/, loki
accounts-db.conf); the data stays in the botsmann supabase schema, which
every route already read with the service-role client. verifyUser now reads
AccountKit's session; /api/user/profile moves onto it too. New accounts get
uuid ids, and migration 013 drops the person columns' keys to auth.users,
which a new person's id is not in. Nothing is deleted. The profile editor
writes AccountKit's name and image.

Existing people keep their rows: scripts/db/accountkit-people.sql lists
everyone who owns rows with their OrangeCat actor id, and
scripts/db/accountkit-import.sql gives each an account under the same id,
linked to OrangeCat by that actor id, never by address (loki
accountkit-supabase.yml rehearses it rolled back, then imports).

Pages were served with public, max-age=3600 to every browser, account pages
included: after sign-out the browser showed its cached /account. /account
and /auth/* are now private, no-store. The account menu's trigger has a name.

tests/__tests__/accounts runs the ways in and the import on the committed
migration; browser-smoke.yml's account job rehearses the import and runs
the browser journey against the production build with AccountKit's real
mail caught by a sink.

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

* fix(auth): send a signed-out visitor to sign in with the router

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

* ci(auth): the shared sign-in's button is matched by how it starts

AccountKit 0.24 names only the providers Morulia publishes, so the label
changes with Morulia.

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

* ci(auth): expect the shared sign-in only once Morulia publishes a provider

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

* ci: run the checks on the journey change

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 23:27:16 +01:00
107e8c5c08 docs(db): point this repo at its own database, and gate the way back (#143)
The schema fix landed in #138, but the repo still told you to operate a
Supabase we do not have. docs/SUPABASE_SETUP.md opened with "Completed Setup"
for a hosted project jkjmhtirxwhljpkcfxqe.supabase.co and said to apply
migrations by pasting SQL into a supabase.com dashboard. Two unreferenced
scripts printed the same instruction, one handing out a psql string against
pooler.supabase.com, and the CLI's .temp cache with the old project ref was
committed — twice, once nested under supabase/migrations/.

That is not stale clutter, it is the outage. A wrong pointer to a real-looking
place is worse than no pointer: no pointer makes someone ask, a plausible one
makes them assume it was handled. Nobody pasted anything, the eleven migrations
were never applied, and /api/health served PGRST205 for months while every
deploy went green.

So the doc now describes what is actually true — self-hosted on bitbaum at
supabase.orangecat.ch, our tables in the `botsmann` schema because one database
backs several apps and `public` is orangecat's, and migrations applied
automatically on deploy by fleetcrown's apply-schema.sh against the
botsmann._deploy_schema_history ledger. Nothing is pasted anywhere. 280 lines
became 100.

Fixing today's copies only clears today's copies, so check:selfhost joins
verify: it fails on supabase.com/dashboard, app.supabase.com, pooler URLs and
real project refs, allows supabase.com/docs because the product documentation
is still correct for us, and exempts docs/archive/ so history can stay honest.
Proven to fail before shipping — it catches an injected dashboard link and a
project ref, and leaves the your-project.supabase.co placeholder alone.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 08:08:06 +00:00
93d6ed067b fix(db): our tables are not in orangecat's schema — tell every client (#138)
/api/health has returned 503 because `public.consultations` does not exist. It
never did. Botsmann shares one self-hosted Supabase database with orangecat,
which owns `public` and its 128 tables; ours were nowhere, because all eleven
migrations were unapplied.

The schema half is fixed in the deploy pipeline (fleetcrown#398): botsmann now
declares `supabase:botsmann` and its migrations apply into a schema of its own,
exactly as printcraft's do. That has run — all 11 tags are recorded and the 12
tables exist.

This is the other half. A Supabase client that is not told the schema queries
`public`, so it would still get PGRST205. Measured against production just now:

  GET /rest/v1/consultations                      -> 404 PGRST205
  GET /rest/v1/consultations  Accept-Profile: botsmann -> 200 []

`db: { schema }` is what sends that header, and it was missing from all four
client factories — anon, service-role, browser and route-handler.

The schema name is one constant in lib/constants.ts, not four literals. The
second copy is how the first goes stale, and this repo has just spent a day
proving what duplicated configuration costs.

Two things this also removes:

  * `scripts/run-migration.ts` and `scripts/migrate-via-api.ts` applied SQL
    through the service-role client with no schema set. They are from the era
    when migrations were run by hand; now they would create our tables inside
    orangecat's `public`. Schema is the pipeline's job, and a second way to do
    it is a second way to do it wrong. Nothing references them.
  * The bare `SupabaseClient` type hardcodes `'public'`, so annotating with it
    silently asserts we query orangecat's tables — and rejects the client we
    actually build. The type is now derived from the factory, which keeps the
    two in step and survives supabase-js reordering its generics.

New test pins it per file, by count: every `createClient` call in a client file
must set the schema, from the shared constant, with comments stripped first so
the guard cannot be fooled by prose. Adding a fifth unscoped factory fails the
test instead of production. Mutation-checked: unscoping the browser client
fails it.

verify green: 237 tests, lint, typecheck, build.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 19:57:39 +00:00
GandClaude Opus 5 7af354316a ci: call the central auto-merge sweep instead of carrying a copy (#136)
auto-merge-sweep.sh was copied into 22 repos and drifted into EIGHT distinct
versions, 245 to 404 lines. Three of them independently grew different fixes for
real outages, and each fix reached only the repo that wrote it:

  evig, revampit   infra-failure detection + re-run. An Actions incident left
                   main "failure" with no failed job at all; 11 PRs stranded
                   for roughly 14 hours.
  fleetcrown       DEADLOCK naming — a red base with the repairing PR sitting in
                   the queue was indistinguishable from "nothing to merge".
  the other 19     neither.

Nothing could carry a fix across, so every repo waited to hit each outage
itself. This repo now calls the canonical sweep in maonakamoto/dotfiles, and the
local copy is deleted.

The canonical is the union of the three, built on the variant ten repos were
already running rather than on the longest one — the 404-line variant is missing
the step-summary reporting the 296-line one has, so "take the biggest file"
would have silently deleted working behaviour. The merge was 106 insertions and
zero deletions: nothing can be lost by adopting it.

The triggers stay in this file because they genuinely are per-repo: workflow_run
must name the CI workflow exactly, and that name differs across the fleet.

Two details that are silent when wrong, both found by piloting rather than
reasoning:

  rearm_workflows is SPACE-separated. The sweep word-splits it; a comma makes
  one bogus token, every dispatch fails, and the only symptom is that nothing
  deploys — while the sweep still exits 0 and reports a successful merge.

  permissions are declared on the CALLER as well. A called workflow's token is
  capped by what the caller grants, so relying on the callee's block alone can
  hand it a read-only token; the sweep would then merge nothing while exiting 0,
  which is indistinguishable from having nothing to merge.

Verified before this rollout: the canonical ran end to end in dotfiles' own CI,
and the reusable-workflow path ran end to end in the pilot repo (s-ink).

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 14:54:40 +00:00
G b97d282d0a fix(ci): declare the failing-job list before the branch that can skip it (#132) 2026-08-07 09:56:28 +00:00
G bdf710c760 fix(ci): a red base must not trap the PR that repairs it (#131) 2026-08-07 09:37:31 +00:00
G 6aeae2b8fb fix(ci): stop skipping conflicts, and keep branches current (#129) 2026-08-07 07:16:13 +00:00
GandClaude Opus 5 35606a2be2 fix(ci): drain the merge queue oldest-first, not newest-first (#128)
`gh pr list` returns newest-first, and the sweep merges the first eligible PR
then stops. So the newest green PR wins every sweep, and an older one can wait
indefinitely.

Observed in maonakamoto/fleetcrown on 2026-08-06: two consecutive sweeps merged
the two newest PRs while three older green ones sat untouched and were never
even evaluated. With several agent sessions opening PRs continuously that is
starvation — and it starves the worst candidate, since the longest-waiting PR
is the one whose checks were proven against the most now-stale base.

PR numbers increase monotonically with creation, so sorting ascending is FIFO.
The ordering was never a decision, just whatever gh happened to return.

Fixed upstream first (fleetcrown #182) and verified in production there: the
sweep immediately after it landed correctly took the oldest open PR rather than
the newest. This is that one-line change, applied to the fleet.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 13:38:01 +00:00
G 7e03d649a6 ci: green PRs merge and deploy themselves (#127)
* ci: add the auto-merge sweep policy

* ci: green PRs merge and deploy themselves

* ci: allow CI to be dispatched so auto-merge can re-arm it

* ci: allow deploy to be dispatched so an automated merge still ships
2026-08-05 19:16:22 +02:00
GandClaude Opus 4.8 26b042cd86 chore(infra): remove Vercel references — self-hosted now (#120)
Botsmann now runs self-hosted on the Hetzner box "bitbaum" behind Caddy
(botsmann.orangecat.ch); Vercel is fully decommissioned.

- CI: rename the "Deploy to Vercel" workflow to a vendor-neutral CI workflow
  (build/lint/test only). Actual deploy runs from .husky/pre-push → Hetzner
  deploy script. Remove vercel.json and the Vercel-only deploy-monitor.sh.
- Docs: rewrite current-setup deploy/hosting text in .claude/CLAUDE.md,
  README badge, docs/COMMANDS.md and docs/SHARED_CONTEXT.md to the self-hosted
  box. Repoint the dead botsmann.vercel.app URL → botsmann.orangecat.ch.
- Code: neutralize "(Vercel)" route-segment comments; reword the warmup cron
  comment; update the demo page tech-stack line to self-hosted.
- Keep: secret-scan guardrail (VERCEL_OIDC_TOKEN) and `env -u VERCEL` in the
  husky hooks, the educational hosting-comparison page, historical docs/archive,
  and executive-docs business/finance planning material (see PR body).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 09:23:49 +02:00
g-butandClaude Sonnet 4.6 aa515d3d89 chore: fix prettier formatting across 28 files
CI format:check was failing. Auto-formatted all files to match
Prettier config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 09:45:47 +01:00
g-butandClaude Opus 4.5 1c7abeebac docs(claude): add global standards reference and update date
- Add @~/.claude/CLAUDE.md import for global engineering standards
- Update Last Updated date to 2026-01-23

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:22:36 +01:00
Your Name 8a55e4fb9e feat: Complete deployment automation and modern design overhaul
- Fix header layout to prevent movement when megamenu opens
- Redesign homepage with modern, futuristic aesthetic
- Implement automated deployment with GitHub Actions
- Optimize build process for production deployment
- Add deployment monitoring and verification scripts
- Update README with comprehensive deployment documentation

Breaking changes:
- Header now uses fixed positioning with backdrop blur
- Homepage features gradient backgrounds and glassmorphism effects
- Automated CI/CD pipeline with comprehensive testing and monitoring
2025-10-02 23:46:03 +02:00