Skip to content

Share the Group by split button - #3430

Merged
kodiakhq[bot] merged 3 commits into
mainfrom
elizabet/split-value-button
Oct 21, 2026
Merged

kodiakhq[bot] merged 3 commits into
mainfrom
elizabet/split-value-button

Conversation

@elizabetdev

Copy link
Copy Markdown
Member

Summary

Group by uses a new shared split button: a fixed name, then the current value. On a narrow screen a count such as 3 fields shows as 3. A single field still shows its name.

Columns and Sort will use the same button in a follow-up. This PR only switches Group by, so that button can be reviewed on its own. Storybook (Components/SplitValueButton) says when to use it.

Related: #3387. Replaces #3429, which closed when the branch moved off the agent/ prefix.

Screenshots or video

Screenshot 2026-10-21 at 15 10 27

On the search page:
Screenshot 2026-10-21 at 15 14 15

How to reproduce

Starting point: Vercel preview, or yarn app:dev:local connected to the demo server.

On main:

  1. Open Search.
  2. Open Group by and select two fields, then Apply.
  3. Narrow the window below 900px. The button still reads 2 fields.

On this branch:

  1. Open Search.
  2. Open Group by and select two fields, then Apply.
  3. Narrow the window below 900px. The value shows 2. One field still shows its name, and an empty selection still shows none.

How to test on Vercel preview

Preview routes: /search

Steps:

  1. Open Group by.
  2. Select two fields and click Apply.
  3. Verify the button reads Group by and 2 fields at a desktop width.
  4. Narrow the viewport below 900px.
  5. Verify the value shows 2.

References

Made with Cursor

elizabetdev and others added 2 commits October 21, 2026 14:48
Group by needs the same name-and-value button Columns and Sort will use. On a narrow screen a field count is only the number.

