Skip to content

fix(supabase): repair mismatched-quote syntax errors in 8 test files - #419

Merged
thinkclay merged 2 commits into
mainfrom
fix/supabase-test-quote-syntax
Jul 30, 2026
Merged

thinkclay merged 2 commits into
mainfrom
fix/supabase-test-quote-syntax

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Summary

Nightly regression runs (#416, #418) found that 9 string literals across 8 files under packages/supabase have mismatched or unescaped quote characters (e.g. a string that opens with ', contains an unescaped inner ', and closes with "). Because deno test parses every matching file in a glob before running any of them, a single broken file aborts the entire run with a SyntaxError before any test executes. That means the whole packages/supabase/tests/** and functions/trpc/__tests__/** layers have produced zero test signal since the breaking commit (#334, 2026-06-09).

This PR only fixes the quote-character bugs — no logic changes, no scope creep.

Files fixed

  • packages/supabase/tests/routers/background-checks-disputes.test.ts
  • packages/supabase/tests/routers/ccpa.test.ts
  • packages/supabase/tests/routers/personality-assessment.test.ts
  • packages/supabase/tests/unit/ccpa-gpc.test.ts
  • packages/supabase/tests/unit/ccpa-notifications.test.ts
  • packages/supabase/tests/unit/ccpa-pdf-generator.test.ts
  • packages/supabase/functions/trpc/__tests__/map-functions.test.ts
  • packages/supabase/functions/trpc/__tests__/profile-experience.test.ts
  • packages/supabase/functions/trpc/__tests__/universities.test.ts

Bonus fix (same file, trivial)

While verifying, ccpa-gpc.test.ts's "Source identifier" test could finally execute (previously masked by the syntax error) and failed for real: it asserted GPC_CONFIG.SOURCE === "gpc", but the actual config (functions/trpc/routers/ccpa/gpc.ts:34) and the ccpa_opt_out_source DB enum (migration 140_req_3_ccpa_compliance.sql) both use "gpc_signal". Updated the test's expectation to match reality — one line, no production code touched.

Verification

Deno isn't preinstalled in this sandbox; installed deno 2.9.4 to verify:

  • deno check (parse + typecheck) on all 9 files: no syntax errors (previously failed immediately with SyntaxError: Expected ','... on every one of them).
  • deno test --allow-all --no-check --unstable-sloppy-imports --config packages/supabase/tests/deno.json packages/supabase/tests/unit/ccpa-gpc.test.ts → 28 passed, 0 failed (was 1 failed before this PR, once the syntax error was cleared — now genuinely fixed).
  • Other files in the suite need a running local Supabase (pnpm supa start + pnpm supa functions serve api) to execute past setup — not available in this sandbox — but all now parse/typecheck cleanly and fail only on expected ECONNREFUSED to 127.0.0.1:54321, confirming the syntax bugs are resolved and no new ones were introduced.

Out of scope (filed separately / left as-is)

  • Neither pnpm test:deno nor pnpm test:endpoints is wired into any GitHub Actions workflow — that's the second half of Syntax errors in 8 test files (from #334) silently break Deno test suites for packages/supabase #418's suggested fix and is a CI-config change, not a test-content fix. Leaving that for a follow-up so this PR stays small and reviewable.
  • Encountered one unrelated pre-existing issue while probing the full suite: background-checks-disputes.test.ts also fails with SyntaxError: The requested module '../shared/setup' does not provide an export named 'requireAuthSetup' once run standalone — a separate, pre-existing export mismatch unrelated to quoting. Not fixed here to keep this PR focused; worth a follow-up issue.
  • CI itself is currently blocked by an account billing issue (CI: GitHub Actions jobs never start — account billing block #375) — unrelated to this change, noted for context.

Closes #416, closes #418.


Generated by Claude Code

Deno parses every file in a test glob before running any of them, so
these 9 mismatched-quote string literals (opening with one quote char,
closing with another, or an unescaped inner apostrophe) aborted the
entire packages/supabase/tests and functions/trpc/__tests__ suites
with a SyntaxError before a single test could execute. Fixes #416
and #418.

Also corrects a stale assertion in ccpa-gpc.test.ts that expected
GPC_CONFIG.SOURCE to be "gpc" — the real config (and the
ccpa_opt_out_source DB enum in migration 140) uses "gpc_signal".
That mismatch was invisible until the syntax error blocking the file
was fixed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPAY48vbsvdMCqNWy4EMiz

Copy link
Copy Markdown
Contributor Author

All 9 CI check failures on this PR (TypeScript Type Check, Code Quality Checks, Monorepo Integrity Checks, Run Tests, Unit & Integration Tests, Lighthouse Performance Audit, E2E Web Tests (Playwright), changes) completed in ~3 seconds each with no retrievable job logs (404) — the signature of the account-billing block in #375, not a real failure from this diff. Confirmed the same pattern reproduces on recent main runs unrelated to this branch (e.g. run 30022099505 on 2026-07-23, also failure in ~6s). Nothing to fix here on my end; will re-check once #375 (GitHub Actions billing) is resolved and CI can actually run. Local verification (deno check + deno test) for this PR's changes is in the PR description above.


Generated by Claude Code

# Conflicts:
#	packages/supabase/tests/routers/ccpa.test.ts
#	packages/supabase/tests/unit/ccpa-gpc.test.ts
@thinkclay
thinkclay marked this pull request as ready for review July 30, 2026 12:09
@thinkclay

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and narrowed to what is still needed, then merging.

Six of the nine files were already fixed on main — the tests/unit/ and tests/routers/ files. That is what made this CONFLICTING. Both conflicts (ccpa-gpc.test.ts, ccpa.test.ts) were the same bug fixed two equivalent ways — this branch escaped the inner quotes, main used a template literal — so I took main's version. The prepush parse probe over tests/unit/ tests/routers/ now loads all 390 tests cleanly.

The three functions/trpc/__tests__/ files are still genuinely broken on main, which is why this PR is still worth merging. Confirmed before the rebase:

error: SyntaxError: Expected ',', got 'Ferris'
51 |   name: 'Universities - Search for 'Ferris' returns Ferris State University",

After the rebase all three pass deno check. Diff is now +9/-9 across exactly those three files.

One caveat on the stated outcome

This does not yet make the trpc suite runnable. Loading the directory now fails on a different, pre-existing bug:

error: Module not found "https://deno.land/[email protected]/assert/mod".
    at functions/trpc/__tests__/document-cache.test.ts:12:8

14 files in that directory import assert/mod without the .ts extension. Unrelated to quoting, present on main, and not touched here. Filed separately — this PR is still a strict improvement, just not the whole story.

Note the prepush probe only covers tests/unit/ and tests/routers/, not functions/trpc/__tests__/, which is why that directory's breakage never trips it.

@thinkclay
thinkclay merged commit d856e10 into main Jul 30, 2026
4 of 9 checks passed
@thinkclay
thinkclay deleted the fix/supabase-test-quote-syntax branch July 30, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants