Skip to content

Print canonical docs shortlinks in --help, api show, and plugin errors - #2098

Open
waldekmastykarz wants to merge 13 commits into
dotnet:mainfrom
waldekmastykarz:print-canonical-docs-shortlinks
Open

waldekmastykarz wants to merge 13 commits into
dotnet:mainfrom
waldekmastykarz:print-canonical-docs-shortlinks

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

Adds stable https://go.devproxy.net?go=<code> docs shortlinks to CLI output so agents and users can find the right docs page without guessing Learn URLs.

Changes

  • --help for every command ends with a Docs: line:
    • root and group commands (e.g. api, cert) → cli
    • leaf commands → cli-<command path> (e.g. cli-api-show, cli-config-get)
    • commands contributed by built-in plugins → <pluginname> (e.g. mocks → mockresponseplugin)
    • commands contributed by third-party plugins → no link (no canonical page)
  • devproxy api show: adds Docs: https://go.devproxy.net?go=api (text) and a docs property (JSON).
  • Plugin errors (load failure, initialization failure, missing URLs to watch, config schema validation): append the plugin's docs link for plugins shipped in DevProxy.Plugins. Third-party plugins keep the original message.
  • New DocsLinks helper in DevProxy.Abstractions/Utils so the CLI never hard-codes Learn paths, plus HelpDocs to resolve per-command links.

Notes

I probed every code the CLI can emit. All resolve except these, which need redirects added on the shortlink service: cli-msgraphdb, cli-cert-remove, websocketmockresponseplugin.

Resolves #2063

Adds stable https://go.devproxy.net?go=<code> links to CLI output so agents
and users can find the right documentation page without guessing Learn URLs:

- Every command's --help ends with a Docs: line (cli, cli-<command>,
  or <pluginname> for commands contributed by built-in plugins)
- devproxy api show includes the Proxy API docs link in text and JSON output
- Plugin load, initialization, and configuration validation errors include
  the plugin's docs link for plugins shipped with Dev Proxy

Closes dotnet#2063

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner November 5, 2026 10:46
Copilot AI balanced review requested due to automatic review settings November 5, 2026 10:46

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.

🟢 Approval recommended

No active review issues are reported for the documentation-shortlink changes.

No open issues 🎉

What changed in this PR

Adds canonical documentation shortlinks to Dev Proxy’s CLI output, helping users and agents find relevant documentation without constructing Learn URLs.

Changes:

  • Adds command-specific docs links to help output, including built-in plugin commands while excluding third-party plugins.
  • Includes documentation links in api show text and JSON output and selected built-in plugin error messages.
  • Centralizes shortlink generation and adds tests for command-link resolution.
File Description
DevProxy/​Plugins/​PluginServiceExtensions.cs Adds docs links to built-in plugin load, initialization, and missing-URL errors.
DevProxy/​Commands/​HelpDocs.cs Resolves command-specific links and explicit plugin overrides.
DevProxy/​Commands/​DevProxyHelpAction.cs Appends documentation links to help output.
DevProxy/​Commands/​DevProxyCommand.cs Associates plugin commands with their documentation links.
DevProxy/​Commands/​ApiCommand.cs Adds API documentation links to text and JSON output.
DevProxy.Tests/​HelpDocsTests.cs Tests command-link resolution and third-party exclusion.
DevProxy.Abstractions/​Utils/​DocsLinks.cs Centralizes shortlink generation and built-in plugin identification.
DevProxy.Abstractions/​Plugins/​BasePlugin.cs Adds built-in plugin docs links to configuration validation errors.

Review effort: Balanced

@waldekmastykarz waldekmastykarz added the pr-enhancement Product features, behavior fixes, and usability or compatibility improvements label Nov 21, 2026
Copilot AI balanced review requested due to automatic review settings November 25, 2026 14: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

Assembly-loading failures occur outside the catch, causing startup to exit without the advertised documentation link when a shipped plugin DLL cannot load.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 06:42

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.

🟢 Approval recommended

No active review issues block the documentation-link additions.

1 open issue

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 07:18

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.

🟢 Approval recommended

No active review issues remain for the CLI documentation-link changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 13:09

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.

🟢 Approval recommended

No active review issues remain for the changes adding documentation links to CLI help, API output, and built-in plugin diagnostics.

No open issues 🎉

Review effort: Balanced

@garrytrinder garrytrinder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Functional test results

  • PR: #2098
  • Tested commit: 338d45fe418dd0750dcd1d2efd1c8ac0759fe88a
  • Environment: macOS, .NET SDK 10.0.103, PR source build; isolated fixtures, certificate, and application-data directory. Proxy safety flags: --detach --as-system-proxy false --port 0 --api-port 0 --install-cert false.
Scenario or test command Expected Actual Result
dotnet restore DevProxy.sln --locked-mode; dotnet build DevProxy.sln --no-restore Source and shipped plugins build without changing dependencies Build succeeded, zero warnings/errors; no lock-file changes PASS
Current-head CI Required automated validation succeeds on tested SHA Build, smoke, Linux/Windows/macOS tests, CodeQL and CLA all successful; automated tests not rerun locally PASS
Root/group/leaf --help; all leaves under api, cert, config, jwt; standalone commands including stdio One final canonical Docs: line, appropriate to command path; group/root use cli All tested command paths emit the expected final line, including cli-api-show, cli-config-get, cli-cert-remove, and cli-msgraphdb PASS
Configured MockResponsePlugin: mocks --help, mocks from-http-responses --help Both link to plugin docs instead of CLI paths Both end with Docs: https://go.devproxy.net?go=mockresponseplugin PASS
Independently compiled PR2098.Custom.dll: custom2098 --help, missing-URL diagnostic No fabricated canonical documentation for third-party plugins No Docs: line in custom command help or custom-plugin error PASS
api show API docs link and existing auth/endpoint information Exactly one Docs: https://go.devproxy.net?go=api; seven endpoints and bearer-auth guidance retained PASS
api show --output json Valid JSONL result envelope; new API docs property without losing existing fields data.docs is https://go.devproxy.net?go=api; seven endpoint records and authentication.scheme=Bearer retained PASS
Built-in LatencyPlugin and WebSocketMockResponsePlugin with empty urlsToWatch Missing-URL diagnostic includes matching plugin link Both diagnostics contain the expected lowercased plugin shortlink PASS
LatencyPlugin with minMs:20,maxMs:10 Initialization error includes plugin docs and remains a startup failure Failed to initialize plugin LatencyPlugin: ... Docs: https://go.devproxy.net?go=latencyplugin; exit 1 PASS
Local HTTP JSON schema requiring an absent property in LatencyPlugin settings Schema validation error includes plugin docs Missing-property validation diagnostic includes Docs: https://go.devproxy.net?go=latencyplugin PASS
Temporarily remove this checkout's built plugins/DevProxy.Plugins.dll, configure LatencyPlugin, execute api show Assembly-load error includes plugin docs and fails startup Error includes Docs: https://go.devproxy.net?go=latencyplugin; exit 1; owned assembly immediately restored PASS
Nonexistent plugin name Explicit not-found error remains; no invented documentation page Existing not-found diagnostic retained PASS
dotnet run --no-build --no-launch-profile --project DevProxy -- -c <fixture> --detach --as-system-proxy false --port 0 --api-port 0 --install-cert false --output json; authenticated GET /proxy; curl --noproxy "" --proxy <assigned-url> http://pr2098.invalid/smoke Owned daemon alive; API 200; request actually routed through assigned proxy returns deterministic mock Final owned PID 54939: proxy port 62281, API port 62282; API HTTP 200; proxied HTTP 200 with {"pr2098":"mock-ok"} PASS
PID-scoped status and stop Target only owned daemon; stop releases process Status identifies owned PID; final graceful stop exit 0; all recorded owned PIDs verified absent PASS
Follow representative shortlinks with curl -sS -L --max-time 20 -o /dev/null -w '%{http_code} %{url_effective}' 'https://go.devproxy.net?go=<code>' Existing docs pages reachable cli, cli-api-show, api, mockresponseplugin, latencyplugin, cli-msgraphdb, cli-cert-remove all finish HTTP 200. The latter two previously noted missing redirects now work PASS
Follow emitted https://go.devproxy.net?go=websocketmockresponseplugin Reach usable WebSocketMockResponsePlugin documentation Repeatedly finishes HTTP 404 at https://learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/technical-reference/websocketmockresponseplugin BLOCKED

Requested changes

None in the PR source: no functional code defect was reproduced. External documentation follow-up remains necessary: publish the WebSocketMockResponsePlugin target page or redirect its shortlink to a usable reference. The PR description already identifies this dependency. No inline code comment was added because the observed blocker is the external destination, not a defect at a changed source line.

Outcome

Comment only. All 35 local functional assertions passed, and current-head CI is green. Full end-to-end documentation-link validation remains blocked by the WebSocketMockResponsePlugin destination's HTTP 404, so this report does not approve or request source changes. This is functional testing, not a replacement for code review.

Cleanup completed: all owned proxy PIDs exited, temporary fixtures/certificates and generated logs removed, temporarily moved plugin DLL restored, and checkout left clean. One intermediate rerun had a fixture-isolation working-directory mismatch; its owned PID required targeted SIGTERM and was verified exited before a corrected isolated rerun passed. No unrelated instances were stopped; no code was changed, committed, pushed, or merged.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 15:08

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

The standalone plugin help pipeline bypasses the docs-footer action, so both devproxy plugin --help and devproxy plugin list --help still omit the Docs: footer.

1 open issue

Review effort: Balanced

Comment thread DevProxy/Commands/DevProxyHelpAction.cs Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 15:24

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.

🔵 Needs a closer look

Human assessment is needed because an unpublished finding flags error handling that may mask plugin failures and abort processing when plugin names are blank.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 15:34

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.

🟢 Approval recommended

No active review issues remain for the documentation-shortlink changes.

No open issues 🎉

Review effort: Balanced

@garrytrinder garrytrinder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Functional test results

  • PR: #2098 (fresh rerun after standalone plugin help fix)
  • Tested commit: 270c37b5f3eab608956be245267d83912c028cd2
  • Environment: macOS, .NET SDK 10.0.103, PR source build; owned .devproxy/pr2098-rerun fixtures, HOME/CFFIXED_USER_HOME, application data and certificate path.
Scenario or test command Expected Actual Result
dotnet restore DevProxy.sln --locked-mode; dotnet build DevProxy.sln --no-restore Locked dependencies and clean source build Succeeded, zero warnings/errors; no lock-file edits PASS
Current-head CI Automated tests and checks pass on tested commit Build, smoke, Linux/Windows/macOS tests, CodeQL and CLA successful; automated tests not rerun locally PASS
From an otherwise unconfigured fixture directory: devproxy plugin --help --log-level None Standalone command works without config and ends with CLI docs Exit 0; final Docs: https://go.devproxy.net?go=cli PASS
Same directory: devproxy plugin list --help --log-level None and plugin list -h Examples retained; one docs footer after examples Both exit 0 and end with Docs: https://go.devproxy.net?go=cli-plugin-list, after Examples PASS
devproxy plugin list --output json without config Existing structured inventory unaffected by help change Exit 0; result contains 47 plugins, including MockResponsePlugin; no text docs footer pollutes JSON PASS
Root/group help and all leaf commands under api, cert, config, jwt; standalone core commands One correct final docs footer, groups/root use cli All tested command paths emit expected final links, including cli-api-token, cli-config-validate, cli-stdio PASS
MockResponsePlugin command group and leaf help Plugin docs override command-path docs mocks and mocks from-http-responses both end with mockresponseplugin shortlink PASS
Independently compiled third-party plugin command help and missing-URL diagnostic No fabricated canonical documentation link Custom command help and plugin error have no Docs link PASS
api show, text and --output json API docs added without changing existing auth/endpoints Text includes exactly one API docs line; JSONL data.docs is API shortlink; seven endpoints and Bearer authentication preserved PASS
LatencyPlugin and WebSocketMockResponsePlugin without watched URLs Diagnostic includes correct plugin shortlink Both emit correct matching docs link PASS
LatencyPlugin minMs:20,maxMs:10 Initialization failure includes docs; startup still fails Matching diagnostic and latencyplugin docs; exit 1 PASS
Local HTTP schema requiring absent requiredForTest property Config validation error includes plugin docs Missing-property diagnostic includes latencyplugin docs PASS
Temporarily move only this checkout's built plugin DLL, run configured LatencyPlugin Assembly load error includes docs and propagates failure Matching docs link, exit 1; DLL restored immediately afterward PASS
Unknown plugin name Existing explicit not-found behavior retained Not-found diagnostic retained without invented docs page PASS
Source dotnet run --no-build --no-launch-profile --project DevProxy -- -c <fixture> --detach --as-system-proxy false --port 0 --api-port 0 --install-cert false --output json; authenticated API request; curl through assigned proxy Owned daemon live, API HTTP 200, deterministic proxy response HTTP 200 Final owned PID 14220, proxy port 57215/API port 57216; API HTTP 200; proxied http://pr2098.invalid/smoke returns HTTP 200 with {"pr2098":"mock-ok"} PASS
PID-scoped status and stop Only owned daemon selected and stopped Status matches PID; stop exit 0; both run PIDs verified absent PASS
Follow all 21 distinct emitted codes in this matrix using curl -sS -L --max-time 25 -o /dev/null -w '%{http_code} %{url_effective}' 'https://go.devproxy.net?go=<code>' Usable documentation destination 19 finish HTTP 200, including cli-msgraphdb and cli-cert-remove PASS
Follow emitted cli-plugin-list shortlink Usable plugin-list documentation Repeated HTTP 404 at https://go.devproxy.net/?go=cli-plugin-list BLOCKED
Follow emitted websocketmockresponseplugin shortlink Usable plugin reference Repeated HTTP 404 at https://learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/technical-reference/websocketmockresponseplugin BLOCKED

Requested changes

None in PR source: no functional implementation defect was reproduced. External documentation follow-up remains: add a working cli-plugin-list mapping and publish or correct the WebSocketMockResponsePlugin destination. These are service/documentation dependencies, so no inline source-code comment is appropriate.

Outcome

Comment only. All 39 local functional assertions passed, including the corrected standalone plugin help paths and adjacent regressions. Current-head CI is green. End-to-end documentation availability remains blocked by the two external HTTP 404 destinations above; this report therefore neither approves nor requests source changes. The tested upstream head was rechecked immediately before publication.

Cleanup completed: owned daemons stopped gracefully, all owned PIDs verified exited, local schema server stopped, temporary fixtures/certificates/state/logs removed, moved assembly restored and checkout clean. No source changes, commits, pushes or merges. This functional report does not replace code review.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 08:47

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

Blank plugin names cause DocsLinks.Get to throw in both exception handlers, masking original diagnostics and potentially turning log-and-continue behavior into a startup failure.

1 open issue

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 09:02

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.

🟢 Approval recommended

No active review issues are reported for the CLI documentation-link changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@garrytrinder garrytrinder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Functional test results

  • PR: #2098, retested November 27
  • Tested commit: 5990ff78b5da6f460b1adfcf7868d955b3aeebee
  • Environment: macOS, .NET SDK 10.0.103, exact PR source build; owned .devproxy/pr2098-20261127 fixtures, HOME/CFFIXED_USER_HOME with pre-created Application Support, isolated state/logs and DEV_PROXY_CERT_PATH.
