fix(api): write-through to local DB after PDS writes (#81)
* fix(api): write-through to local DB after PDS writes
After a successful PDS write, immediately index the record in the local
database so GET requests reflect the change without waiting for the
Jetstream firehose to deliver the event. This eliminates the race
condition where page refresh showed stale data (skills, positions,
education, etc. appearing to vanish after adding/removing).
Extract DB write logic from Jetstream indexers into a shared
record-indexer service. Both write routes and Jetstream handlers now
call the same idempotent upsert functions -- when Jetstream eventually
delivers the duplicate event, the ON CONFLICT clause makes it a no-op.
Follows the write-through pattern used by Cloudflare's Statusphere
(the canonical ATProto AppView example) for read-your-own-writes
consistency on custom lexicons.
Closes #79
* style: format new files with prettier
* fix(tests): use unique canonical skill slug to avoid cross-suite FK conflict
The record-indexer test and skill-normalization-db test both created a
canonical skill with slug 'javascript'. When running together, cleanup
order caused FK violations. Use a unique slug 'writethrough-testlang'
to isolate the test data.
authored by