fix(cli): quick mode runs ad-hoc instead of minting a quick-<timestamp> benchmark per invocation; ambiguity-safe -n name reuse - #476
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit c312d82.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
…arks; harden findBenchmark name reuse Phase 1 of benchmark dedup: stop the two CLI paths that grew the benchmarks list on every invocation of the same command. - Quick mode (bare 'benchmark' with no server running) previously created a fresh 'quick-$(Date.now())' Benchmark doc per run. It now delegates to the unified evaluation-runs API as an ad-hoc run over all stored test cases (sources: test-case-ids), creating zero Benchmark docs. Server lifecycle preserved via forceStopServer (teardown remains ownership-gated in createServerCleanup: only a process this invocation spawned is stopped). - findBenchmark resolves: exact id > exact name > UNIQUE trimmed/ case-insensitive match, so a case/whitespace variant reuses the existing benchmark instead of minting a duplicate. findBenchmarkDetailed distinguishes not-found from AMBIGUOUS: when 2+ benchmarks collide case-insensitively, the -n flows error listing the collisions — the CLI neither guesses nor creates a third near-duplicate (adversarial-review finding, addressed). Tests: unit (quick-mode action pins ad-hoc contract + no createBenchmark; findBenchmark/Detailed matrix incl. ambiguity), integration (two identical ad-hoc runs leave benchmark entities unchanged). Signed-off-by: goyamegh <goyamegh@amazon.com>
…lock.json origin/main's package-lock.json carries name '@goyamegh/agent-health' — a fork-side package rename (used for fork npm publishing) that leaked upstream via the opensearch-project#437 branch repair. package.json correctly says '@opensearch-project/agent-health'; regenerating the lockfile restores the authoritative scope. No dependency changes. Signed-off-by: goyamegh <goyamegh@amazon.com>
d25c026 to
c312d82
Compare
|
Re: Code-Diff-Analyzer high finding on
In other words: the analyzer is right that scope changes matter, but the hijack-shaped state is the one currently on |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #476 +/- ##
==========================================
- Coverage 69.04% 69.01% -0.03%
==========================================
Files 393 393
Lines 32217 32217
Branches 9527 9527
==========================================
- Hits 22243 22234 -9
- Misses 7796 7812 +16
+ Partials 2178 2171 -7
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Description
Re-running the bare
agent-health benchmarkcommand (quick mode) created a freshquick-${Date.now()}Benchmark doc on every invocation, growing the benchmarks list unbounded — runs are per-invocation, benchmarks are not. This was the remaining un-landed piece of the benchmark-dedup work: #437 shipped the content-addressed images + doctor, but the quick-mode CLI change itself was inadvertently dropped from that PR during a branch repair (the 0.6.0 changelog listed it in error — corrected here with an erratum note).Changes
benchmark(no-n/-f, no server running) now routes through the existing unified evaluation-runs API as an ad-hoc run over all stored test cases. Zero Benchmark docs created; the run appears on Evaluations → Runs with the standard "promote to benchmark" affordance. Legacy server lifecycle preserved (starts its own server, stops it afterwards — teardown remains ownership-gated increateServerCleanup, it only ever stops a process it spawned).findBenchmarkname reuse, ambiguity-safe. Resolution is now: exact id → exact name → unique trimmed/case-insensitive match, so-n "my bench "reusesMy Benchinstead of minting a duplicate. A newfindBenchmarkDetaileddistinguishes not found from ambiguous: when 2+ benchmarks collide case-insensitively (Foo+FOO), the-nflows error listing the collisions — the CLI neither guesses nor creates a third near-duplicate under the colliding name.Behavior changes (intentional): quick mode no longer leaves a
quick-*benchmark behind (use run promotion instead);-nwith a case/whitespace variant of exactly one existing benchmark now reuses it instead of creating a new one.Testing
test-case-idssources, nocreateBenchmarkcall);findBenchmark/findBenchmarkDetailedmatrix (exact-over-fuzzy, unique fuzzy reuse, ambiguous → surfaced collisions). Full unit suite: 5,705 passed.benchmarkId, no benchmark references the seeded test case, no newquick-*benchmark appears.benchmark -a demotwice → 0 Benchmark docs, 2 ad-hoc runs (server stamps both with the same image digest, confirming the dedup convergence shipped in feat: content-addressed benchmark images, benchmark doctor, and quick-mode dedup — shared, comparable benchmarks via CLI #437).An adversarial model review (gpt-5.4) was run on the diff; its findings (ambiguity-created duplicates in the create-if-missing
-npath, teardown ownership) were addressed in this revision — ambiguity is now a hard error, and teardown was verified ownership-gated.Check List
--signoff