Skip to content

feat(frontend): add a shadcn revision drawer for variants, deployments and evaluators - #7995

Merged
mmabrouk merged 3 commits into
release/v0.128.3from
feat/m-revision-drawer
Nov 2, 2026
Merged

mmabrouk merged 3 commits into
release/v0.128.3from
feat/m-revision-drawer

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Context

The /m variants, deployments and evaluators views (M5) each need to show one revision when a user clicks a row. In the old app this is a drawer that is really a full playground, built on antd, opened through global atoms. It closes only on clicks on an antd Layout, its prev/next arrows vanish after the first close, and a deleted revision id opens an empty drawer. /m has no playground for non-agent apps yet, so it needs a smaller, read-only drawer that all three views can share.

Changes

This PR adds RevisionDrawer to @agenta/entity-ui/variant (an existing subpath, so no package.json change) and a small /m host for it. It adds no /m page; the variants, deployments and evaluators pages come in later PRs.

The API is the contract the three views use. It is props only, with no atom and no context:

import {RevisionDrawer, type RevisionDrawerProps} from "@agenta/entity-ui/variant"

type RevisionDrawerKind = "variant" | "deployment" | "evaluator"

interface RevisionDrawerProps {
    revisionId: string | null          // null = closed
    kind: RevisionDrawerKind           // sets the title and the detail rows
    onClose: () => void
    navigationIds?: readonly string[]  // prev/next show with 2 or more ids
    onNavigate?: (revisionId: string) => void
    actions?: ReactNode                // header-right slot; the host owns every write
}

What the drawer draws:

  • A right-side Sheet: full screen on phones, min(1100px, 92vw) above. Close with the X ("Close"), Escape, or a click on the overlay.
  • A header with the title per kind ("Workflow Revision", "Deployment", "Evaluator"), prev/next ("Previous revision", "Next revision"), and the host's actions.
  • The configuration, read only, with a Form / JSON / YAML switch. It starts in JSON for deployments and in Form otherwise. A revision with no parameters shows "No parameters to display".
  • A "Details" column: "Variant" (deployments), "Type" and "Slug" (evaluators), "Date created", "Created by", "Note", "Deployment".
  • Loading, not found and error states.

The /m host, features/revisions/RevisionDrawerHost.tsx, keeps the open revision in the URL as ?revisionId= (the old app's name, so old links open here too). It writes with a shallow router.replace.

Speed. The config pane wraps the whole drill-in editor. The drawer loads it with React.lazy, so importing @agenta/entity-ui/variant does not load it. revisionDrawerLazyConfig.test.ts proves this: it imports the entry and checks that the config section module did not load, then imports the pane and checks that it did. I also checked that the test fails when the drawer imports the pane eagerly. Pages still load the host with next/dynamic and {ssr: false} and render it only after the first open.

One change from the M5 spec. The spec puts the DrillInUIProvider (the editor slots) in the /m host. I put it inside the lazy config pane instead, with editor slots from @agenta/ui, and a host's own slots still win. Reasons: the drawer then works with props only in every host, and the host does not pull the drill-in barrel into its chunk. The API above does not change.

New copy (not in the old app): "This revision is no longer available.", "Could not load this revision", "Previous revision", "Next revision".

Old-app bugs this drawer does not have (each has a test):

  • It closes on an overlay click on any page, not only on pages with an antd Layout.
  • Prev/next ids are a prop computed by the page on each render, not a global atom that a close resets.
  • A deleted or foreign revision id shows "This revision is no longer available." and a failed load shows a retry, instead of an empty drawer.
  • The URL is the only open state. There is no second "opened via URL" flag.
  • The icon buttons have accessible names.

Deferred to M9 and M10, as the spec says: editing, Commit, "Playground", "Test App" / "Test Evaluator", and the create contexts.

Tests

  • @agenta/entity-ui: revisionDrawer.render.test.tsx (shell, header, states), revisionConfigView.render.test.tsx (view modes, read only, empty), revisionDetails.render.test.tsx (rows per kind; variant revisions never read the evaluator catalog), revisionDrawerLazyConfig.test.ts (speed guard).
  • @agenta/mobile: revisionDrawerHost.render.test.tsx (URL open, close, shallow replace on next).
  • Storybook: @agenta/mobile/Developer/Revisions/RevisionDrawer with Variant, Deployment, Evaluator, Loading, NotFound, LoadError and Phone stories. The Variant story's play function clicks next, switches to YAML and presses Escape.
  • Checks run: @agenta/entity-ui tests (1546 passed) and type check, @agenta/mobile type check, full @agenta/mobile tests (832 passed; the one failure is agentPermissions.render.test.tsx, which also fails on the release branch), eslint on the changed files.
  • Storybook built once for this head. I checked every story at 1440 px and 390 px, light and dark. The Variant play function ran to the end: it clicked next, switched to YAML, and closed the drawer with Escape.

Follow-ups

  • The JSON and YAML views show only parameters. Code and hook groups show in Form only. This comes from the shared PlaygroundConfigSection serializer, which the playground also uses, so it needs a separate change.
  • In Storybook, "Created by" is blank and the deployment row is empty. The member list has no fixture, and the deployment row waits for the app's idle signal. Both fill in the real app.

What to QA

There is no /m page yet. The variants, deployments and evaluators PRs add the pages and their QA.

…s and evaluators

Read-only RevisionDrawer in @agenta/entity-ui/variant (props only) with a
lazy config pane, a details column, load states, and a /m host that keeps
the open revision in ?revisionId=.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Website preview

Preview URL: https://pr-7995-agenta-website-preview.mahmoud-637.workers.dev

Built from c9efba6aa30af89a41eb2a00bc3c27046c722e2e. This comment updates in place on every push.

@mmabrouk

mmabrouk commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Review loop result for head c9efba6aa3 (base 426c0e93c7), 2 rounds. Round 2 reviewed 9cee18111a; the last commit only renames a test fixture and adds one test assertion that the round 2 slop review asked for.

Lens Final rating
Slop Low
Simplify Low
Correctness Low
Naming Low

The security lens did not run. This change adds no access check, no API call, and no stored data; it reads the same revision queries the app already uses.

Fixed: The evaluator "Slug" row now reads the workflow slug (artifactSlug) and stays hidden until it loads, instead of falling back to the revision's own opaque slug. The config emptiness check now reuses hasRenderableConfigSections. The host comment states the rule for pages instead of describing callers that do not exist yet. A test now checks the hidden slug row.

Left on purpose: The "Type" row keeps the isEvaluator check next to kind, because the M5 spec asks for it so a wrong kind never fetches the evaluator catalog. The JSON and YAML views show only parameters, not the code or hook groups. That is the shared PlaygroundConfigSection serializer, which the playground uses too, so it needs its own change; the Form view shows those groups.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Item Value
Status stopped
Commit c9efba6aa30af89a41eb2a00bc3c27046c722e2e
Manual expiry (UTC) Not granted
CI deadline (UTC) Not granted
Workflow https://github.com/Agenta-AI/agenta/actions/runs/41493584656

Preview use finished or expired. Environment absence verified; retained storage requires separate provider accounting.

Post /preview as a new comment to request a one-hour preview. Repeating it while active does not extend the hour.
Preview data is disposable. Expiry is enforced by the next successful cleanup sweep, not an exact timer.
Environment deletion stops its compute. Provider-retained storage and permanent services may still be billed.

@mmabrouk
mmabrouk changed the base branch from release/v0.128.2 to release/v0.128.3 November 2, 2026 19:01
@mmabrouk
mmabrouk merged commit 557f612 into release/v0.128.3 Nov 2, 2026
86 of 90 checks passed
@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant