Skip to content

Conversation

@davemarco
Copy link
Contributor

@davemarco davemarco commented Aug 18, 2025

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

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Checked that no error notifications appeared when user cancels query

Summary by CodeRabbit

  • New Features

    • Improved handling of user-cancelled searches: cancellations are now treated as completed, avoiding failure states.
  • Bug Fixes

    • Prevents error notifications when a search is cancelled by the user.
    • Ensures the interface no longer displays a failed state for cancelled operations.
  • Notes

    • All other errors continue to show failure status and detailed notifications as before.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 18, 2025

Walkthrough

Treats 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

Cohort / File(s) Change Summary
Search UI metadata handling
components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts
Added PRESTO_CANCEL_ERROR_NAME = "USER_CANCELED". In PRESTO_SEARCH_SIGNAL.FAILED, if resultsMetadata.errorName === PRESTO_CANCEL_ERROR_NAME set UI state to DONE and return early; otherwise retain FAILED handling and show notification. Docstring updated to mention notification on error path.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • hoophalab
  • kirkrodrigues

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco requested a review from hoophalab August 18, 2025 17:18
@davemarco davemarco marked this pull request as ready for review August 18, 2025 17:22
@davemarco davemarco requested a review from a team as a code owner August 18, 2025 17:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between a03936f and fe34ddb.

📒 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

hoophalab

This comment was marked as outdated.

@hoophalab hoophalab dismissed their stale review August 18, 2025 20:15

dismiss

davemarco and others added 2 commits August 18, 2025 16:55
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 the errorName field 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.

📥 Commits

Reviewing files that changed from the base of the PR and between fe34ddb and 00b1730.

📒 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 — LGTM

This aligns with the PR objective: user‑cancelled queries no longer trigger FAILED state or notifications. Using errorName and break prevents the failure notification from firing.


38-44: Cancellation Paths Confirmed to Be Treated as Success

I’ve verified across the codebase:

  • In useUpdateStateWithMetadata.ts, PRESTO cancellations (errorName === "USER_CANCELED") are mapped to SEARCH_UI_STATE.DONE and never fall through to failure handling.
  • The generic search route (server/src/routes/api/search/index.ts) emits lastSignal: 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/errorMsg on FAILED signals for cancellation, nor is TRINO_SEARCH_SIGNAL used anywhere.

All cancellation paths now resolve to a successful completion—no error notification will be shown for user-cancelled queries.

@davemarco davemarco requested a review from hoophalab August 18, 2025 21:03
Copy link
Contributor

@hoophalab hoophalab left a 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 kirkrodrigues changed the title feat(webui): Move to success state after user cancel action instead of failure state for Presto queries. feat(webui): Move to success state (instead of failure state) after user cancel action for Presto queries. Aug 20, 2025
Copy link
Member

@kirkrodrigues kirkrodrigues left a 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.

@kirkrodrigues kirkrodrigues changed the title feat(webui): Move to success state (instead of failure state) after user cancel action for Presto queries. feat(webui): Move to success state (instead of failure state) after user-cancel action for Presto queries. Aug 22, 2025
@davemarco davemarco merged commit 0f14077 into y-scope:main Aug 25, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants