Skip to content

Web UI: show single-value results with full height - #109245

Merged
alexey-milovidov merged 10 commits into
masterfrom
play-single-value-full-height
Jul 21, 2026
Merged

alexey-milovidov merged 10 commits into
masterfrom
play-single-value-full-height

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

In the Web UI (play.html), when a query result is exactly one row and one column (for example, the output of SHOW CREATE TABLE), the value is now shown with its full height instead of being clamped to three lines. This makes such results readable at a glance without having to select the cell to expand it. Multi-row or multi-column results keep the existing 3-line clamp.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Web UI: show a single-value result (one row, one column, e.g. SHOW CREATE TABLE) with full height instead of clamping it to three lines.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

Version info

  • Merged into: 26.7.1.1286 (included in 26.7 and later)

When a query result is exactly one row and one column (for example, the
output of `SHOW CREATE TABLE`), the Web UI now shows the value with its
full height instead of clamping the cell to three lines. This makes such
results readable without having to select the cell to expand it.

Multi-row or multi-column results keep the existing 3-line clamp.
@clickhouse-gh

clickhouse-gh Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [77a8c67]

Summary: ✅


AI Review

Summary

This PR makes 1x1 table results in play.html render at full height instead of staying clamped to three lines. The happy-path wiring is in place, but the new invariant is not carried through the partial-result error and restore branches, so failed queries that already streamed a single cell still render with the old clamped behavior.

Findings

⚠️ Majors

  • [programs/server/play.html:6093] The new single-value contract only runs on successful table renders. A result shaped as meta + one row + {"exception": ...} takes the stream_exception branch at lines 6039-6044, where we still do renderTotals / applyColumnColors / transposeIfNeeded / _changeTableLayout but never call expandSingleValueIfNeeded; reopening the same failed snapshot misses it too via the restoreErrorSnapshot callers at lines 6590-6592 and 6887-6893. That leaves failed single-cell results on the old 3-line clamp after this PR, even though restoreErrorSnapshot is meant to mirror the live partial-result UI.
    Suggested fix: thread expandSingleValueIfNeeded through those partial-result error paths as well, ideally in restoreErrorSnapshot after applyColumnColors and in the live stream_exception branch before _changeTableLayout, then add a focused regression for a meta + one row + {"exception": ...} response.
Final Verdict

Status: ⚠️ Request changes

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jul 3, 2026
Comment thread programs/server/play.html Resolved
Address review (clickhouse-gh): the single-value full-height rule
`#data-table.single-value .cell-content` was more specific than
`.td-selected .cell-content`, so selecting a tall 1x1 result (e.g.
`SELECT repeat('line\n', 1000)`) dropped the selected-state
`max-height: 50vh` and internal scrolling while the cell kept
`position: absolute`, producing an unbounded overlay over the page.

Scope the unclamped rule to unselected cells
(`td:not(.td-selected)`) so a selected single-value cell falls back
to the bounded, internally-scrolling `.td-selected` behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, what's with 03096_order_by_system_tables? Provide a fix.

@groeneai

groeneai commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

@alexey-milovidov 03096_order_by_system_tables is not caused by this PR (it only touches programs/server/play.html). On this PR's run it hit the transient variant and CI reruns passed 38/38.

Root cause of the flakiness: despite the name the test has no ORDER BY (empty reference). It runs SYSTEM FLUSH LOGS only to materialize every system log table, then checks none has a non-default sorting key; it reads no log rows. The global flush blocks up to the 180s waitFlush timeout draining the server-wide log queues (query_metric_log, trace_log, ...), and under many concurrent parallel tests that shared backlog can exceed 180s:

Code: 159. DB::Exception: Timeout exceeded (180 s) while flushing system log 'DB::SystemLogQueue<DB::QueryMetricLogElement>'. (TIMEOUT_EXCEEDED)

CIDB, last 180 days: all 18 timeout failures are on parallel + slow-backend lanes (coverage, s3 storage, tsan); 0 on master.

Fix in #109365: add no-parallel so it runs in the sequential phase, when no other test is feeding the shared queues. The sorting-key check is unchanged.

@alexey-milovidov
alexey-milovidov requested a review from pamarcos July 6, 2026 04:57

@pamarcos pamarcos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works

Before

Image

After

Image

But GPT-5.5 flagged that it might break existing behavior:

  • [programs/server/play.html:1903-1913, 2863-2869, 4427-4429] The selected 1x1 cell can still become full-height. expandSingleValueIfNeeded runs before _changeTableLayout, so _changeTableLayout measures the unclamped value and freezes the row at full height. After selection, .td-selected .cell-content applies, but its min-height: calc(100% + 2px) refers to that already-huge cell height, so it defeats max-height: 50vh. This keeps the exact “bounded selected cell” behavior from the second commit from working for tall values like SELECT repeat('line\n', 1000).
    Suggested fix: cap the selected-state min-height for single-value cells, for example after the selected rule:
#data-table.single-value .td-selected .cell-content
{
    min-height: min(calc(100% + 2px), 50vh);
}

@pamarcos pamarcos self-assigned this Jul 6, 2026
Addresses review feedback from @pamarcos (via GPT-5.5): a single-value
result is expanded to full height by `expandSingleValueIfNeeded` before
`_changeTableLayout` freezes the row height, so a tall value (e.g.
`SELECT repeat('line\n', 1000)`) freezes its row at full height. When
that cell is then selected, the `min-height: calc(100% + 2px)` on
`.td-selected .cell-content` resolves against the frozen full height and,
because `min-height` takes precedence over `max-height`, defeats the
`max-height: 50vh` bound, keeping the cell full-height instead of
scrolling internally.

Cap the selected-state `min-height` at `50vh` for single-value cells with
`#data-table.single-value .td-selected .cell-content`, so a selected tall
single-value cell falls back to the same bounded, internally-scrolling
behavior as any other selected cell.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Thanks @pamarcos — good catch, that is a real edge case. Fixed in 0b591d0: since expandSingleValueIfNeeded expands the single-value cell before _changeTableLayout freezes the row height, a tall value freezes its row at full height, and the selected-state min-height: calc(100% + 2px) (which takes precedence over max-height) then defeats the 50vh bound. I capped it with min-height: min(calc(100% + 2px), 50vh) scoped to #data-table.single-value .td-selected .cell-content, so a selected tall single-value cell falls back to the same bounded, internally-scrolling behavior as any other selected cell.

Comment thread programs/server/play.html Resolved
…lue cells

The `.single-value` unclamp rule set both `max-height: none` and
`overflow: visible`. The latter removed the base `.cell-content`
`overflow: hidden`, so with the inherited `white-space: pre` a long
single-line value (e.g. `SELECT repeat('x', 100000)` or a long line in
`SHOW CREATE TABLE`) painted past the `40vw` cell cap and across the page.

Drop only the vertical clamp: keep the base `overflow: hidden` so the
content is still clipped horizontally at the `40vw` cap. With
`max-height: none` the box grows to the full content height, so there is
no vertical overflow to clip and the whole value remains visible.

Addresses the `clickhouse-gh` AI review Major at programs/server/play.html:1718.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Updating the branch to fix the 04001_join_reorder_through_expression test, which was broken today in master.

Comment thread programs/server/play.html Resolved
alexey-milovidov and others added 4 commits July 6, 2026 22:51
Address AI review (play.html:2098): a tall single-value result (e.g.
`SELECT repeat('line\n', 1000)`) is shown unclamped, so `_changeTableLayout`
froze its row at the full content height. Selecting the cell then moved
`.cell-content` to `position: absolute` and bounded it to `50vh`, but the row
stayed frozen at full height, leaving a large blank row with a `50vh` overlay
pinned at the top.

Fix the root cause: skip the row-height freeze for single-value tables in
`_changeTableLayout`. The freeze exists only to stop absolutely-positioned cell
content from reflowing the following rows, but a single-value table has one row
with nothing below it. With the freeze gone, selecting the value cell collapses
the row to the row-number cell's height (~1 line) and the overlay is bounded to
`50vh` with internal scrolling, matching the fallback behavior of any other cell.

This makes the previous `#data-table.single-value .td-selected .cell-content`
`min-height` cap redundant (the selected cell's `calc(100% + 2px)` now resolves
against the collapsed row-number height, well under `50vh`), so remove it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…plate literal

The single-value CSS comment was added inside the shadow-root style block,
which lives in a JS template literal; the backticks in the comment terminated
the literal and broke the page script. Found by test_play_reconcile_startup:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109245&sha=03660d963d8d083e14c4df7229909556e7004a85&name_0=PR

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109245&sha=03660d963d8d083e14c4df7229909556e7004a85&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%203%2F6%29 (test_replicated_database/test.py::test_replicated_table_structure_alter, tracked in #110036) and provide a fix in a separate PR. The previous fix attempt #110145 was closed unmerged, so a new approach is needed. If a fix is already in progress, link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

A root-cause fix is already open: #111029 (Closes #110036).

Root cause: #107491 (merged 2026-07-10, the regression onset) added isRowExistsLightweightDeleteMarker to InterpreterAlterQuery::getRequiredAccess, which runs before lockForAlter. That read uses getInMemoryMetadataPtr(context, /*bypass=*/false), pinning the query-scoped snapshot cache (enable_shared_storage_snapshot_in_query) to the pre-ALTER structure. A concurrent comment-only or settings-only ALTER on a ReplicatedMergeTree then takes its commit base from that same pinned cache and commits the stale structure via setInMemoryMetadata, silently dropping a column added by a racing ALTER ... ADD COLUMN. replica_path/metadata_version stays equal to the ZooKeeper version, so SYSTEM SYNC REPLICA cannot detect or repair it.

#111029 reads the commit base with bypass=true (fresh lock-free load, no query cache) under the already-held alter lock at all three commit sites in StorageReplicatedMergeTree::alter and StorageMergeTree::alter, and adds a regression test. That fixes the source rather than repairing divergence after the fact, which is why the earlier attempts were superseded: #110030 (test-only) and #110145 (converge on recovery) both only repaired the already-diverged structure.

On #111029's own CI, test_replicated_table_structure_alter passes in the integration flaky variant. I do not have a separate fix in progress; #111029 is the one to track.

…ull-height

# Conflicts:
#	programs/server/play.html
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The two CI failures on the previous head 374029baaba are unrelated to this HTML-only change, and fixes are already in progress:

I merged master to resolve a conflict with the deferred-layout change in play.html (#110127 line of work): kept both new methods, ran expandSingleValueIfNeeded unconditionally in the deferred-transpose branch (it is content-only, no measurement), and verified the page script with the test_play_reconcile_startup harness locally (all scenarios pass).

Comment thread programs/server/play.html
else targetResultEl._pendingTranspose = true;
/// Content-only (toggles a class based on row/column counts, no measurement),
/// so it runs even for a hidden tab, like the totals/coloring passes above.
targetResultEl.expandSingleValueIfNeeded();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expandSingleValueIfNeeded is only wired through the successful table paths. A response like meta + one row + {"exception": ...} takes the stream_exception branch at lines 6039-6044, where we render totals/coloring/transpose/layout but never set the single-value class; reopening the same failed snapshot misses it too via the restoreErrorSnapshot callers at lines 6590-6592 and 6887-6893. So a failed one-row/one-column result still falls back to the old 3-line clamp after this PR, even though restoreErrorSnapshot is supposed to mirror the live partial-result UI.

Please thread the new helper through those partial-result error paths as well. The smallest fix is usually to call expandSingleValueIfNeeded from restoreErrorSnapshot after applyColumnColors, plus the live stream_exception branch before _changeTableLayout, and add a focused regression for a meta + one row + {"exception": ...} response.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 21, 2026
Merged via the queue into master with commit 2b6bcc2 Jul 21, 2026
180 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants