Skip to content

{CLI} Load scoped help metadata only from verb contributors - #1468

Open
DanielMicrosoft wants to merge 1 commit into
mainfrom
issue-992-scoped-cli-help
Open

DanielMicrosoft wants to merge 1 commit into
mainfrom
issue-992-scoped-cli-help

Conversation

@DanielMicrosoft

@DanielMicrosoft DanielMicrosoft commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Related command

az vm --help, az vm create --help, and other scoped CLI help requests

Description

Fixes Azure/CLIPS#992.

Scoped help currently loads full metadata for every routing-selected extension before filtering by verb. This change uses the existing routing selection to load only packages contributing to the requested verb.

  • Retain selected verb ownership alongside the selected installation, before routing-index construction.
  • Preserve all shared-verb contributors, selected versions and DLL locations, and help availability when duplicate leaves prevent index construction.
  • Keep root help broad and preserve existing command/group rendering, intrinsic help, and missing-extension hints.
  • Add real-loader integration tests proving scoped help skips unrelated DLLs while root help still loads them, and update the help-system documentation.

Selection is deliberately verb-level, not command/group-path-level. Routing's existing DLL fallback for missing or invalid sidecars is unchanged.

Testing Guide

This PR represents a solid perf improvement.

Before:
image

After:

image

No timing benchmark or full test suite was run.

History Notes


  • The PR title starts with [Component Name] for customer-facing changes or {Component Name} for non-customer-facing changes, and does not end with trailing punctuation or spaces.
  • Customer-facing changes include a useful release note in the PR title or the History Notes section.
  • I added or updated tests for behavior changes.
  • I updated documentation when behavior, setup, support, or security guidance changed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DanielMicrosoft DanielMicrosoft changed the title [CLI] Load scoped help metadata only from verb contributors {CLI} Load scoped help metadata only from verb contributors Nov 16, 2026
@DanielMicrosoft
DanielMicrosoft marked this pull request as ready for review November 16, 2026 05:10
Copilot AI balanced review requested due to automatic review settings November 16, 2026 05:10

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.

🟡 Changes recommended

Scoped help can incorrectly return VerbNotFound for legacy indexes with valid commands but empty ownership lists; the broad-selection fallback and a real-loader regression test are needed.

1 open issue
What changed in this PR

This PR narrows scoped CLI help discovery to routing-selected packages that contribute to the requested verb, avoiding unrelated metadata loads while keeping root help broad.

Changes:

  • Retain verb ownership alongside selected package versions and DLL locations.
  • Pass the requested verb through help discovery, retaining shared contributors even when routing-index construction fails.
  • Add integration coverage for scoped loading and update the help-system documentation.
File Description
tests/​Cli.Tests/​Help/​RuntimeHelpDispatcherTests.cs Update mocks for verb-aware package selection.
tests/​Cli.Tests/​Extensions/​SelectedExtensionIntegrationTests.cs Verify scoped versus root loading and unmatched-verb behavior.
tests/​Cli.Tests/​Extensions/​ExtensionRoutingDiscoveryTests.cs Cover shared ownership, selected versions, and commandless verbs.
src/​CLI/​Program.cs Forward the help verb to routing selection.
src/​CLI/​Help/​RuntimeHelpDispatcher.cs Request packages for the scoped help verb.
src/​CLI/​CliExtensionServiceRegistration.cs Record verb ownership and expose filtered selection.
src/​CLI/​AssemblyLoading/​SelectedExtensionLocations.cs Store ownership metadata and filter package IDs by verb.
eng-docs/​spec/​help-system.md Document scoped discovery and routing fallback behavior.

Review effort: Balanced

Comment on lines +150 to +151
selectedLocations?.Record(info.PackageId, info.ResolvedVersion, info.Location,
info.Verbs.Concat(projection.Namespaces));

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.

2 participants