Skip to content

[Feat] Unified Sessions M1: Add schema and helpers - #1696

Draft
roomote-roomote[bot] wants to merge 2 commits into
developfrom
feature/unified-sessions-m1-1rnslp5wloxoe
Draft

[Feat] Unified Sessions M1: Add schema and helpers#1696
roomote-roomote[bot] wants to merge 2 commits into
developfrom
feature/unified-sessions-m1-1rnslp5wloxoe

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. View the task or mention @roomote-roomote for follow-up asks.

What changed

  • Added the additive sessions, session_tasks, and session_participants schema, relations, constraints, indexes, and generated Drizzle migration.
  • Added typed server exports and a Session test factory.
  • Added deriveSessionStatus, idempotent visible-Task attachment, owner participant creation, monotonic activity updates, and cached-status recomputation serialized by a Session row lock.
  • Added real-Postgres coverage for Session vocabularies, owner retention, uniqueness, hidden Tasks, Fast delegation, rollups, status precedence, and concurrent Task settlement.

Why this change was made

This is Unified Sessions milestone M1. It establishes the N-1-safe persistence and package-owned helper layer required before enqueue interception or any user-visible Session behavior can ship.

Impact

There is no user-visible behavior change and no feature flag is introduced in M1. The schema is additive, existing Task and Fast conversation records remain canonical, and older application code ignores the new tables safely.

The owner-shape constraint intentionally allows a user or automation owner FK to become null after deletion. This is required for the specified ON DELETE SET NULL retention behavior; values in the wrong owner column remain prohibited, and deletion retention is covered by a real-database test.

Validation completed against the final branch: 44 targeted real-Postgres tests passed, pnpm lint passed, pnpm check-types passed, and the pre-push oxlint, residual lint, fast typecheck, and knip gates passed.

@roomote-community

roomote-community Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

No new code issues found. See task

  • packages/db/src/lib/sessions.ts:63 - Concurrent refreshes can persist a stale cached status.

Reviewed 862c94c

Comment thread packages/db/src/lib/sessions.ts
@roomote-roomote

roomote-roomote Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the concurrent Session status refresh race in 862c94c7. Session refreshes now lock before reading linked Tasks, and a two-transaction regression test verifies concurrent settlements finish at ready. All 44 targeted database tests, lint, type checks, and pre-push gates pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant