feat(library): optional descriptions for saved queries (#29 phase 1)#30
Merged
Conversation
Saved queries gain an optional free-text `description`, surfaced via the
two editing screens from the current Altinity Play design:
- the editor Save popover gains a "Description — optional" textarea
(⌘/Ctrl+Enter commits; plain Enter inserts a newline);
- the Saved-panel pencil ("Edit name & description") opens an expanded
Name + Description edit form, and read-rows render a 2-line description
preview above the SQL preview.
`description` round-trips losslessly through the JSON envelope
(buildExportDoc / parseImportDoc / mergeSaved, mirroring chart/view).
`saveQuery` and `renameSaved` take a `description` arg; `renameSaved`
leaves it untouched when the arg is undefined (name-only rename). All
layers stay at the per-file 100% statements/lines coverage gate.
Pre-phase for the document-style "Library" File menu (#29 phase 2).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AX4YR7RHKj7JfmS2AqnRrm
… review) - parseImportDoc now trims `description` and drops a whitespace-only one, matching saveQuery/renameSaved. Import was the only entry point that passed it through verbatim, so a blank/whitespace description leaked into a visible empty .desc band and round-tripped on re-export. - renameSaved coerces with String(description || '') like saveQuery, so a null (distinct from undefined) clears the note instead of storing the literal 'null'. Tests cover both new branches (whitespace-import dropped; null-rename cleared). Cleanup-only refactors from the review were intentionally skipped to keep the merge surface small (saved-io.js/state.js are being edited in parallel on another branch); the pre-existing raw-NUL contentKey separator is left as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGBS74oUsXarGkCRQKEFLu
BorisTyshkevich
added a commit
that referenced
this pull request
Jun 24, 2026
…file-menu + review fixes Resolves the binary-merge conflict on src/core/saved-io.js and folds in the PR #30 review fixes plus PR #31 (File menu) review fixes found this pass. saved-io.js (conflict resolution + fixes): - Kept PR #31's feature-complete version (buildMarkdownDoc/buildSqlDoc, append). - Converted the raw NUL byte in contentKey to the '\0' escape, so the file is text again — that NUL is what made it binary-to-git and un-3-way-mergeable. - Re-applied the PR #30 fix: parseImportDoc trims `description` (drops whitespace- only), matching saveQuery/renameSaved. - buildMarkdownDoc collapses whitespace in the `### name` heading so a query name with a newline can't break the cookbook structure. file-menu.js (PR #31 review fixes): - CRITICAL: the File menu read bare `app.document` (undefined — createApp only exposes a local doc), so it threw on first click in production. Use `app.document || document`, matching shortcuts.js/results.js. Tests passed only because the fake-app supplies document. - Anchor the dropdown via zoomScale() (divide getBoundingClientRect by the html{zoom} scale), like the editor popovers — it mis-anchored ~20% off otherwise. state.js auto-merged: renameSaved keeps both PR #30's null-safe String(... || '') and PR #31's libraryDirty flag. All 715 tests pass; per-file coverage gate holds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGBS74oUsXarGkCRQKEFLu
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
Pre-phase for #29 (document-style "Library" File menu). Adds an optional free-text
descriptionto saved queries, surfaced via the two editing screens from the current Altinity Play design.This ships independently; the File-menu / library-name / dirty-dot work follows in phase 2.
Changes
src/core/saved-io.js—descriptionround-trips losslessly through the JSON envelope: carried bybuildExportDoc, normalized byparseImportDoc(non-strings dropped), and handled bymergeSaved(add / replace-by-id / drop-on-update), mirroring the existingchart/viewtreatment.src/state.js—saveQuery(state, tab, name, description, …)andrenameSaved(state, id, name, description, …)now take adescription;renameSavedleaves it untouched when the arg isundefined(name-only rename), sets/clears it otherwise.src/ui/app.js— the editor Save popover gains a "Description — optional" textarea (⌘/Ctrl+Enter commits; plain Enter inserts a newline), prefilled from the linked saved entry.src/ui/saved-history.js— the Saved-panel pencil ("Edit name & description") opens an expanded Name + Description edit form (Name⏎ / Desc⌘⏎ commit, Esc/Cancel revert); read-rows render a 2-line description preview above the SQL preview.src/styles.css— styles for the popover textarea, the edit form, and the row description preview (reuses existing tokens).Tests
Per-file 100% statements/lines gate held (functions ≥95 / branches ≥90). New/updated coverage in
saved-io,state,saved-history, andappspecs: description export/import/merge, save/rename set·update·clear·keep-existing, the edit-form commit/cancel paths + double-fire guard, the row description preview, and the popover prefill + ⌘Enter commit.npm test→ 693 passing, all thresholds met.npm run build→dist/sql.htmlbuilds clean.Design source: Claude Design project
Altinity Play(build 2026-06-24) —SavedItem+EditorToolbarsave popover.🤖 Generated with Claude Code