feat(vscode): Add draft workflow system for Designer V2#8811
feat(vscode): Add draft workflow system for Designer V2#8811Elaina-Lee wants to merge 6 commits intomainfrom
Conversation
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
✅ Risk Level
✅ What & Why
✅ Impact of Change
✅ Test Plan
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | Title is good; optionally expand to draft/publish wording. |
| Commit Type | ✅ | Keep as feature. |
| Risk Level | ✅ | risk:medium is appropriate given the cross-cutting changes. |
| What & Why | ✅ | Good description; consider noting reason for sync fs usage. |
| Impact of Change | ✅ | Document new files in user docs / gitignore guidance if needed. |
| Test Plan | ✅ | Unit tests present. Consider adding an integration/E2E test for messaging and disk I/O. |
| Contributors | OK; consider adding other contributors if applicable. | |
| Screenshots/Videos | OK; keep or update if visuals change during reviews. |
Final Notes & Actionable Recommendations
-
Overall: This PR passes the PR-title and PR-body checks. The PR description and body follow the required template and are coherent and complete. Unit tests exist and align with the claimed tests in the PR body. Labels include
risk:mediumand match the body. -
Important engineering suggestions (please consider addressing):
- DraftManager uses synchronous fs calls (mkdirSync, writeFileSync, readFileSync, unlinkSync). In VS Code extension environments, blocking the event loop can be problematic for large files or slow I/O. Consider using the async fs APIs (fs.promises) or offloading to a background worker to avoid blocking the extension host. If sync usage is intentional (simplicity / atomicity), add a code comment explaining the rationale and any mitigations.
- Ensure the extension-side implementation (the native extension process that receives messages) has handlers for the new commands (
SaveDraft,DraftLoaded,DraftSaveResult,DiscardDraft). From the diff I see ExtensionCommand entries added — double-check the counterpart in the extension host code is present and handles errors and telemetry. - Add an integration/E2E test that simulates the webview <-> extension messaging cycle for saveDraft and discardDraft and verifies draft files are created and removed. This will help catch issues that unit tests (with many mocks) may not surface.
- Consider CI/packaging implications: because the change writes new files to workflow directories, confirm whether those new files should be git-ignored in certain templates or referenced in docs to avoid user confusion.
- Validate permission/security: ensure that saving draft files cannot accidentally write outside the intended workflow directory. The current use of path.dirname(workflowFilePath) seems OK but it is worth adding a small sanity check or unit test for path traversal edge cases.
Please update the PR if you want to address any of the recommendations above. If you do make modifications (for example switching to async fs APIs), mention them in the PR body so reviewers know the risk/behavior changes.
Thank you for a comprehensive PR with tests and good documentation in the body — this made review straightforward.
Last updated: Tue, 17 Feb 2026 23:33:36 GMT
|
📊 Coverage check completed. See workflow run for details. |
There was a problem hiding this comment.
Pull request overview
This PR implements a comprehensive draft/publish workflow system for the VS Code Designer V2, matching the Azure portal's implementation. It allows users to make changes that are auto-saved as drafts every 5 seconds, with an explicit "Publish" action to commit changes to the published workflow state.
Changes:
- Draft file management system with per-workflow directory storage (workflow.draft.json, connections.draft.json, parameters.draft.json)
- Auto-save mechanism using
useThrottledEffectwith 5-second throttle anduseChangeCountfor change detection - Redux state management for draft artifacts with dual-state support (draft vs. published)
- UI enhancements including draft/publish mode switching, discard options, and save status notifications
- Full internationalization of user-facing strings via designerMessages
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/vscode-extension/src/lib/models/extensioncommand.ts | Added 4 new extension commands for draft operations |
| apps/vs-code-react/src/webviewCommunication.tsx | Added message handlers for draft loaded and save result events |
| apps/vs-code-react/src/state/test/DesignerSlice.test.ts | Comprehensive unit tests (18 tests) for all draft-related Redux reducers |
| apps/vs-code-react/src/state/DesignerSlice.ts | Added draft state properties and 8 new reducers for draft management |
| apps/vs-code-react/src/run-service/types.ts | Added TypeScript interfaces for draft message types |
| apps/vs-code-react/src/intl/messages.ts | Added 15 internationalized messages for draft UI elements |
| apps/vs-code-react/src/app/designer/appV2.tsx | Integrated draft workflow logic, mode switching, and draft state handling |
| apps/vs-code-react/src/app/designer/DesignerCommandBar/indexV2.tsx | Implemented auto-save UI, draft notifications, and publish/discard controls |
| apps/vs-code-designer/src/constants.ts | Defined draft file name constants |
| apps/vs-code-designer/src/app/utils/codeless/draftManager.ts | Core draft file I/O utilities (save, load, discard, path helpers) |
| apps/vs-code-designer/src/app/utils/codeless/test/draftManager.test.ts | Comprehensive unit tests (18 tests) for draft manager utilities |
| apps/vs-code-designer/src/app/commands/workflows/openDesigner/openDesignerForLocalProject.ts | Extension-side draft handling, initialization with draft data, and publish workflow |
apps/vs-code-designer/src/app/commands/workflows/openDesigner/openDesignerForLocalProject.ts
Show resolved
Hide resolved
apps/vs-code-designer/src/app/commands/workflows/openDesigner/openDesignerForLocalProject.ts
Show resolved
Hide resolved
❌ PR Validation ErrorAn error occurred while validating your PR. Please try again later or contact the maintainers. Error: Bad escaped character in JSON at position 5810 |
|
📊 Coverage check completed. See workflow run for details. |
3 similar comments
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
📊 Coverage CheckThe following changed files need attention:
Please add tests for the uncovered files before merging. |
Commit Type
Risk Level
What & Why
Adds a full draft/publish workflow system to the VS Code Designer V2, matching the portal's implementation. Users can now make changes that are auto-saved as drafts every 5 seconds, then explicitly "Publish" when ready. This prevents accidental loss of in-progress work and provides a clear separation between draft and published workflow states.
Key capabilities:
workflow.draft.json,connections.draft.json,parameters.draft.json) per workflow directoryuseThrottledEffect+useChangeCountBJSWorkflowProviderindependentlydesignerMessagesImpact of Change
DraftManagerutility for draft file I/O. New draft-related Redux reducers and extension commands. Command bar V2 has new props for draft state.connections.json/parameters.json. Draft files cleaned up on publish or discard.Test Plan
Unit tests (36 total):
draftManager.test.ts(18 tests) - path helpers, hasDraft, saveDraft, loadDraft, discardDraftDesignerSlice.test.ts(18 tests) - all draft-related Redux reducersManual testing:
workflow.draft.jsonappears after ~5 secondsworkflow.jsonis updated and draft files are deletedContributors
@hyehwalee
Screenshots/Videos
Recording.2026-02-17.153240.mp4