Skip to content

Conversation

nbbeeken
Copy link
Collaborator

Description

Using a preference I control whether or not to show the warning and prevent setting a higher maxTimeMS.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

);

// Data Explorer limits for maxTimeMS (5 minutes = 300,000ms)
const WEB_MAX_TIME_MS_LIMIT = 300_000; // 5 minutes
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest storing this in a single place + explaining why 5 minutes is the value we chose here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed and done!

@nbbeeken nbbeeken marked this pull request as ready for review September 29, 2025 14:19
@nbbeeken nbbeeken requested a review from a team as a code owner September 29, 2025 14:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a maxTimeMS warning system for CompassWeb to prevent users from setting query timeouts longer than 5 minutes (300,000ms), which is the Data Explorer backend limit. The implementation uses a new preference showMaxTimeMSWarning that is enabled by default in the web environment.

  • Adds showMaxTimeMSWarning preference to control the warning behavior
  • Implements hard limit enforcement and validation for maxTimeMS fields
  • Adds tooltip warnings when users attempt to exceed the 5-minute limit

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/compass-web/src/entrypoint.tsx Enables the showMaxTimeMSWarning preference by default for CompassWeb
packages/compass-preferences-model/src/preferences-schema.tsx Defines the new showMaxTimeMSWarning preference with proper schema validation
packages/compass-query-bar/src/constants/query-option-definition.ts Adds WEB_MAX_TIME_MS_LIMIT constant and updates maxTimeMS input validation
packages/compass-query-bar/src/utils/query.ts Updates validation functions to enforce the 5-minute limit when warnings are enabled
packages/compass-query-bar/src/stores/query-bar-reducer.ts Passes showMaxTimeMSWarning preference to validation functions
packages/compass-query-bar/src/components/query-option.tsx Adds tooltip warning UI for maxTimeMS fields exceeding the limit
packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-options/pipeline-collation.tsx Applies the same maxTimeMS validation and warning to aggregation pipeline options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 84 to 85
// Data Explorer limits for maxTimeMS (5 minutes = 300,000ms)
const WEB_MAX_TIME_MS_LIMIT = 300_000; // 5 minutes
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

This constant is duplicated from packages/compass-query-bar/src/constants/query-option-definition.ts. Consider importing WEB_MAX_TIME_MS_LIMIT from the constants file instead of redefining it to avoid potential inconsistencies.

Copilot uses AI. Check for mistakes.

Comment on lines 55 to 56
// Data Explorer limits (5 minutes = 300,000ms)
const WEB_MAX_TIME_MS_LIMIT = 300_000; // 5 minutes
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

This constant is duplicated from packages/compass-query-bar/src/constants/query-option-definition.ts. Consider importing WEB_MAX_TIME_MS_LIMIT from the constants file instead of redefining it to avoid potential inconsistencies.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants