Skip to content

Draw the probe field and scan band with WebGPU - #57

Merged
maaland merged 1 commit into
mainfrom
feat/probe-shaders-54
Oct 7, 2026
Merged

maaland merged 1 commit into
mainfrom
feat/probe-shaders-54

Conversation

@maaland

@maaland maaland commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Closes #54

Covers all five "Done when" lines of #54 (issue updated with the agreed scope change: our own renderer instead of the shaders package; the static version on touch devices).

What changes

  • effects/dot-field.ts: our WebGPU renderer. One full-screen WGSL fragment shader draws the dot grid and turns dots signal-coloured inside a soft lens (follows the cursor with lag) or band (eases from one end to the other and back, 2.4 s each way). Opaque canvas in the colour behind it, buffer capped at 2× DPR, stops off screen, the lens only draws while moving. 2.3 KB gzipped.
  • effects/gate.ts: useShaderAllowed (WebGPU adapter, no reduced motion, no save-data, a mouse for the lens; listens for changes) and useTokenColors (oklch tokens → hex, follows light/dark).
  • effects/probe-field.tsx, effects/scan-band.tsx: render the CSS version on the server, load dot-canvas.tsx with next/dynamic once allowed, fade the canvas in after its first frame, and drop it if the GPU fails or is lost.
  • Home uses the probe field; the running scan shows the band above the checks.
  • ui-shaders skill rewritten for our renderer (where it lives, the rules, how to check), including why we don't use the package.
  • @webgpu/types (dev only): TypeScript 7's DOM library doesn't include the WebGPU types.

Why not the shaders package

Tried first, working and verified, then dropped (agreed in the session): its engine imports all ~200 effects, so the chunk was 2.5 MB (~720 KB gzipped). It also reports the visitor's user agent and our hostname to shaders.com unless disableTelemetry is set.

UI review

Production build (next start) against a throwaway PGlite database seeded with replayed fixture scans; headless Chromium with WebGPU on Metal.

  • WebGPU, light and dark: both effects live, no console errors; screenshots match the CSS version with the lens and band in clear signal green; the band moves between frames; the lens follows the mouse.
  • No WebGPU (plain headless: no adapter) and reduced motion: static version only, no canvas.
  • GPU device lost (SwiftShader): onUnavailable fires and the static version stays.
  • Loading: a finished report (/s/drippa.ai) doesn't fetch the renderer; home and the running page do. No requests to other hosts.
  • ui-review screenshots for home and the running page at 390 px and 1280 px, light and dark and reduced motion: no sideways scroll.
  • Not checked: Safari and Firefox with WebGPU on real hardware (only Chromium here). Worth a look on the preview.
  • pnpm lint, pnpm typecheck, pnpm test (347 passing), pnpm build pass.

🤖 Generated with Claude Code

A small renderer of our own (one WGSL fragment shader, ~2 KB gzipped)
draws the home page's dot field, with a lens of signal dots following
the cursor, and the running scan's dot strip, with a signal band
sweeping across. Each effect renders its CSS version first and loads
the renderer lazily, only with WebGPU, no reduced motion, no data
saving, and for the lens a mouse. If the GPU can't start or goes away,
the CSS version stays. Colours come from the theme tokens and follow
light/dark. Finished reports don't load it.

We tried the shaders package first; it bundles all ~200 of its effects
(~720 KB gzipped) and reports visitors' user agents by default, so the
ui-shaders skill now describes our renderer instead.

Closes #54

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
stackprobe Ready Ready Preview Oct 7, 2026 6:06pm UTC

Request Review

@drippa-ai

drippa-ai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Product review: Probe field on home and scan band on running scans, drawn with WebGPU

✅ Delivers ticket #54 — 5 of 5 outcomes

What was promised

  • ✅ On a WebGPU browser with a mouse, the home page shows the dot field and dots near the cursor turn green.
  • ✅ With reduced motion, without WebGPU, or on touch devices, the same area shows the still dot pattern and nothing moves.
  • ✅ While a scan runs, a green band sweeps across a strip of dots, and it is gone once the report appears.
  • ✅ The renderer is fetched only on the home and running-scan pages, and finished reports never load it.
  • ✅ The effects pause when off screen, use the theme colours in light and dark mode, and cause no layout shift while loading.

Proof
Not tested in the browser: the test user could not sign in: could not get past Vercel’s protection — check the bypass secret

Tests worked out by Drippa from ticket #54, the pull request description and the code change — none written by hand.

Test it yourself (7 steps)

Page change — click through it on this pull request's preview.
Browser check could not run: the test user could not sign in: could not get past Vercel’s protection — check the bypass secret

Before you start

  • A desktop Chromium-based browser with WebGPU enabled and a mouse
  • Optionally, Safari or Firefox with WebGPU, which the author did not test
  1. Open the home page and wait a moment, then move the mouse over the area behind the headline.
    → A dot grid fills the area. A soft circle of larger green dots follows the cursor with a slight lag, then settles back to the right side of the area when the mouse leaves.
  2. Switch the system or browser between light and dark mode while on the home page.
    → The dots, background and green follow the theme with no mismatched block behind the headline.
  3. Turn on reduced motion (OS setting or devtools rendering emulation) and reload the home page, then move the mouse.
    → Only the still dot pattern with a fixed green patch shows, and nothing follows the cursor.
  4. Turn reduced motion off. On the home page, type a domain that has not been scanned yet into the field and press Scan.
    → The running-scan page opens, and a bordered strip of dots sits above the list of checks with a green band sweeping from side to side.
  5. Wait on the running-scan page until the report appears.
    → The dot strip and its moving band are gone, and the finished report shows.
  6. Reload a finished report page with the browser's network panel open.
    → No extra effect script is downloaded and no dot strip shows. Nothing is requested from other sites.
  7. Open the home page on a phone or with touch emulation on.
    → The still dot pattern shows behind the headline and the page doesn't scroll sideways.
Details

The home headline gets a dot grid whose dots light up green near the cursor. The running-scan page gets a strip of dots with a green band sweeping back and forth. Both always show the still dot pattern first. The live version fades in only on browsers with WebGPU, no reduced-motion setting and no data-saver, and the home effect also needs a mouse. If the graphics card fails, the page falls back to the still pattern. The renderer is loaded only when it can run, and it follows light and dark mode.

Test coverage: ⚠️ Thin — Tests check that both effects start as the still version and check the band's timing and the lens movement. The live drawing is checked only by hand in the description.

🔍 Checked: ticket #54 with 5 done-when lines; 10 of 13 changed files read (all app code, the tests and the dependency change); scan page routing checked in repo

🎫 Linked to drippa-ai/stackprobe#54 — compared diff against ticket


Updated by Drippa • 2026-10-07 18:39 UTC

Comment @drippa-ai review for a fresh review.

@maaland
maaland merged commit f348800 into main Oct 7, 2026
7 checks passed
@maaland
maaland deleted the feat/probe-shaders-54 branch October 7, 2026 18:16

This branch was successfully deployed

1 active deployment
Preview — 29fa8669 Deployed Oct 7, 2026 by vercel[bot]
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.

Probe field and scan band shaders

1 participant