feat(eval): grouped help and command examples for the eval commands - #2262
feat(eval): grouped help and command examples for the eval commands#2262jariy17 wants to merge 4 commits into
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Reviewed the router mechanism (flags.tsx, handler.tsx, router.tsx, index.tsx), the --evaluator → --evaluators rename across the 8 handlers, and the SDK bump.
- The
Flag.groupplumbing is minimal and correctly optional; ungrouped flags stay in Commander's default section. Handler.examplesis optional and read off the authored node incompile(), so middleware wrappers (which only need to forwardhandle) don't have to carry it.withEffectiveTuiSupportalso forwards it viahandler.examples?.()so nothing gets dropped through TUI wrapping.- The
-h, --helprelocation toOther options:correctly triggers only whenownFlags.some(f => f.group), keeping unchanged behavior for commands that don't opt in. - New router tests cover: heading ordering, ungrouped flags remaining in
Options:,-hplacement in both cases, examples rendering exactly once afterParameter details:, and the no-examples case. - The rename is complete: no leftover
"--evaluator"argv,flag("evaluator", …), orflags["evaluator"]reads insrc/, and the singularevaluatorresource-type enum inproject removeis correctly left alone (it's a resource selector, not a flag list). Error messages updated to'--evaluators <evaluators...>'. All corresponding fixture/unit tests updated in the same PR. - SDK bump to
3.1129.0on both agentcore clients is scoped and justified for the follow-up PRs.
No changes requested.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2262 +/- ##
==========================================
Coverage 97.05% 97.06%
==========================================
Files 566 568 +2
Lines 39228 39343 +115
==========================================
+ Hits 38073 38188 +115
Misses 1155 1155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
662bc9b to
e6da03d
Compare
|
Claude Security Review: no high-confidence findings. (run) |
560bd65 to
b14c0dc
Compare
| import type { SessionSourceValue, SessionWindow } from "./types"; | ||
|
|
||
| export class SessionSource { | ||
| // Declared source-arms first so `--help` lists the source heading above the |
There was a problem hiding this comment.
remove this comment.
| return `\nParameter details:\n\n${sections.join("\n\n")}\n`; | ||
| } | ||
|
|
||
| // Indentation of a rendered example: the description sits one level in, the |
There was a problem hiding this comment.
remove code comments everywhere
…bulary Review feedback on #2262: - Each handler names its own `--help` headings; the shared HELP_GROUP module is gone, along with its unit test. - The Examples mechanism is removed entirely — Handler.examples, formatExamples, commandExamples, and the router tests that covered them. Worked invocations now live in each flag's `help:` block, which `--help` renders under "Parameter details" the way `harness create` already does. - Code comments added by the previous two commits are removed. Flags taking an API-shaped object gain that long-form documentation: --data-source-config (separately for the data-plane and control-plane shapes, which differ), --ground-truth, --filters, and --payload-template. Their one-line descriptions shrink to a type name, matching harness create.
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
Two presentation mechanisms for commands whose option list has grown past
the point of skimming. No command uses either yet — the follow-up PRs that
add flags to batch-evaluation and online-evaluation consume them.
Help groups:
- Flag.group renders through Commander's Option.helpGroup(), so a command can
carry semantic headings instead of one flat "Options:". Ungrouped flags keep
Commander's default section, so nothing changes for commands that opt out.
- A command that groups its flags gets its generated -h/--help moved to
"Other options:". Left alone it sits by itself under "Options:", reading as
though it were the command's only ungrouped flag.
Examples:
- Handler.examples takes { description, command } entries and the renderer owns
the layout. `command` is authored as the shell command with no indentation:
a string renders on one line, an array joins with backslash continuations.
Splitting the array is how the author picks the break points, which keeps a
terminal-width heuristic out of it and keeps the printed command pasteable.
- commandExamples() mirrors commandParameterDetails(): Commander omits added
help text from helpInformation(), so a TUI rendering has to ask for it or
silently drop it.
Applies the router's group and example mechanisms to the five eval commands whose option lists had grown past skimming. Presentation only — no flag is added, removed, or renamed, and no request changes. One shared vocabulary (src/handlers/eval/helpGroups.tsx) rather than per-command headings: batch evaluation, batch insights, and online evaluation all name a session source, narrow it, and apply evaluators, so the same concept should read the same in all three. Naming the headings in one place also means a typo cannot silently split one heading into two. Notable placements: - `--name`/`--description`/`--kms-key-arn` sit under "Configuration:" rather than an "Evaluation options:" heading that would also have to hold encryption. - `--endpoint` joins "Session source:" on online-eval create instead of taking a heading of its own for one flag. - SessionSource declares its source arms before its filters, because Commander orders headings by the first flag declared in each. Its descriptions lose the "source:"/"filter:"/"time filter:" prefixes, which the headings now carry. Examples are worked invocations per command, covering each source arm and each authentication and dataset mode. batch-insights run gets groups but no examples. The new test asserts what the router's own rendering tests cannot: that every flag on these commands carries a group, that the group comes from the shared vocabulary, that a heading's flags are declared contiguously, and that no example names a flag its command does not declare.
…bulary Review feedback on #2262: - Each handler names its own `--help` headings; the shared HELP_GROUP module is gone, along with its unit test. - The Examples mechanism is removed entirely — Handler.examples, formatExamples, commandExamples, and the router tests that covered them. Worked invocations now live in each flag's `help:` block, which `--help` renders under "Parameter details" the way `harness create` already does. - Code comments added by the previous two commits are removed. Flags taking an API-shaped object gain that long-form documentation: --data-source-config (separately for the data-plane and control-plane shapes, which differ), --ground-truth, --filters, and --payload-template. Their one-line descriptions shrink to a type name, matching harness create.
Each handler declares the headings it uses once at the top of its own file rather than repeating the string at every flag — "Session source (choose exactly one):" was written three times in online-eval create alone. Declared in first-appearance order so reading them top-down matches the order the headings render. Nothing is shared between files: CONFIGURATION is declared independently in the four handlers that use it, and sessionSource owns SESSION_SOURCE and SOURCE_FILTERS because it declares those flags. `--help` output is byte-identical for all five commands.
ca176e6 to
c8936e9
Compare
|
Claude Security Review: no high-confidence findings. (run) |
I have decided to implement help groups using the Commander helpGroup feature. As shown below, organizing flags into groups makes it easier for users to understand how each flag functions within the command.
agentcore eval batch-evaluation evaluateBefore (
refactor):After (this PR):
agentcore eval batch-evaluation simulateBefore (
refactor):After (this PR):
agentcore eval batch-insights runBefore (
refactor):After (this PR):
agentcore eval online-eval createBefore (
refactor):After (this PR):
agentcore eval online-eval updateBefore (
refactor):After (this PR):
Tests
Router (6 new): heading names and ordering, ungrouped flags staying in
Options:,-hplacement with and without groups, examples rendering exactly once afterParameter details:, backslash continuation for array commands vs single-line for strings, and the no-examples case.Handlers (14 new,
src/handlers/eval/helpGroups.test.ts): asserts what the router's rendering tests cannot — that every flag on these five commands carries a group, that the group comes from the shared vocabulary, that a heading's flags are declared contiguously (a stray one would reorder the headings), and that no example names a flag its command doesn't declare.Mutation-checked: ungrouping a flag, hand-typing a heading that drifts from the vocabulary, and misspelling a flag inside an example each fail a test.
Verification
bun test— 3199 pass, 0 fail (225 files)bun run typecheck,bun run lint:check,bun run format:check— clean*.screen.test.tsxsuites don't assert on these commands' option layoutFollow-ups
#2265 adds
--output-configto batch-evaluation, renames--qualifier→--endpoint, and makes--start-time/--end-timerequire a timezone. #2266 does the online-eval equivalents plus the managed-role widening.