2 Commits
Author SHA1 Message Date
9036cb3fb2 fix(cat): break the bootstrap deadlock that would have kept @cat inert (#768)
Caught by checking production rather than by reading the code: the queue
had deployed, and the Cat still had no account. Following that through,
it never would have got one.

The circularity: resolveMentions can only flag @cat when a Cat PROFILE
exists, so with no account nothing is ever queued — and the worker called
ensureCatAccount AFTER its empty-queue early return, so an empty queue
established nothing. Nothing queued, so nothing was established, so
nothing queued. A freshly deployed platform would sit there with @cat
resolving to nobody, looking exactly like a working feature that nobody
had used yet.

The worker now establishes the account before it looks at the queue. One
primary-key lookup per tick when it is a no-op, which is every tick after
the first, and the every-minute timer therefore becomes what brings the
Cat into existence.

Second half of the same bug, in the timer: `Persistent=true` only
replays a run MISSED while the machine was down. A timer enabled for the
first time just waits for the next OnCalendar — for a daily timer, up to
24 hours. Production confirmed it: the unit was installed and enabled,
LAST was "-", NEXT was 12 hours away. OnActiveSec=1min makes a freshly
deployed Cat exist within the minute.

Pinned by a test that asserts the ORDERING, not just the call, and proven
by restoring the old arrangement — two tests go red.

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 11:52:34 +00:00
06772cc506 feat(cat): give the Cat an account, and stop the deploy list from drifting (#766)
The Cat is a real profile rather than a rendering convention, which is
what lets a Cat reply be an ordinary messages or timeline_events row —
read receipts, search, deletion, threading, moderation and realtime all
work on it without a branch. The cost of that is exactly this: something
has to create the row.

ensureCatAccount is idempotent and cheap when it is a no-op (one indexed
lookup), so it is safe on every tick, and running it on a schedule makes
the identity self-healing: @cat is linked wherever it is written, so a
missing profile silently resolves every mention on the platform to
nobody. Daily re-assertion turns that from a support ticket into an
invariant.

The login address is cat@orangecat.invalid, and both halves are
load-bearing. `.invalid` is reserved by RFC 2606 and can never be
delivered to or registered, which matters because an account's email is
its password-reset channel — a bot identity with a routable address is
one somebody can eventually take. There is no password either, so there
is no credential to phish. The local part is what makes the handle `cat`
at all: handle_new_user derives the username from
split_part(email, '@', 1). That trigger is also the answer to why
production contains handles like m.schaupensteiner and butaeff+ocauth2 —
signup derives usernames from email addresses and never sees the
validator.

It recovers from a half-built account rather than assuming a clean slate:
the auth user survives a deleted profile row, so "already registered" is
the expected second run, not a failure. When it genuinely cannot
establish an account it returns null and says so loudly, because a caller
that improvises a sender is worse than one that stays quiet.

Also collapses the deploy script's systemd list, which was written three
times — the scp arguments, the install loop and the enable calls. Adding
a timer meant editing three places, and missing the third shipped a unit
file that never ran: the same silent-failure shape as a cron route
nothing invokes. There is now one array, and every .timer in it is
enabled from that same array.

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 11:12:06 +00:00