Skip to content

feat(docs): interactive query playground + live landing SDK demo#339

Draft
EricAndrechek wants to merge 1 commit into
mainfrom
docs-query-playground
Draft

feat(docs): interactive query playground + live landing SDK demo#339
EricAndrechek wants to merge 1 commit into
mainfrom
docs-query-playground

Conversation

@EricAndrechek

Copy link
Copy Markdown
Member

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 /playground page — both running real queries in the browser against the public read-only demo at stats.wavehouse.dev (our GitHub-activity dogfood, gh_events) via @wavehouse/sdk.

Closes #286.

/playground page (sidebar entry, live badge)

A structured query builder against gh_events:

  • Rows or Aggregate mode — column picker, AND-combined filter rows (column / operator / value), aggregations + group-by, a single order-by, limit, and time range.
  • Run executes in your browser; Watch live opens an SSE tail.
  • As you build, the equivalent SDK chain and the raw /v1/query JSON AST render live (both copy-pasteable), and the query serializes to a shareable ?q= URL.

Landing section, now interactive

  • Query tab: tweak event_type / limit, Run, see rows inline; "Open the full playground →" deep-links your query.
  • Live updates tab: Run opens an SSE tail you watch events land in.
  • Ingest tab: stays illustrative — the demo is read-only.

How

  • A shared, framework-free runtime — docs/src/lib/playground.ts — owns the curated public schema, the SDK client, the QuerySpec → 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.
  • No eval. The builder UIs drive a typed QuerySpec; 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.
  • Runs are bounded by a 12s client-side abort, degrade to a stable skeleton without JS, and tear down (SSE + pending runs) across Astro view transitions.

#286 checklist

  • /playground query-builder page (item 1) — structured builder, results table, raw AST, generated SDK code, sidebar entry.
  • Mini query builder woven into the landing section (item 3) — the Query/Live tabs.
  • Per-doc-page "Run it" on existing sdk.md / api.md code blocks (item 2) — deliberately deferred: it needs those .md pages converted to .mdx and 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 _buildAST for group_by; the cache wording is corrected — structured /v1/query shares the in-process L1 read cache, so repeats can be X-Cache: HIT).

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@EricAndrechek, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 43d25769-5839-4632-9900-6ffdcb1c28a0

📥 Commits

Reviewing files that changed from the base of the PR and between 46d92e7 and c515ad7.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • docs/src/components/HomeQueryDemo.astro
  • docs/src/components/QueryPlayground.astro
  • docs/src/config/sidebar.ts
  • docs/src/content/docs/index.mdx
  • docs/src/content/docs/playground.mdx
  • docs/src/lib/playground.ts
  • docs/src/styles/global.css
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs-query-playground
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch docs-query-playground

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area/docs Documentation, site/, README labels Jun 11, 2026
@github-actions

Copy link
Copy Markdown

📚 Docs preview is livehttps://c8d634db-wavehouse-docs.wave-rf.workers.dev

  • Commitc515ad7: feat(docs): interactive query playground + live landing SDK demo
  • Author@EricAndrechek, Claude Opus 4.8 (1M context)
  • Committed — 2026-06-10 21:09 (UTC-04:00)
  • Deployed — 2026-06-10 21:14 EDT

@EricAndrechek EricAndrechek moved this from Backlog to In progress in WaveHouse Task Board Jun 11, 2026
@EricAndrechek EricAndrechek moved this from In progress to In review in WaveHouse Task Board Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation, site/, README documentation Improvements or additions to documentation

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

feat(docs): query-builder playground page + live SDK examples woven into doc pages

1 participant