Skip to content

Conversation

@hoophalab
Copy link
Contributor

@hoophalab hoophalab commented Aug 13, 2025

Description

Fastify logging accepts the first argument as an object not a string.
As the title indicates, we're now logging the Presto cancel route output as an object.

This bug was discovered by @junhaoliao and can be reproduced by updating the webui server's packages to their latest versions. It didn't show previously because Pino could silently handling obj an unknown argument in the old version.

The old interface definition:

    interface LogFn {
    ...
        (obj: unknown, msg?: string, ...args: any[]): void;
    }

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

  1. Search cancellation works exactly as before.

  2. The package successfully builds with the updated dependencies.

Summary by CodeRabbit

  • New Features

    • No user-facing changes in this release.
  • Refactor

    • Standardized structured logging for search cancellation events to improve consistency and traceability; no change to behaviour or API.
  • Chores

    • Improved observability by switching to object-based log payloads for cancellation logs, aiding diagnostics and log aggregation without altering functionality.

@hoophalab hoophalab requested a review from a team as a code owner August 13, 2025 17:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Walkthrough

Updates the Presto search API cancel route logging to pass a structured object payload ({ searchJobId }) instead of a primitive argument, with the log message unchanged. No other functionality or control flow is modified.

Changes

Cohort / File(s) Summary
Logging payload format update
components/webui/server/src/routes/api/presto-search/index.ts
Change logger usage from request.log.info(searchJobId, "Presto search cancelled"); to request.log.info({ searchJobId }, "Presto search cancelled");. No behavioural changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • davemarco
  • 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.


📜 Recent 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 settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 58f471e and 1b1cd71.

📒 Files selected for processing (1)
  • components/webui/server/src/routes/api/presto-search/index.ts (1 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/server/src/routes/api/presto-search/index.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: haiqi96
PR: y-scope/clp#0
File: :0-0
Timestamp: 2025-07-29T14:04:13.769Z
Learning: User haiqi96 requested creating a GitHub issue to document a bug fix from PR #1136, which addressed MySQL compatibility issues with invalid SQL CAST operations in the WebUI component.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (1)
components/webui/server/src/routes/api/presto-search/index.ts (1)

201-201: Correct Pino/Fastify log usage change — LGTM

Passing an object as the first argument aligns with Pino’s LogFn signature and ensures searchJobId is captured as structured metadata. Good consistency with the rest of the file’s logging style.

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

@hoophalab
Copy link
Contributor Author

hoophalab commented Aug 13, 2025

A bug of cancel button but not related to this PR: If the user click "Run" and then immediately "Cancel," the query won't actually stop. This might be because Presto's cancel route returns success even if queries aren't submitted yet.
This bug will probably be automatically fixed after we handle query status correctly in client in a future PR, but we may need to revisit the resetful api design especially if the user want to use api directly.
@coderabbitai can you create an issue on this?

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

I'll create a GitHub issue to track this cancel button bug for you.


🏁 Script executed:

#!/bin/bash
# Create a GitHub issue for the cancel button bug
gh issue create \
  --title "Bug: Cancel button doesn't stop query when clicked immediately after Run" \
  --body "## Description

A bug has been identified with the cancel button functionality in the WebUI. When a user clicks \"Run\" and then immediately clicks \"Cancel,\" the query won't actually stop.

## Expected Behavior
The query should be cancelled when the Cancel button is clicked.

## Actual Behavior
The query continues running despite the Cancel button being clicked immediately after Run.

## Suspected Cause
This might be because Presto's cancel route returns success even if queries aren't submitted yet.

## Potential Resolution
This bug will probably be automatically fixed after we handle query status correctly in the client in a future PR. However, we may need to revisit the RESTful API design, especially if users want to use the API directly.

## Additional Context
- Issue reported by @hoophalab
- Not related to PR #1191 (which addresses logging format in the cancel route)
- Affects WebUI search functionality

## References
- Original discussion: https://github.com/y-scope/clp/pull/1191
- Related PR: https://github.com/y-scope/clp/pull/1191" \
  --assignee hoophalab

Length of output: 1238


@hoophalab: I've successfully created GitHub issue #1195 to track the cancel button bug you reported.

The issue includes:

  • Complete description of the bug behavior
  • Your suspected cause (Presto cancel route returning success before query submission)
  • Context about potential future fixes and RESTful API design considerations
  • References back to this PR discussion
  • Assignment to you as the reporter

This will ensure the bug is properly tracked and can be addressed in a future PR when you implement the query status handling improvements.


🧠 Learnings used
Learnt from: haiqi96
PR: y-scope/clp#0
File: :0-0
Timestamp: 2025-07-29T14:04:13.769Z
Learning: User haiqi96 requested creating a GitHub issue to document a bug fix from PR #1136, which addressed MySQL compatibility issues with invalid SQL CAST operations in the WebUI component.

@y-scope y-scope deleted a comment from coderabbitai bot Aug 13, 2025
@y-scope y-scope deleted a comment from coderabbitai bot Aug 13, 2025
@y-scope y-scope deleted a comment from coderabbitai bot Aug 13, 2025
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

for the title, how about

fix(webui): Log Presto cancel route output as object instead of string.

@hoophalab hoophalab changed the title fix(webui): Change Presto cancel route logging output from string to object. fix(webui): Log Presto cancel route output as object instead of string. Aug 14, 2025
@hoophalab hoophalab merged commit 4288532 into y-scope:main Aug 14, 2025
10 checks passed
@hoophalab hoophalab deleted the pino branch August 14, 2025 22:04
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.

2 participants