Skip to content

fix(app): open the discard confirm above the edit alert modal - #3870

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
jordansimonovski/hdx-6235-confirm-above-modals
Dec 1, 2026
Merged

kodiakhq[bot] merged 2 commits into
mainfrom
jordansimonovski/hdx-6235-confirm-above-modals

Conversation

@jordan-simonovski

@jordan-simonovski jordan-simonovski commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closing the edit alert modal with unsaved changes opened the "discard changes?" confirm behind the editor. You couldn't see it or click it, the backdrop just went darker, and the modal couldn't be closed. The shared confirm dialog now stacks above every app modal, so it shows on top of whichever modal asked for it.

  • The edit alert modal and the confirm both used Mantine's default modal z-index (200). The confirm is mounted earlier in the page, so it lost the tie. The dashboard tile editor sets a lower z-index, which is why it never hit this.
  • The confirm now sits at 100000: above the highest app modal (9999), below notifications and spotlight.
  • Breaking changes: none.

Screenshots or video

Same screen and data: Alerts page, Edit alert, Slack/webhook channel changed, outer X clicked.

Before After
before after

How to reproduce

Starting point: yarn dev (alerts need the API), with one webhook created in Team settings.

On main:

  1. In Chart explorer, pick the Logs source, click Add alert, choose a webhook and click Create alert.
  2. On Alerts, open the alert's ... menu and click Edit alert.
  3. Change the webhook in Send to, then click the modal's top-right X.
  4. The modal stays open with a darker backdrop and no confirm visible. Clicking X or Cancel again does nothing.

On this branch:

  1. Repeat steps 1 to 3.
  2. "You have unsaved changes. Discard them and close the editor?" shows above the editor. Discard closes the modal.

How to test on Vercel preview

N/A: the alerts page needs the API, which the preview's local mode doesn't run.

References

  • Linear Issue: HDX-6235
  • Related PRs:

Note

Low Risk
Small presentation-layer stacking change in the shared confirm modal only; no auth, data, or API behavior changes.

Overview
Fixes a case where closing an editor modal with unsaved changes left the shared “discard?” confirm hidden behind the same modal (both used Mantine’s default modal z-index), so the UI could get stuck with a darker backdrop and no way to dismiss.

The confirm dialog in useConfirm now uses zIndex={100_000}, chosen to sit above the highest in-app modals while staying below notifications and spotlight. A data-testid="confirm-modal" hook and a new unit test assert the confirm’s z-index is greater than Mantine’s default modal z-index when opened from inside another modal.

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

The confirm dialog and the edit alert modal both used Mantine's default
modal z-index, so the confirm opened behind the editor and the modal
could not be closed. Give the confirm a z-index above every app modal.

Fixes HDX-6235
@jordan-simonovski
jordan-simonovski requested a review from a team as a code owner November 30, 2026 22:35
@changeset-bot

changeset-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9b053b2

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 30, 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 Dec 1, 2026 12:54am UTC
hyperdx-storybook Ready Ready Preview Dec 1, 2026 12:54am UTC

Request Review

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Nov 30, 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: 1
  • Production lines changed: 3 (+ 34 in test files, excluded from tier calculation)
  • Branch: jordansimonovski/hdx-6235-confirm-above-modals
  • Author: jordan-simonovski

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.

@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.

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

No inline comments. 1 P3 folded at the bottom.

🔵 1 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/__tests__/useConfirm.test.tsx:49 — Test only checks that the confirm is above 200, not above the app's highest modal → The test passes for any z-index above 200, so changing it back to something like 300 or 1000 would still pass. A confirm at that level would again open behind the 9999 modal in packages/app/src/components/Alerts.tsx:156 and the 10050 popovers in AlertScheduleFields.tsx. Fix: export the value as a named constant from useConfirm.tsx (e.g. CONFIRM_Z_INDEX). Then test it against the real bounds: above 9999, and below Spotlight's 200001 (Spotlights.tsx:233) and Notifications' 999999 (ThemeWrapper.tsx:36). Or render the inner test modal at zIndex={9999} and assert the confirm is above it.

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

Copy link
Copy Markdown
Contributor

Deep Review

A tightly scoped fix: the shared confirm dialog (ConfirmProvider) now renders at zIndex={100_000} so the "discard unsaved changes" confirm stacks above app modals instead of opening behind them. The ordering was independently verified against the app's real z-index tiers (app modals 9999, Spotlight 200001, Notifications 999999), and 100_000 sits correctly above modals and below spotlight/notifications — the inline comment is accurate. No P0/P1 issues.

✅ No critical issues found.

🟡 P2 — recommended

  • packages/app/src/__tests__/useConfirm.test.tsx:32 — the regression test asserts the confirm z-index is only greater than getDefaultZIndex('modal') (200), but the bug was the confirm opening behind app modals pinned to 9999; the asking modal renders at the default tier, so a regression lowering the value to anything between 201 and 9999 would still pass while reintroducing the bug.
    • Fix: render the sibling modal at zIndex={9999} and assert the confirm's z-index exceeds that concrete tier.
    • correctness, testing, kieran-typescript
  • packages/app/src/useConfirm.tsx:76 — the 100_000 literal encodes a cross-layer ordering contract against values hardcoded separately in ThemeWrapper.tsx, Spotlights.tsx, and Alerts.tsx, with the invariant enforced only by a prose comment, so changing any of those scattered constants can silently re-regress the stacking order.
    • Fix: source the value from a shared z-index scale alongside the modal/spotlight/notification tiers rather than a standalone magic literal.
    • maintainability, kieran-typescript
🔵 P3 nitpicks (1)
  • packages/app/src/__tests__/useConfirm.test.tsx:31 — the test reads Mantine's internal --mb-z-index CSS variable; a Mantine upgrade that renames it makes Number('') resolve to 0, flipping the assertion to a confusing failure unrelated to the component's actual contract.
    • Fix: assert against the z-index prop/style the component controls, or pin the Mantine version this lookup depends on in a comment.
    • testing, kieran-typescript

Reviewers (8): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, kieran-typescript, previous-comments.

Testing gaps:

  • No test exercises the confirm stacked above a modal at the real 9999 tier, nor asserts it stays below spotlight/notifications — only one half of the documented invariant is covered.
  • onConfirm/onClose promise resolution and the routeChangeStart dismiss handler remain untested; the new test covers only the z-index value.

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 30, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

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

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

Tests ran across 4 shards in parallel.

View full report →

@kodiakhq
kodiakhq Bot merged commit c64f403 into main Dec 1, 2026
43 of 45 checks passed
@kodiakhq
kodiakhq Bot deleted the jordansimonovski/hdx-6235-confirm-above-modals branch December 1, 2026 05:59

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 9b053b23 Deployed Dec 1, 2026 by vercel[bot]
Preview – hyperdx-storybook — 9b053b23 Deployed Dec 1, 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