Skip to content

fix(app): tighten the search results row - #3855

Open
elizabetdev wants to merge 1 commit into
mainfrom
elizabet/search-results-row-copy
Open

elizabetdev wants to merge 1 commit into
mainfrom
elizabet/search-results-row-copy

Conversation

@elizabetdev

@elizabetdev elizabetdev commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

The row above the search histogram spreads a lot of text over both sides:
553 Results, Group by, then Scanned Rows: 2,895 | Elapsed Time: 216ms next to
the actions. This tightens it.

  • Group by comes first, since it is the control. The count and query stats follow it as read-only context.
  • Count and stats sit together. 553 results · 2,895 rows scanned · 216ms all describe the same query, so they no longer sit on opposite sides.
  • Only actions are on the right: Resume live tail and the generated SQL button.
  • Shorter, sentence-case copy. Scanned Rows: … / Elapsed Time: … become … rows scanned · …ms. Results, Resume Live Tail, Show Generated SQL and Generated SQL (Timeline) are now sentence case.
  • SearchNumRows now renders only the stats. The SQL button and modal moved to a new GeneratedSqlButton so they can sit on the other side.
  • The pattern view gets the same layout.

Screenshots or video

I couldn't capture these (no browser available in the session that opened this PR). Left for the author to fill in.

Before

Screenshot 2026-11-28 at 12 15 00

After

Screenshot 2026-11-28 at 12 08 06

How to reproduce

Starting point: yarn app:dev:local connected to the demo server (onboarding → "Connect to Demo Server"), or the Vercel preview.

On main:

  1. Open Search and pick a log source.
  2. Look at the row above the histogram: 553 Results, Group by, then Scanned Rows: … | Elapsed Time: … on the right.

On this branch:

  1. Open Search and pick a log source.
  2. The row reads Group by · N results · N rows scanned · Nms on the left, with Resume live tail (when scrolled back from live) and the </> button on the right.
  3. Switch to the Event patterns tab. The same layout applies.

How to test on Vercel preview

Preview routes: /search

Steps:

  1. Open /search and select a log source.
  2. Verify the first item in the row above the histogram is the Group by button.
  3. Verify the text after it reads like N results · N rows scanned · Nms.
  4. Click the </> icon on the right and verify the Generated SQL modal opens.

References

  • Linear Issue:
  • Related PRs:

Note

Low Risk
UI layout and copy changes on the search page with no auth, API, or data-path changes; behavior is covered by updated unit and e2e tests.

Overview
Tightens the search histogram stats row so Group by leads on the left, then result count and query stats together (N results · N rows scanned · Nms), while Resume live tail, trace chart toggle, and generated SQL stay on the right.

SearchResultsCountGroup now takes explicit groupBy and stats slots instead of children, matching that left-side order (expand filters → group by → total count → stats).

SearchNumRows is stats-only: shorter dimmed copy joined with ·, no SQL modal. GeneratedSqlButton is a new sibling component for the SQL preview action.

Copy is sentence case across the row (results, Resume live tail, Show generated SQL, etc.). Unit and e2e tests follow the new strings and component split.

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

@elizabetdev
elizabetdev requested a review from a team as a code owner November 27, 2026 20:14
@changeset-bot

changeset-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8ab7bc2

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

@vercel

vercel Bot commented Nov 27, 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 8:18pm UTC
hyperdx-storybook Ready Ready Preview Nov 27, 2026 8:18pm UTC

Request Review

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

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: 2
  • Production lines changed: 214 (+ 107 in test files, excluded from tier calculation)
  • Branch: elizabet/search-results-row-copy
  • Author: elizabetdev

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

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.

