Skip to content

chore(dev-portal): show ClickHouse version, add expand/collapse all, improve pill contrast - #3834

Merged
kodiakhq[bot] merged 5 commits into
mainfrom
dev-portal-header-polish
Nov 27, 2026
Merged

kodiakhq[bot] merged 5 commits into
mainfrom
dev-portal-header-polish

Conversation

@karl-power

@karl-power karl-power commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #3827: show each stack's ClickHouse version, add an expand/collapse all button, and fix low-contrast pill text on the dev portal.

  • Each card header shows the ClickHouse version (ClickHouse 26.10.3.7) next to the slot badge, read from the container's image tag that docker ps already returns, so there are no extra queries. Distinct versions across a worktree's environments are listed together.
  • An "Expand all" / "Collapse all" button sits in the tab bar on the Live tab. It reads "Collapse all" only when every card is open; when some are collapsed it expands them all. The choice is saved like the per-card toggle.
  • Pill text (slot, ClickHouse version, LOCAL/DOCKER, DEV/E2E/INT) now meets 4.5:1 contrast in both themes. Light mode was at 2.0–3.0:1 and is now 5.3–7.4:1; the two weakest dark-mode pills go from 4.6–4.8:1 to 6.0–8.5:1.

Screenshots or video

To be added by author.


Note

Low Risk
Changes are limited to debug reporting, dev-tooling UI, and stylesheet tokens; no auth, billing, or query-path logic.

Overview
Copy debug info now adds one clickhouse: line per saved connection (name + server version), placed after the backend line. Versions are prefetched when the Help menu’s debug item is mounted (using cached getServerVersion per connection) so clipboard copy still works under Safari’s user-gesture rules. setHdxClickHouseVersions holds the data until versions are known; tests cover omission vs. listing.

Dev portal stacks API now attaches a parsed Docker image tag as each container’s version; Live cards show distinct ClickHouse versions in the header beside the slot badge. The Live tab gets Expand all / Collapse all, with state persisted like per-card toggles. Badge/pill colors use dedicated --pill-* tokens so slot, env, and type labels meet ~4.5:1 contrast in light and dark themes.

Reviewed by Cursor Bugbot for commit 2950c34. Bugbot is set up for automated code reviews on this repo. Configure here.

@karl-power
karl-power requested a review from a team as a code owner November 26, 2026 11:00
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 27, 2026 10:17am UTC
hyperdx-storybook Ready Ready Preview Nov 27, 2026 10:17am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2950c34

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 5
  • Production lines changed: 164 (+ 21 in test files, excluded from tier calculation)
  • Branch: dev-portal-header-polish
  • Author: karl-power

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 108 in total (1.10%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

2 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 1 P3

1 posted as inline comment(s) on the changed lines. 1 P3 folded at the bottom.

🔵 1 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/__tests__/hdxDebug.test.ts:20 — New tests only cover the setter-to-report formatting; the code that actually gets the versions has no test → Add an AppNav.components test that mocks useConnections and getMetadata().getServerVersion (one tuple, one undefined), opens the Help menu, and checks that window.hdx.report() shows clickhouse: <name> 26.10.3.7 and clickhouse: <name> unknown. That covers the tuple .join('.'), the name mapping and the effect wiring, none of which the current tests touch.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is low-risk local dev-portal tooling plus a debug-report addition. Reviewers verified the happy paths and the main adversarial inputs hold: imageVersion() guards null/empty and strips registry-port prefixes before tag parsing, getServerVersion swallows its own errors (so Promise.all cannot reject), the collapse/toggle refactor keeps aria-expanded, the .collapsed class, and services-table[hidden] in sync, and chVersion is HTML-escaped before rendering. The one human review request (add ClickHouse version to debug info) is fully implemented and tested.

🟡 P2 — recommended

  • scripts/dev-portal/server.js:93 — the new imageVersion() encodes five distinct behaviors (version tag, latest/head pass-through, sha256: image-ID → null, untagged → null, @digest stripping) but has zero tests and scripts/dev-portal has no test harness.
    • Fix: Extract imageVersion into an importable module and add cases covering each documented branch, including registry-with-port and digest-pinned image names.
    • testing, correctness, maintainability, adversarial
🔵 P3 nitpicks (3)
  • packages/app/src/components/AppNav/AppNav.components.tsx:208 — the version-fetch useEffect is fire-and-forget with no latest-wins guard, so on a rapid connections change a superseded in-flight batch can overwrite newer data read by window.hdx.report(); impact is low (debug surface, self-heals on next run) and the rejection path is unreachable.
    • Fix: Add a let stale = false flag with a cleanup return () => { stale = true } and skip setHdxClickHouseVersions when stale.
    • kieran-typescript, julik-frontend-races, testing
  • packages/app/src/hdxDebug.ts:189 — a connection name is an unconstrained string, so one containing \n injects fabricated lines into the newline-delimited copied debug report, making a shared report ambiguous or forgeable.
    • Fix: Strip control characters from c.name (e.g. c.name.replace(/[\r\n\t]+/g, ' ')) before interpolating it into the report line.
    • adversarial
  • scripts/dev-portal/index.html:531 — the new pure helpers (clickhouseVersionLabel dedup/null, toggleAllStacks/updateToggleAllButton state flips) live in an inline <script> and are unreachable by any automated test.
    • Fix: Extract the pure helpers into an importable module and cover the multi-version-join, no-clickhouse-service, and all-collapsed-vs-some-open transitions.

Reviewers (10): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, adversarial, previous-comments, agent-native, learnings-researcher.

Testing gaps:

  • The new AppNavVersionItem effect (connections → {name, version} mapping, undefined → 'unknown' fallback) has no test in packages/app.
  • PR CI reported 1 failed / 478 passed / 12 flaky E2E tests; the failing test's identity is not visible from PR metadata, so confirm it is unrelated/flaky before merge (cause not inferred).

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 479 passed • 1 skipped • 1243s

Status Count
✅ Passed 479
❌ Failed 0
⚠️ Flaky 12
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@jordan-simonovski

Copy link
Copy Markdown
Contributor

Looks good! Could we also add the CH version to the debug info?

under packages/app/src/hdxDebug.ts:

// with the other module state
let clickhouseVersions: { name: string; version?: string }[] = [];

export function setHdxClickHouseVersions(
  next: { name: string; version?: string }[],
): void {
  clickhouseVersions = next;
}

// in buildReport(), after the `backend:` line
...clickhouseVersions.map(
  c => `clickhouse: ${c.name} ${c.version ?? 'unknown'}`,
),

packages/app/src/components/AppNav/AppNav.components.tsx:

import { useConnections } from '@/connection';
import { setHdxClickHouseVersions } from '@/hdxDebug';
import { getMetadata } from '@/metadata';

const AppNavVersionItem = ({ version }: { version?: string }) => {
  const [copied, setCopied] = React.useState(false);
  const { data: connections } = useConnections();

  return (
    <Menu.Item
      // ...unchanged props
      onClick={async () => {
        // getServerVersion is cached per connection, so this is usually free
        setHdxClickHouseVersions(
          await Promise.all(
            (connections ?? []).map(async c => ({
              name: c.name,
              version: (
                await getMetadata().getServerVersion({ connectionId: c.id })
              )?.join('.'),
            })),
          ),
        );
        const text = window.hdx?.report() ?? `frontend: ${version ?? 'dev'}`;
        // ...rest unchanged
      }}
    >

@karl-power

Copy link
Copy Markdown
Contributor Author

Looks good! Could we also add the CH version to the debug info?

@jordan-simonovski pushed!

// Fetched when the Help menu opens rather than on click: awaiting before the
// clipboard write would drop the user gesture Safari requires for it.
// getServerVersion is cached per connection, so this is usually free.
React.useEffect(() => {

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.

🟡 P2 — ClickHouse versions only load once the Help menu has been opened, so window.hdx.report()/copy() leave them out, and a fast first click can too

Move this effect into AppNav.tsx, next to the setHdxIdentity effect (~line 224), which is always mounted. Right now it sits in AppNavVersionItem, which only mounts while Menu.Dropdown is open. So the console API from installHdxDebug (packages/app/src/hdxDebug.ts) has no clickhouse: lines until the menu has been opened at least once. Also, Promise.all only writes once the slowest connection answers, so clicking Copy right after opening the menu (cache still cold) gives a report with no ClickHouse lines at all. Write each connection's result as it arrives, or fetch on nav mount, so one slow connection doesn't hold back the others.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2950c34. Configure here.

)?.join('.'),
})),
).then(setHdxClickHouseVersions);
}, [connections]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Debug copy can miss versions

Low Severity

Copy debug info reads clickhouseVersions immediately, while the Help-menu effect still fetches them. The first copy can omit the clickhouse: lines when getServerVersion is not already cached. In-flight results also write module state with no cancellation, so an older request can replace newer connection data.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2950c34. Configure here.

@kodiakhq
kodiakhq Bot merged commit dd3e6de into main Nov 27, 2026
33 of 56 checks passed
@kodiakhq
kodiakhq Bot deleted the dev-portal-header-polish branch November 27, 2026 10:24

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 2950c347 Deployed Nov 27, 2026 by vercel[bot]
Preview – hyperdx-storybook — 2950c347 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants