Skip to content

feat(app): add InlineNameInput as the one way to name objects - #3278

Merged
kodiakhq[bot] merged 9 commits into
mainfrom
elizabet/inline-name-field
Oct 5, 2026
Merged

kodiakhq[bot] merged 9 commits into
mainfrom
elizabet/inline-name-field

Conversation

@elizabetdev

@elizabetdev elizabetdev commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Users name things in several different ways today: dashboards and saved searches use a click-to-edit title (hover for a pencil or double-click, then a "Save Name" button), and other places use a bordered text field. This PR adds one shared component, InlineNameInput, and documents it as the single pattern for naming objects.

How it behaves

  • At rest it looks like the title. Hovering shows a light border; clicking edits in place. No pencil, no double-click, no "Save Name" button.
  • Saved objects (InlineNameInput): Enter or clicking away saves, Escape or an empty name reverts. After a commit it shows the saved value, so a rename that fails or gets overwritten by a concurrent dashboard save visibly reverts instead of leaving a name that was never saved.
  • Drafts (InlineNameInputControlled): a react-hook-form field that saves with the surrounding form. Not used in the app yet; it's meant for the full-page tile editor.
  • Sizes: xs, sm (default), md. Page titles use md (18px, down from the previous ~22px heading).
  • When it is the page title, it renders inside a heading (headingLevel={3}) so screen readers and getByRole('heading') still find it.

Changes

  • Dashboard and saved search pages use InlineNameInput; EditablePageName is deleted.
  • Pattern docs: agent_docs/naming_objects.md, a naming-objects agent skill, and Storybook pages (Guidelines/Naming objects, Components/InlineNameInput). Linked from AGENTS.md, the agent_docs README, and code_style.md.
  • E2E helpers type into the field instead of double-clicking the heading, and wait for the document title to confirm the rename persisted.

The chart editor keeps its existing "Chart Name" field for now; it needs a layout change before the inline field fits.

Screenshots or video

See Storybook → Components/InlineNameInput (saved object, long name, draft in an editor header, and all sizes).

Screenshot 2026-10-02 at 18 50 03

How to test on Vercel preview

Preview routes: /dashboards/list

Steps:

  1. Create a new dashboard from the dashboards list.
  2. Hover the dashboard title and confirm a light border appears, with no pencil button.
  3. Click the title, replace the text with "Renamed dashboard", and press Enter.
  4. Verify the breadcrumb shows "Renamed dashboard".
  5. Click the title, type extra text, and press Escape.
  6. Verify the title still reads "Renamed dashboard".

References

  • Linear Issue: HDX-5592 (follow-up)
  • Related PRs: dashboard tile editor page (elizabet/dashboard-tile-editor-page), which will adopt InlineNameInputControlled in its header

elizabetdev and others added 3 commits October 2, 2026 11:50
Replace EditablePageName (pencil button, double-click, "Save Name") with a
field that looks like the title and edits in place. Saved objects commit on
Enter or blur; drafts use the controlled variant and save with their form.

Document the pattern in agent_docs/naming_objects.md, a naming-objects skill,
and Storybook (Guidelines/Naming objects, Components/InlineNameInput).

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the "Chart Name" label and input with the inline name field. Swap
the lg/sm sizes for xs, sm (default), and md, and use md for page titles so
dashboard and saved search names are smaller.

Co-authored-by: Cursor <cursoragent@cursor.com>
The chart editor layout needs rework before the inline name field fits.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6a57642

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 2, 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 5, 2026 6:21pm UTC
hyperdx-storybook Ready Ready Preview Oct 5, 2026 6:21pm UTC

Request Review

@github-actions github-actions Bot added the review/tier-3 Standard — full human review required label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Tier 3 — Standard

Introduces new logic, modifies core functionality, or touches areas with non-trivial risk.

Why this tier:

  • Diff size: 427 production lines changed (Tier 2 max: < 250)

Review process: Full human review — logic, architecture, edge cases.
SLA: First-pass feedback within 1 business day.

Stats
  • Production files changed: 6
  • Production lines changed: 427 (+ 484 in test files, excluded from tier calculation)
  • Branch: elizabet/inline-name-field
  • Author: elizabetdev

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

@github-actions

github-actions Bot commented Oct 2, 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 128 in total (1.80%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

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

2 posted as inline comment(s) on the changed lines. 2 listed below.

Findings outside the changed lines

2 minor
  • 🔵 packages/app/src/components/InlineNameInput/InlineNameInput.tsx:745 — NameRoot hand-rolls an h1–h6/span switch that Mantine already provides → Delete NameRoot and render <Box component={headingLevel ? h${headingLevel} : 'span'} ...> (or Mantine Title order={headingLevel}). code_style.md says to prefer Mantine components over custom elements, and the seven-branch switch adds nothing.
  • 🔵 packages/app/src/components/InlineNameInput/InlineNameInput.tsx:871 — InlineNameInputControlled and its rules prop have no caller in the app → Nothing outside the story and the unit test uses InlineNameInputControlled, and nothing at all passes rules. Yet code_style.md now makes it a REQUIRED pattern. Either ship it with the tile-editor PR that uses it, or at least drop the unused rules prop (and its register param typing, which is not the type Controller expects) until a caller needs it.

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

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Replaces the dashboard and search name editor with a new component.

The PR appears safe to merge; no outstanding review finding or new issue in the PR changes was identified.

Summary

This PR replaces the dashboard and saved-search click-to-edit titles with a shared inline name input, adds guidance and Storybook examples, and updates name-related E2E helpers. The three previous Greptile threads are resolved; the current code retains accessible heading names and removes the cited type assertions.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Dashboard or saved-search name] --> B[InlineNameInput]
  B -->|Enter or blur| C[Save rename]
  B -->|Escape or empty name| D[Restore saved name]
  C -->|Save succeeds| E[Display saved value]
  C -->|Save fails| D
Loading

Reviews (7) · Last reviewed commit: "Merge branch 'main' into elizabet/inline..."

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. This is a focused, well-tested refactor: a new InlineNameInput component replaces EditablePageName, the dashboard and saved-search pages adopt it, and the commit/revert/pending state machine is covered by unit tests. The three prior review comments (heading accessibility regression, as const casts in the component and stories) are genuinely resolved — real h1–h6 elements via NameRoot, aria-label={value || placeholder} on the heading, and casts replaced with a typed Record/array. A grep confirms no as/as const remain in the component or stories. The two page integrations wire error handling correctly: DBSearchPage surfaces a notification and rethrows so the field reverts, and useUpdateSavedSearch has no competing onError, so there is no double-notification; DBDashboardPage relies on setDashboard's existing error notification and rejects only to revert.

No P2 issues rise above a transient/edge-case bar once re-graded against concrete failure modes in this diff.

🔵 P3 nitpicks (3)
  • packages/app/src/components/InlineNameInput/InlineNameInput.tsx:60 — When headingLevel is set but both value and placeholder are empty, headingName is undefined, so the heading renders with no accessible name wrapping only an input; both current call sites pass a placeholder, so this is a latent contract gap rather than a live defect.
    • Fix: Fall back to a stable non-empty accessible name (or require a placeholder) whenever headingLevel is provided.
  • packages/app/src/components/InlineNameInput/InlineNameInput.tsx:100 — During a rapid concurrent double-rename, the derived-state setPending(undefined) fires on any value change and can momentarily clear a newer in-flight pending name, briefly flashing an intermediate saved value; the final state is still correct.
    • Fix: Reconcile pending against the latest committed draft instead of clearing it unconditionally when value changes.
  • packages/app/src/components/InlineNameInput/__tests__/InlineNameInput.test.tsx:31 — The Enter-commit test asserts toHaveBeenCalledWith but not call count, so an accidental double-commit on the Enter→blur path would not be caught.
    • Fix: Add expect(onCommit).toHaveBeenCalledTimes(1) to the Enter and blur commit tests.

Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, adversarial, previous-comments.

Testing gaps:

  • The page-level onCommit wiring (the DBDashboardPage promise wrapper around setDashboard, and the DBSearchPage mutateAsync + notification revert path) is only exercised indirectly by e2e persistence checks; the error/revert path for the real pages has no unit coverage.
  • No explicit test for the remount-on-commit behavior of local (temporary) dashboards, where dashboardHash changes the component key after a rename.

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 Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 394 passed • 1 skipped • 1296s

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

Tests ran across 4 shards in parallel.

View full report →

Co-authored-by: Cursor <cursoragent@cursor.com>
The field dropped the draft as soon as it committed, so the old name
flashed for the whole request. It now holds the typed name until the
saved value arrives, and reverts when the save fails.

Co-authored-by: Cursor <cursoragent@cursor.com>
The heading wrapped only an input, so its accessible name was the
input's label. It now carries the current name, and the heading tag
is chosen without a cast.

Co-authored-by: Cursor <cursoragent@cursor.com>
The heading wraps an input, so toHaveText never sees the name. The two
Terraform-gate tests now check the field value. Enter during IME
composition no longer commits.

Co-authored-by: Cursor <cursoragent@cursor.com>
@elizabetdev

Copy link
Copy Markdown
Member Author

Addressed the latest review on d6512faee.

  • The two failing Terraform-gate tests called toHaveText on the level-3 heading. That heading only wraps the name input, so its text is empty. dashboardName now points at dashboard-name-input, and both checks use toHaveValue.
  • The pending-name unit test now flushes the resolved save before asserting, so a flash back to the old name would fail.
  • Enter during IME composition no longer blurs and commits.

Left as they are:

  • The six heading branches stay. The suggested `h${level}` as const is the cast the earlier review asked to remove.
  • InlineNameInputControlled stays in this PR. The tile editor page (elizabet/dashboard-tile-editor-page) is its first caller, and the naming guideline documents both variants together.
  • Escape still resets the input before blur, because blur reads the DOM value. A skip flag would be a second path through the same handler.

size="md"
headingLevel={3}
data-testid="dashboard-name-input"
onCommit={editedName => {

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.

🔵 minor — Renaming before the dashboard loads leaves a name on screen that was never saved

When dashboard is still undefined (loading, or the id is not found), onCommit returns undefined. InlineNameInput then keeps pending set to the typed name until value changes, so the title shows a name that was never saved. This is the opposite of the 'visibly reverts' behaviour the component promises. Return Promise.reject(new Error('Dashboard not loaded')) here, or make the input readOnly until dashboard exists.

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

level: 3,
// The document title comes from the saved dashboard, so it only changes
// once the rename has persisted.
const escaped = newName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

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.

🔵 minor — Inline regex-escape duplicates lodash escapeRegExp, which is already used in the app

Replace the inline .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') with import { escapeRegExp } from 'lodash', as packages/app/src/components/KubernetesFilters.tsx does. This copy is now the third: utils/materializedViews.ts and components/deltaChartUtils.ts each have their own private escapeRegExp.

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

@kodiakhq
kodiakhq Bot merged commit 51e47b1 into main Oct 5, 2026
29 checks passed
@kodiakhq
kodiakhq Bot deleted the elizabet/inline-name-field branch October 5, 2026 18:28

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 6a57642e Deployed Oct 5, 2026 by vercel[bot]
Preview – hyperdx-storybook — 6a57642e Deployed Oct 5, 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-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants