feat(docs): interactive query playground + live landing SDK demo#339
feat(docs): interactive query playground + live landing SDK demo#339EricAndrechek wants to merge 1 commit into
Conversation
Closes #286. Adds a new /playground page (sidebar entry) with a structured query builder against the public read-only gh_events demo at stats.wavehouse.dev: column picker, AND-combined filter rows, aggregations + group-by, order/limit, and time range. Run executes in the browser via @wavehouse/sdk; the equivalent SDK chain and the raw /v1/query JSON AST render live, and the query serializes to a shareable ?q= URL. A "Watch live" button opens an SSE tail. The landing "Query it like a database. Subscribe to it like a socket." section is now interactive: the Query tab runs a tweakable query and renders rows inline (with a deep link into the playground), the Live updates tab opens an SSE tail, and the Ingest tab stays illustrative since the demo is read-only. No code is eval'd — a shared runtime (docs/src/lib/playground.ts) drives a typed QuerySpec, so the on-page code box is generated, never executed text. The same runtime backs the landing demo and the full page so they can't drift; runs are bounded by a 12s client-side abort and degrade to a no-JS skeleton. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 11 minutes and 19 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
📚 Docs preview is live → https://c8d634db-wavehouse-docs.wave-rf.workers.dev
|
What
Turns the docs landing "Query it like a database. Subscribe to it like a socket." section into a working playground, and adds a full
/playgroundpage — both running real queries in the browser against the public read-only demo atstats.wavehouse.dev(our GitHub-activity dogfood,gh_events) via@wavehouse/sdk.Closes #286.
/playgroundpage (sidebar entry,livebadge)A structured query builder against
gh_events:/v1/queryJSON AST render live (both copy-pasteable), and the query serializes to a shareable?q=URL.Landing section, now interactive
event_type/limit, Run, see rows inline; "Open the full playground →" deep-links your query.How
docs/src/lib/playground.ts— owns the curated public schema, the SDK client, theQuerySpec→ builder / generated-code / raw-AST bridge, the results-table renderer, the stream helper, and?q=(de)serialization. The landing demo and the full page are both thin consumers, so they can't drift.eval. The builder UIs drive a typedQuerySpec; the on-page code box is generated text, never executed. The?q=param is hard-validated against the known column/op/agg sets and only ever feeds the typed SDK builder.#286 checklist
/playgroundquery-builder page (item 1) — structured builder, results table, raw AST, generated SDK code, sidebar entry.sdk.md/api.mdcode blocks (item 2) — deliberately deferred: it needs those.mdpages converted to.mdxand each block instrumented. The shared runtime added here is the building block; happy to file a follow-up if we want it.Verification
Driven end-to-end with Playwright against the live demo: playground Run returns rows, Aggregate + group-by returns grouped rows with a consistent AST, the landing Query tab returns rows, the deep-link serializes the spec, and the generated-code / raw-AST previews update live as controls change — zero console errors. Responsive check at desktop + 390px.
Self-reviewed via
/prepush(code + docs reviewers); their findings are addressed in this branch (notably: the raw-AST preview now mirrors the SDK's_buildASTforgroup_by; the cache wording is corrected — structured/v1/queryshares the in-process L1 read cache, so repeats can beX-Cache: HIT).🤖 Generated with Claude Code