Skip to content

Redesign Query Insights - #1049

Draft
Tomasz Naumowicz (tnaum-ms) wants to merge 49 commits into
mainfrom
dev/tnaum/query-insights-next
Draft

Tomasz Naumowicz (tnaum-ms) wants to merge 49 commits into
mainfrom
dev/tnaum/query-insights-next

Conversation

@tnaum-ms

Copy link
Copy Markdown
Collaborator

Redesigns the Query Insights experience with a streamlined analysis flow, shared model selection, richer model and cost information, and explorer entry points.

This draft is intended to share the updated Query Insights design and implementation for early feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…I-4)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…urce (WI-5)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…(WI-10)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ta (WI-11)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rebuild Welcome/Configure/Analyze on the LocalQuickStart patterns: header
with Feature preview, copyable explain snippets and privacy note, live
non-throwing input inspection with line/column errors, sample plans,
summary-row editors for optional context, and an Analyze summary bar with
inline model change, Edit inputs and Re-run. The reused panel no longer
nests its own scroll area inside the wizard page.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The full sentence stays in the tooltip; the long value clipped in the
right column at common widths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… the explorer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fluent tokens and chevron icon instead of raw SCSS, locale-formatted
costs and token counts, compact identity line, visible edge in high
contrast.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…itle

- Wizard model section uses the Optional context label/value table; no
  collapsible; missing data reads 'Not reported for this model'.
- Default model: saved choice, else first Powerful (API category), else first.
- Analyze step titled 'Query Insights analysis results', no transient subtitle.
- New configure-models L2 scenario.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dges

Same CounterBadge list as LocalQuickStart; Required/Optional badges sit
next to each entry title instead of acting as bullets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…options (Phase F)

Five options for the AI Performance Insights card's model selection (model pill,
split button, settings strip, native quick pick, header chip popover) plus the
current layout, rendered with mock models in the L2 scenario
queryInsightsStandalone/tab-model-options.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e' label

- Compact ModelPicker becomes a VS Code chat-style model pill with a
  grouped menu (cost badge per model).
- Card: primary action + pill, one muted meta line (prompt, Explore,
  Learn more), existing cost footnote.
- The utility model never shows 'Free'; the careful footnote wording
  ('No additional cost for most GitHub Copilot subscribers.') is used
  in the card and the wizard Cost row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…over

Replace the hand-rolled model pill (Menu + Tooltip with an overflowing table)
with a Fluent Dropdown grouped by category, cost badges per option and an
info Popover holding the model details. The listbox is height-capped and
scrolls, and the model list is refetched when the dropdown opens. The wizard
uses the same compact setup instead of the details table. Also bold Welcome
list titles and narrow the JSON editor gutter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d, matching Command type

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cards

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… identities

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…o the output channel

Tab card (Phase K):
- Actions row is model picker -> details -> Get AI Performance Insights.
- One muted footer: cost note, accuracy disclaimer, Explore, and
  "Learn more about AI Performance Insights".
- Prompt source removed from all UI and the getPromptSourceInfo RPC;
  PromptTemplateService traces it to the output channel on every request.

Query Insights Explorer (Phase L):
- Model picker moves into the Configure footer before Analyze query; the
  AI model section and "choice is saved" text are removed.
- "Explain output" is the single term with one Required marker.
- Explain editors auto-size and wrap long lines.
- Namespace shown once (Optional context); prefilled explain opens on
  Configure.
- "AI responses may be inaccurate" removed from every AI card header and
  stated once in the Powered-by byline (and where the user prompts).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

❌ CI failed: fast tier (draft PR)

Commit c3cabe5, workflow run.

Layer Result Ran or skipped because
Static checks ❌ failed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ⏭️ skipped draft PR; runs once the PR is marked ready
VSIX: inspect contents ⏭️ skipped draft PR; runs once the PR is marked ready
VSIX: self-test of the checks ⏭️ skipped draft PR; runs once the PR is marked ready
VSIX: activate in VS Code ⏭️ skipped draft PR; runs once the PR is marked ready
VSIX: self-test of the activation check ⏭️ skipped draft PR; runs once the PR is marked ready
Webview host in unbundled extensions ⏭️ skipped draft PR; runs once the PR is marked ready
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Full run: add the ci:full-requested label to run every layer once on the current commit.
No full run yet.

Code quality

Check Status How to fix
Localization (l10n) ❌ Failed Run npm run l10n and commit the updated files.
ESLint ❌ Failed Run npm run lint and fix the reported issues.
Prettier formatting ❌ Failed Run npm run prettier-fix to auto-format, then commit.

Build size

Not measured: draft PR; runs once the PR is marked ready.

Updated in place on every run.

resources/prompts/local/query-insights.prompt.md is gitignored; when it exists
(and no prompt-path setting is configured) it replaces the built-in index
advisor prompt for find, aggregate and count. Prompt source: local-resource-file.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…w plan reachable

- Normalize shards/inputStages before @mongodb-js/explain-plan-helper, which
  fails with "x is not iterable" on non-array values; guard the same loops in
  StagePropertyExtractor.
- Log the Stage 2 analysis error, stack and execution plan to the output channel.
- Keep "View Raw Execution Stats" available after a Stage 2 failure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Recommendations with action "none" (query change, verify, maintenance, data
model, support) render as an advisory InsightCard: kind title and icon,
optional copyable command, risks only when provided, no execute button.
The kind comes from a new optional "kind" field, falling back to a
"Kind:" prefix in the justification. Adds the analyze-insights L2 scenario.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When an index only provides order (for example _id_ with a
streamingPrimaryKey cursor and every predicate in runtimeFilterSet),
DocumentDB reports `indexUsage: {}` instead of an array. The low-cardinality
index advisory iterated it and Stage 2 failed with "indexUsage is not
iterable". Both indexUsage readers now require an array, as do scanKeys.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Shared CopyButton: the icon becomes a checkmark for two seconds and the
  result is announced, like the explorer's snippet buttons.
- Index cards offer Copy command next to the primary action.
- Rename the "Verify First" advice card to "Verify".

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A "Copy as Markdown" action next to the Optimization Opportunities title
exports every card in display order, then the model, prompt source, usage
and the exact data messages sent to the model (user query and context,
never the instruction prompt). The Stage 3 complete event now carries
these modelInputs from the AI service.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lection scans

A batched find on a non-indexed field runs as a streaming cursor that walks
_id_ to resume each batch (cursorScanType: streamingPrimaryKey). The explain
shows IXSCAN on _id_ with no indexFilterSet and every condition in
runtimeFilterSet, so the analysis reported "Index used: _id_" for what is a
full collection scan.

Add a second, DocumentDB-only analysis pass (documentDbPlanRefinements.ts)
that runs after the engine-neutral explain-plan-helper extraction and before
the rating. It reports these plans as a collection scan and adds a neutral
"Collection read in _id order" badge. It keys off DocumentDB-only fields, so
MongoDB plans and real _id lookups are unchanged. Applied corrections are
exposed as planRefinements and recorded in Stage 2 telemetry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace "Copy as Markdown" with a Share menu:
- Copy as Markdown: the full report, including the model inputs.
- Copy as rich text: email-safe HTML (inline styles, tables, light palette,
  shape markers instead of color-only meaning) plus a plain Markdown
  alternative without the model inputs, written through the webview
  clipboard. Falls back to plain text through the host when rich text
  cannot be written.

AI Markdown is rendered with micromark (already bundled through
react-markdown; now a direct dependency at the locked 4.0.2), which escapes
raw HTML and drops unsafe links; only http(s) links are kept. Copy feedback
is shared through a useCopyFeedback hook, and the report uses the same
visible badges as the panel (visibleDiagnostics).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…for both copy formats

"Copy as rich text" now renders the same Markdown report with inline styles
instead of a separate HTML layout. The header box, rating pill, progress bar
and recommendations table did not paste well into Teams and Word; the report
is now headings, paragraphs, lists and code blocks only.

The Markdown gains a "Query Efficiency Analysis" section (rating as shape and
word, metrics as a list, the visible badges), so both formats carry the same
content, including the model inputs. Removes buildOptimizationShareHtml and the
includeModelInputs option.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added ci:full-requested Requests a full run of CI checks. and removed ci:full-requested Requests a full run of CI checks. labels Oct 23, 2026

This branch has not been deployed

No deployments
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.

1 participant