Co-authored-by: Cursor <cursoragent@cursor.com>
The frame was stretching in a column layout, so the chevron sat away from the end of the value.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Oct 21, 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: 3
  • Production lines changed: 148 (+ 161 in test files, excluded from tier calculation)
  • Branch: elizabet/split-value-button
  • 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 123 in total (1.62%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

github-actions Bot commented Oct 21, 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:

  • 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
  • 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
  • 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
    severity. Reply with one sentence; if it is critical, 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.

4 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 4 minor

None could be anchored to changed lines; they are listed below.

Findings outside the changed lines

4 minor
  • 🔵 packages/app/src/components/SplitValueButton/SplitValueButton.module.scss:157 — align-self: flex-start overrides the parent row's vertical centering → Remove align-self: flex-start. The only caller renders the control inside SearchResultsCountGroup (packages/app/src/DBSearchPage.tsx:357), which is a <Group align="center">, and this line now pins the button to the top of that row instead of centring it next to the count chart and expand-filters button. If the Storybook Stack layout needs the fit-content width, set alignment in the story or in a parent-specific rule, not in the shared control.
  • 🔵 packages/app/src/components/SplitValueButton/SplitValueButton.tsx:380 — summary and count are two separate sources of truth that callers must keep in sync → The narrow-screen text depends on count > 1, while the wide-screen text and the aria-label come from summary. A caller that passes count={1} with summary="3 fields", or forgets to update count, shows a different value at each width. Have the component take fields: string[] (plus an optional formatter for Sort's direction) and work out both the summary and the count internally with fieldListSummary, so callers can't pass values that disagree.
  • 🔵 packages/app/src/components/SearchGroupBy/SearchGroupBySelect.tsx:134 — Compact view shows a bare number with no way to see which fields, and the title prop meant for this has no callers → Below 900px the trigger now reads just 2, and the only way to see which fields are grouped is to open the popover. SplitValueButton declares title ("Full clause, shown on hover when the value is only a summary"), but nothing passes it. Pass title={appliedFields.length > 1 ? appliedFields.join(', ') : undefined} here, or remove the unused prop.
  • 🔵 packages/app/src/components/SplitValueButton/__tests__/SplitValueButton.test.tsx:437 — Tests always force compact, so the viewport-driven path is never tested → Every test passes compact explicitly, so the compact ?? useCompactViewport() fallback (the behaviour this PR ships) is never exercised, and the SearchGroupBySelect tests don't cover the narrow case either. Add a test that leaves compact unset, mocks useCompactViewport (or the window width) to return true, and asserts search-group-by-button reads 2 for two applied fields.

Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a low-risk presentational refactor: it extracts a shared SplitValueButton from the Group by control and collapses a multi-field count to a bare number below 900px. The correctness and maintainability passes found nothing at reporting confidence — summary and count are both derived from the same appliedFields in the same render, so the compact collapse and aria-label stay consistent, and the useCompactViewport SSR-safe default means the first client render matches the server markup (no hydration mismatch). The prior Greptile test comment is confirmed resolved (/^3$/). The remaining signal is a test-coverage gap.

🟡 P2 -- recommended

  • packages/app/src/components/SplitValueButton/SplitValueButton.tsx:62 -- Every test injects compact explicitly, so the real useCompactViewport() branch (isCompact = compact ?? viewportCompact) that drives production behavior is never exercised, and a regression in the hook wiring would stay green.
    • Fix: Add a test that omits compact and mocks useWindowSize to report a width below and above COMPACT_MAX_WIDTH, asserting the count collapses to the number only on the narrow viewport.
    • testing, correctness
🔵 P3 nitpicks (3)
  • packages/app/src/components/SplitValueButton/SplitValueButton.tsx:63 -- The compact count === 0 ("none") case is unasserted; tests cover count > 1 and count === 1 but not the count > 1 guard boundary at zero.
    • Fix: Add a compact test with count={0} and summary="none" asserting the rendered text stays none.
    • testing, correctness
  • packages/app/src/components/SplitValueButton/SplitValueButton.tsx:83 -- The dimmed prop (c={dimmed ? 'dimmed' : undefined}), used by the consumer when value == null, has no test coverage.
    • Fix: Render with dimmed and assert the value Text carries the dimmed color, plus the non-dimmed default.
    • testing, correctness
  • packages/app/src/components/SplitValueButton/SplitValueButton.tsx:75 -- The title/hover prop is forwarded to the button but never asserted, and the sole consumer never passes it, so on a narrow screen a collapsed count (e.g. 3) exposes the full value only via aria-label, not a tooltip.
    • Fix: Add an assertion that a provided title reaches the button, and consider wiring title from the consumer so sighted users can recover the full field list in compact mode.
    • testing, correctness

Reviewers (6 returned of 9 dispatched): correctness, testing, maintainability, previous-comments, kieran-typescript, agent-native. The frontend-races, project-standards, and learnings reviewers did not return before output was finalized; independent analysis of the hydration/layout path (benign client-only collapse after mount) and the changeset (@hyperdx/app patch, correct for an app-only change) surfaced no additional issues.

Testing gaps: The production useCompactViewport path, and the dimmed, title, and compact count === 0 behaviors, are present in the component but have no assertions. As Columns and Sort adopt the button, note that summary and count are independent props the caller must keep aligned — a future adopter passing a non-count summary with count > 1 would drop information in compact mode.

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

@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ab2df8b

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 Oct 21, 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 Oct 21, 2026 3:04pm UTC
hyperdx-storybook Ready Ready Preview Oct 21, 2026 3:04pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 456 passed • 1 skipped • 1397s

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

Tests ran across 4 shards in parallel.

View full report →

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Extracts SplitValueButton and uses it for Group by.

  • Group by field counts shrink to numbers on narrow screens.

Reviews (2) · Last reviewed commit: "test(app): require the narrow split butt..." · Reviewed by Greptile

A substring check for 3 also passed when the label was still 3 fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kodiakhq
kodiakhq Bot merged commit 96a0861 into main Oct 21, 2026
46 of 48 checks passed
@kodiakhq
kodiakhq Bot deleted the elizabet/split-value-button branch October 21, 2026 15:40

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — ab2df8b9 Deployed Oct 21, 2026 by vercel[bot]
Preview – hyperdx-storybook — ab2df8b9 Deployed Oct 21, 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.

2 participants