Skip to content

W-22203426: feat: move eval normalizer, formatter, YAML translator, and runner into library#276

Merged
WillieRuemmele merged 9 commits into
mainfrom
afr/W-22203426/eval-refactor-to-library
May 7, 2026
Merged

W-22203426: feat: move eval normalizer, formatter, YAML translator, and runner into library#276
WillieRuemmele merged 9 commits into
mainfrom
afr/W-22203426/eval-refactor-to-library

Conversation

@andresrivas-sf
Copy link
Copy Markdown
Contributor

Summary

@W-22203426@

  • Moves evalNormalizer, evalFormatter, yamlSpecTranslator from plugin-agent into this shared library so any consumer can use them without depending on the CLI plugin
  • Adds a new agentEvalRunner module that encapsulates resolveAgent, executeBatches, and buildResultSummary (API execution logic previously embedded in the run-eval command)
  • Exports all four modules from the package index.ts
  • Adds comprehensive unit tests: 279 tests across evalNormalizer, evalFormatter, yamlSpecTranslator, and agentEvalRunner

Test plan

  • yarn compile passes in agents repo
  • yarn test passes in agents repo (all new test files: evalNormalizer, evalFormatter, yamlSpecTranslator, agentEvalRunner)
  • No regressions in existing agents tests
  • After merging and bumping version, companion PR in plugin-agent resolves correctly

🤖 Generated with Claude Code

…nd runner into library

Extracts evalNormalizer, evalFormatter, yamlSpecTranslator, and the new
agentEvalRunner module from plugin-agent into the @salesforce/agents library
so any consumer can use them directly without depending on the CLI plugin.
All four modules are exported from the package index.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
andresrivas-sf and others added 2 commits May 5, 2026 14:12
- Export EvalOutput, EvalResult, TestError, TestResult from evalFormatter so
  callers get proper types without casting
- Rewrite buildResultSummary using the exported types, eliminating all
  Record<string,unknown> casts
- Type AgentEvalRunResult.tests[].evaluations and .outputs as EvalResult[]/EvalOutput[]
- Improve resolveAgent error messages to include actionable suggestions
- Fix evalCounter to only increment when an id is auto-generated
- Replace as-any stub cast with as-unknown StreamPromise in tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread src/agentEvalRunner.ts Outdated
const conn = org.getConnection();

// Escape single quotes to prevent SOQL injection
const escapedApiName = apiName.replace(/'/g, "\\'");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you'll want to escape it like this

const escapedApiName = apiName.replace(/'/g, "''");     

Comment thread src/agentEvalRunner.ts Outdated
`SELECT Id FROM BotDefinition WHERE DeveloperName = '${escapedApiName}'`
);
if (!botResult.records.length) {
throw new Error(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

these should be SfErrors. There's a few other just plain Errors not SfErrors

andresrivas-sf and others added 5 commits May 7, 2026 16:29
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…scratch orgs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…blic API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@WillieRuemmele
Copy link
Copy Markdown
Member

QA Notes:


done here: salesforcecli/plugin-agent#413 (comment)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@WillieRuemmele WillieRuemmele merged commit 95a0b63 into main May 7, 2026
15 checks passed
@WillieRuemmele WillieRuemmele deleted the afr/W-22203426/eval-refactor-to-library branch May 7, 2026 22:19
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