Skip to content

Store contract tests, viewer e2e on Chromium/WebKit, and sideshow demo + README gif#1

Merged
benvinegar merged 4 commits into
mainfrom
claude/romantic-payne-7efd72
Jun 11, 2026
Merged

Store contract tests, viewer e2e on Chromium/WebKit, and sideshow demo + README gif#1
benvinegar merged 4 commits into
mainfrom
claude/romantic-payne-7efd72

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Carries out the three priorities from the next-session plan.

Store contract tests

  • New reusable runStoreContract(name, makeStore) suite (test/storeContract.ts): sessions CRUD + lastActiveAt ordering, snippet versioning with the 20-entry history cap, cascade deletes, comment seq monotonicity (including across deletes), and all listComments filters.
  • Runs against JsonFileStore (tmp dir, plus a reload-from-disk persistence test) and SqlStore, via a minimal SqlStorage shim backed by Node's built-in node:sqlite (test/sqlStorageShim.ts). Zero new dependencies — lighter than the wrangler-dev / miniflare options the plan floated — and the Durable Object store is now covered by plain npm test.
  • test/workersSqlTypes.d.ts provides minimal ambient mirrors of the Cloudflare SqlStorage globals so workers/sqlStore.ts typechecks inside the Node program (the real workers-types conflict with @types/node); the workers tsconfig still checks against the real types.

Viewer e2e (Chromium + WebKit)

  • Playwright suite (e2e/viewer.spec.ts) with a per-test server fixture: each test boots server/index.ts on an ephemeral port with a tmp SIDESHOW_DATA.
  • Covers: SSE live card insert without reload, the sandboxed-iframe resize bridge growing past the 120px default (the WebKit regression trap from AGENTS.md), composer comment round-trip to the API, and the version select appearing after a PUT.
  • npm run test:e2e + a new e2e CI job (npx playwright install --with-deps chromium webkit); kept out of npm test. All 8 (4 × 2 engines) pass locally.

sideshow demo + README gif

  • sideshow demo seeds two showcase sessions against a running server: "Auth refactor" (JWT refresh sequence diagram revised to v2 with a user/agent comment thread, plus an interactive backoff explainer) and "Queue profiling" (metrics card). Content rebuilt from the docs/sideshow-*.png references, following the design guide (CSS variables; verified rendering in light and dark). Seed data lives in bin/demoData.js — the CLI stays dependency-free.
  • Mentioned in the README quick start and exercised in the pack-smoke CI job.
  • README now embeds a 12.8 s, 0.96 MB gif of the publish → live appear → comment → v2 revise loop, recorded by scripts/record-demo.mjs (replays the demo choreography in a video-recording Chromium, so the clip is regenerable).

Notes for review

  • The contract suite caught a real test-ordering hazard: JsonFileStore.updateSnippet mutates the object createSnippet returned, so the suite captures the pre-update updatedAt before updating (commit 848829c includes the fix; it flaked 1-in-3 runs before).
  • node:sqlite prints an ExperimentalWarning during npm test; it's unflagged on Node ≥22.13 so both CI matrix legs (22, 24) are fine.
  • Validation gate (npm test, typecheck, lint, format:check) is green; tests run clean three times in a row.

🤖 Generated with Claude Code

benvinegar and others added 4 commits June 11, 2026 09:03
Extract a reusable runStoreContract() suite (sessions CRUD + lastActiveAt
ordering, snippet versioning + history cap, cascade deletes, comment seq
monotonicity, listComments filters) and run it against both Store
implementations. SqlStore runs on a minimal SqlStorage shim backed by
node:sqlite, so the Durable Object store is covered by plain
> sideshow@0.1.0 test
> node --test 'test/**/*.test.ts'

✔ publish without session auto-creates one (15.124666ms)
✔ publish into an existing session groups snippets (7.808458ms)
✔ publish into unknown session 404s instead of silently creating (0.785834ms)
✔ update bumps version and keeps history; old version renderable (2.315083ms)
✔ snippet page is wrapped with CSP and bridge (1.287333ms)
✔ comments attach to snippets and filter by author/after (2.776334ms)
✔ long-poll resolves when a comment arrives (52.328833ms)
✔ deleting a session cascades to snippets and comments (1.943917ms)
✔ rename session (1.318792ms)
✔ auth token guards mutating routes when configured (2.002625ms)
✔ mcp endpoint: initialize, tools/list, publish round trip (2.761208ms)
✔ mcp endpoint: unknown method and unknown tool (0.391875ms)
✔ mcp endpoint requires bearer when token configured (0.29ms)
✔ rejects empty and oversized html (4.042875ms)
✔ JsonFileStore: creates sessions with trimmed fields and defaults (5.182792ms)
✔ JsonFileStore: renames sessions; blank title clears it; unknown id is null (2.020042ms)
✔ JsonFileStore: lists sessions by lastActiveAt, newest first; activity reorders (38.762333ms)
✔ JsonFileStore: removeSession returns false for unknown ids (1.262583ms)
✔ JsonFileStore: creates snippets with defaults; unknown session is null (1.284125ms)
✔ JsonFileStore: lists snippets oldest first, optionally filtered by session (24.661542ms)
✔ JsonFileStore: updates bump the version and archive the previous one (1.541458ms)
✔ JsonFileStore: caps history at 20 versions (6.541916ms)
✔ JsonFileStore: removing a session cascades to its snippets and comments (2.13325ms)
✔ JsonFileStore: removing a snippet cascades to its comments only (1.719916ms)
✔ JsonFileStore: creates comments; unknown session is null (1.24075ms)
✔ JsonFileStore: comment seq is strictly monotonic, even across deletes (1.331167ms)
✔ JsonFileStore: filters comments by session, snippet, and afterSeq (1.771583ms)
✔ JsonFileStore: data survives a reload from disk (1.840375ms)
(node:51073) ExperimentalWarning: SQLite is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
✔ SqlStore: creates sessions with trimmed fields and defaults (3.219583ms)
✔ SqlStore: renames sessions; blank title clears it; unknown id is null (0.297667ms)
✔ SqlStore: lists sessions by lastActiveAt, newest first; activity reorders (34.414875ms)
✔ SqlStore: removeSession returns false for unknown ids (0.262708ms)
✔ SqlStore: creates snippets with defaults; unknown session is null (0.395791ms)
✔ SqlStore: lists snippets oldest first, optionally filtered by session (23.044709ms)
✔ SqlStore: updates bump the version and archive the previous one (0.51075ms)
✔ SqlStore: caps history at 20 versions (0.757083ms)
✔ SqlStore: removing a session cascades to its snippets and comments (0.36125ms)
✔ SqlStore: removing a snippet cascades to its comments only (0.3775ms)
✔ SqlStore: creates comments; unknown session is null (0.226917ms)
✔ SqlStore: comment seq is strictly monotonic, even across deletes (0.187083ms)
✔ SqlStore: filters comments by session, snippet, and afterSeq (0.309417ms)
ℹ tests 41
ℹ suites 0
ℹ pass 41
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 180.512333
with no new dependencies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per-test server fixture (ephemeral port, tmp data file) drives the real
viewer: SSE live card insert without reload, sandboxed-iframe resize
bridge growing past the 120px default (the WebKit regression trap),
composer comment round-trip to the API, and the version select after an
update. Runs via npm run test:e2e and a new CI job; kept out of npm test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Seeds two showcase sessions against a running server: an auth-refactor
session with a JWT refresh sequence diagram (v2 + comment thread) and an
interactive backoff explainer, plus a queue-profiling session with a
metrics card. Mentioned in the README quick start and exercised in the
pack-smoke CI job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… loop

Recorded with scripts/record-demo.mjs (Playwright screencast of the demo
session choreography, converted to a 0.96 MB gif with ffmpeg). Also fix a
timestamp flake in the store contract: JsonFileStore mutates the object
returned by createSnippet, so the pre-update updatedAt must be captured
before updating.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​playwright/​test@​1.60.010010010099100

View full report

@benvinegar benvinegar merged commit de4499c into main Jun 11, 2026
6 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