Skip to content

adopt(superset-sqllab): ready to send: SQL Lab autosave loses edits typed while a save is in flight - #160

Open
MeharPro wants to merge 1 commit into
mainfrom
claude/beautiful-einstein-5r1xn0
Open

MeharPro wants to merge 1 commit into
mainfrom
claude/beautiful-einstein-5r1xn0

Conversation

@MeharPro

@MeharPro MeharPro commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Status: ready to send (after the sender's by-hand items in docs/adoption/hunts/superset-sqllab-issue.md, "Before sending").

What

A race hunt on Apache Superset's SQL Lab (master 730016b8, run natively, GenClass injected from outside). EditorAutoSync marks editors as saved at the time the PUT /tabstateview/<id> response arrives. An edit typed while that request is in flight therefore counts as saved, is never sent, and a reload brings back the old SQL. Explore reported it (RACE 2 of 6 at 600 ms, 3 of 6 at 900 ms, on exactly the loads whose server copy lost the edit) and its replay reproduced it. A plain Playwright script reproduces it 3 of 3 at 600, 900 and 1,500 ms (0 of 3 at 0 and 300 ms). Two smaller bugs of the same family the brief predicted were also confirmed and fixed, each as its own patch: Format SQL overwrites text typed while formatting, and the Save query modal saves twice on a double click.

Only files under docs/adoption/hunts/ are added or changed; nothing in packages/.

Files

  • docs/adoption/hunts/superset-sqllab.md: the report (setup, scenarios and verdicts incl. negatives, the finding in causal order, root cause, fixes, tests, fixed variant, problems with GenClass, time).
  • docs/adoption/hunts/superset-sqllab.patch: the autosave fix plus a Jest regression test (git format-patch; applies at 730016b8 and at the brief's f44d3992).
  • docs/adoption/hunts/superset-sqllab-format.patch and superset-sqllab-savequery.patch: the two secondary fixes, each with its test.
  • docs/adoption/hunts/superset-sqllab-issue.md: the issue (Superset's bug-report form), the pull request (Superset's template), the optional Format SQL issue and PR, the disclosure paragraph and the "before sending" checklist.
  • docs/adoption/hunts/superset-sqllab/: harness (hunt.mjs, repro-autosave.mjs, repro-format-save.mjs, lib.mjs, summarise.mjs) and results/{unfixed,fixed}/ (tool texts and summaries, each file under 25 KB).
  • docs/adoption/hunts/README.md: the row.

To send (a person, from a personal account, after the owner's go-ahead)

  1. Re-search apache/superset issues and PRs for anything filed since 2026-11-03 ("tabstateview", "EditorAutoSync", "autosave" + "SQL Lab", "unsaved" + "sqllab").
  2. Reproduce by hand: DevTools throttling at about 1 s latency. Type in SQL Lab, wait for the autosave PUT, type more while it is pending, wait 10 s, reload: the second edit is gone.
  3. File issue A from superset-sqllab-issue.md through the bug-report form (fields map one to one).
  4. Fork apache/superset, git am docs/adoption/hunts/superset-sqllab.patch on a branch from master, set yourself as author, keep the Generated-by: Claude Code trailer, read the diff, then run npm run test -- src/SqlLab/components/EditorAutoSync with and without the fix and pre-commit run on the staged files.
  5. Open PR B (title fix(sqllab): keep editor changes made while the tab state is being saved) with "Fixes #". Superset keeps PRs open at least 24 h and needs CI green plus one approval. Answer review yourself.
  6. Format SQL (section C of the drafts) only after A/B get a maintainer response. Save query: no draft, later if at all.

Measured (every number with its M and latencies)

unfixed fixed
autosave, plain Playwright, response held 0/300/600/900/1,500 ms, 3 trials each lost 0/0/3/3/3 of 3 lost 0 of 3 at 0/600/900/1,500
Format SQL, plain, held 0/300/900/1,500 ms typed text lost 0/0/3/3 of 3 0/0/0/0 of 3
Save query, two clicks 150 ms apart, held 0/300/900 ms duplicate 0/3/3 of 3 0/0/0 of 3
explore autosave, slow_ms 300/600/900, 2 baselines + 6 seeds each no race / RACE 2 of 6 / RACE 3 of 6 (replay reproduced both); oracle agrees per load no race at all three
explore format RACE 6/5/5 of 6 no race / no race / RACE 3 of 6 (false: formatted vs unformatted, text kept)
explore savequery RACE 2 of 2 (false: harness tab names) / no verdict / no verdict RACE 5/2/6 of 6 (false: harness tab names, client-id key, unexplained text)
Jest regression tests (3 patches) each fails 3 of 3 each passes 3 of 3

False reports: on the fixed build, 0 of 72 explore loads had any bug by the harness's own oracle, but 4 of 9 fixed sessions still carried a RACE line. On the unfixed build, the verdict was right in 6 of 9 sessions.

Problems with GenClass itself (report section 7)

  • When a bug needs latency, the delayed fifo baselines can carry it: at 900 ms the "failing run" explore named was the correct one.
  • slow_ms explores "response before or after the user's next keystrokes", but the docs describe only reordering.
  • Superset's Redux store (production build, no DevTools enhancer) was not discovered, and component state came under minified names.
  • Stale-write findings on a bookkeeping counter (autosave). Format-SQL replays said "inconclusive" for a timing-dependent mangling.
  • A PUT keyed by an un-normalised 11-character client id fed a false RACE line.
  • No identical-in-flight witness for the Save query double submit (16 of 18 seeded loads sent two identical POSTs).
  • Save query double submit: no verdict, because the second click exists only in the failing loads.

Checks

  • npm run typecheck -w @genclass/runtime and npm run build -w @genclass/runtime pass: build run (the harness uses dist/); typecheck not run separately, since no runtime source changed
  • unit tests pass: not run, since no GenClass code changed
  • no packages/runtime/test/review-*.test.ts was edited
  • no model-visible text changed
  • no public-surface change
  • a correct app is not made worse: no runtime change
  • sim/ and demos/ not touched
  • no dependency change (the local xlsx workaround stayed in the Superset clone, out of every patch)

Notes for the reviewer

  • Read superset-sqllab.md sections 3 (the tables), 4 (the finding) and 7 (GenClass problems) first.
  • Branch: the session was told to push to claude/beautiful-einstein-5r1xn0 rather than adopt/superset-sqllab.
  • Upstream checks run in the session on the changed Superset files: pre-commit oxfmt, oxlint, custom rules, type-checking-frontend (after npm run plugins:build), all passed; every src/SqlLab Jest suite: 47 suites, 526 passed, 1 skipped.
  • Not run: Superset's Playwright e2e suite (a Jest unit test covers each fix); the server-side PUT ordering the brief suspected (it needs a save slower than the 5 s debounce; noted, not fixed).
  • Local deviations: xlsx repointed to an npm mirror because cdn.sheetjs.com is blocked by this container's proxy; zstd installed for the build.
  • Session time: about 1 h 40 min.

Generated by Claude Code

Race hunt on Apache Superset's SQL Lab (master 730016b8), GenClass injected
from outside. EditorAutoSync marks editors saved at the time the PUT
/tabstateview response arrives, so an edit typed while the save is in
flight is never sent and a reload brings back the old SQL. Explore reported
it at 600 and 900 ms and its replay reproduced it; a plain Playwright
script reproduces it 3 of 3 at 600, 900 and 1,500 ms (0 of 3 at 0 and 300).

Report, three patches against Superset (autosave, Format SQL overwriting
typed text, Save query double submit), each with a Jest test failing 3 of 3
before and passing 3 of 3 after, the issue and pull request drafts, and the
harness with its results. Nothing sent upstream.

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

This branch has not been deployed

No deployments
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.

2 participants