Context
The RLS inventory missed Prisma's implicit _UserCalendarSections join behind User.subscribedSections. It is pure owner data, but current subscription reads/writes use nested connect/disconnect and localized Prisma clients outside an explicit user RLS transaction. Applying a raw policy to implicit A/B columns would be brittle and getPrisma(locale) is not currently transaction-context aware.
Blocked by the production runtime identity/cache correction in #603. Part of #601.
Proposed sequence
- Add explicit
UserSectionSubscription(userId, sectionId, createdAt) with stable unique/indexes.
- Backfill from
_UserCalendarSections in an explicit transactional migration without dropping the old relation.
- Route subscription read/write/page services through an explicit TransactionClient; do not rely on cached
getPrisma(locale) escaping ALS.
- Add REST, GraphQL, MCP, dashboard/calendar parity tests under the non-owner runtime role.
- Cut reads/writes to the explicit model, verify counts/IDs, then remove the implicit join in a later migration.
- In a separate activation migration, ENABLE + FORCE RLS with owner USING/WITH CHECK and exact runtime grants.
Acceptance criteria
Context
The RLS inventory missed Prisma's implicit
_UserCalendarSectionsjoin behindUser.subscribedSections. It is pure owner data, but current subscription reads/writes use nested connect/disconnect and localized Prisma clients outside an explicit user RLS transaction. Applying a raw policy to implicitA/Bcolumns would be brittle andgetPrisma(locale)is not currently transaction-context aware.Blocked by the production runtime identity/cache correction in #603. Part of #601.
Proposed sequence
UserSectionSubscription(userId, sectionId, createdAt)with stable unique/indexes._UserCalendarSectionsin an explicit transactional migration without dropping the old relation.getPrisma(locale)escaping ALS.Acceptance criteria
LOGIN NOINHERIT NOBYPASSRLS.Usertable grants.