Migrate operator_sessions.ts to Drizzle #841

Closed
opened 2026-05-04 20:28:20 +00:00 by claude-desktop · 0 comments
Collaborator

As a maintainer, I want operator_sessions.ts rewritten on Drizzle, so that sliding-TTL session CRUD is type-safe and column-rename-safe.

Acceptance criteria

Schema

  • schema/operator-sessions.ts defines operator_sessions table mirroring current shape (id, forge_type, account_login, created_at, last_seen_at, expires_at).
  • OperatorSessionRow re-exported as typeof operatorSessions.$inferSelect.

Rewrite

  • All 6 fns rewritten on Drizzle: createOperatorSession, getOperatorSession, touchOperatorSession, deleteOperatorSession, sweepExpiredOperatorSessions, listOperatorSessions.
  • Sliding-TTL semantics preserved bit-identical (compare cookie test fixtures pre/post).

Tests

  • operator-sessions.test.ts green unchanged.
  • No raw SQL strings remain in operator-sessions.ts.

Out of scope

  • Cookie / middleware code (http/session-middleware.ts) — DB shape unchanged.

References

  • apps/server/src/infrastructure/database/operator-sessions.ts (current).
  • Issue #480 — original sliding-TTL spec.
  • Foundation story (#839) must merge first.
**As a** maintainer, **I want** `operator_sessions.ts` rewritten on Drizzle, **so that** sliding-TTL session CRUD is type-safe and column-rename-safe. ## Acceptance criteria ### Schema - [ ] `schema/operator-sessions.ts` defines `operator_sessions` table mirroring current shape (`id`, `forge_type`, `account_login`, `created_at`, `last_seen_at`, `expires_at`). - [ ] `OperatorSessionRow` re-exported as `typeof operatorSessions.$inferSelect`. ### Rewrite - [ ] All 6 fns rewritten on Drizzle: `createOperatorSession`, `getOperatorSession`, `touchOperatorSession`, `deleteOperatorSession`, `sweepExpiredOperatorSessions`, `listOperatorSessions`. - [ ] Sliding-TTL semantics preserved bit-identical (compare cookie test fixtures pre/post). ### Tests - [ ] `operator-sessions.test.ts` green unchanged. - [ ] No raw SQL strings remain in `operator-sessions.ts`. ## Out of scope - Cookie / middleware code (`http/session-middleware.ts`) — DB shape unchanged. ## References - `apps/server/src/infrastructure/database/operator-sessions.ts` (current). - Issue #480 — original sliding-TTL spec. - Foundation story (#839) must merge first.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
charles/claude-hooks#841
No description provided.