Skip to content

feat(frontend): variants and deployments in /m behind the developer view switch - #8003

Merged
mmabrouk merged 9 commits into
release/v0.128.4from
feat/m-view-variants
Nov 3, 2026
Merged

mmabrouk merged 9 commits into
release/v0.128.4from
feat/m-view-variants

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Nov 2, 2026

Copy link
Copy Markdown
Member

For the release after v0.128.3. Do not merge into v0.128.3.

Context

The old app has a "Registry" page (variants and revisions of an app) and a deployments page (which revision runs in each environment). /m has neither. This PR adds both to /m as one developer view, behind the staged switch from #7985. It ships with stage hidden, so no user sees it and the navigation has no link.

Changes

  • New view variants in DEVELOPER_VIEWS (stage hidden, label "Variants"). Route /w/[workspace_id]/p/[project_id]/variants?app=<id>, wrapped in DeveloperViewGate. The page has an app picker that writes ?app= and the active tab.
  • Variants tab: a table of revisions, newest first, with Name, Model, Created on, Created by and Commit notes columns (Name and Created on on a phone), search (sent to the server after 300 ms), and a "Load more" button. The row menu has View details (opens the revision drawer from feat(frontend): add a shadcn revision drawer for variants, deployments and evaluators #7995), Deploy, Delete, Copy ID and Copy Slug.
  • Deployments tab: one card per environment, and the deployment history of the selected environment (kept as ?env=<slug>). A history row can open the drawer or be reverted.
  • Dialogs: deploy a revision to an environment, deploy to an environment from a list of revisions, delete a revision, revert a deployment.
  • Pure builders in @agenta/entities: buildAppDeploymentHistory and pickModelName. fetchEnvironmentRevisionsList accepts a next cursor. RevisionDetails in @agenta/entity-ui shows a dash when the author is unknown.
  • The Deployments tab has a "Use API" link to the endpoints view from feat(frontend): endpoints page in /m behind the developer view switch #7993. It shows only when that view is enabled.
  • Left out on purpose: Open in Playground, Compare, "How to use API" drawer, bulk delete, whole-variant delete and the header Deploy button (the list has no row selection).

Bugs in the old pages, fixed here (each has a test)

  • The Deploy dialog showed three fake rows ("dev", "stage", "prod") when the app had no environments. Deploying to one failed. It now says "No environments".
  • Deploy, Revert and Delete showed to every role. They now need deploy_environments or edit_workflows.
  • Failures showed the raw API text. They now show a short sentence and the detail goes to the console.
  • A failed revert threw an unhandled error with no message. It now shows a message.
  • The search in the Deploy dialog did nothing, and the page search filtered the dialog. The dialog now has its own search.
  • The registry search sent a request per keystroke. It now waits 300 ms.
  • The selected environment was kept by name and could match the wrong environment. It is now kept by slug.
  • A deployment matched only by app slug showed no variant and no Revert target.
  • Variant names came from a cache that kept the old name after a rename. Names now come from the query.
  • Delete on a grouped row deleted only the newest revision. This view deletes exactly the chosen revision.
  • Review found four more data bugs in the new history code, all fixed with tests: history stopped at the first 100 environment revisions, a deploy after an undeploy of the same revision was dropped, a first commit on v0 with scripts was hidden as an empty seed, and cards and dialogs showed a variant's slug after it was renamed.

New user-facing text (needs Mahmoud's approval)

  • Registry label "Variants" and description "Variants of an app, their revisions, and where each is deployed."
  • "Pick an app" and "Choose an app to see its variants."
  • Empty states: "No variants available", "This app has no committed revisions yet.", "No environments", "Deploy a revision to see it here.", "Try a shorter search.", "No deployment history available"
  • Load errors: "Could not load apps", "Could not load variants", "Could not load deployments", "Couldn't load the environments"
  • Failure toasts: "Couldn't deploy this revision", "Couldn't delete this revision", "Couldn't revert this deployment"
  • "Cannot delete the only revision. Delete the app instead."
  • "Load more" button
  • Unchanged from the old page: "Registry", "Use API", "Deploy variant", "Deploy message", "Delete revision", "Revert message", "Are you sure you want to revert?", "Deployed to successfully", "Reverted in successfully", "Deleted workflow successfully", "Current variant", "Last modified".

Tests

  • pnpm --filter @agenta/mobile types:check and pnpm --filter @agenta/oss types:check: clean.
  • pnpm --filter @agenta/mobile lint: clean (8 existing warnings).
  • pnpm --filter @agenta/mobile test: 164 of 165 files pass (997 of 998 tests). The one failure is membersTabRoleChange.render.test.tsx, which also fails on release/v0.128.3. agentPermissions.render.test.tsx, the other known failure, also fails on the release branch and passed in this run.
  • New tests cover the history builder (appDeploymentHistory), the data hooks, the table, the dialogs and the screen. Storybook stories for the screen and dialogs are in @agenta/mobile/Developer.
  • Review loop: two rounds, then a correctness check on the fixes, which rated Low. Round two left three correctness findings and one display finding; all four are fixed in the last commit. Round one's earlier rating was Medium for correctness.
  • Speed: no antd, no new dependency, no package.json change. Nothing in _app, AppProviders, GlobalDrawers or the app shell imports the view. The one developer link uses prefetch={false}.

Open problems

  • Follow-up before preview: the environment revisions API app filter only reads the first 100 rows. The page works around it by paging through the history on the client (up to 50 pages of 100, so up to 50 requests on a very large project). Fix the API filter, then remove the client paging.
  • No screenshots of the real app yet, because the view is hidden.
  • developerViews.ts gains a variants entry. Other view PRs add their own entry in the same array, so merge order needs a manual merge there; keep every entry.

What to QA

Not reachable yet. To try it, set AGENTA_DEVELOPER_VIEWS=variants on the web container and open /m/w/<workspace>/p/<project>/variants. Once the stage is preview, switch it on in Settings > Preferences.

  • No ?app=: "Pick an app" shows. Pick an app: the address gets ?app=<id> and the revisions list shows.
  • Search for part of a variant name. The list filters after a short pause.
  • Row menu > Deploy on a revision, choose an environment, add a message. The toast says "Deployed to successfully" and the Deployments tab shows the new row on top.
  • Rename a variant in the old app, reload: the new name shows in the list, the cards and the history.
  • Revert a deployment from the history: the confirmation asks for a message, and the environment card shows the reverted revision.
  • Delete a revision that is not the only one: only that revision goes. Deleting the only revision is refused with a message.
  • As a reader without deploy_environments: Deploy and Revert are not shown.
  • Regression: with the switch off, the same address shows "not found".

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Summary

Summary by CodeRabbit

  • New Features
    • Added a developer Variants view to browse app revisions in grouped or flat views, search and open revision details, and deploy or delete revisions when permitted.
    • Added a Deployments view with environment selection, deployment history, revision deployment, and permitted revert actions.
    • Added dialogs and status messages for deployment, deletion, and revert workflows.
    • Added pagination for deployment history and clearer fallback text when revision authors are unavailable.

Adds a hidden developer Variants route for app revisions and deployments. The screen supports app selection, revision grouping, deployment-history browsing, and actions to deploy, revert, or delete revisions. The changes also add data hooks, entity utilities, tests, and Storybook stories.

Changes: Variants registry and deployment management

Layer / File(s) Summary
Route and app selection
web/mobile/src/features/developer/DeveloperAppPicker.tsx, web/mobile/src/features/developer/developerViews.ts, web/mobile/src/features/developer/useUrlParams.ts, web/mobile/src/features/variants/VariantsScreen.tsx, web/mobile/src/features/variants/states/PickAppState.tsx, web/mobile/src/pages/w/[workspace_id]/p/[project_id]/variants/index.tsx, web/mobile/tests/unit/variantsRoute.render.test.tsx, web/mobile/tests/unit/variantsScreen.render.test.tsx
Adds the hidden /variants developer view and route. The screen reads app and tab values from the URL, displays app-selection and loading or error states, and clears related URL values when the app or tab changes.
Revision browsing and actions
web/mobile/src/features/variants/useAppRevisions.ts, web/mobile/src/features/variants/useIsOnlyRevision.ts, web/mobile/src/features/variants/useShownRevisionRow.ts, web/mobile/src/features/variants/variantsView.ts, web/mobile/src/features/variants/VariantsTab.tsx, web/mobile/src/features/variants/VariantsTable.tsx, web/mobile/src/features/variants/VariantRow*, web/mobile/src/features/variants/states/Variants*.tsx, web/packages/agenta-entities/src/workflow/core/pickModelName.ts, web/packages/agenta-entity-ui/src/variant/RevisionDrawer/RevisionDetails.tsx, web/mobile/tests/unit/variantsScreen.render.test.tsx, web/mobile/tests/unit/variantsData.test.tsx, web/packages/agenta-entities/tests/unit/appDeploymentHistory.test.ts, web/packages/agenta-entity-ui/tests/unit/revisionDetails.render.test.tsx, web/storybook/stories/developer-views/VariantsScreen.stories.tsx, web/storybook/tailwind.config.ts
Adds paginated revision loading, variant grouping and flat display modes, responsive tables, and permission-gated row actions. Adds model-name extraction and an em-dash fallback for missing revision authors.
Deployment history data
web/packages/agenta-entities/src/environment/api/api.ts, web/packages/agenta-entities/src/environment/core/*, web/packages/agenta-entities/src/environment/index.ts, web/mobile/src/features/variants/useAppDeploymentHistory.ts, web/mobile/tests/unit/variantsData.test.tsx, web/packages/agenta-entities/tests/unit/appDeploymentHistory.test.ts
Adds an optional cursor to environment revision requests and builds app-specific deployment rows from environment revisions. The query fetches pages, builds history, and filters rows by search text.
Deployment, reversion, and deletion flows
web/mobile/src/features/variants/DeploymentsTab.tsx, web/mobile/src/features/variants/DeploymentHistoryTable.tsx, web/mobile/src/features/variants/DeploymentRowMenu.tsx, web/mobile/src/features/variants/EnvironmentCards.tsx, web/mobile/src/features/variants/DeployRevisionDialog.tsx, web/mobile/src/features/variants/DeployToEnvironmentDialog.tsx, web/mobile/src/features/variants/RevertDeploymentDialog.tsx, web/mobile/src/features/variants/DeleteRevisionDialog.tsx, web/mobile/src/features/variants/useDeploymentWrites.ts, web/mobile/src/features/variants/states/DeploymentsEmpty.tsx, web/mobile/src/features/variants/states/EnvironmentCardsSkeleton.tsx, web/mobile/tests/unit/deploymentsTab.render.test.tsx, web/mobile/tests/unit/variantDialogs.render.test.tsx, web/storybook/stories/developer-views/DeploymentsTab.stories.tsx, web/storybook/stories/developer-views/VariantDialogs.stories.tsx
Adds environment selection, deployment history display, and dialogs for deployment, reversion, and deletion. Publish hooks map revision and environment data to the publish operation, and the tests and stories cover these flows and their states.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant DeploymentsTab
  participant useAppDeploymentHistory
  participant fetchEnvironmentRevisionsList
  participant buildAppDeploymentHistory
  User->>DeploymentsTab: open Deployments tab
  DeploymentsTab->>useAppDeploymentHistory: request app history for selected environment
  loop fetch revision pages
    useAppDeploymentHistory->>fetchEnvironmentRevisionsList: request page with cursor
    fetchEnvironmentRevisionsList-->>useAppDeploymentHistory: return revision page
  end
  useAppDeploymentHistory->>buildAppDeploymentHistory: build app deployment rows
  buildAppDeploymentHistory-->>useAppDeploymentHistory: return deployment rows
  useAppDeploymentHistory-->>DeploymentsTab: return search-filtered history
Loading
Merge Risk: Low · previous review 1ce24

Some variants can show the wrong label or disappear when searched by their displayed name. The view is mergeable with owner awareness of these limited browsing issues.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "feat(frontend): variants and deployments in /m behind the developer view switch" matches the main change. The PR adds a hidden Variants developer view to /m with variants and deployments ta…
Description check Passed The description states the purpose (adding variants and deployments to /m behind the staged developer-view switch), lists the changes, bug fixes, tests, open problems, and QA steps. It matches the cha…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(frontend): variants and deployments in /m behind the developer view switch" matches the main change. The PR adds a hidden Variants developer view to /m with variants and deployments tabs, gated behind the developer view switch. The title is specific and concise, and it names the main feature. It omits the dialogs and the history builders, which is expected for a title.

Full details: Description check

Explanation

The description states the purpose (adding variants and deployments to /m behind the staged developer-view switch), lists the changes, bug fixes, tests, open problems, and QA steps. It matches the changeset and the objectives, so it is clearly related to the change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 47 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c9bd4a2 and 1ce2480.

Files selected for processing: 47
  • web/mobile/src/features/developer/DeveloperAppPicker.tsx
  • web/mobile/src/features/developer/developerViews.ts
  • web/mobile/src/features/developer/useUrlParams.ts
  • web/mobile/src/features/variants/DeleteRevisionDialog.tsx
  • web/mobile/src/features/variants/DeployRevisionDialog.tsx
  • web/mobile/src/features/variants/DeployToEnvironmentDialog.tsx
  • web/mobile/src/features/variants/DeploymentHistoryTable.tsx
  • web/mobile/src/features/variants/DeploymentRowMenu.tsx
  • web/mobile/src/features/variants/DeploymentsTab.tsx
  • web/mobile/src/features/variants/EnvironmentCards.tsx
  • web/mobile/src/features/variants/RevertDeploymentDialog.tsx
  • web/mobile/src/features/variants/VariantRowCells.tsx
  • web/mobile/src/features/variants/VariantRowMenu.tsx
  • web/mobile/src/features/variants/VariantsScreen.tsx
  • web/mobile/src/features/variants/VariantsTab.tsx
  • web/mobile/src/features/variants/VariantsTable.tsx
  • web/mobile/src/features/variants/states/DeploymentsEmpty.tsx
  • web/mobile/src/features/variants/states/EnvironmentCardsSkeleton.tsx
  • web/mobile/src/features/variants/states/PickAppState.tsx
  • web/mobile/src/features/variants/states/VariantsEmpty.tsx
  • web/mobile/src/features/variants/states/VariantsNoMatch.tsx
  • web/mobile/src/features/variants/useAppDeploymentHistory.ts
  • web/mobile/src/features/variants/useAppRevisions.ts
  • web/mobile/src/features/variants/useDeploymentWrites.ts
  • web/mobile/src/features/variants/useIsOnlyRevision.ts
  • web/mobile/src/features/variants/useShownRevisionRow.ts
  • web/mobile/src/features/variants/variantsView.ts
  • web/mobile/src/pages/w/[workspace_id]/p/[project_id]/variants/index.tsx
  • web/mobile/tests/unit/deploymentsTab.render.test.tsx
  • web/mobile/tests/unit/variantDialogs.render.test.tsx
  • web/mobile/tests/unit/variantsData.test.tsx
  • web/mobile/tests/unit/variantsRoute.render.test.tsx
  • web/mobile/tests/unit/variantsScreen.render.test.tsx
  • web/packages/agenta-entities/src/environment/api/api.ts
  • web/packages/agenta-entities/src/environment/core/appDeploymentHistory.ts
  • web/packages/agenta-entities/src/environment/core/index.ts
  • web/packages/agenta-entities/src/environment/core/types.ts
  • web/packages/agenta-entities/src/environment/index.ts
  • web/packages/agenta-entities/src/workflow/core/pickModelName.ts
  • web/packages/agenta-entities/src/workflow/index.ts
  • web/packages/agenta-entities/tests/unit/appDeploymentHistory.test.ts
  • web/packages/agenta-entity-ui/src/variant/RevisionDrawer/RevisionDetails.tsx
  • web/packages/agenta-entity-ui/tests/unit/revisionDetails.render.test.tsx
  • web/storybook/stories/developer-views/DeploymentsTab.stories.tsx
  • web/storybook/stories/developer-views/VariantDialogs.stories.tsx
  • web/storybook/stories/developer-views/VariantsScreen.stories.tsx
  • web/storybook/tailwind.config.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Website preview

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

Built from 241c57254b832170541cf936aa0593abab9f3718. This comment updates in place on every push.

revisionId: revision.id,
workflowId: revision.workflow_id ?? appId,
variantId,
variantName: variant?.name ?? variant?.slug ?? revision.name ?? variantId,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Remove the revision.name read from the variant label.

When the variant is missing from variantById, the label falls back to revision.name. That value is not a valid display label. UI-created revisions carry the variant name ("default"). SDK-created revisions carry no name. The row then shows a wrong or empty label. Resolve the label from the variant only, then fall back to variantId.

--- "a/web/mobile/src/features/variants/useAppRevisions.ts"
+++ "b/web/mobile/src/features/variants/useAppRevisions.ts"
@@ -88,7 +88,7 @@
                         revisionId: revision.id,
                         workflowId: revision.workflow_id ?? appId,
                         variantId,
-                        variantName: variant?.name ?? variant?.slug ?? revision.name ?? variantId,
+                        variantName: variant?.name ?? variant?.slug ?? variantId,
                         variantSlug: variant?.slug ?? revision.variant_slug ?? null,
                         version: Number(revision.version),
                         model: pickModelName(revision.data?.parameters ?? null),

As per coding guidelines: "Review blocker: any .name read off a revision entity (e.g. selectors.data(id)?.name or a revision row's name) used as a display label." Also: "Never label a variant from a revision's fields."

Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
variantName: variant?.name ?? variant?.slug ?? revision.name ?? variantId,
variantName: variant?.name ?? variant?.slug ?? variantId,

Source: Coding guidelines

revisionId,
workflowId: appId,
variantId,
variantName: variant?.name ?? variant?.slug ?? entity.name ?? variantId,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Remove the entity.name read from the variant label.

This row feeds the drawer Deploy action and the deploy dialog text. The label falls back to entity.name, which is a revision field. It can hold "default" or be empty, so the dialog can name the wrong variant. Use the variant list only, then variantId.

--- "a/web/mobile/src/features/variants/useShownRevisionRow.ts"
+++ "b/web/mobile/src/features/variants/useShownRevisionRow.ts"
@@ -36,7 +36,7 @@
             revisionId,
             workflowId: appId,
             variantId,
-            variantName: variant?.name ?? variant?.slug ?? entity.name ?? variantId,
+            variantName: variant?.name ?? variant?.slug ?? variantId,
             variantSlug: variant?.slug ?? entity.variant_slug ?? null,
             version: Number(entity.version ?? 0),
             model: pickModelName(entity.data?.parameters ?? null),

As per coding guidelines: "revision.name is dead for display. Never read it as a label and never write entity names into it."

Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
variantName: variant?.name ?? variant?.slug ?? entity.name ?? variantId,
variantName: variant?.name ?? variant?.slug ?? variantId,

Source: Coding guidelines

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

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

Dependent tests finished. Post /preview for manual review. 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.3 to release/v0.128.4 November 3, 2026 09:12
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