Repository navigation
feat(frontend): Playground compare view in /m behind the developer view switch - #8049
Conversation
|
Caution Review failedThe pull request is closed. Summary
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-8049-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 |
|
🤖 The AI agent says: Live QA on a fresh OSS stack (head 4c66443), with Mistral runs. /w playground (shared code changed by this PR): all 8 checks pass.
/m compare view (hidden): at 1440 px, the variables, the commit in the second column and the close prompt all pass. At 390 px the same checks pass, but the result columns sit to the right of the input column, so the page scrolls sideways. That is a follow-up. |
The delete tests waited a fixed 180 ms after the click. On a busy machine the app lists reload later than that, and the selection check ran too early.
+ Compare copies the last revision into a local draft, or adds a picked revision. With two or more revisions the playground shows the compare view, loaded on demand: a variant column (move left, move right, close), one config column per revision, a sticky input column, and completion or chat rows with one output column per revision. The config and run areas scroll sideways together. Fixes against the old playground: closing a revision drops its draft and asks first from the menu too; the chat compare Run bar shows Cancel while it runs; a commit in any column replaces that column, not the first.
The test cases, messages and results live under the anchor revision, which a reorder keeps in place. A commit of the column at index 0 was taken as the anchor swap and moved the state away; closing the anchor left the state behind. The swap now follows the real anchor, and closing it moves the state to the new first column. The shared input column now asks for every variable any compared revision uses, and the variant card averages read each run's trace, as the output footer does.
…he anchor moves A run cleaned the shared test case row against its own revision and deleted the inputs another compared revision reads. The clean, at run time and after an anchor commit, now keeps every root revision's input keys; the request is still filtered per revision. A run in flight writes to the loadable it started under, so moving the anchor state left the other column waiting forever. Runs are now stopped before the anchor state moves.
f61b10c to
eb091cf
Compare
4c66443 to
767480a
Compare
…ew-playground-compare # Conflicts: # web/mobile/src/features/playground/PlaygroundWorkspace.tsx
Do not merge into v0.128.4. This goes into the next release.
Stacked on #8046 (playground input extras and focus drawer), which is stacked on #8041 (playground revision actions). The base of this PR is
feat/m-view-playground-inputs-extra. It needs both: the compare columns reuse the revision bar from #8041 and the row parts from #8046. Merge #8041, then #8046, then this one.Context
The /m playground shows one revision at a time. In /w you can put two or more revisions side by side and run the same test cases or chat turn on all of them. This PR adds that compare view to /m. It is playground PR 6.
Before the review loop finished, the work also changed shared state code in
@agenta/playground, which the /w compare view uses. Those changes need a /w compare live check before this ships (see Package changes and Open problems).It ships hidden
The playground is reachable only when the
playgrounddeveloper view is enabled. This PR adds no route, no navigation entry, no dependency and no antd. The compare view loads withnext/dynamiconly when two or more revisions are selected, so the single view never downloads it.What the compare view does
mdup. The config area has a "Variants" column with one card per revision, then one config column per revision, each with its own revision bar (switch, Commit, Deploy, menu). The run area has a sticky input column, then one output column per revision. Both areas scroll sideways together.md, and each column is 85% of the screen wide.Left out on purpose: drag and drop reorder (Move left and Move right replace it), a drag handle on the split, and the per-row "Create local copy for comparison" button in the picker (it shows on hover only, and "Compare" already copies the last column).
/w bugs fixed in /m
Package changes and their effect on /w
@agenta/playground(used by /w). These came out of review rounds 1 and 2 and change how the /w compare view behaves:derivedLoadableIdAtom).setEntityIdstreated the column at index 0 as the anchor, so after a reorder a commit moved the shared state to the wrong place. The anchor swap now follows the real anchor.referencedVariableKeysAtomFamilynow returns the variables of every revision on screen, not only the anchor's, so the input column shows the union.In a single-revision playground these paths do not run, but in /w compare they do. Tests in
playgroundCompareRuns.render.test.tsxcover each case on the real controllers.@agenta/playground-ui(/m only): the newpanels/comparefolder,CompareButtonandRevisionTreeinpanels/config(the switcher now shares the tree),usePlaygroundScrollSyncmoved into the package (without theuse-animation-framedependency /w uses), an optionalentityIdonRunsPanelHeader(none means all revisions),hideUserMessageonChatTurn, and anonRerunoverride onChatMessage.This PR also makes the delete tests from #8041 wait for the selection in place of a fixed 180 ms wait, which was flaky on a busy machine.
New user-facing text
Strings not copied from /w:
The other strings ("Compare options", "Discard unsaved changes?", the two close messages, "Close panel", "Generations", "Chat") are copied from /w.
Checks
release/v0.128.4(atd5bc67afec, with feat(frontend): evaluators and archived evaluators in /m behind the developer view switch #8007 and fix(frontend): pass the leave question to the shared unsaved guard in the test set editor #8031):@agenta/mobileand@agenta/oss(/w) pass.playgroundRevisionActions.render.test.tsxpassed 27 of 27 when it ran alone. When the machine was busy, four of its delete tests timed out at 5 seconds. The head before the rebase fails the same way, so the rebase did not cause it.Recorded runs on the final head (
36ad244091), before the rebase:@agenta/mobile,@agenta/oss(/w) and@agenta/playgroundpass.membersTabRoleChange.render.test.tsx, which also fails on the release branch. New test files:playgroundCompare,playgroundCompareRunsandplaygroundScrollSync.@agenta/playgroundtests: 281 passed.56f8d8fb8d): budget passes, the playground route minus the app shell changed by 0.1 KB gzip or less, the compare chunk is 6.1 KB gzip and loads on demand, and the route has no antd.@agenta/playgroundchanges.Review results
Three rounds of Codex slop, simplify and correctness. Round 1: correctness High, slop Medium, simplify Medium; the findings were the anchor swap after a reorder, lost state when the anchor closes, inputs from the anchor only, and averages read from a wrong result shape. Fixed. Round 2: correctness High, simplify High, slop Medium; the findings were the row clean that deleted other revisions' inputs, and a column that waited forever when the anchor moved during a run. Fixed. Round 3 (head
36ad244091): simplify Low, correctness Medium, slop Medium, with one finding left (the first item below).Open problems
sess:<root>:<evaluator>) stay "running". /m has no evaluator chain until PR 7, but /w can hit it. Fix before PR 7 ships evaluator chains in compare: cancel every pending or running result in the old loadable, downstream too, before the move, with a chain test.?revisions=leaves drafts out. /w does the same. The playground snapshot in PR 8 fixes it.How to QA once enabled
Enable the view with
AGENTA_DEVELOPER_VIEWS=playground, then open a prompt app's playground.