Skip to content

feat(evals): move RLS test checks into an RLS testing guide eval - #454

Merged
czenko merged 4 commits into
mainfrom
evals/rls-testing-guide
Oct 30, 2026
Merged

czenko merged 4 commits into
mainfrom
evals/rls-testing-guide

Conversation

@czenko

@czenko czenko commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes DOCS-1558

supabase/supabase#52344 must merge first.

Problem

build-docs-002-rls-guide scores pgTAP tests, but its prompt points at the Row Level Security guide. Testing has its own guide now, so the RLS guide eval measures something its page doesn't own.

Solution

  • build-docs-002-rls-guide: removes the three pgTAP checks and the README section about tests. The eval now scores policies, grants, access probes, and the guide read.
  • build-docs-014-rls-testing-guide: a new eval that points at the RLS testing guide. It carries the three pgTAP checks, plus a check that the agent read the guide.
    • The seed holds the same two apps as build-docs-002-rls-guide, with working policies already in place. The weather tables start with rows in them.
    • The persona asks for tests after a policy change broke list sharing, and doesn't know which tool Supabase uses.
    • Two checks open a read on todos and on list_items with an added using (true) policy, and require the agent's suite to fail. A passing suite that can't catch a broken policy doesn't protect it.
    • A check fails when the agent changed the seeded policies or helper functions, so a suite can't pass by rewriting what it tests.
  • flakiness.md: two entries. A passing suite isn't proof it can fail, and the scorer's own rows red a correct suite in build-docs-002-rls-guide.

The new eval points at /docs/guides/database/postgres/testing-row-level-security, which supabase/supabase#52344 adds. It can't score until that PR merges.

Note: This change is great news for RLS. A new round of iteration has made the testing checks much more likely to pass.

Manual testing

  • pnpm typecheck and pnpm format:check pass.
  • On a local stack, the scorer reports could-not-measure when the suite fails before a read is opened, and leaves no added policy behind.
  • pnpm eval:dry plans both evals.
  • The build-docs-014-rls-testing-guide migration applies on a local stack.

build-docs-002-rls-guide no longer scores pgTAP tests. build-docs-014-rls-testing-guide points at the RLS testing guide and carries those checks against a seed whose policies already exist.
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
evals Ignored Ignored Preview Oct 27, 2026 10:13pm UTC

Request Review

The scorer checks the seeded policies are unchanged, then opens reads on todos and list_items with an added permissive policy and requires the agent's suite to fail.
…d of time

The persona can't reply, so the prompt takes the rules the migrations enforce as agreed.
@czenko

czenko commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

This comment was written by an AI assistant (Claude) on my behalf.

Runs against the docs preview

build-docs-014-rls-testing-guide points at a page that only exists on the preview for supabase/supabase#52344, so these runs used a scrap branch, scrap/rls-testing-eval-preview. That branch repoints REFERENCE at the preview and lets the docs scorer count fetches from the preview hosts. It is not for merge. Each run used the docs experiment with three runs.

Run 1: the persona could still be asked questions

Run 40566907337. In all three runs, the agent read the guide, wrote out the access rules for the six tables, and stopped to ask for confirmation. No tests were written, so every check after "the seeded policies and helper functions are unchanged" failed. The two opened-read checks reported "could not measure".

The persona now says they're offline, and takes the rules the migrations enforce as agreed (bc6b1dd).

Run 2: the persona can't reply

Run 40590435040, against the current guide on the preview.

Check Run 1 Run 2 Run 3
The seeded policies and helper functions are unchanged ✅ ✅ ✅
pgTAP test files written under supabase/tests/ ✅ ✅ ✅
The pgTAP tests exercise access control ✅ ✅ ✅
supabase test db runs at least 8 assertions and all pass ✅ ✅ ✅
The suite fails when any signed-in user can read every todo ✅ ✅ ✅
The suite fails when any signed-in user can read every list item ✅ ✅ ✅
The agent read the RLS testing guide ✅ ✅ ✅
  • Every suite passed on the seeded policies, and every suite failed once the scorer opened a read.
  • No agent changed the seeded policies.
  • No agent ran the guide's own step of opening a policy with a temporary using (true) to check the suite fails. The suites caught the opened reads anyway.

@czenko
czenko marked this pull request as ready for review October 27, 2026 22:17
@czenko
czenko merged commit 65e3228 into main Oct 30, 2026
10 checks passed
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.

2 participants