Keep operator session validation off the event loop #275

Closed
opened 2026-08-08 07:10:03 +00:00 by timmy · 0 comments
Owner

Problem

Every authenticated request performs synchronous SQLite DDL, expiry deletion, and lookup on the FastAPI event-loop thread. GET /api/v1/session repeats the lookup, and public assets are validated unnecessarily. Under registry latency, concurrent mobile polling and actions serialize.

Vertical slice

  • Initialize the durable registry outside request validation.
  • Make validation read-only and execute it off the event loop.
  • Reuse the middleware result in session status.
  • Skip registry lookup on public routes while preserving fail-closed protected access and durable cross-worker revocation.

Acceptance tests

  • A blocked registry lookup does not block an event-loop heartbeat or health request.
  • Concurrent authenticated requests overlap lookup latency.
  • Session status performs one durable lookup and public routes perform zero.
  • Expired/revoked sessions remain rejected; registry failures return sanitized 503.

No historical issue or recent commit addresses event-loop blocking, per-request DDL/write pruning, duplicate session validation, or public-route lookups. Related #258/#262/#268 establish auth, fail-closed config, and revocation only.

## Problem Every authenticated request performs synchronous SQLite DDL, expiry deletion, and lookup on the FastAPI event-loop thread. `GET /api/v1/session` repeats the lookup, and public assets are validated unnecessarily. Under registry latency, concurrent mobile polling and actions serialize. ## Vertical slice - Initialize the durable registry outside request validation. - Make validation read-only and execute it off the event loop. - Reuse the middleware result in session status. - Skip registry lookup on public routes while preserving fail-closed protected access and durable cross-worker revocation. ## Acceptance tests - A blocked registry lookup does not block an event-loop heartbeat or health request. - Concurrent authenticated requests overlap lookup latency. - Session status performs one durable lookup and public routes perform zero. - Expired/revoked sessions remain rejected; registry failures return sanitized 503. No historical issue or recent commit addresses event-loop blocking, per-request DDL/write pruning, duplicate session validation, or public-route lookups. Related #258/#262/#268 establish auth, fail-closed config, and revocation only.
timmy self-assigned this 2026-08-08 07:10:03 +00:00
timmy closed this issue 2026-08-08 07:16:56 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#275
No description provided.