mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-19 00:03:30 +00:00
Every operation the SlateDB store answers with a full keyspace scan becomes an indexed query here: listing a user's sessions joins one row per session via the partial unique index instead of scanning every token ever issued and grouping by chain, and revoking one is a single DELETE that cascades. Rotation is the structural win. Claiming the presented token is one `UPDATE ... WHERE used_at_ms IS NULL ... RETURNING`, and it is the transaction's first statement, so SQLite takes the write lock before anything is read. A concurrent caller blocks on that lock and then sees the token already spent, which is exactly the replay signal -- so the store needs no `KeyedMutex` to serialise rotation, and the guarantee survives more than one server process. Expiry is checked ahead of reuse on the cold path, preserving the ordering callers depend on: only replaying a still-live token revokes its chain. Drops the ordering CHECKs between a session's timestamps and its tokens'. Rotation stamps `now` from the process clock against rows written by an earlier request, so an NTP step backwards would have turned a harmless clock anomaly into refresh failing outright for every affected session. The store is not wired into the server yet. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| build-support | ||
| fabro-api | ||
| fabro-auth | ||
| fabro-client | ||
| fabro-config | ||
| fabro-core | ||
| fabro-db | ||
| fabro-dev | ||
| fabro-http | ||
| fabro-macros | ||
| fabro-model | ||
| fabro-oauth | ||
| fabro-options-metadata | ||
| fabro-proc | ||
| fabro-redact | ||
| fabro-static | ||
| fabro-telemetry | ||
| fabro-template | ||
| fabro-test | ||
| fabro-types | ||
| fabro-util | ||
| fabro-vault | ||