Scenario or test command Expected Actual Result
dotnet restore DevProxy.sln --locked-mode; dotnet build DevProxy.sln --no-restore Source build and locked dependencies valid Succeeded, zero warnings/errors; lock files unchanged PASS
Current-head CI Automated validation succeeds on tested SHA Build, smoke, Linux/Windows/macOS tests, CodeQL and CLA successful; no local automated-test rerun PASS
Standalone plugin --help, plugin list --help, plugin list -h from unconfigured fixture directory Correct final docs footer; list examples appear before footer Exit 0; group uses cli, list uses cli-plugin-list; examples retained PASS
Standalone plugin list --output json without config Structured inventory remains valid Exit 0; 49 plugins, including MockResponsePlugin; no text docs footer in JSON PASS
Root/group help, all leaves under api, cert, config, jwt, and standalone core commands Exactly one final canonical command docs line All tested paths retain expected footers PASS
Configured built-in MockResponsePlugin command help Plugin-level docs rather than CLI path mocks and mocks from-http-responses both link to mockresponseplugin PASS
Independently compiled third-party plugin: command help and missing watched URLs No invented canonical documentation Custom command help and error contain no Docs link PASS
api show text and JSON API docs, authentication and endpoint contracts retained Text has one API docs line; JSONL data.docs is API shortlink; seven endpoints and Bearer authentication preserved PASS
api show --output json schema regression Existing endpoint schemas coexist with added docs All seven endpoints retain responses; POST /proxy retains requestBody PASS
Built-in LatencyPlugin/WebSocketMockResponsePlugin without watched URLs Explicit error with matching plugin docs Correct missing-URL diagnostics and plugin shortlinks PASS
LatencyPlugin with minMs:20,maxMs:10 Initialization error includes docs; startup fails Matching error with latencyplugin docs, exit 1 PASS
Local HTTP JSON schema requiring absent requiredForTest field Configuration error includes plugin docs Original missing-property diagnostic plus latencyplugin docs PASS
Nonexistent configured plugin name Explicit not-found diagnostic retained Existing error remains, no invented docs page PASS
Temporarily move this checkout's shipped plugin DLL; configure named LatencyPlugin Original load failure plus docs; startup fails Exit 1, load diagnostic includes latencyplugin docs; DLL restored afterward PASS
Same missing DLL, plugin name "" and " " Preserve original assembly-load exception; no DocsLinks exception Both exit 1 with original dependency-resolution error, no docs suffix or ArgumentException PASS
Compile fixture assembly named DevProxy.Plugins containing a type inheriting from a deliberately unavailable dependency; configure plugin name "" and " " Preserve ReflectionTypeLoadException and log-and-continue behavior Both exit 0 after original ReflectionTypeLoadException/missing dependency diagnostic; API output continues; no plugin docs suffix or DocsLinks exception PASS
Same type-discovery fixture, named LatencyPlugin Nonblank names still receive plugin docs; log and continue Original exception retained; latencyplugin docs present; API output continues, exit 0 PASS
Source dotnet run --no-build --no-launch-profile --project DevProxy -- -c <fixture> --detach --as-system-proxy false --port 0 --api-port 0 --install-cert false --output json; authenticated GET /proxy; curl --noproxy "" --proxy <assigned-url> http://pr2098.invalid/smoke Owned process live; API 200; real proxied request returns deterministic mock 200 Final owned PID 44061, proxy port 54446/API port 54447; authenticated API HTTP 200; proxied HTTP 200 with {"pr2098":"mock-ok"} PASS
PID-scoped status and stop Target only this run's daemon; verify exit Status matches owned PID; graceful stop exit 0; both run PIDs verified absent PASS
Follow 21 previously emitted documentation codes with curl -sS -L --max-time 25 -o /dev/null -w '%{http_code} %{url_effective}' 'https://go.devproxy.net?go=<code>' Usable documentation targets 19 return final HTTP 200, including cli-msgraphdb and cli-cert-remove PASS
Follow emitted cli-plugin-list link Usable plugin-list docs HTTP 404 at https://go.devproxy.net/?go=cli-plugin-list BLOCKED
Follow emitted websocketmockresponseplugin link Usable plugin reference HTTP 404 at https://learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/technical-reference/websocketmockresponseplugin BLOCKED

Requested changes

None in PR source: no implementation defect was reproduced. External documentation follow-up remains necessary: add the cli-plugin-list mapping and publish or correct the WebSocketMockResponsePlugin destination. No inline source comment is appropriate for these external service/documentation blockers.

Outcome

Comment only. All 45 local functional assertions passed, including both blank-name error handlers and the named-plugin regression. Current-head CI is green. End-to-end documentation availability is still blocked by the two external HTTP 404s above; this report neither approves nor requests source changes.

Cleanup completed: owned daemons stopped gracefully, all owned PIDs verified exited, schema server stopped, fixtures/certificates/state/logs removed, temporarily replaced shipped DLL restored, and checkout clean. No fixes, commits, pushes or merges. Tested upstream head was rechecked immediately before publication. Functional testing does not replace code review.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 12:16

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.

🟢 Approval recommended

There are no active review issues for the changes adding documentation shortlinks to CLI help and output.

No open issues 🎉

Review effort: Balanced

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

pr-enhancement Product features, behavior fixes, and usability or compatibility improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print canonical docs shortlinks in --help, api show, and plugin errors

3 participants