Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

This PR fixes the issue that error while canceling query

This PR fixes the issue that error while canceling query
@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 10, 2025
@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 10, 2025

Greptile Overview

Greptile Summary

Added guard clause to check config.isEnterprise !== "true" before calling the cancel query API, resolving immediately for non-enterprise builds. This prevents unnecessary API calls that would return 403 errors.

Key Changes:

  • Added import for config from @/aws-exports
  • Added early return in cancelQuery() function when not running enterprise edition
  • The backend API endpoint (/api/{org_id}/query_manager/cancel) returns 403 "Not Supported" for non-enterprise builds, so this frontend check prevents error notifications

Impact:

  • Non-enterprise users will no longer see error notifications when attempting to cancel queries
  • Enterprise users continue to function as before with full query cancellation support

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a simple guard clause that prevents API calls to an enterprise-only endpoint. The fix is well-targeted, matches the backend's feature flag implementation, and follows the existing pattern of early returns when conditions aren't met. No logical errors or side effects were found.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/src/composables/useLogs/useSearchBar.ts 5/5 Added enterprise check before calling cancel query API to prevent 403 errors in non-enterprise builds

Sequence Diagram

sequenceDiagram
    participant UI as User Interface
    participant cancelQuery as cancelQuery()
    participant config as Config
    participant API as Backend API

    UI->>cancelQuery: Call cancelQuery()
    cancelQuery->>config: Check config.isEnterprise
    
    alt isEnterprise !== "true"
        cancelQuery-->>UI: resolve(true) immediately
        Note over cancelQuery,UI: Skip API call in non-enterprise
    else isEnterprise === "true"
        alt No trace IDs
            cancelQuery-->>UI: resolve(true)
        else Has trace IDs
            cancelQuery->>API: DELETE /query_manager/cancel
            alt API Success
                API-->>cancelQuery: Success response
                cancelQuery->>UI: Show success notification
            else API Error
                API-->>cancelQuery: Error response
                cancelQuery->>UI: Show error notification
            end
            cancelQuery-->>UI: resolve(true) in finally
        end
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nikhilsaikethe nikhilsaikethe merged commit 56e9973 into branch-v0.30.0 Dec 10, 2025
38 checks passed
@nikhilsaikethe nikhilsaikethe deleted the fix/cancel-query-on-enterprise-30.0 branch December 10, 2025 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants