Skip to content

Browser playground: paste a migration, see what leaks - #8

Merged
Amsozzer1 merged 6 commits into
mainfrom
playground
Oct 13, 2026
Merged

Amsozzer1 merged 6 commits into
mainfrom
playground

Conversation

@Amsozzer1

@Amsozzer1 Amsozzer1 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Builds on #7 (merged): it uses the shared report wording and the pure lint module from there. Not deployed yet.

What it is

A static page in playground/: paste Supabase migration SQL and seed rows, and see what Lintel would flag. Postgres runs as PGlite in a Web Worker. No backend, nothing leaves the browser: a Content-Security-Policy allows only this site's own files.

  • Same code as the CLI:

    • the Supabase environment (src/core/supabase);
    • apply rules;
    • the P001 probe;
    • lint normalization;
    • the 23 linter queries Supabase CLI v2.118.0 runs.

    test/render.test.ts checks that the page prints exactly what lintel check prints for the same report.

  • Extensions: Supabase-only extensions are no-op stubs generated from the image's catalog (src/core/supabase/extensions.generated.ts). Ones that can't be stubbed (PostGIS, pgroonga, rum) say so.

  • First load: the leaky example runs automatically, so the first screen shows P001 [proven].

  • Safety and loading:

    • a 20 s watchdog replaces a stuck worker, since PGlite can't cancel queries;
    • the engine loads after the page, and the findings beam fills as it arrives.
  • Assets: fonts (Charter, Commit Mono) and PGlite are self-hosted; licenses are in public/licenses/.

Deploy (not done)

pnpm playground:build produces dist/lintel/ and dist/_headers for amsozzer.com/lintel/. See playground/README.md.

Tests

  • pnpm test:playground: 15 tests (engine, examples, CLI-identical output).
  • pnpm check:all: passes, with layering rules allowing the playground to import src/core only.

🤖 Generated with Claude Code

Amsozzer1 and others added 5 commits October 13, 2026 17:56
…ines without it

gen-supabase-env now also creates every extension the pinned image ships,
reads each one's member objects back from the catalog, and writes
src/core/supabase/extensions.generated.ts: the image's extension list,
supautils.extensions_parameter_overrides, and for each extension a stub
with the same schemas, types, tables, views and function signatures, and
bodies that do nothing. Extensions defining operators, access methods,
casts or base types (postgis, pgroonga, rum, ...) are listed as
unstubbable instead. Stubs record the extensions whose types they use.

environment.ts gains the API a standalone engine (the playground) needs:
extensionStubFiles() resolves stubs against what the engine has natively,
unavailableExtension() says why one can't be created, and
standaloneBeforeChecksSql() drops temp objects (the CLI checks on a new
connection) and applies supautils' schema overrides from the generated
config. The CLI bundle doesn't include any of it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A static page (playground/, a pnpm workspace package built with Vite).
Postgres runs as PGlite in a Web Worker; nothing leaves the browser, and
the build's Content-Security-Policy only allows this site's own files.

- The engine runs the CLI's environment (src/core/supabase), apply rules,
  P001 probe and lint normalization, plus the linter SQL Supabase CLI
  v2.118.0 runs. Output is the CLI's human report line for line;
  test/render.test.ts holds the two together. Empty tables show as
  unverified_no_rows.
- Native extensions load on demand; Supabase-only ones use the generated
  stubs. Each run starts a fresh Postgres from a prepared data directory.
- PGlite can't cancel a query, so a 20 s watchdog (and a stop link)
  replaces the worker.
- PGlite's files are self-hosted and downloaded after the page loads, with
  progress: the beam over the findings fills as the engine arrives.
- Four examples with seed rows: leaky table, fixed table,
  `using (true)` for anon, clean.
- Set in Charter and Commit Mono, self-hosted; licenses in
  public/licenses with every other third-party notice.

dependency-cruiser: the playground may import src/core only, and nothing
imports the playground.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- On load, the leaky table example is filled in and checked as soon as
  Postgres is ready, so the first screen shows the P001 [proven] line with
  no clicks.
- Check is visible without scrolling at 1280x720 and 1440x800: a tighter
  masthead, and the migration editor sizes to the window (8 to 18 lines),
  still resizable.
- Example SQL lines stay under 60 characters, so none is cut off at desktop
  width. On phones, editors soft-wrap instead of scrolling sideways.
- In one column, findings come first, and the findings beam carries the
  loading progress (the separate masthead loading line is gone).
- A quiet text link to the repo on the wordmark row.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ned linter SQL source

- Built for amsozzer.com/lintel/ (PLAYGROUND_BASE overrides): dist/lintel/
  plus dist/_headers with the same CSP as a header (adding
  frame-ancestors 'none') and immutable caching for hashed assets and
  PGlite files, which now live under pglite/<version>/.
- The linter SQL is pinned to supabase/cli commit 70b42b8 (tag v2.118.0).
  Its license (MIT: apps/cli/package.json, the published `supabase` npm
  package, apps/cli-go/LICENSE) is recorded in the generated file, in
  public/licenses/README.txt with the license text, and in
  THIRD_PARTY_NOTICES.md. It is not taken from supabase/splinter, which has
  no LICENSE file, or from Studio's lint query, whose last SQL version has
  13 of the 23 lints.
- README: how to deploy to a Cloudflare Pages or static-assets site.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e examples fit

Seed emails use the reserved example.com domain. Its longer lines fit the
editor from 1180px, so the two-column layout starts there; narrower
windows get one column, findings first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Amsozzer1
Amsozzer1 changed the base branch from cli/unverified-tables to main October 13, 2026 22:58
@Amsozzer1
Amsozzer1 marked this pull request as ready for review October 13, 2026 22:58
@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Sorry @Amsozzer1, your pull request is larger than the review limit of 150,000 diff characters

amsozzer.com drops trailing slashes, so the page is served as /lintel and
relative URLs would resolve against the site root. The worker's PGlite
path and the licenses link now come from the build's base path, and
_headers gets a rule for /lintel itself, which /lintel/* doesn't match.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Amsozzer1
Amsozzer1 merged commit 6d8947b into main Oct 13, 2026
4 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.

1 participant