Skip to content

feat(evals): eval the Edge Function secrets guide in supabase.com/docs - #285

Draft
czenko wants to merge 6 commits into
mainfrom
evals/edge-function-secrets-guide
Draft

feat(evals): eval the Edge Function secrets guide in supabase.com/docs#285
czenko wants to merge 6 commits into
mainfrom
evals/edge-function-secrets-guide

Conversation

@czenko

@czenko czenko commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Closes DOCS-1305

Problem

The Managing secrets guide is the only place that says where a local secret has to sit for the function runtime to load it. Neither the Supabase agent skill nor Supacademy covers the topic, so the page is the only carrier. Users keep landing on the wrong file: FDBKIN-11884 and CLI-818 both ask for the project-root .env and supabase/functions/.env to be told apart, and FDBKIN-12716 and FDBKIN-6831 are the recurring "I set it and the function cannot read it" shape.

Nothing in the repo tests an Edge Functions docs page as the subject under test. deploy-functions-001-edge-function-secrets owns the hosted side and does not touch local loading.

Solution

  • Adds evals/docs/build-docs-007-edge-function-secrets. The seed is a Vite app that calls a provider from the browser with the key as a literal, and a TODO comment fixes the endpoint and the missing_api_key failure contract the probe needs.
  • The prompt asks for the key to be sorted out and for the local stack to be running. It never names the mechanism. The stripped-word list is in README.md.
  • projectRunning: false, so the agent owns the stack lifecycle. supabase start bakes supabase/functions/.env into the edge runtime container's environment at creation time, so a file written after the stack is up is invisible to it. Letting the agent start the stack is what makes the runtime claim measurable without the scorer restarting anything.
  • Eleven checks. Four read the client, three read where the key landed, three probe the served endpoint, and one asserts the page was retrieved with content.
  • The ignore-rules check uses git check-ignore rather than git ls-files. The harness strips .git when it copies the seed in, so the tracked-file form matches nothing and reads green whatever the project ignores. The same check in deploy-functions-001 is affected.

Manual testing

  1. pnpm typecheck. Passes.
  2. npx biome check evals/docs/build-docs-007-edge-function-secrets/. Clean.
  3. pnpm eval:dry -- --suite docs --experiment-suite docs. Plans codex-gpt-5.6-luna-no-skills x build-docs-007-edge-function-secrets.
  4. Score six local fixtures against the file-based checks. Predictions were written before running and all six matched. The one that decides the design puts the key in the project-root .env and fails the provider key sits where the local function runtime loads it, with the other five failing on the bundle, the function source, and the ignore rules respectively.

Baseline

Three runs on codex-gpt-5.6-luna-no-skills, all 7/11.

All three built a function reading OPENAI_API_KEY from the environment, started the stack, and answered {"error":"missing_api_key"}. Two wrote supabase/functions/.env.example and stopped rather than creating the file supabase start reads. The third wrote no env file. Placement, ignore rules, and the request-time probe agree on every run, which is the source-level claim and the behavioral one corroborating each other.

The fourth failure is instrumentation, not the page. the agent read the Managing secrets guide the prompt referenced reds on every run even though every run reached the page. Codex web_search never sets hasContent, because CLI 0.138 mangles open_page into the catch-all and the url-shape fallback in packages/core/src/docs-results.ts:309 leaves it unset. Every docs eval carries this check and docs evals run only on Codex, so it needs a fix that is not scoped to this PR.

An earlier baseline on this branch red two checks that hunted the seeded literal. Agents replace it, so those checks reported nothing placed on solutions that placed a credential correctly. Fixed in 6f38449, and a fixture reproducing it is part of the set.

Adds build-docs-007-edge-function-secrets to the docs suite, with the
Managing secrets guide as the subject under test.

The seed is a Vite app that calls a provider straight from the browser with
the key as a literal. The prompt asks for that to be sorted out and for the
local stack to be running, and never names the mechanism. Whether the guide
transmits where a local secret has to sit is the measurement.

projectRunning is false so the agent owns the stack lifecycle. supabase start
bakes supabase/functions/.env into the edge runtime container's environment at
creation time, so a file written after the stack is up is invisible to it.
Letting the agent start the stack is what makes the runtime claim measurable
without the scorer restarting anything.

The ignore-rules check uses git check-ignore rather than git ls-files, because
the harness strips .git when it copies the seed in and a tracked-file scan
matches nothing.
@vercel

vercel Bot commented Sep 11, 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 Sep 11, 2026 11:12pm UTC

Request Review

@czenko czenko added the run-evals-changed Add to a PR to refresh only the benchmark evals that have had changes label Sep 11, 2026
czenko and others added 2 commits September 11, 2026 15:31
The first baseline red two checks on every run with "the seeded provider
key is not in any file in the workspace". Agents replace the placeholder the
seed ships, so a check that hunts the literal reports nothing placed on a
solution that placed a working credential in the right file.

Both checks now resolve the env name the function reads, minus the names
supabase start injects itself, and ask whether that name is set in a file the
runtime loads and whether that file is ignored. A function that takes the whole
environment at once falls back to asking whether any non-platform credential
was placed at all.

The ignore check carves out .env.example and its siblings, because shipping a
template with a placeholder is the documented habit.

A fixture reproducing the baseline failure, where the agent substitutes its own
key value, now passes both checks. The fixture that puts the credential in the
project-root .env still fails placement, which is the claim the eval exists to
make.
czenko and others added 2 commits September 11, 2026 16:05
The seed's contract read as an open task. It now states what is true: the team
builds against POST /functions/v1/suggest, and the endpoint answers 503 with
missing_api_key when the credential is not reachable.

Same content, so the checks and the fixtures are unaffected. The docblock and
README lines that referred to it as a TODO change with it.
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.

1 participant