Skip to content

fix(aggregations): $rerank bug bash changes COMPASS-10696#8117

Open
DarshanaVenkatesh wants to merge 8 commits into
mainfrom
COMPASS-10696
Open

fix(aggregations): $rerank bug bash changes COMPASS-10696#8117
DarshanaVenkatesh wants to merge 8 commits into
mainfrom
COMPASS-10696

Conversation

@DarshanaVenkatesh

@DarshanaVenkatesh DarshanaVenkatesh commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Update assistant question copy and prompt
  • link to docs for native reranking not enabled banner in compass
  • “View token usage” should display in full screen mode
  • Add “View token usage” button with link to docs in $rerank consumes tokens banner
  • Change all banner buttons to "button" following example
Screenshot 2026-06-05 at 10 38 42 AM Screenshot 2026-06-05 at 10 38 48 AM

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
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • 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)

Copilot AI review requested due to automatic review settings June 1, 2026 15:57
@DarshanaVenkatesh DarshanaVenkatesh changed the title COMPASS-10696: add token usage link and banner COMPASS-10696: $rerank bug bash changes Jun 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Bug-bash polish for the $rerank feature: tightens banner layouts via a shared button style, adds "View token usage" affordances (in the rerank tokens banner and focus-mode header), deep-links the "Native reranking not enabled" error to the project settings highlight (with a docs fallback), and expands the assistant prompt for the "rerank as first stage" insight.

Changes:

  • Extract a shared bannerButtonStyles and apply consistent gap-based layouts across rerank/server-error banners.
  • Add View token usage buttons/links sourced from a new buildRerankTokenUsageUrl (with a dochub fallback when Atlas metadata is absent).
  • Extend buildProjectSettingsUrl with an optional highlight parameter (covered by a new unit test) and rewrite the assistant prompt for rerank-first-stage.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/compass-assistant/src/prompts.ts Rewrites the rerank-first-stage insight prompt and updates its display text.
packages/compass-aggregations/src/components/banner-button-styles.ts New shared style for in-banner action buttons (no-wrap, no underline).
packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx Switches to shared button styles and uses gap for layout.
packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx Drops the local bannerButtonStyles in favor of the shared one.
packages/compass-aggregations/src/components/rerank-tokens-banner.tsx Adds a "View token usage" button using buildRerankTokenUsageUrl with a docs fallback.
packages/compass-aggregations/src/components/server-error-banner.tsx Always renders a Project Settings/docs link for rerank-not-enabled errors and uses the new highlight query param.
packages/compass-aggregations/src/components/focus-mode/focus-mode-modal-header.tsx Adds a "View token usage" link when focusing a $rerank stage.
packages/atlas-service/src/url-builders.ts Adds optional highlight query param to buildProjectSettingsUrl.
packages/atlas-service/src/url-builders.spec.ts Adds a unit test for the highlight parameter.
Comments suppressed due to low confidence (1)

packages/compass-aggregations/src/components/server-error-banner.tsx:98

  • When atlasMetadata is unavailable, projectSettingsHref now falls back to RERANK_DOCS_URL, but the button is still labeled "Project Settings" with an OpenNewTab icon. Clicking it will take the user to MongoDB documentation rather than an actual project settings page, which is misleading. Consider rendering different label/affordance (e.g. "Learn more") when the link points to docs, or only render the button when the Atlas link is available.
            {projectSettingsHref && (
              <Button
                size="xsmall"
                href={projectSettingsHref}
                target="_blank"
                rightGlyph={<Icon glyph="OpenNewTab" />}
                className={bannerButtonStyles}
              >
                Project Settings
              </Button>
            )}

@DarshanaVenkatesh DarshanaVenkatesh added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Jun 5, 2026
@DarshanaVenkatesh DarshanaVenkatesh marked this pull request as ready for review June 5, 2026 17:42
@DarshanaVenkatesh DarshanaVenkatesh requested a review from a team as a code owner June 5, 2026 17:42
@DarshanaVenkatesh DarshanaVenkatesh changed the title COMPASS-10696: $rerank bug bash changes fix(aggregations): $rerank bug bash changes COMPASS-10696 Jun 5, 2026
@github-actions github-actions Bot added the fix label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature flagged PRs labeled with this label will not be included in the release notes of the next release fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants