feat(vscode): Add draft workflow system for Designer V2#8811
feat(vscode): Add draft workflow system for Designer V2#8811Elaina-Lee wants to merge 3 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 | ✅ | Keep the current title. |
| Commit Type | ✅ | Correctly selected (feature). |
| Risk Level | ✅ | risk:medium appropriate for file I/O + publish flows. |
| What & Why | ✅ | Good, concise explanation. |
| Impact of Change | ✅ | Good; consider documenting draft file implications for end users. |
| Test Plan | ✅ | Unit tests present; consider adding E2E/integration test(s). |
| Contributors | Optional: add other contributors (PM/design) if applicable. | |
| Screenshots/Videos | Optional: add screenshots of draft badge/notification for reviewer convenience. |
Final notes & recommendations
- Overall: This PR passes the PR title/body checks. The PR body follows the required template and the label
risk:mediummatches the code changes. - Suggestions to improve safety and reviewer confidence before merge:
- Add at least one E2E/integration/automation test that runs the full lifecycle (autosave -> load draft -> publish -> discard) to validate the file I/O and message plumbing between extension and webview.
- Consider adding defensive error handling in draftManager functions (saveDraft/loadDraft/discardDraft). Right now the extension catches errors when calling saveDraft, but the draftManager APIs themselves use synchronous fs calls without try/catch. Add defensive try/catch for JSON parsing and fs ops or clearly document that callers must handle exceptions.
- Consider atomic file writes (write to tmp file + rename) to avoid partial writes if the process is interrupted during writeFileSync.
- Confirm and document whether draft files should be ignored by git (user-level guidance). Since drafts are per-workflow and on-disk, a short note in README or docs would help users avoid accidentally committing drafts.
- Add small inline comments in code where you intentionally use synchronous fs operations (explain rationale — extension host vs. worker) for future maintainers.
- Optional UX suggestion: capture/emit the reason for autosave failures with more context (e.g., permission error) so the Badge tooltip shows helpful guidance.
Please update if you plan to add any E2E tests or additional error handling — otherwise this PR is ready from a PR title/body/template perspective. Thank you for the thorough description and unit tests — excellent work!
Please update the PR if you want me to re-check after you add any recommended tests or doc changes. Thanks!
Last updated: Fri, 13 Feb 2026 21:18:07 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. |
2 similar comments
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
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