Skip to content

Add query syntax reference to search input - #2381

Merged
kodiakhq[bot] merged 4 commits into
hyperdxio:mainfrom
vinzee:va/syntax_guide
Jul 7, 2026
Merged

Add query syntax reference to search input#2381
kodiakhq[bot] merged 4 commits into
hyperdxio:mainfrom
vinzee:va/syntax_guide

Conversation

@vinzee

@vinzee vinzee commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduce a quick-reference guide for SQL and Lucene query syntax directly within the search interface. Users can now click a help icon next to the language selector to view common query examples, operators, and formatting rules tailored to the active query language. This improves usability and helps users construct valid search queries more easily.

Screenshots or video

Lucene

image

SQL

image

How to test on Vercel preview

References

  • Linear Issue: n/a
  • Related PRs: n/a

Introduce a quick-reference guide for SQL and Lucene query syntax
directly within the search interface. Users can now click a help icon
next to the language selector to view common query examples, operators,
and formatting rules tailored to the active query language. This
improves usability and helps users construct valid search queries more
easily.
@changeset-bot

changeset-bot Bot commented May 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f0ef250

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

@vinzee is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. This is a self-contained, read-only display feature (a syntax reference modal) with no backend, auth, data-mutation, or network-write surface. No P0/P1 issues. The items below are recommendations and nits.

🟡 P2 -- recommended

  • packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx:180 -- New 350-line component ships with zero tests; the pure helpers filterSections and Highlight and the modal open/close, language-toggle, and filter-reset behavior are entirely unverified despite the repo's strong colocated-test convention.
    • Fix: Add SearchInput/__tests__/SyntaxReferenceModal.test.tsx covering filterSections (empty/whitespace query, expr-only match, desc-only match, no-match empty state, case-insensitivity), Highlight mark rendering, and the ActionIcon-opens-modal wiring in SearchWhereInput.
    • testing, maintainability, kieran-typescript, project-standards
  • packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx:1 -- User-facing change to the published @hyperdx/app package has no changeset, which AGENTS.md PR Hygiene requires before merge.
    • Fix: Run yarn changeset and add an entry describing the new search syntax reference modal.
  • packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx:350 -- File is 350 lines, exceeding the documented 300-line max in agent_docs/code_style.md.
    • Fix: Extract SQL_SECTIONS/LUCENE_SECTIONS into a sibling constants module and/or move SyntaxTable/Highlight into their own file.
🔵 P3 nitpicks (4)
  • packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx:180 -- filterSections guards on query.trim() but then matches with the untrimmed query.toLowerCase(), so a trailing space (e.g. "timeout " while typing) passes the guard yet matches nothing and shows a false "No results" state.
    • Fix: Compute the needle once as query.trim().toLowerCase() and reuse it in both filterSections and Highlight so filtering and highlighting stay consistent.
  • packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx:292 -- The language-sync effect depends on [opened, initialLanguage], so it re-fires on any initialLanguage change (not just the open transition) and would reset a user's in-modal tab choice; not reachable via current UI since the overlay blocks the background language switch, but the effect contradicts its stated "sync on open" intent.
    • Fix: Track the previous opened value in a ref and call setLanguage only on the falsetrue transition.
  • packages/app/src/components/SearchInput/SearchWhereInput.tsx:221 -- style={{ marginRight: 4 }} on the ActionIcon uses a raw inline style where agent_docs/code_style.md requires individual Mantine style props.
    • Fix: Replace with mr={4}.
  • packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx:335 -- The external-link Text uses c="dimmed" while the rest of the file uses the semantic token var(--color-text-muted) for the same intent, an inconsistency code_style.md discourages.
    • Fix: Use style={{ color: 'var(--color-text-muted)' }} for consistency.

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

Testing gaps:

  • No tests added for the new SyntaxReferenceModal (helpers filterSections/Highlight, language-tab reset on reopen, query reset on close/toggle, empty-filter state).
  • No test extends the existing SearchWhereInput.test.tsx to cover the new help-icon-opens-modal interaction.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a query syntax reference modal accessible via a help icon next to the language selector in SearchWhereInput. Users can browse SQL and Lucene example queries, filter them with a text input, and follow an external link to the full ClickStack documentation.

  • SyntaxReferenceModal.tsx is a new self-contained component with static SQL_SECTIONS / LUCENE_SECTIONS data, a filterSections helper, and a Highlight sub-component for match display.
  • SearchWhereInput.tsx gains a useDisclosure hook, an ActionIcon help button in the language-switch row, and renders the modal as a Fragment sibling to the existing Box.

Confidence Score: 5/5

Safe to merge — the change is purely additive UI with no mutations to existing query or data-fetching logic.

Both files are self-contained UI additions. The modal manages its own local state cleanly, the static reference data is read-only, and the integration in SearchWhereInput is a minimal wrapper change that does not alter any existing behaviour.

No files require special attention.

Important Files Changed

Filename Overview
packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx New modal component with SQL/Lucene syntax reference tables, filter input, and highlight support — well-structured, no logic errors found.
packages/app/src/components/SearchInput/SearchWhereInput.tsx Adds help icon button and modal trigger via useDisclosure; refactored JSX wraps existing content in a Fragment alongside the new SyntaxReferenceModal — change is minimal and correct.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant U as User
    participant SWI as SearchWhereInput
    participant SRM as SyntaxReferenceModal

    U->>SWI: Click help icon (IconHelp)
    SWI->>SWI: "openSyntaxRef() → syntaxRefOpened = true"
    SWI->>SRM: "opened=true, language, onClose=closeSyntaxRef"
    SRM->>SRM: useEffect: setLanguage(initialLanguage)
    SRM->>U: Render modal with SegmentedControl + filter input (autoFocus)

    U->>SRM: Type in filter input
    SRM->>SRM: setQuery(value) → filterSections() → Highlight matches

    U->>SRM: Switch language tab (SegmentedControl)
    SRM->>SRM: setLanguage(newLang) + setQuery('')

    U->>SRM: Close modal (Escape / backdrop / X)
    SRM->>SRM: setQuery('') then onClose()
    SRM->>SWI: "closeSyntaxRef() → syntaxRefOpened = false"
    SWI->>U: Modal unmounted
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant U as User
    participant SWI as SearchWhereInput
    participant SRM as SyntaxReferenceModal

    U->>SWI: Click help icon (IconHelp)
    SWI->>SWI: "openSyntaxRef() → syntaxRefOpened = true"
    SWI->>SRM: "opened=true, language, onClose=closeSyntaxRef"
    SRM->>SRM: useEffect: setLanguage(initialLanguage)
    SRM->>U: Render modal with SegmentedControl + filter input (autoFocus)

    U->>SRM: Type in filter input
    SRM->>SRM: setQuery(value) → filterSections() → Highlight matches

    U->>SRM: Switch language tab (SegmentedControl)
    SRM->>SRM: setLanguage(newLang) + setQuery('')

    U->>SRM: Close modal (Escape / backdrop / X)
    SRM->>SRM: setQuery('') then onClose()
    SRM->>SWI: "closeSyntaxRef() → syntaxRefOpened = false"
    SWI->>U: Modal unmounted
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into va/syntax_guide" | Re-trigger Greptile

Comment thread packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx Outdated
Comment thread packages/app/src/components/SearchInput/SyntaxReferenceModal.tsx

@pulpdrew pulpdrew left a comment

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.

LGTM after a few tweaks to a couple of the examples. Thanks for the contribution!

@kodiakhq
kodiakhq Bot merged commit 803f824 into hyperdxio:main Jul 7, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants