Skip to content

fix(playground): resolve the #877 review items - #888

Merged
ajitpratap0 merged 20 commits into
mainfrom
fix/playground-review-items
Oct 29, 2026
Merged

ajitpratap0 merged 20 commits into
mainfrom
fix/playground-review-items

Conversation

@ajitpratap0

Copy link
Copy Markdown
Owner

Summary

Follow-ups from the claude-review on #877 (stacked on it; GitHub retargets this PR to main when #877 merges).

  1. Render tests for SqlOutput and TranspileTab error, success and empty states (website/scripts/sqlOutput.test.mjs): real components transpiled in-process with typescript and rendered with react-dom/server; only the CodeMirror editor is stubbed. No new dependencies.
  2. Copy feedback timers: one useCopyFeedback hook (backed by a pure, unit-tested createCopyFeedback) for the Format/Transpile output, Lint, AST and "go get" copy buttons. A second click restarts the reset timer, unmount clears it, and the "go get" copy now shows a failure instead of an unhandled rejection.
  3. Dialect arguments documented: parse/format/lint/analyze/highlight use generic rules for an unknown dialect; transpile returns unsupported source|target dialect "x" (JSDoc in WasmLoader.tsx, wasm/main.go, new table in docs/HIGHLIGHTING.md). Behaviour unchanged; a Go test pins the format fallback.
  4. error_span dropped from the Format/Transpile payload: nothing read it, and the editor already marks the same parse error from Lint/Analyze parse_error_span. Contract fixture, types and tests updated.
  5. WASM delivery: confirmed lazy-loaded (next/dynamic, runtime fetch) and served brotli-compressed by Vercel; only change is clamping download progress to 1.

Test Plan

  • cd website && npm run typecheck && npm run lint && npm test — 44/44 pass; lint warnings unchanged from base (7, pre-existing)
  • go test ./wasm/..., GOOS=js GOARCH=wasm go vet ./wasm/
  • pre-commit hook (fmt, vet, short tests)

Breaking Changes

The WASM format / transpile JSON no longer includes error_span on failure. It was undocumented outside the bridge types and unused by the site.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2

Ajit Pratap Singh and others added 18 commits October 28, 2026 01:23
… compatibility page

- metrics.ts: add REALWORLD_CORPUS (per-dialect pass/total from
  scripts/dialect-audit at 8d8c527, totals derived, released: false) and
  the REALWORLD_STATUS qualifier.
- DialectShowcase: each dialect card shows "Real-world corpus: N/N" with an
  "on main, next release" qualifier; anchors and v1.15.0 QA badges unchanged.
- FEATURES: Multi-Dialect cites the corpus from metrics.ts; new full-width
  "Format & Transpile" card (v1.14 features, comment/hint preservation
  marked next release) with a code icon so the grid stays balanced.
- SQL_COMPATIBILITY.md: single-dialect reproduce command, the ratchet rule,
  and a table of unreleased statement syntax (multi-table UPDATE/DELETE,
  UPDATE/DELETE TOP and OUTPUT, GO [n], RETURNING INTO, ARRAY JOIN/LIMIT BY,
  MERGE with VALUES, CLONE ... AT, SEQUENCE DDL, EXPLAIN, Oracle '/', <=>
  and == gating), each example checked with ParseWithDialect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…xample

- wasm: format() now calls gosqlx.FormatWithDialect with the selected
  dialect (TOP stays TOP in SQL Server, comments and hints are kept) and
  returns {"result"} or {"error","error_span"} (bridge.TextResponse); add a
  gosqlxTranspile(sql, from, to) export wrapping gosqlx.Transpile.
- bridge: Format and Transpile helpers with tests for dialect format,
  comment preservation, ErrUnplaceableComment, operator/quote/escape
  transpilation and transpile errors; contract fixture extended.
- website: Transpile tab (From is the editor dialect, To is selectable),
  Format tab shares a SqlOutput component, TextData in bridgeTypes and the
  contract check, loader gains transpile(); tab bar scrolls on narrow
  screens; default SQL starts with a comment.
- homepage: Transpile API example (MySQL -> PostgreSQL) and a Format
  example that keeps a comment, each with its printed output.
- regenerate src/generated/sample-ast.json (new AST quote fields).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…ST surface

- format guide: replace "Comments are not preserved" with comment and hint
  handling, ErrUnplaceableComment, FormatWithDialect and the CLI's comment
  check and fully lower-case --no-uppercase
- CLI guide: add transpile, stats and watch sections, dialect aliases,
  validate --quiet/--check/--list-dialects, lint exit 1 on syntax errors,
  -o for parse/transpile; drop unsourced performance claims and link to
  /benchmarks/
- api/gosqlx.md: Format, FormatWithDialect, WithComments, Lint error
  contract, SplitStatements block and separator handling, Transpile
  operator mapping, ExtractColumns alias rule (#849)
- api/ast.md: ExplainStatement, BatchSeparator, Extras/DialectExtras/
  EnsureExtras, identifier quote style, literal introducers,
  TableReference.Modifiers, PIVOT/UNPIVOT additions, BinaryExpression.BitwiseXor;
  struct field names corrected from the Go source
- feature tour: formatting with comments, transforms, fingerprinting and
  transpilation, with outputs produced from main
- troubleshooting, usage, LSP and MCP guides: Lint error return,
  SplitStatements blocks/GO/DELIMITER/'/', LSP outline and formatting,
  MCP GO counts and alias columns
- lint-sql-in-ci: fix the link to the renamed comments section

Unreleased behaviour is marked in body text; no heading carries a version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…ext release

- CLI_GUIDE: describe what gosqlx watch does today (watches, reports nothing,
  never rewrites files); drop the --mode claims pending the watch fix
- CLI_GUIDE, api/gosqlx.md: ||/ becomes CBRT() only for Snowflake and
  ClickHouse; other targets return an error
- CLI_GUIDE: remove unsourced validate latency/throughput claims
- api/ast.md: DialectExtras() returns a shallow struct copy; EnsureExtras()
  is the mutable path
- SQL_COMPATIBILITY: <=> and == accepted only in the listed dialects (none in
  v1.16.0), quote dialect-audit output exactly, qualify GO statement counts,
  call the corpus production-style
- website: production-style corpus wording, CLI guide description, playground
  intro/meta mention transpile, Transpile tab notes comments are dropped
- bridge: TextResponse doc matches WasmLoader.parseResult (throws on error)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
Library, CLI, MCP server.json, Claude Code plugin, Glama, VS Code
extension, pygosqlx, performance baselines, website version constant
and docs headers now report 1.17.0. Adds the 1.17.0 entries to the CLI
and package version-history comments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…vercel skip]

- CHANGELOG: rename [Unreleased] to [1.17.0] with a release summary;
  Behavior changes first (led by the #868 GO change), new Security and
  Performance sections, duplicates merged and PR numbers on every entry.
- MIGRATION: v1.16.0 -> v1.17.0 checklist and companion versions.
- VS Code extension changelog 1.17.0 entry.
- API reference: new formatter package page; AST container fields,
  CTE/PIVOT fields, checked formatting, linter syntax errors, security
  scanner, tokenizer dialect lexing, LSP sync key and error handling,
  MCP parse_sql dialect, CLI security merge and quiet mode.
- Generated v1-17-0 release post (split-changelog).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…[vercel skip]

Re-ran scripts/dialect-audit on all 8 dialects at fda9a5e: 2,813
statements (was 2,788), all passing. Updates metrics.ts (released: true,
per-dialect counts, sourceCommit), the SQL_COMPATIBILITY table and every
2,788 mention, and regenerates the v1-17-0 release post.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…el skip]

Rewrite the "unreleased / on the main branch / next release" markers in
the guides and API reference now that the behaviour ships in v1.17.0, and
regenerate the homepage sample AST for the new AST fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…ctness work

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
gen-readme-metrics --check requires the doc.go version history and the
docs/*.md banners to match the latest tag; they move to 1.17.0 in the
post-tag follow-up, as for v1.16.0 (#855).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
The playground page now transfers 3.60 MB (CI median), 1.4 KB over the
shared 3.6 MB budget, because the GoSQLX WASM module grows with the
parser. Budget it like its script size: measured value plus ~15%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
- Render tests for SqlOutput and TranspileTab error, success and empty
  states (react-dom/server + in-process TypeScript, no new dependencies).
- One useCopyFeedback hook for the four copy buttons: the reset timer is
  restarted on each click and cleared on unmount, and the "go get" copy
  now reports a failed clipboard write.
- Document that parse/format/lint/analyze/highlight treat an unknown
  dialect as generic while transpile returns an error (JSDoc, wasm/main.go,
  docs/HIGHLIGHTING.md).
- Drop the unused error_span from the Format/Transpile payload; Lint and
  Analyze keep parse_error_span, which the editor already marks.
- Clamp WASM download progress to 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
gosqlx-website Ready Ready Preview Oct 29, 2026 10:38am UTC

@github-actions github-actions Bot added documentation Improvements or additions to documentation wasm WebAssembly playground labels Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 22s —— View job


Review of PR #888

I read the diff only. I didn't run the tests.

The change is clean overall. The createCopyFeedback / useCopyFeedback split makes the timer logic testable without a DOM. The error_span removal is applied consistently across the Go struct, the Go tests, the JSON fixture, the TS types and the contract check. ErrorSpan is still imported in bridgeContract.check.ts because the lint and analyze checks use it, so there's no unused import.

Issues

  1. The "go get" copy button still doesn't show a failure (Playground.tsx:142-149, :349).

    • The PR description says the copy "now shows a failure instead of an unhandled rejection".
    • The code only fixes the unhandled rejection. It destructures just { copied, flash } and calls flash("failed").
    • The button label is copied ? '✓ Copied' : 'Copy', so a failed copy shows nothing.
    • Fix: also destructure copyFailed and render a failed label, as FormatTab, LintTab and AstTab do. Otherwise correct the description.
  2. Small robustness points (non-blocking)

    • In useCopyFeedback, flash is a no-op until the effect has run. That's fine for click handlers.
    • Under React StrictMode the effect disposes and recreates the feedback object. That works, but a disposed object isn't reused, which is correct.
    • The Math.min(1, received / total) clamp is good. Since total > 0 is checked before the read loop, there is no division by zero.
  3. Style nit: the useCopyFeedback import sits above the react import in AstTab, FormatTab, LintTab and Playground. Put it after the react import to match the usual ordering.

  4. Test coverage

    • The render tests for SqlOutput and TranspileTab cover the error, success and empty states well. Stubbing only SqlEditor keeps them realistic.
    • The loader hook relies on node:module registerHooks. That needs a recent Node, so check that CI's Node version supports it.
    • There is no test that the hook wiring clears the timer on unmount, but createCopyFeedback covers that logic directly.
  5. Breaking change: dropping error_span is documented in the description. It would be worth a line in CHANGELOG.md under [Unreleased], per CLAUDE.md.

The only item I'd fix before merging is #1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
@ajitpratap0 ajitpratap0 reopened this Oct 29, 2026
@ajitpratap0
ajitpratap0 changed the base branch from docs/website-next-release to main October 29, 2026 10:08
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 33s —— View job


Review of PR #888

I read the diff and the key files (useCopyFeedback.ts, Playground.tsx). I didn't run the tests.

Summary

The change is solid. Splitting the timer logic into the pure createCopyFeedback makes it unit-testable without a DOM. The error_span removal is consistent across the Go struct, Go tests, JSON fixture, TS types and the contract check. Clamping download progress to 1 is correct.

Issues

  1. The "go get" copy button doesn't show a failure (website/src/components/playground/Playground.tsx:142-150, :349) — worth fixing before merge.

    • The PR description says the copy "now shows a failure".
    • The code destructures only { copied, flash } and calls flash("failed"), but the label is copied ? '✓ Copied' : 'Copy'. A failed copy shows nothing.
    • The unhandled rejection is fixed, but the failure state is never rendered.
    • Fix: destructure copyFailed and render a failed label, as FormatTab, LintTab and AstTab do. Otherwise correct the description.
  2. Non-blocking: flash is a no-op until the effect has run.

    • feedback.current is null before mount, so a call made before then is silently dropped.
    • This is fine for click handlers, which only fire after mount.
    • Under StrictMode the effect disposes and recreates the feedback object. That works.
  3. Style nit: the useCopyFeedback import sits above the react import in AstTab, FormatTab, LintTab and Playground. Put it after the react import to match the usual ordering.

  4. Tests

    • The SqlOutput and TranspileTab render tests cover the error, success and empty states well, and stubbing only the editor keeps them realistic.
    • The loader hook uses node:module registerHooks. Confirm CI's Node version supports it.
    • No test checks that the hook clears the timer on unmount. createCopyFeedback covers that logic directly, so this is minor.
  5. Breaking change: dropping error_span is documented in the PR body. Add a line under [Unreleased] in CHANGELOG.md, per CLAUDE.md.

Security and performance

I found no security concerns. The WASM bundle stays lazy-loaded.

@github-actions github-actions Bot added the cli label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 16s —— View job


Review of PR #888

I read the diff and the key files (useCopyFeedback.ts, Playground.tsx). I didn't run the tests.

Summary

The change is solid. Splitting the timer logic into the pure createCopyFeedback makes it unit-testable without a DOM. The error_span removal is applied consistently across the Go struct, Go tests, fixture, TS types and contract check. Clamping download progress to 1 is correct.

Issues

  1. The "go get" copy button still doesn't show a failure (website/src/components/playground/Playground.tsx:142-150, :349). I'd fix this before merge.

    • The code destructures only { copied, flash } and calls flash("failed").
    • The label is copied ? '✓ Copied' : 'Copy', so a failed copy shows nothing.
    • The unhandled rejection is fixed, but the failed state is never rendered, which doesn't match the PR description.
    • Fix: destructure copyFailed and render a failed label, as FormatTab, LintTab and AstTab do. Otherwise reword the description.
  2. Non-blocking: flash is a no-op before the effect runs. feedback.current is null until mount, so an earlier call is silently dropped. Click handlers only fire after mount, so this is fine. The StrictMode dispose and recreate cycle also works.

  3. Style nit: the useCopyFeedback import sits above the react import in some files. Put it after for consistency.

  4. Tests

    • The SqlOutput and TranspileTab render tests cover the error, success and empty states well.
    • The test loader relies on node:module registerHooks. Confirm that CI's Node version supports it.
    • No test checks that the hook clears the timer on unmount. createCopyFeedback covers that logic directly, so this is minor.
  5. Changelog: the error_span removal is a breaking change. Add a line under [Unreleased] in CHANGELOG.md, per CLAUDE.md.

Security and performance

I found no security concerns. The WASM bundle stays lazy-loaded.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 26s —— View job


Review of PR #888

I read the diff and re-checked the current branch. I didn't run the tests.

Summary

The change is solid. createCopyFeedback is pure and unit-testable, and useCopyFeedback wraps it cleanly. The error_span removal is consistent across the Go struct, Go tests, fixture, TS types and contract check. Clamping download progress to 1 is correct.

Issues

  1. The "go get" copy button still doesn't show a failure (website/src/components/playground/Playground.tsx:142-150, :349). I'd fix this before merge.

    • The code destructures only { copied, flash } and calls flash("failed").
    • The label is copied ? '✓ Copied' : 'Copy', so a failed copy shows nothing.
    • The unhandled rejection is fixed, but the failed state is never rendered. This doesn't match the PR description.
    • Fix: destructure copyFailed and render a failed label, as FormatTab, LintTab and AstTab do. Otherwise reword the description.
  2. Changelog: CHANGELOG.md has an [Unreleased] section (line 8), but I found no entry for the error_span removal. It is a breaking change to the WASM JSON, so add a line there, per CLAUDE.md.

  3. Non-blocking: flash is a no-op before the effect runs. feedback.current is null until mount. Click handlers only fire after mount, so this is fine. The StrictMode dispose and recreate cycle also works.

  4. Style nit: the useCopyFeedback import sits above the react import in some files. Put it after for consistency.

  5. Tests

    • The SqlOutput and TranspileTab render tests cover the error, success and empty states well.
    • The test loader relies on node:module registerHooks. Confirm CI's Node version supports it.
    • No test checks that the hook clears the timer on unmount. createCopyFeedback covers that logic directly, so this is minor.

Security and performance

I found no security concerns. The WASM bundle stays lazy-loaded.

Fix item 1 →
· branch fix/playground-review-items

@ajitpratap0
ajitpratap0 merged commit a381f7f into main Oct 29, 2026
32 checks passed
@ajitpratap0
ajitpratap0 deleted the fix/playground-review-items branch October 29, 2026 10:46

This branch was successfully deployed

1 active deployment
Preview — 312ae22c Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli documentation Improvements or additions to documentation performance python wasm WebAssembly playground

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant