Skip to content

feat(frontend): playground foundation in /m behind the developer view switch (1 of 8) - #8012

Merged
mmabrouk merged 7 commits into
release/v0.128.4from
feat/m-view-playground-foundation
Nov 3, 2026
Merged

mmabrouk merged 7 commits into
release/v0.128.4from
feat/m-view-playground-foundation

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Nov 3, 2026

Copy link
Copy Markdown
Member

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

Context

This is part 1 of 8 for the prompt playground in /m. The playground lets a developer edit and run a prompt app. It ships hidden, under the view id playground. Users do not see it until the developer view switch turns it on.

Changes

  • Adds the route apps/[app_id]/playground. The route loads with next/dynamic inside the developer view gate, so the shared app shell does not load it.
  • Adds the screen parts: a header, a resizable split on desktop, and a Configuration / Generations switch on phones.
  • The run pane is a placeholder. Later PRs fill it in.
  • Adds load, error, and not-found states.
  • Agent apps redirect away from the playground.
  • Adds a leave guard. It warns before a user leaves with an unsaved draft.
  • DrillInBridgeProvider no longer needs sessionId.

Structure that later PRs follow

  • Panels live at @agenta/playground-ui/panels/<name>. One ./panels/* entry in the export map of that package's package.json covers them. The change adds no dependency.
  • usePlaygroundSelection is the hook for the playground selection.
  • PlaygroundScreen, PlaygroundWorkspace, and PlaygroundSplit are the screen parts.

Speed

  • speed:check passes.
  • The route's first load is 1324.9 KB gzip. This PR adds a budget row for the route.
  • The on-demand playground code is 165.7 KB gzip.
  • A new script, scripts/speed/antd-in-route.mjs, checks that the route adds no antd beyond the app shell.
  • The app shell already reaches antd through some dynamic imports. Someone is auditing that separately, so this PR does not change it.

Checks

  • Types for /m, /w, and /playground-ui.
  • Full mobile test suite. Two tests fail, and both also fail on the release branch: agentPermissions.render.test.tsx and membersTabRoleChange.render.test.tsx.
  • Playground tests.

Review

  • Review round 2 rated Low for correctness, slop, and naming.

Notes

  • The Storybook config gained an @ alias to web/mobile/src. It also gained a Tailwind source path for /m.
  • Open problem: an agent app with an unsaved draft shows the leave dialog on redirect. No link reaches the playground for agent apps yet, so no user hits this today.

@coderabbitai

coderabbitai Bot commented Nov 3, 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 prompt playground with a configuration editor, revision selection, and responsive layouts for desktop and mobile.
    • Added Form, JSON, and YAML configuration views, plus loading and error states with retry.
    • Added unsaved-change warnings when leaving the playground.
  • Bug Fixes
    • Improved navigation warnings so in-page selection changes don’t trigger an unnecessary confirmation.
    • Ensured committed workflow revisions are selected in the correct session.

Adds a mobile app playground route for prompt apps. The route loads and selects workflow revisions, displays a responsive configuration and generations workspace, and supports draft navigation warnings. The change also adds shared configuration-panel components, tests, Storybook stories, and build checks.

Changes: App playground

Layer / File(s) Summary
Revision selection and URL state
web/mobile/src/features/playground/usePlaygroundSelection.ts, web/mobile/src/features/playground/playgroundUrl.ts, web/mobile/tests/unit/playgroundSelection.test.tsx
The selection hook reads revision IDs from the URL, filters revisions, selects a latest revision when needed, and synchronizes eligible selections back to the URL. Tests cover selection, cleanup, and retry behavior.
Shared configuration panel
web/packages/agenta-playground-ui/src/panels/config/*, web/packages/agenta-playground-ui/src/hooks/useLocalDraftWarning.ts, web/mobile/tests/unit/configPanel.render.test.tsx, web/storybook/stories/playground/ConfigPanel.stories.tsx
Adds a revision-aware configuration panel with draft and deployment details, view selection, and a hydration skeleton. Tests and stories cover saved revisions, drafts, hydration, and JSON view selection.
Page, workspace, and navigation behavior
web/mobile/src/pages/w/[workspace_id]/p/[project_id]/apps/[app_id]/playground.tsx, web/mobile/src/features/playground/*, web/mobile/src/features/automations/*, web/mobile/src/features/chat/*, web/mobile/src/features/developer/developerViews.ts, web/mobile/tests/unit/*playground*, web/mobile/tests/unit/drillInBridgeCommit.test.tsx, web/mobile/tests/unit/developerViews.render.test.tsx, web/mobile/tests/unit/agentPermissions.render.test.tsx
Adds the playground route and responsive workspace. Revision commits use a caller-provided callback. Dirty non-shallow navigation prompts for confirmation, while shallow navigation does not.
Build checks and Storybook coverage
web/mobile/scripts/speed/antd-in-route.mjs, web/mobile/scripts/speed/budget.json, web/packages/eslint.config.mjs, web/storybook/.storybook/main.ts, web/storybook/stories/playground/*, web/storybook/tailwind.config.ts, web/storybook/tsconfig.json
Adds a route-specific Ant Design source check and gzip budget. Adds restricted imports for playground panel files, Storybook configuration for mobile sources, and playground stories.

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

Sequence Diagram(s)

sequenceDiagram
  participant PlaygroundPage
  participant PlaygroundScreen
  participant usePlaygroundSelection
  participant WorkflowQueries
  participant PlaygroundWorkspace
  participant ConfigPanel
  PlaygroundPage->>PlaygroundScreen: pass workspace, project, and app IDs
  PlaygroundScreen->>usePlaygroundSelection: read app and revision selection
  usePlaygroundSelection->>WorkflowQueries: query app and selected revisions
  WorkflowQueries-->>usePlaygroundSelection: return query results
  usePlaygroundSelection-->>PlaygroundScreen: return status and primary revision
  PlaygroundScreen->>PlaygroundWorkspace: render selected revision
  PlaygroundWorkspace->>ConfigPanel: pass revision ID and view mode
Loading
Merge Risk: Low · previous review 877e2

The playground is mergeable with bounded risk, but its phone story and release check do not enforce their intended coverage, and revision URL state can be wrong after an abandoned render. Address these before relying on those checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.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. Documentat… 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 clearly identifies the playground foundation as the main change and states that it is gated behind the developer view switch. The part number adds minor noise but does not obscure the change…
Description check Passed The description directly explains the hidden playground route, its screen components, loading behavior, leave guard, provider change, performance checks, and testing status.
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 clearly identifies the playground foundation as the main change and states that it is gated behind the developer view switch. The part number adds minor noise but does not obscure the change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.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 34 files. (3 skipped: 3 unsupported.)

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 877e24c.

Files selected for processing: 37
  • web/mobile/scripts/speed/antd-in-route.mjs
  • web/mobile/scripts/speed/budget.json
  • web/mobile/src/features/automations/AutomationDetailScreen.tsx
  • web/mobile/src/features/automations/useUnsavedGuard.ts
  • web/mobile/src/features/chat/ConfigPane.tsx
  • web/mobile/src/features/chat/DrillInBridgeProvider.tsx
  • web/mobile/src/features/developer/developerViews.ts
  • web/mobile/src/features/playground/PlaygroundHeader.tsx
  • web/mobile/src/features/playground/PlaygroundScreen.tsx
  • web/mobile/src/features/playground/PlaygroundSplit.tsx
  • web/mobile/src/features/playground/PlaygroundWorkspace.tsx
  • web/mobile/src/features/playground/RunPanePlaceholder.tsx
  • web/mobile/src/features/playground/playgroundUrl.ts
  • web/mobile/src/features/playground/states/PlaygroundLoadError.tsx
  • web/mobile/src/features/playground/states/PlaygroundSkeleton.tsx
  • web/mobile/src/features/playground/usePlaygroundLeaveGuard.ts
  • web/mobile/src/features/playground/usePlaygroundSelection.ts
  • web/mobile/src/pages/w/[workspace_id]/p/[project_id]/apps/[app_id]/playground.tsx
  • web/mobile/tests/unit/agentPermissions.render.test.tsx
  • web/mobile/tests/unit/configPanel.render.test.tsx
  • web/mobile/tests/unit/developerViews.render.test.tsx
  • web/mobile/tests/unit/drillInBridgeCommit.test.tsx
  • web/mobile/tests/unit/playgroundScreen.render.test.tsx
  • web/mobile/tests/unit/playgroundSelection.test.tsx
  • web/packages/agenta-playground-ui/package.json
  • web/packages/agenta-playground-ui/src/hooks/useLocalDraftWarning.ts
  • web/packages/agenta-playground-ui/src/panels/config/ConfigPanel.tsx
  • web/packages/agenta-playground-ui/src/panels/config/ConfigPanelHeader.tsx
  • web/packages/agenta-playground-ui/src/panels/config/ConfigPanelSkeleton.tsx
  • web/packages/agenta-playground-ui/src/panels/config/index.ts
  • web/packages/eslint.config.mjs
  • web/storybook/.storybook/main.ts
  • web/storybook/stories/playground/ConfigPanel.stories.tsx
  • web/storybook/stories/playground/PlaygroundScreen.stories.tsx
  • web/storybook/stories/playground/playgroundFixtures.ts
  • web/storybook/tailwind.config.ts
  • web/storybook/tsconfig.json

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

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Website preview

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

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

@coderabbitai coderabbitai Bot left a comment •

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.

Follow-up Comments

Nitpick Require the phone-only Generations switch in ReadyPhone.

98-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Require the phone-only Generations switch in ReadyPhone.

ReadyPhone sets no phone viewport. Its play function also skips the click when the Generations radio is absent, so the story passes at desktop width without exercising the phone switch. The switch appears only below the md breakpoint, so a desktop render can pass as phone coverage. Set a phone viewport, and wait for the radio so that a missing switch fails the story.

🧪 Suggested fix
 export const ReadyPhone: Story = {
     args: {projectId: "", revisionId: ""},
+    parameters: {viewport: {defaultViewport: "iphone6"}},
     play: async ({canvasElement}) => {
         const canvas = within(canvasElement)
         await canvas.findByText("Capital finder")
-        const generations = canvas.queryByRole("radio", {name: "Generations"})
-        if (generations) generations.click()
+        const generations = await canvas.findByRole("radio", {name: "Generations"})
+        generations.click()
     },

Open the source location

}
process.exit(1)
}
console.log(`No antd in ${route}: ${files.size} chunks checked, ${mapped} with source maps.`)

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 · Maintainability & Code Quality · Quick win

Supported by static analysis

Script executed:

#!/bin/bash
# Inspect release-check invocations without building or running repository code.
rg -n -C2 --glob 'package.json' --glob '*.yml' --glob '*.yaml' \
  --glob '*.mjs' --glob 'Dockerfile*' \
  'antd-in-route\.mjs|speed:check|scripts/speed/check\.mjs' .

Repository: Agenta-AI/agenta

Length of output: 3584


Script executed:

printf '%s\n' '--- workflow ---'
nl -ba .github/workflows/17-check-mobile.yml | sed -n '185,250p'
printf '%s\n' '--- mobile package scripts ---'
nl -ba web/mobile/package.json | sed -n '1,32p'
printf '%s\n' '--- scanner entrypoint and output assumptions ---'
nl -ba web/mobile/scripts/speed/antd-in-route.mjs | sed -n '1,45p;90,120p'
printf '%s\n' '--- all workflow/script references ---'
rg -n -F --glob '.github/workflows/**' --glob 'web/**' 'antd-in-route.mjs' . || test "$?" -eq 1

Repository: Agenta-AI/agenta

Length of output: 10187


Script executed:

nl -ba web/mobile/scripts/speed/antd-in-route.mjs | sed -n '33,95p'

Repository: Agenta-AI/agenta

Length of output: 3087


Run the Ant Design scan in the required mobile release check.

The mobile CI workflow runs speed/check.mjs, but it does not run antd-in-route.mjs. The speed:check package script also does not chain the scan. Therefore, a transitive Ant Design import can pass the current mobile build, lint, and speed checks without this route-specific check.

Add antd-in-route.mjs to the required post-build mobile check. Preserve the scanner's server/pages/<route>/react-loadable-manifest.json input, or run the scanner against the complete build output, so dynamic-import chunks are included.

Source: Coding guidelines

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

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

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:13
@mmabrouk
mmabrouk force-pushed the feat/m-view-playground-foundation branch from 877e24c to c81fb4d Compare November 3, 2026 09:20
@mmabrouk
mmabrouk merged commit aa68c09 into release/v0.128.4 Nov 3, 2026
25 of 31 checks passed
@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Nov 3, 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