Develop tarun - #235
Closed
Provar-tarunprashar wants to merge 9 commits into
Closed
Conversation
Release 1.6.0 — merge develop → main
RCA: org_describe resolved the Provar workspace via a sibling workspace-<name> dir; the layout needed updating so the project's parent directory is treated as the workspace root. Fix: workspaceCandidates now yields <parent>/, <parent>/Provar_Workspaces/workspace-<basename>/, and ~/Provar/workspace-<basename>/; discoverWorkspace requires a .metadata dir so candidate 1 falls through when the parent is not a workspace; removed the now-unused projectNameDashes helper and updated tests and docs.
…examples, and generation-gap guidance
Improves Provar test-case generation grounding and validation so a Salesforce
UI test case can no longer validate as "perfect" while being unrunnable, and so
the model is steered to the correct step shapes at generation time.
## Issues found
1. Local (no-auth) validation only checked required arguments for UiAssert, so a
test case missing required args on UiConnect/UiWithScreen/UiDoAction/etc.
still scored 100/100 (validity + quality) — a misleading "verified" signal.
2. The bundled step schema (provar_test_step_schema.json) had wrong UI
required-args: phantom screenName (UiWithScreen), formLocator (UiFill),
tableLocator/rowSelector (UiWithRow), action (UiHandleAlert), and a UiAssert
required set that contradicted the reference doc and the corpus rule.
3. Tool descriptions told the model to fall back to reading the
provar://docs/step-reference MCP *resource*, which a tools-only client cannot
read — a dead-end fallback.
4. examples_retrieve returned count:0 with no usable fallback when no API key was
configured, leaving first-test-case generation with zero grounding.
5. Second round of gaps (verified against docs/PROVAR_TEST_STEP_REFERENCE.md):
- Salesforce UI tests generated with UiConnect instead of ApexConnect.
- Dangling connection references (downstream uiConnectionName did not match
the connect step's resultName).
- Invalid interaction name (interaction=click) instead of action/set/file.
- UiAssert field assertions emitted as flat <namedValues> instead of the
nested <uiFieldAssertion> structure.
6. Root cause behind ProvarTesting#5: the local structural rules only ran on TOP-LEVEL
apiCalls; every real UI action/assert lives nested under UiWithScreen
substeps, so those rules never fired on real UI steps. Net effect: the broken
sample scored 100 while the correct sample scored lower (inverted signal).
## Solution added
- Made local validation schema-driven and recursive: a new STEP-REQUIRED-ARGS-001
rule derives required args per apiId from the (corrected) schema and applies to
ALL step types; per-call structural rules now recurse into nested substeps.
- Corrected the schema's UI required-args against the authoritative reference doc.
- Added provar_step_schema tool (the callable form of the schema resource) and
repointed the "read the resource" fallbacks to it.
- Added an offline bundled-examples fallback for examples_retrieve (no/invalid
key), guarded by a test that re-validates every bundled example.
- Added rules to catch the 2nd-round gaps: UI-INTERACTION-002 (bad interaction
name), extended UI-ASSERT-STRUCTURE-001 (namedValues shape), SF-CONNECT-TYPE-001
(UiConnect w/o ApexConnect on a SF UI test), CONNECT-REF-CONSISTENCY-001
(dangling connection reference).
- Enriched the schema guidance (single source of truth surfaced by
provar_step_schema) so generation is steered right: pattern opens with
ApexConnect, interaction vocabulary (action/set/file, never click), nested
uiFieldAssertion requirement, connection resultName/reference consistency.
## Changes by file (what & why)
- src/mcp/rules/provar_test_step_schema.json — corrected phantom UI required-args
to match the reference doc; enriched validation_rules with connect-selection,
interaction-vocabulary and nested-assert guidance; fixed the ui_interaction_pattern
to open with ApexConnect (was UiConnect). This is the single KB the validator,
generator guidance, and provar_step_schema all read.
- src/mcp/tools/bestPracticesEngine.ts — added schema-driven STEP-REQUIRED-ARGS-001
(major) that reads required_arguments from the schema for every apiId (excludes
UiAssert + NitroX variants, which have dedicated rules).
- src/mcp/rules/provar_best_practices_rules.json — registered STEP-REQUIRED-ARGS-001.
- src/mcp/tools/testCaseValidate.ts — made per-call validation recurse into nested
substeps; added UI-INTERACTION-002, SF-CONNECT-TYPE-001, CONNECT-REF-CONSISTENCY-001;
extended UI-ASSERT-STRUCTURE-001 to catch the namedValues shape; repointed the
step-reference fallback to provar_step_schema.
- src/mcp/rules/provar_layer1_rules.json — cataloged the new Layer-1 rule ids
(drift-guard source of truth).
- src/mcp/tools/stepSchemaTools.ts (new) — provar_step_schema tool: returns a
step's required/optional args by api_id, a category listing, or the full index.
- src/mcp/server.ts — import + register provar_step_schema (authoring group).
- src/mcp/examples/bundledExamples.ts (new) — a known-correct, validated
create+verify Account example + selection helper for the offline fallback.
- src/mcp/tools/qualityHubApiTools.ts — examples_retrieve returns bundled examples
(source:"bundled") on no-key/invalid-key; repointed the fallback hint.
- src/mcp/tools/testCaseGenerate.ts / testCaseStepTools.ts — repointed the
"read the resource" fallbacks to the provar_step_schema tool.
- scripts/mcp-smoke.cjs — added a provar_step_schema smoke call.
- docs/mcp.md, docs/VALIDATION_RULE_REGISTRY.md, README.md — documented the new
tool, rules, bundled-example behavior; regenerated the rule registry; tool
count 42 -> 43.
- test/fixtures/account-ui-gaps-bad.testcase, account-ui-gaps-good.testcase (new)
— the broken vs corrected samples, wired in as dogfood fixtures.
- test/unit/mcp/*.test.ts — new/updated tests for every change (see Testing).
## Testing done
- Full repo suite: 1535 passing, 0 failing (fresh, no wireit cache).
- tsc --noEmit clean; eslint clean on all changed files.
- Dogfood: account-ui-gaps-bad fires all four gap rules and is_valid=false;
account-ui-gaps-good is clean of the gap rules and is_valid=true.
- Drift guards: every bundled example re-validates to quality_score 100 / zero
violations; schema guidance is asserted (pattern opens with ApexConnect,
interaction vocab lists action/set and forbids click, UiAssert requires
uiFieldAssertion).
- End-to-end via the local MCP server (provar_step_schema returns correct args;
examples_retrieve returns bundled examples on no key). Generation manually
confirmed to now emit ApexConnect + action/set + nested assert.
- Note: scripts/mcp-smoke.cjs targets the globally-installed (published) plugin,
not the local build, so it validates these changes only after publish/CI.
## Codex review summary (working tree vs origin/main)
- [P1] "Imported modules not in the commit" — the new files (stepSchemaTools.ts,
bundledExamples.ts) were untracked at review time; they ARE included in this
commit, so a clean checkout builds. Resolved.
- [P2] provar_step_schema is only registered in the `authoring` tool group, so a
PROVAR_MCP_TOOLS=validation session (where validate errors now tell the user to
call provar_step_schema) would not have it available. Known follow-up: also
register it for validation-only sessions (or keep a resource fallback in that
guidance). Not addressed in this commit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Provar-tarunprashar
added a commit
to Provar-tarunprashar/provardx-cli
that referenced
this pull request
Jul 28, 2026
…t rules, fix apiId allow-list Req: Port PR ProvarTesting#235's schema-driven validation work onto a repo-hosted branch so CI can run, and reconcile every step-schema entry against real Provar test cases before any of it is used for scoring. Fix: Reconciled all 73 schema entries against a 1457-file corpus and a freshly IDE-minted test case, split arguments into required/recommended/ide_emitted tiers, aggregated the schema rules so scoring damping applies, deduped them against existing mustContainArgument rules, removed click from the interaction denylist, taught the connection rule to read project connections, and corrected the Provar AI apiId allow-list. Originally authored by Tarun Prashar (PR ProvarTesting#235, raised from a fork so CI could not run). Ported here with review findings folded in. ## Why the original could not ship Measured over 2,701 real customer/POC/demo .testcase files: - 166 previously-valid test cases flipped to is_valid=false, 164 of them because UI-INTERACTION-002 denylisted `click` as a hallucination. `click` is a real Provar interaction with 1,240 well-formed corpus occurrences, emitted by the IDE recorder, and third in frequency behind action (15,983) and set (11,787). - 704 files (26.1%) dropped below the quality threshold; mean quality_score fell 97.53 -> 86.87. STEP-REQUIRED-ARGS-001 promoted the entire bundled schema from a documentation aid to a scoring ruleset in one step, and the schema had never been audited for that job. ## Schema reconciliation 59 of 73 entries failed reconciliation. Phantom required-args appearing zero times in both the reference doc and the corpus included ForEach valuePath/iterationPathName (real: list/valueName), RestRequest webConnectionName/endpoint/method (real: connectionName/restResourceUrl), StepGroup name (0 of 6,750 real steps carry it as an argument -- Provar uses the apiCall name= attribute), Read dataUrl (real: urlString), Split delimiter (real: separator), Match pattern (real: regex), Replace searchString (real: find), and UiFill locator, which alone dropped a genuine IDE-exported fixture to 42.75. 28 further entries carried phantom argument NAMES in optional_arguments -- never scored, so no rule caught them, but provar_step_schema serves the entry verbatim to the generating model, which is how names like screenName and formLocator kept propagating. Dropped where the corpus has >=20 instances; retained below that, where absence is weak evidence. ## Three argument tiers required_arguments means Provar fails without it. ide_emitted_arguments means the IDE always writes it, even empty (ApexConnect carries 18 on 100% of 1,524 instances). Conflating the two caused the over-gating. recommended_arguments covers the 80-99% band. STEP-REQUIRED-ARGS-001 (major) scores the first, STEP-RECOMMENDED-ARGS-001 (minor) the second, STEP-IDE-PARITY-001 (info, weight 1) the third -- so nothing is silently unchecked, but IDE-parity drift costs under 2 points. ## Scoring and deduplication STEP-REQUIRED-ARGS-001 emitted one violation per step. calculateBPScore damps a single violation logarithmically but sums per-violation penalties linearly, so per-step emission bypassed the damping entirely: a 71-step file deducted 266 points (score 0) where the aggregated form costs 26.8. All three tier rules now emit one violation carrying a count. (apiId, argument) pairs already covered by a dedicated mustContainArgument rule are read from the catalogue at runtime and suppressed, resolving 21 pairs and 16 duplicate checks. ## Provar AI apiId allow-list API-UNKNOWN-001 (critical, weight 10, bridged into is_valid) listed the AI namespace as ...forcedotcom.core.testapis.ai.*, which exists in no real file. The IDE writes com.provar.core.ai.api.*, so the validator declared genuine IDE-authored XML nonexistent. Pre-existing on develop. Both the current and the corpus-attested legacy ...testapis.generate.* namespaces are now allowed. ## Guidance that resolves All 11 fallbacks naming the unreadable provar://docs/step-reference resource now name the provar_step_schema tool, and that tool is registered in the validation, qualityhub and authoring groups so the recovery path works in a filtered session. Registrars are deduped in the group loop, since a tool in multiple groups would otherwise be registered more than once. CONNECT-REF-CONSISTENCY-001 now resolves references against the project's .testproject connections as well as connect-step resultNames, and suppresses when a connect step's name is non-literal. This removed 66 false positives on project-level connections. examples_retrieve is relevance-gated: an off-topic query returns nothing rather than an unrelated Salesforce UI example, and `source` (corpus/bundled/none) is set on every path. The bundled example itself was not IDE-faithful -- it omitted 19 IDE-emitted arguments -- and has been corrected. ## Result over the same 2,701 files is_valid flips 166 -> 2 (both genuine load-blocking defects). Files below threshold 704 -> 1. Mean quality_score 97.518 -> 97.611, above baseline, with 12 files recovering is_valid from the apiId fix. 1543 unit tests passing, tsc and eslint clean. Co-Authored-By: Tarun Prashar <tarun.prashar@provartesting.com>
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.
fix(mcp): schema-driven validation, provar_step_schema tool, bundled examples, and generation-gap guidance
Improves Provar test-case generation grounding and validation so a Salesforce
UI test case can no longer validate as "perfect" while being unrunnable, and so
the model is steered to the correct step shapes at generation time.
Issues found
test case missing required args on UiConnect/UiWithScreen/UiDoAction/etc.
still scored 100/100 (validity + quality) — a misleading "verified" signal.
required-args: phantom screenName (UiWithScreen), formLocator (UiFill),
tableLocator/rowSelector (UiWithRow), action (UiHandleAlert), and a UiAssert
required set that contradicted the reference doc and the corpus rule.
provar://docs/step-reference MCP resource, which a tools-only client cannot
read — a dead-end fallback.
configured, leaving first-test-case generation with zero grounding.
the connect step's resultName).
nested structure.
apiCalls; every real UI action/assert lives nested under UiWithScreen
substeps, so those rules never fired on real UI steps. Net effect: the broken
sample scored 100 while the correct sample scored lower (inverted signal).
Solution added
rule derives required args per apiId from the (corrected) schema and applies to
ALL step types; per-call structural rules now recurse into nested substeps.
repointed the "read the resource" fallbacks to it.
key), guarded by a test that re-validates every bundled example.
name), extended UI-ASSERT-STRUCTURE-001 (namedValues shape), SF-CONNECT-TYPE-001
(UiConnect w/o ApexConnect on a SF UI test), CONNECT-REF-CONSISTENCY-001
(dangling connection reference).
provar_step_schema) so generation is steered right: pattern opens with
ApexConnect, interaction vocabulary (action/set/file, never click), nested
uiFieldAssertion requirement, connection resultName/reference consistency.
Changes by file (what & why)
to match the reference doc; enriched validation_rules with connect-selection,
interaction-vocabulary and nested-assert guidance; fixed the ui_interaction_pattern
to open with ApexConnect (was UiConnect). This is the single KB the validator,
generator guidance, and provar_step_schema all read.
(major) that reads required_arguments from the schema for every apiId (excludes
UiAssert + NitroX variants, which have dedicated rules).
substeps; added UI-INTERACTION-002, SF-CONNECT-TYPE-001, CONNECT-REF-CONSISTENCY-001;
extended UI-ASSERT-STRUCTURE-001 to catch the namedValues shape; repointed the
step-reference fallback to provar_step_schema.
(drift-guard source of truth).
step's required/optional args by api_id, a category listing, or the full index.
create+verify Account example + selection helper for the offline fallback.
(source:"bundled") on no-key/invalid-key; repointed the fallback hint.
"read the resource" fallbacks to the provar_step_schema tool.
tool, rules, bundled-example behavior; regenerated the rule registry; tool
count 42 -> 43.
— the broken vs corrected samples, wired in as dogfood fixtures.
Testing done
account-ui-gaps-good is clean of the gap rules and is_valid=true.
violations; schema guidance is asserted (pattern opens with ApexConnect,
interaction vocab lists action/set and forbids click, UiAssert requires
uiFieldAssertion).
examples_retrieve returns bundled examples on no key). Generation manually
confirmed to now emit ApexConnect + action/set + nested assert.
not the local build, so it validates these changes only after publish/CI.
Codex review summary (working tree vs origin/main)
bundledExamples.ts) were untracked at review time; they ARE included in this
commit, so a clean checkout builds. Resolved.
authoringtool group, so aPROVAR_MCP_TOOLS=validation session (where validate errors now tell the user to
call provar_step_schema) would not have it available. Known follow-up: also
register it for validation-only sessions (or keep a resource fallback in that
guidance). Not addressed in this commit.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com