You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version and capability checks serve different purposes and must not be conflated.
Structured sources: capability is authoritative
system.functions, system.formats, engine tables, and data-type tables exist across different ClickHouse releases and expose different documentation columns depending on version, build, registration, and privileges.
missing: successful no-match, cacheable per connection;
unavailable: unsupported/denied/incompatible capability, cacheable per connection;
transient auth/network failure: retryable, not durably cached.
Cache keys include kind:name. Every request is tied to a connection generation so stale responses cannot repopulate caches or replace pane content after reconnect.
Shared loading rules
Probe each capability at most once per connection, subject to the version policy above.
Use system.columns or one silent optimistic probe.
Missing tables/columns and denied access never surface query errors.
Clear capability, result, pending, and pane-navigation state on connection change.
CM6 interaction
Compact hover and completion info
Show signature/kind, one-line summary, optional introduced version, optional alias notice, and accessible Open reference action. Continue syntax-tree suppression inside comments, strings, and quoted identifiers.
Hover and completion info share helpers. Async updates verify that tooltip/editor DOM is still live.
Keyboard
F1 opens documentation for the strongest target at selection.main.head.
prevent browser default only when handled;
return unhandled when no target resolves;
tooltip, completion, schema actions, and F1 call one openDocEntry(DocTarget) path;
document F1 in the shortcuts dialog.
Hover is never the sole access path.
Workbench reference pane
Use one persistent non-modal right-side pane:
no backdrop or focus trap;
editor remains usable;
one instance, replacing content for a new target;
bounded resize;
labelled complementary region;
close/Escape and focus restoration;
distinct loading, missing, unavailable, transient, oversized, and fallback states;
retry for transient failure;
session-local navigation history only.
Do not require the schema graph's bottom pane to share this geometry.
Pure context classification
Use a pure src/core/doc-context.ts-style module receiving SQL, caret position, and optional precomputed tokens/syntax. It returns ranked targets and issues no SQL.
Use confirmed fields from system.formats, system.table_engines, system.database_engines, and system.data_type_families. system.formats has no syntax; never query or fabricate it.
On eligible/probed servers, treat system.documentation as exactly:
name
type
description
source
Unknown future type values remain renderable through an unknown normalized kind while preserving the server label.
Schema-surface integration
Phases 2–3 may add explicit engine/type documentation actions. Preserve current expand/select and insertion gestures. Opening docs does not mutate editor text or close schema views.
Compatibility
Pre-26.6 servers may still provide structured metadata and should use it.
Parsed pre-26.6 servers never receive a system.documentation request.
Missing rich columns degrade by field.
Denied access produces no toast/banner or probe storm.
User-defined/undocumented entities may show minimal or missing states.
Summary
Provide version-exact ClickHouse reference documentation inside SQL Browser, sourced from the connected server rather than the public website.
Implementation is split into three sequenced child issues:
system.documentationcoverage and safe Markdown rendering.Version and capability policy
Version and capability checks serve different purposes and must not be conflated.
Structured sources: capability is authoritative
system.functions,system.formats, engine tables, and data-type tables exist across different ClickHouse releases and expose different documentation columns depending on version, build, registration, and privileges.For #313 and #314:
serverVersion >= 26.6gate;system.documentation: version short-circuit plus capability probesystem.documentationis a ClickHouse 26.6 feature.For #315:
system.documentation.A version check is therefore a negative optimization, not proof of capability.
Reconnect/invalidate clears all version-derived and probed capability state. Tests must cover pre-26.6 no-request behavior, 26.6+ probing, unknown-version probing, partial structured schemas, denied access, and custom-build differences.
Product goals
system.*privileges degrade silently.innerHTML.Source-of-truth policy
Preferred source order:
system.documentationfor breadth, complete Markdown bodies, or structured-source fallback;A safely derived latest-doc link may be secondary. SQL Browser must not fetch the public site to populate the pane.
Do not hard-code row counts, entity counts, or a closed server type enum.
Current architecture
Extend the current post-CM6 architecture:
src/editor/codemirror-adapter.tsowns CM6 completion, info, hover, syntax context, and keymap;src/application/schema-catalog-service.tsowns reference lifecycle, lazy docs, capability state, caching, and invalidation;src/net/ch-client.tsowns silent system-table queries and row decoding;src/core/**remains pure and DOM-free;Do not recreate textarea-era editor overlays.
Shared documentation model
found: normalized and cacheable;missing: successful no-match, cacheable per connection;unavailable: unsupported/denied/incompatible capability, cacheable per connection;Cache keys include
kind:name. Every request is tied to a connection generation so stale responses cannot repopulate caches or replace pane content after reconnect.Shared loading rules
system.columnsor one silent optimistic probe.system.documentationbody.CM6 interaction
Compact hover and completion info
Show signature/kind, one-line summary, optional introduced version, optional alias notice, and accessible
Open referenceaction. Continue syntax-tree suppression inside comments, strings, and quoted identifiers.Hover and completion info share helpers. Async updates verify that tooltip/editor DOM is still live.
Keyboard
F1opens documentation for the strongest target atselection.main.head.openDocEntry(DocTarget)path;Hover is never the sole access path.
Workbench reference pane
Use one persistent non-modal right-side pane:
Do not require the schema graph's bottom pane to share this geometry.
Pure context classification
Use a pure
src/core/doc-context.ts-style module receiving SQL, caret position, and optional precomputed tokens/syntax. It returns ranked targets and issues no SQL.Strong context wins. Weak identifiers are not guessed. Ambiguous names open disambiguation.
Rendering and safety
Structured fields render directly through DOM construction.
For Markdown:
Rules:
innerHTMLor raw HTML;https:links only, withnoopener noreferrer;Structured sources
#313
Use whichever confirmed
system.functionscolumns exist, including optional description, syntax, arguments, parameters, returned value, examples, introduced version, categories, alias, deterministic, and higher-order metadata. Missing fields degrade independently.#314
Use confirmed fields from
system.formats,system.table_engines,system.database_engines, andsystem.data_type_families.system.formatshas nosyntax; never query or fabricate it.#315
On eligible/probed servers, treat
system.documentationas exactly:Unknown future type values remain renderable through an
unknownnormalized kind while preserving the server label.Schema-surface integration
Phases 2–3 may add explicit engine/type documentation actions. Preserve current expand/select and insertion gestures. Opening docs does not mutate editor text or close schema views.
Compatibility
system.documentationrequest.Child issues
#313 — Phase 1
Capability-gated function docs, target-aware catalog API, reconnect-safe cache, CM6 hover/info, F1, non-modal pane, aliases, examples, and fallback.
#314 — Phase 2
Capability-gated formats/engines/types, SQL-context expansion, schema actions, related navigation, and no nonexistent format syntax query.
#315 — Phase 3
26.6 lower-bound short-circuit, 26.6+/unknown-version capability probing, broad entity kinds, bounded Markdown, disambiguation, related navigation, and parser robustness tests.
Phases land in order.
Umbrella acceptance criteria
system.documentationrequests.system.documentationonce.Non-goals