-
Notifications
You must be signed in to change notification settings - Fork 83
feat(webui): Move to success state (instead of failure state) after user-cancel action for Presto queries. #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughTreats Presto query cancellations (errorName "USER_CANCELED") as DONE instead of FAILED in the search results metadata handler, adding a local cancellation constant and an early-return branch; non-cancellation failures still set FAILED and show a notification. Changes
Sequence Diagram(s)sequenceDiagram
participant SearchPage
participant Hook as useUpdateStateWithMetadata
participant Metadata as ResultsMetadata
participant Notification as NotificationService
SearchPage->>Hook: deliver resultsMetadata
Hook->>Hook: switch on resultsMetadata.signal
alt PRESTO_SEARCH_SIGNAL.FAILED
alt resultsMetadata.errorName == "USER_CANCELED"
Hook->>SearchPage: setState(DONE)
Note right of Hook: no notification
else Other error
Hook->>SearchPage: setState(FAILED)
Hook->>Notification: show(error message)
end
else other signals
Hook->>SearchPage: existing state updates
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}
⚙️ CodeRabbit Configuration File
- Prefer
false == <expression>rather than!<expression>.
Files:
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
Show resolved
Hide resolved
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
Show resolved
Hide resolved
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
Show resolved
Hide resolved
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
Outdated
Show resolved
Hide resolved
…dateStateWithMetadata.ts Co-authored-by: hoophalab <[email protected]>
…dateStateWithMetadata.ts Co-authored-by: hoophalab <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts (1)
14-18: Centralise the cancellation sentinel to avoid drift; minor comment clarification.Good local constant and naming. To prevent future duplication, consider exporting this sentinel from a shared constants module (e.g.,
@common) and importing it here. Also clarify the comment to reference theerrorNamefield explicitly.Apply this tiny comment clarification now:
-/* -* Presto error name for user cancellation -*/ +/* + * Presto error name for user cancellation (errorName) + */If you choose to centralise later, remove the local constant in this block and import it from your shared module. For example (outside this range):
// At the imports section: import { PRESTO_CANCEL_ERROR_NAME } from "@common/index.js";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}
⚙️ CodeRabbit Configuration File
- Prefer
false == <expression>rather than!<expression>.
Files:
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
🧬 Code Graph Analysis (1)
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts (1)
components/webui/client/src/pages/SearchPage/SearchState/typings.ts (1)
SEARCH_UI_STATE(31-31)
🔇 Additional comments (2)
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts (2)
38-44: Treating Presto cancellation as DONE (using errorName) and breaking out is correct — LGTMThis aligns with the PR objective: user‑cancelled queries no longer trigger FAILED state or notifications. Using
errorNameandbreakprevents the failure notification from firing.
38-44: Cancellation Paths Confirmed to Be Treated as SuccessI’ve verified across the codebase:
- In
useUpdateStateWithMetadata.ts, PRESTO cancellations (errorName === "USER_CANCELED") are mapped toSEARCH_UI_STATE.DONEand never fall through to failure handling.- The generic search route (
server/src/routes/api/search/index.ts) emitslastSignal: SEARCH_SIGNAL.RESP_DONE(with a “Query cancelled…” message) for user-initiated cancellations, which the client also treats as DONE.- No other components inspect
errorName/errorMsgonFAILEDsignals for cancellation, nor isTRINO_SEARCH_SIGNALused anywhere.All cancellation paths now resolve to a successful completion—no error notification will be shown for user-cancelled queries.
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
Show resolved
Hide resolved
hoophalab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Validations:
cancelling a query no longer shows a notification
kirkrodrigues
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deferring to @hoophalab's review.
Description
Cancelling a presto query creates triggers a failure state in the presto engine. These were being treated as errors in the webui, and a notification was exposed to user. Instead, to mirror clp/clp-s webui, we want to treat a user cancel as a non-error, and not show a notification or move to failure state.
To achieve this, we just check if the error name is user cancel, and if so, ignore error.
Checklist
breaking change.
Validation performed
Checked that no error notifications appeared when user cancels query
Summary by CodeRabbit
New Features
Bug Fixes
Notes