Skip to content

[DOCS-1645] feat: Add a docs eval for securing-your-api - #525

Closed
jeremenichelli wants to merge 2 commits into
mainfrom
jeremiasmenichelli/docs-1642-add-a-docs-eval-for
Closed

jeremenichelli wants to merge 2 commits into
mainfrom
jeremiasmenichelli/docs-1642-add-a-docs-eval-for

Conversation

@jeremenichelli

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature: a new docs eval, build-docs-018-securing-your-api.

What is the current behavior?

Nothing scores the Securing your API guide. Related evidence: supabase/agent-skills #645, #498.

What is the new behavior?

An agent adds internal staff notes, customer-visible replies and a close_stale_tickets job to a seeded support desk. The scorer then checks two things:

  • Intended parts work: customers read replies on their own ticket, the server key can write notes and replies and run the job, and visitors can search help articles.
  • Internal parts are unreachable: no client reads or writes notes (including the ticket owner), no client runs the job, and a visitor can run no function other than the help search.

The seed pins default privileges as SQL, not auto_expose_new_tables. It exercises two traps the page doesn't spell out: default-privilege revokes only affect future objects, and the revoke block also revokes from service_role.

Additional context

  • Not run end to end. I had no Docker daemon, so the probes haven't met a real stack. Biome is clean, and tsc reports nothing in this eval.
  • Server-key probes run in the database (set local role service_role), not over HTTP.
  • Still to do: score example solutions locally, then add the run-evals-changed label for results.
  • To check: whether 013 and 016 are reserved ids, and what new tables get on the pinned CLI. Existing READMEs disagree.

@jeremenichelli
jeremenichelli requested a review from a team as a code owner November 18, 2026 14:16
@jeremenichelli jeremenichelli added the run-evals-changed Add to a PR to refresh only the benchmark evals that have had changes label Nov 18, 2026
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
evals Ready Ready Preview Nov 18, 2026 2:28pm UTC

Request Review

czenko
czenko previously requested changes Nov 20, 2026

@czenko czenko 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.

The design is solid: the seeded default privileges, the owner probe on notes, and the confirmations as the superuser.

It looks like the first refresh shows two checks that could red correct work, though.

  • replies are readable by the ticket's customer and by nobody else reds all 3 runs with PGRST303 JWT issued at future. It is the first probe after sign-up, so the token's iat is still ahead of PostgREST. Later probes with the same clients pass. Poll a cheap authenticated read after sign-up until PGRST303 clears, and report it as could-not-measure if it never does.
  • the server key can write and read replies and notes reds runs 1 and 3 on GRANT SELECT ON public.ticket_replies TO service_role. Both inserts landed. The console never reads replies with the server key, so a least-privilege grant is correct work here. Drop the reply read-back, confirm the row as the superuser, and rename the check to say what it proves.
  • The title says deployment/database-migrations, but the eval is securing-your-api. Retitle before merging.

@czenko
czenko dismissed their stale review November 20, 2026 22:57

Switching this to a comment.

awaseem added a commit that referenced this pull request Nov 23, 2026
Adds `build-docs-024-general-configuration` for
[DOCS-1643](https://linear.app/supabase/issue/DOCS-1643/add-a-docs-eval-for-authgeneral-configuration).

The ticket's claim was "sign-ups can be turned off and sessions tuned".
The page only links out to sessions, so I narrowed it to what the page
actually teaches: **close sign-ups without locking out anyone who
already has an account.**

I confirmed the claim against Auth v2.196.0 and CLI 2.117.0. There are
two ways to get it wrong, and the page doesn't warn about either:
- `[auth.email] enable_signup = false` looks like "turn off sign-ups"
but turns off email login for everyone (supabase/supabase#40582).
- Turning off email confirmation only confirms people when they sign up.
Anyone who signed up before still gets `Email not confirmed`, and with
sign-ups closed they can't sign up again to fix it. The page says it
"implicitly confirms the user's email in the database". This is the
agent failure in supabase/agent-skills#505.

The seed is a closed beta with two confirmed testers, two who never
confirmed, and two strangers. The scorer restarts the stack, tries to
make new accounts, logs in as everyone, and checks the testers kept the
same account id. Mailpit runs so an open sign-up actually creates the
account.

I ran six example solutions against a real stack, and every one scored
as predicted:

| Solution | Result |
|---|---|
| correct | all pass |
| sign-ups closed + confirmation off (what the page suggests) |
unconfirmed testers locked out |
| `[auth.email] enable_signup = false` | every tester locked out |
| confirm every account | strangers get in |
| delete and recreate the testers | new account ids |
| nothing | new accounts get made, unconfirmed testers locked out |

I also moved the stack restart and status helpers from the redirect URLs
eval into `evals/docs/lib/local-stack.ts`, since this is the second eval
to use them. No check names changed there, and I reran its harness after
the move.

Heads up: #525 also uses id 018, which clashes with the merged redirect
URLs eval.

Baseline will come from CI. Would love any feedback!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
jeremenichelli added a commit that referenced this pull request Nov 23, 2026
## What is the current behavior?

Nothing scores the [Deploy database
migrations](https://supabase.com/docs/guides/deployment/database-migrations)
guide, and no existing eval covers it. `build-docs-015-cascade-deletes`
checks that a migration file was written, but it is about a different
page.

The page teaches the workflow in its walkthrough (`migration new`, add
the SQL, `migration up`). It does not say that a migration which has
already shipped must not be edited, or that a column added to a table
with rows needs a value for those rows. Related evidence, all in
supabase/agent-skills: #578 (preserve committed migrations, use forward
fixes), #519 (migration replay safety), #538 (repo naming conventions),
#599 (history repair). The last two are out of scope here and named as
such in the README.

## What is the new behavior?

The claim under test is that a schema change ships as a new migration
that applies cleanly.

An agent gets a bakery app with two migrations that `local/README.md`
says production has already applied. It is asked to add a standard or
express delivery option to every order, with existing orders reading
"standard". The prompt avoids the page's vocabulary, and the README
lists the stripped words.

The scorer runs nine checks:

| Check | What it proves | Reads |
| --- | --- | --- |
| Shipped migrations untouched | The two existing files are
byte-identical | files |
| Change is in a new migration that sorts after the existing ones | A
new file the CLI would run, not skipped or sorted earlier | files |
| Agent's local database has the option | The agent applied it locally,
read before the scorer touches anything | database |
| New migrations apply on top of a database that already has orders |
Rollout in a scratch database built from the seed's own two migrations
plus three orders | scratch database |
| Existing orders come out as standard | Backfill; requires exactly
`standard\|3` | scratch database |
| New order can be placed as standard or express | Both values work |
scratch database |
| Order saved without an option never has none | Refused (only by an
error naming the column) or defaulted | scratch database |
| Database rebuilt by `supabase db reset` has the option | What a
teammate gets after pulling | database |
| Guide read | A docs call returned the page's content | transcript |

The check that carries the claim is the rollout. Editing an old
migration and running `db reset` looks fine locally. In the scratch
database it fails, because production never re-runs a file it has
applied.

I expect the file checks and the local-database check to saturate. The
signal should be in the rollout and the checks behind it.

Supporting change: `evals/docs/lib/exec-sql.ts` gains an optional
`database` option so probes can run against the scratch database. The
name is validated (`^[a-z0-9_]+$`) because it reaches a shell command.
The default path is unchanged.

## Additional context by Claude

- **Not run end to end.** I had no Supabase CLI, API keys or Node 24
locally, so the agent run, `supabase db reset` and `create database`
against a real stack have not been exercised.
- The framework loads and plans the eval (`run-eval.ts --dry`), and
Biome and `tsc` report nothing on the new files.
- The probes and file checks ran on PGlite against a correct solution
and nine single-flaw solutions (edit in place, nullable column with no
backfill, `NOT NULL` with no default, a file sorting before the existing
ones, a direct alter with no file, a non-runnable filename, and others).
Each failed the checks I predicted beforehand. A broken rollout also
fails the three checks behind it with a `not run` note, by design.
- The shell path of `execSql` was checked with stub `supabase` and
`psql` binaries.
  - The example solutions are not committed.
- **Still to do:** add the `run-evals-changed` label for the baseline,
then record anything that broke in `flakiness.md` with this PR's number.
- **Known limits of the scratch database** (listed in the README):
migrations are applied with psql one file at a time rather than as the
CLI's batch, and it has no `auth` or `storage` schemas. The seed has no
table that needs them. The local-database and rebuild checks read the
real database for that reason.
- **Eval id.** I used `020` because 016, 018 and 019 are taken across
main and open PRs. #525 is titled for this page but contains the
"Securing your API" eval, and its id 018 collides with main's
`build-docs-018-redirect-urls`.
@jeremenichelli jeremenichelli changed the title feat: Add a docs eval for deployment/database-migrations [DOCS-1645] feat: Add a docs eval for securing-your-api Nov 23, 2026
@jeremenichelli

Copy link
Copy Markdown
Contributor Author

@czo fix the branch name and opened this PR to follow up with the work in here, already addressed your comments too.

#544

This branch was successfully deployed

1 active deployment
Preview — 96a760b5 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-evals-changed Add to a PR to refresh only the benchmark evals that have had changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants