Add Initial State Presets Manager to Runner Panel - #16
Conversation
- Implements structured StatePreset interface and helper utility functions in statePresets.ts - Provides pre-configured default presets tailored to template workflows (ReAct, HTTP Router, Translation HITL) and general testing - Adds dropdown list inside the Run Drawer allowing immediate selection and applying of preset JSON inputs - Incorporates inline preset creation/saving and deletion with local storage persistence - Includes thorough unit testing in statePresets.test.ts to guarantee correct saving, partitioning, merging, and deleting behavior - Passes full test suite with no regressions
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughAdds workflow-scoped state presets with embedded defaults, localStorage persistence for custom presets, and run drawer controls for selecting, saving, validating, and deleting presets. ChangesState Presets
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant RunDrawer
participant IndexPage
participant StatePresets
participant LocalStorage
RunDrawer->>IndexPage: select or edit initial state
IndexPage->>StatePresets: loadStatePresets(activeWorkflowId)
StatePresets->>LocalStorage: read workflow-scoped custom presets
LocalStorage-->>StatePresets: stored preset JSON
StatePresets-->>IndexPage: merged preset list
IndexPage-->>RunDrawer: update preset list and initial state
IndexPage->>StatePresets: saveStatePresets(workflowId, presets)
StatePresets->>LocalStorage: persist custom presets
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
frontend/src/test/statePresets.test.ts (2)
45-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winVerify isolation across workflow IDs.
This round-trip test does not prove presets saved for one workflow cannot appear in another workflow.
Proposed test addition
const loaded = loadStatePresets(workflowId); expect(loaded.length).toBe(initial.length + 1); + expect(loadStatePresets("another-custom-flow")) + .toEqual(DEFAULT_PRESETS["general"]); + const foundCustom = loaded.find(p => p.id === "preset-custom-abc");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/src/test/statePresets.test.ts` around lines 45 - 69, Extend the test around loadStatePresets and saveStatePresets to load presets for a different workflowId after saving the custom preset, and assert that the other workflow retains only DEFAULT_PRESETS["general"] without the custom entry. Keep the existing round-trip assertions for the original workflow unchanged.
29-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise the
"general"workflow path.The test never calls
loadStatePresets("general");nulltakes a different early-return path.Proposed test addition
expect(generalPresets[0].id).toBe("general-hello"); + const explicitGeneralPresets = loadStatePresets("general"); + expect(explicitGeneralPresets).toEqual(DEFAULT_PRESETS["general"]); + const templatePresets = loadStatePresets("template-react");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/src/test/statePresets.test.ts` around lines 29 - 38, Update the test case around loadStatePresets to explicitly call loadStatePresets("general") in addition to the null workflow case, and assert that the explicit general workflow returns the expected DEFAULT_PRESETS["general"] length and "general-hello" first preset ID.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@frontend/src/test/statePresets.test.ts`:
- Around line 45-69: Extend the test around loadStatePresets and
saveStatePresets to load presets for a different workflowId after saving the
custom preset, and assert that the other workflow retains only
DEFAULT_PRESETS["general"] without the custom entry. Keep the existing
round-trip assertions for the original workflow unchanged.
- Around line 29-38: Update the test case around loadStatePresets to explicitly
call loadStatePresets("general") in addition to the null workflow case, and
assert that the explicit general workflow returns the expected
DEFAULT_PRESETS["general"] length and "general-hello" first preset ID.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: dbdcc7cf-5687-4d21-98e2-214d13783750
📒 Files selected for processing (3)
frontend/src/flow/statePresets.tsfrontend/src/pages/Index.tsxfrontend/src/test/statePresets.test.ts
This change introduces a fully functional, highly polished State Presets management feature within the browser sandbox run drawer. It allows users to quickly save, apply, and manage multiple initial JSON states for testing different branches and scenarios of their AI agent workflows. It comes pre-packaged with default presets optimized for standard templates and stores custom presets locally in browser localStorage, partitioned by the active workflow.
PR created automatically by Jules for task 5852457557385843694 started by @Jacobcdsmith
Summary by CodeRabbit
New Features
Bug Fixes
Tests