parts.push(`${Number(numRows).toLocaleString()} rows scanned`);
}
if (showElapsed) {
parts.push(showElapsedLoading ? '…ms' : formatDurationMs(searchElapsedMs!));

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 — Elapsed placeholder …ms hardcodes a unit the real value may not use

Use a unit-free placeholder such as …. formatDurationMs (packages/app/src/utils.ts:1079) returns seconds or minutes for longer searches, so a 2.3s search shows …ms while loading and then jumps to 2.3s.

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

@github-actions

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__/useSearchTelemetry.test.tsx:343 — Tests never check the combined N rows scanned · Nms string or the empty-parts early return → Add a test that renders both mockExplainData and searchElapsedMs and asserts the exact text 100 rows scanned · 342ms. Also assert that the error/no-elapsed case renders nothing at all (e.g. container is empty or queryByText('·') is null). Today a broken parts.join or a dangling leading · still passes, because every assertion uses a partial regex like /…ms/ or only checks that rows scanned is absent.

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.

@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 8ab7bc2. Configure here.

{parts.join(' · ')}
</Text>
</>
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Middot gets extra flex gap

Low Severity

SearchNumRows emits the leading middot as its own Text node, and SearchResultsCountGroup places that fragment in a Group with gap="sm". Flex gap then lands on both sides of the first separator, so N results and the scanned/elapsed text do not read as one phrase the way the inner · does.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8ab7bc2. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a presentational refactor of the search results row: SearchNumRows is split into a stats-only component plus a new GeneratedSqlButton, SearchResultsCountGroup moves from a children API to named groupBy/stats slots, and copy is relabeled to sentence case. Correctness and project-standards reviewers came back clean; both production call sites pass all props correctly, imports resolve, the changeset is valid, and the sentence-case changes align with the repo's code_style.md. The component split also removes a prior live-tail flicker vector by decoupling the SQL button from the explain query rather than introducing one.

🔵 P3 nitpicks (4)
  • packages/app/src/DBSearchPage.tsx:437 — the searchElapsedMs! non-null assertion is sound only via cross-variable reasoning (showElapsedLoading/showElapsed) the type checker cannot connect, so a future edit to either predicate silently makes it unsafe.
    • Fix: replace the showElapsed gate plus assertion with a direct else if (searchElapsedMs != null) branch so narrowing removes the !.
    • kieran-typescript
  • packages/app/src/DBSearchPage.tsx:471 — the comment in GeneratedSqlButton explains gating relative to the explain query, but useExplainQuery no longer lives in this component after the split.
    • Fix: trim the comment to state only that the preview renders purely from config.
    • maintainability
  • packages/app/src/__tests__/useSearchTelemetry.test.tsx:317 — the new GeneratedSqlButton describe block seeds mockExplainData and lacks the beforeEach reset the SearchNumRows block has, though the extracted button reads neither.
    • Fix: drop the unused explain-mock setup from the GeneratedSqlButton tests to prevent order-dependent flakiness if the button is ever re-coupled.
    • maintainability, testing
  • packages/app/src/DBSearchPage.tsx:433 — on a failed EXPLAIN poll the !error && numRows != null gate drops the keepPreviousData row count, briefly blanking "N rows scanned"; this guard is pre-existing (the prior render used error || numRows == null ? '') and is not a regression from this diff.
    • Fix: optionally render the retained numRows even when error is set so a single transient poll failure does not blink the count.
    • julik-frontend-races

Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, agent-native, learnings.

Testing gaps:

  • The decorative leading · separator in SearchNumRows is rendered but never asserted (present when parts exist, absent when the component returns null).
  • No test explicitly asserts the combined N rows scanned · Yms join; the completed-search test renders both parts but only matches /342ms/.
  • No render test covers the two call-site layouts (count → separator → stats on the left; GeneratedSqlButton/ResumeLiveTailButton on the right).

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

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 478 passed • 1 skipped • 1073s

Status Count
✅ Passed 478
❌ Failed 0
⚠️ Flaky 13
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 8ab7bc20 Deployed Nov 27, 2026 by vercel[bot]
Preview – hyperdx-storybook — 8ab7bc20 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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant