Repository navigation
feat(frontend): shared evaluation logic for /m, and the live card shows the run value - #8164
Conversation
…live card value Copy the old app's run-level metric aggregation, metric cell text, runs list filters, CSV export helpers and compare rules into @agenta/entities/evaluationRun as pure functions, with tests on real API responses. The invocation metrics come from the invocation step only, which fixes the old app's 261 ms (an evaluator step averaged in). The live overview card now shows the whole run's value, the same number as the summary table, instead of the newest minute. Entire-Checkpoint: 01M6R7H5Q39S1AW5SSYZ9Q1MBS
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Website previewPreview URL: https://pr-8164-agenta-website-preview.mahmoud-637.workers.dev Built from |
Railway Preview Environment
Preview use finished or expired. Environment absence verified; retained storage requires separate provider accounting. Post |
…ure user formatMetricNumber dropped the zeros of whole numbers (100 -> "1"); it now strips trailing zeros only after a decimal point. csvCell prefixes text that starts with =, +, -, @, tab or carriage return with a quote, so a spreadsheet does not run it as a formula. The fixtures use a made-up user id. Entire-Checkpoint: 01M6RCPXCQ4AF87KFAZ32NNNHH
|
🤖 The AI agent says: Fixed the batch review items in 394fc2d: |
Context
The /w vs /m comparison found two numbers that disagree on the same run:
The evaluations plan (Decision 2) also asks for the pure /w logic that /m lacks (metrics, filters, export, compare) to live once in
@agenta/entities, so the next /m evaluation PRs (list columns, filters, run header, scenarios, compare, live) build on it instead of writing it again.Changes
/m fix. The live overview card now shows the whole run's value, the same number as the summary table. The chart lines are unchanged.
Shared logic in
@agenta/entities/evaluationRun/core, copied fromweb/ossas pure functions (no antd, no state):runStatsMap.tsEvalRunDetails/atoms/runMetrics.ts{stepKey}.{metricKey}and{metricKey}entries, merges stat blobs, reads the mean and total of an invocation metric. Invocation metrics come from the invocation step only (the /w bug above is not copied).metricFormat.ts@agenta/ui/cell-renderersmetric formattersrunFilters.tsreferencePayload.ts,previewRunsRequest.ts, filter summaryPOST /evaluations/runs/querybody, the filter count.runExport.tsuseTableExportand the list export resolversrunCompare.tsatoms/compare.ts,state/urlCompare.ts,CompareRunsMenu.tsx?compare=value, the 4-run cap, whether a run can be compared and why not, and which runs can be compared with it.Nothing in /m reads the new functions yet except the tests; the follow-up PRs (7.1, 7.2, 7.6, 7.7, 7.11) wire them in.
web/ossis not changed, so /w keeps its 261 ms until it retires.Tests
tests/unit/evaluation-run-shared-logic.test.ts(entities, 17 tests) runs every function on real API responses captured from a test stack: two finished auto runs on the same test set and a live run. It pins 522 ms for the app duration, reproduces the 261 ms /w printed and why, and checks the /w cell texts, the runs query body, the flags, the CSV escaping and the compare candidates.runOverviewCharts.render.test.tsx(/m): a new test that the live card shows 95.45% next to a newest minute at 0%. It fails without the fix.@agenta/entities,@agenta/mobileand@agenta/oss(the package changed, so /w was checked too). Lint passes on the changed files./m without developer mode does not change: the only screen change is inside the Evaluations results page, which is a developer view (stage
hidden) and only opens with beta developer mode or a deployment that forces it on.What to QA