feat: adopt saved-query format v2 - #217
Merged
Merged
Conversation
Move user-authored query metadata into a complete versioned Spec while keeping id and SQL application-owned. Upgrade v1 storage, imports, shares, tabs, panel edits, dashboards, examples, and generators without retaining flat mirrors or dropping unknown fields. Co-Authored-By: OpenAI Codex <noreply@openai.com> Claude-Session: Codex
upgradeV1Query emitted `panel = {cfg, key: null}` for a null-key chart,
but the live save path (panels.js writePanel) omits the key entirely.
queryContentKey treats an absent field as different from `null`, so a
v1-origin chart and its identical v2-live twin failed to dedup on
merge/append — producing a spurious duplicate (different id) or a
phantom "updated" (same id).
The normal-chart arm now omits `key` when null, matching the live shape.
The view:'table' stash arm keeps `key: null` deliberately — it mirrors
switchPanelType's live output, which is already symmetric. resolvePanel
reads `saved.key != null`, so absent and null resolve identically.
Adds a regression test for the exact merge scenario and a unit test for
the key-less upgrade shape.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TFHi2VLpmCfe1SFkp7Book
This was referenced Jul 13, 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.
What & why
Closes #211.
Introduces the canonical saved-query shape
{id, sql, specVersion, spec}and migrates every live path—local storage, tabs, panel controls, dashboard reads, import/export/merge, share links, and OAuth share restore—to carry the complete Spec without flat mirrors. V1 libraries and legacy shares remain readable; v2 is the only emitted format.Unknown nested fields are preserved across clone/patch/save/rename/favorite/panel/share/merge operations, including inert literal
__proto__keys. Official example libraries and their generators now emit v2, and README/CHANGELOG documentation is updated.Verification
npm test: 2,388 tests passed; per-file statements/lines are 100%, coverage gates greennpm run build: passed; single-filedist/sql.htmlbuiltSIGTRAPbefore opening a page in bundled Chromium/Firefox/WebKit and installed Chrome; the three-engine CI job is the browser gate for this PRChecklist
npm testpasses (the per-file coverage gate is non-negotiable)npm run buildsucceeds (single-filedist/sql.html)src/core/, network insrc/net/(injected fetch), DOM insrc/ui/CHANGELOG.md([Unreleased]) updated