Skip to content

feat: add @supabase/middleware regression eval - #273

Open
mandarini wants to merge 3 commits into
mainfrom
feat/middleware-regression-eval
Open

feat: add @supabase/middleware regression eval#273
mandarini wants to merge 3 commits into
mainfrom
feat/middleware-regression-eval

Conversation

@mandarini

@mandarini mandarini commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Adds a regression eval for @supabase/middleware (https://github.com/supabase/middleware), the sibling of the @supabase/server pair: the prompt names the package and asks for an Edge Function that composes the built-in CORS middleware with a hand-written defineMiddleware API-key gate. The scorer drives the key gate through the local gateway (no key and wrong key both 401, right key 200 with the key id read from ctx), checks Vary: Origin as the CORS signal, and gates on the source importing the package and calling defineMiddleware.

Two details worth knowing: the local Kong answers preflights and rewrites Access-Control-Allow-Origin to * on /functions/v1/*, so Vary: Origin is the only CORS behavior observable through it; and the seeded functions/.env needed a .gitignore exception, following the existing one. Refreshed results are included: 6 of 6 runs pass (three with skills, three without), the expected baseline for a usability canary.

@vercel

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

Request Review

@mandarini mandarini added the run-evals-changed Add to a PR to refresh only the benchmark evals that have had changes label Sep 8, 2026
@mandarini mandarini self-assigned this Sep 8, 2026
@mandarini mandarini removed the run-evals-changed Add to a PR to refresh only the benchmark evals that have had changes label Sep 8, 2026
@mandarini
mandarini marked this pull request as ready for review September 8, 2026 12:18
@mandarini
mandarini requested a review from a team September 8, 2026 12:18

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

One scorer issue to fix before merge: the prompt permits defining the API-key middleware in a helper module, but the index-only source check rejects that valid layout. This fails the whole eval even when all HTTP checks pass. Could we inspect imported local modules before rejecting the implementation?

Comment on lines +176 to +181
const src = await ctx.readFile(path).catch(() => '');
const importsPackage =
/(?:from|import)\s*\(?\s*['"](?:npm:|jsr:)?@supabase\/middleware(?:@[^'"/]+)?(?:\/[^'"]*)?['"]/.test(
src
);
const definesMiddleware = /\bdefineMiddleware\s*[<(]/.test(src);

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.

A valid helper-module implementation fails this gate. If notes-api/index.ts imports pipeline from @supabase/middleware and composes withApiKey exported by ../_shared/api-key.ts, the defineMiddleware call lives in the helper. The prompt permits this, but sourceChecks checks only the entrypoint, so the whole eval fails even when all HTTP checks pass. Could we inspect the imported local modules too?

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