fabro/lib/components
Bryan Helmkamp 701708b32d
Add SQLite-backed AuthSessionStore
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>
2026-07-25 23:42:14 -04:00
..
fabro-acp refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-agent Merge pull request #640 from fabro-sh/codex/workspace-glob-semantics 2026-07-25 12:05:17 -04:00
fabro-automation Remove dead automation TOML serializers 2026-07-25 14:37:58 -04:00
fabro-checkpoint refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-dump Merge branch 'main' into feat/shared-checkout-parallel 2026-07-24 06:29:57 -04:00
fabro-environment refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-github refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-graphviz refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-hooks refactor: centralize agent profile tool configuration 2026-07-24 14:06:29 -04:00
fabro-install refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-interview refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-llm feat(agent): add gpt56 profile for GPT-5.6 Sol, Terra, and Luna 2026-07-25 10:42:32 -04:00
fabro-manifest refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-mcp refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-mcp-store refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-sandbox Merge remote-tracking branch 'origin/main' into codex/workspace-glob-semantics 2026-07-25 11:59:57 -04:00
fabro-slack refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-store Add SQLite-backed AuthSessionStore 2026-07-25 23:42:14 -04:00
fabro-tool refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-tracker refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-validate Merge branch 'main' into feat/shared-checkout-parallel 2026-07-24 06:29:57 -04:00
fabro-variable refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-workflow Merge remote-tracking branch 'origin/main' into codex/workspace-glob-semantics 2026-07-25 11:59:57 -04:00