Skip to content

feat(db): activate personal preference RLS#600

Merged
tiankaima merged 6 commits into
mainfrom
agent/rls-personal-activation-20260722
Jul 22, 2026
Merged

feat(db): activate personal preference RLS#600
tiankaima merged 6 commits into
mainfrom
agent/rls-personal-activation-20260722

Conversation

@tiankaima

Copy link
Copy Markdown
Member

Part of #550

Summary

  • enable and force owner RLS for DashboardLinkClick, DashboardLinkPin, and BusUserPreference after refactor(db): route personal preferences through RLS context #599 deployed their transaction-local context plumbing
  • extend the dedicated runtime-role job with explicit per-table grants instead of broad schema DML
  • prove default-deny reads/writes, concurrent A/B isolation, and forged-owner rejection for all three tables
  • run Todo and personal-preference RLS suites in separate Vitest processes so Prisma disconnect/lifecycle cannot race across files

This still does not close #550. Upload/UploadPending and HomeworkCompletion require the public-read policy decisions documented in the issue before activation.

Verification

  • fresh migration applied locally
  • Todo RLS runtime-role suite: 3/3 passed
  • personal-preference runtime-role suite: 3/3 passed
  • role tested locally after revoking all schema-wide table/sequence privileges and granting only the workflow permissions
  • workflow run block passes bash -n; touched test passes Biome

Copilot AI review requested due to automatic review settings July 22, 2026 10:18
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
life-ustc 1f8f6e1 Commit Preview URL

Branch Preview URL
Jul 22 2026, 11:03 AM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR activates PostgreSQL Row Level Security (RLS) for personal-preference tables and extends CI coverage so the runtime-role job exercises the new RLS behavior under least-privilege grants, aligning with the ongoing RLS rollout in #550 after the context plumbing from #599.

Changes:

  • Enable + FORCE RLS and add owner-isolation policies for DashboardLinkClick, DashboardLinkPin, and BusUserPreference.
  • Add an integration test suite that validates default-deny, concurrent owner isolation, and forged-owner rejection for the three tables.
  • Update the DB-backed CI job to grant runtime-role permissions for the new tables and run the RLS integration suites in separate Vitest processes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/integration/personal-preferences-rls.test.ts Adds integration coverage for personal-preference RLS (default-deny, isolation, forged-owner rejection).
prisma/migrations/20260722174500_personal_preferences_rls/migration.sql Activates RLS + FORCE RLS and defines owner isolation policies for three personal-preference tables.
.github/workflows/db-backed-bun-job.yml Extends runtime-role grants and runs Todo + personal-preference RLS suites in separate Vitest runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/personal-preferences-rls.test.ts
Comment thread tests/integration/personal-preferences-rls.test.ts
Comment thread tests/integration/personal-preferences-rls.test.ts Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread tests/integration/personal-preferences-rls.test.ts
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 22, 2026 10:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/db-backed-bun-job.yml Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 22, 2026 11:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@tiankaima
tiankaima merged commit 961fa6d into main Jul 22, 2026
18 checks passed
@tiankaima
tiankaima deleted the agent/rls-personal-activation-20260722 branch July 22, 2026 11:14
github-actions Bot pushed a commit that referenced this pull request Jul 22, 2026
# [1.77.0](v1.76.0...v1.77.0) (2026-07-22)

### Features

* **db:** activate personal preference RLS ([#600](#600)) ([961fa6d](961fa6d))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.77.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rfc(data): pilot PostgreSQL RLS with Prisma and Hyperdrive

2 participants