PDX-476: fix(mcp): Copilot PR #161 follow-ups — AJV error mapping, catalog source shape, bin alias, prompt count + test coverage#164
Merged
Conversation
RCA: Four issues identified in post-merge Copilot review: AJV error mapping for additionalProperties/required used instancePath (parent object) instead of err.params, NITROX_CATALOG_SOURCE.json had an exposed repo field and missing schemasUpdated key, the provardx-cli bin alias was absent making npx resolution ambiguous, and prompt counts in README/docs were stale at 7 (now 11). Fix: ajvErrorToIssue now special-cases additionalProperties and required keywords to pull field/applies_to from err.params; committed JSON normalised to stable shape; package.json adds provardx-cli bin alias; README.md and docs/mcp.md updated to 11 MCP prompts.
…ies and required errors RCA: Copilot review noted that the new ajvErrorToIssue params-based mapping for additionalProperties and required keywords had no test coverage for the field and applies_to values, leaving the mapping free to silently regress. Fix: Expanded NX_SCHEMA_ADDITIONAL_PROPERTIES test to assert field and applies_to equal the extra property name; added NX_SCHEMA_REQUIRED case asserting field and applies_to equal the missing property name; added applies_to/field assertions to the NX_SCHEMA_TYPE test.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens NitroX AJV schema error reporting in the MCP validator by correctly identifying the offending field/path for additionalProperties and required errors, and adds regression tests to prevent future regressions. It also normalizes the published NitroX catalog-source metadata shape and makes npx -y @provartesting/provardx-cli ... resolve more predictably via an explicit bin alias, alongside doc count updates.
Changes:
- Fix
ajvErrorToIssueto derivefield/applies_tofromerr.paramsforadditionalPropertiesandrequired. - Normalize
docs/NITROX_CATALOG_SOURCE.jsonshape (removerepo, addschemasUpdated: null) and document prompt count update (7 → 11). - Add
provardx-clibin alias and expand unit test coverage for AJV keyword mappings.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/mcp/tools/nitroXTools.ts |
Improves AJV error-to-issue mapping for additionalProperties/required so field/applies_to point to the correct leaf property. |
test/unit/mcp/nitroXTools.test.ts |
Adds regression assertions for field/applies_to for additionalProperties, required, and type AJV errors. |
docs/NITROX_CATALOG_SOURCE.json |
Aligns the shipped catalog-source JSON to a stable resource shape by removing repo and adding schemasUpdated. |
package.json |
Adds provardx-cli as an additional npm bin alias to the same entrypoint. |
README.md |
Updates MCP prompt count from 7 to 11. |
docs/mcp.md |
Updates MCP prompt count from 7 to 11. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
42
to
45
| "bin": { | ||
| "provardx": "./bin/mcp-start.js" | ||
| "provardx": "./bin/mcp-start.js", | ||
| "provardx-cli": "./bin/mcp-start.js" | ||
| }, |
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
ajvErrorToIssueto derivefield/applies_tofromerr.paramsforadditionalPropertiesandrequiredAJV keywords (were silently using parent object path)docs/NITROX_CATALOG_SOURCE.jsonto stable resource shape: remove exposedrepofield, addschemasUpdated: nullprovardx-clibin alias inpackage.jsonsonpx -y @provartesting/provardx-cliresolves unambiguously by package nameREADME.mdanddocs/mcp.mdfieldandapplies_toon all three AJV keyword cases (additionalProperties,required,type)Jira
https://provartesting.atlassian.net/browse/PDX-476
Test plan
yarn compilepassesyarn test:onlypasses (955 passing)yarn lintpassesChanges
src/mcp/tools/nitroXTools.ts: special-caseadditionalProperties/requiredinajvErrorToIssueto pull property names fromerr.paramsdocs/NITROX_CATALOG_SOURCE.json: removerepo, addschemasUpdated: nullpackage.json: addprovardx-clibin aliasREADME.md,docs/mcp.md: update prompt count 7 → 11test/unit/mcp/nitroXTools.test.ts: assertfield/applies_tofor all three AJV keyword cases; addrequiredkeyword test