Store contract tests, viewer e2e on Chromium/WebKit, and sideshow demo + README gif#1
Merged
Merged
Conversation
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>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This was referenced Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Carries out the three priorities from the next-session plan.
Store contract tests
runStoreContract(name, makeStore)suite (test/storeContract.ts): sessions CRUD +lastActiveAtordering, snippet versioning with the 20-entry history cap, cascade deletes, commentseqmonotonicity (including across deletes), and alllistCommentsfilters.JsonFileStore(tmp dir, plus a reload-from-disk persistence test) andSqlStore, via a minimalSqlStorageshim backed by Node's built-innode: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 plainnpm test.test/workersSqlTypes.d.tsprovides minimal ambient mirrors of the CloudflareSqlStorageglobals soworkers/sqlStore.tstypechecks 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)
e2e/viewer.spec.ts) with a per-test server fixture: each test bootsserver/index.tson an ephemeral port with a tmpSIDESHOW_DATA.npm run test:e2e+ a newe2eCI job (npx playwright install --with-deps chromium webkit); kept out ofnpm test. All 8 (4 × 2 engines) pass locally.sideshow demo+ README gifsideshow demoseeds 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 thedocs/sideshow-*.pngreferences, following the design guide (CSS variables; verified rendering in light and dark). Seed data lives inbin/demoData.js— the CLI stays dependency-free.scripts/record-demo.mjs(replays the demo choreography in a video-recording Chromium, so the clip is regenerable).Notes for review
JsonFileStore.updateSnippetmutates the objectcreateSnippetreturned, so the suite captures the pre-updateupdatedAtbefore updating (commit 848829c includes the fix; it flaked 1-in-3 runs before).node:sqliteprints anExperimentalWarningduringnpm test; it's unflagged on Node ≥22.13 so both CI matrix legs (22, 24) are fine.npm test, typecheck, lint, format:check) is green; tests run clean three times in a row.🤖 Generated with Claude Code