PDX-505: detect missing provar plugin with PROVAR_PLUGIN_NOT_FOUND#202
Merged
Merged
Conversation
…OT_FOUND RCA: When the @provartesting/provardx-cli sf plugin is not installed (no provar topic), automation tools failed opaquely with AUTOMATION_*_FAILED carrying "Command provar not found"; there was no dedicated code or probe so users could not tell the root cause was a missing plugin. Fix: Add ProvarPluginNotFoundError + isProvarPluginMissing detector + probeProvarTopic in sfSpawn, and a shared pre-flight in all five automation tools that returns PROVAR_PLUGIN_NOT_FOUND with a details.suggestion remediation (sf plugins install @provartesting/provardx-cli) instead of the generic failure. Adds unit tests and docs/mcp.md error-code entries.
Quality Orchestrator🟢 LOW · 🧪 Tests to Run · Running 2 of 54 tests
▶ Run commandnpx vitest run \
unit/mcp/automationTools.test.ts \
unit/mcp/sfSpawn.test.ts⚡ quality-orchestrator · |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves failure diagnostics for the provar_automation_* MCP tools by detecting when the Salesforce CLI is installed but the @provartesting/provardx-cli sf plugin (the provar topic) is missing, and returning a dedicated PROVAR_PLUGIN_NOT_FOUND error with clear remediation instead of opaque AUTOMATION_*_FAILED errors.
Changes:
- Added
PROVAR_PLUGIN_NOT_FOUNDsupport insfSpawn.tsvia a missing-plugin detector (isProvarPluginMissing), an install hint constant, an error class, and a non-throwingprobeProvarTopichelper. - Wired a shared pre-flight in
automationTools.tsso all 5 automation tools map missing-plugin failures toPROVAR_PLUGIN_NOT_FOUNDwithdetails.suggestion. - Updated docs and added unit tests covering positive/negative detection and tool-level error-code mapping.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/mcp/tools/sfSpawn.ts |
Introduces detection + helpers for identifying a missing provar topic and providing an install hint. |
src/mcp/tools/automationTools.ts |
Adds a shared error-mapping helper so automation tools return PROVAR_PLUGIN_NOT_FOUND when appropriate. |
docs/mcp.md |
Documents the new error code for relevant tools and explains remediation. |
test/unit/mcp/sfSpawn.test.ts |
Adds unit coverage for the new error, detector, and probing helper. |
test/unit/mcp/automationTools.test.ts |
Adds end-to-end-ish unit coverage proving automation tools surface PROVAR_PLUGIN_NOT_FOUND only when intended. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@provartesting/provardx-clisf plugin is not installed (thesfCLI has noprovartopic), the automation tools previously failed opaquely withAUTOMATION_*_FAILEDcarryingCommand provar not found. Users had to recognize that text to realize the root cause.PROVAR_PLUGIN_NOT_FOUNDerror code with actionable remediation (details.suggestion: sf plugins install @provartesting/provardx-cli), mirroring theSfNotFoundError/SF_NOT_FOUNDpattern.sfSpawn.ts:ProvarPluginNotFoundError,PROVAR_PLUGIN_INSTALL_HINT, anisProvarPluginMissing(stdout, stderr)detector (matchescommand provar … not found, oclifprovar is not a sf command, etc.), and a non-throwingprobeProvarTopic(sfPath?)health-check.provar_automation_*tools (config_load, testrun, compile, metadata_download, setup) run a shared pre-flight: when an sf command exits non-zero and the output matches the missing-plugin pattern, they returnPROVAR_PLUGIN_NOT_FOUNDinstead of the generic_FAILED. A genuine failure (or exit 0) is unaffected.Jira
https://provartesting.atlassian.net/browse/PDX-505
Test plan
Tests
sfSpawn.test.ts:ProvarPluginNotFoundErrorshape;isProvarPluginMissingpositive (3 phrasings) + negatives (unrelated error, benign update warning);probeProvarTopictrue/false/sf-missing.automationTools.test.ts: config_load surfacesPROVAR_PLUGIN_NOT_FOUNDwith remediation (positive);command provar not foundphrasing; negative — a generic config-load failure staysAUTOMATION_CONFIG_LOAD_FAILED; testrun also maps; no-fire on exit 0.Changes
src/mcp/tools/sfSpawn.ts: error class, install hint, detector, probe.src/mcp/tools/automationTools.ts: sharedprovarPluginErrorResponsepre-flight wired into all 5 automation failure paths.docs/mcp.md:PROVAR_PLUGIN_NOT_FOUNDadded to the 5 automation tools' error-code lists + a definition note.