Repository navigation
fix: isolate and preserve workflow drafts on workspace switch - #14290
Conversation
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
|
✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged. |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1759 passed, 0 failed📊 Browser Reports
📦 Bundle: 8.15 MB gzip 🔴 +296 BDetailsSummary
Category Glance App Entry Points — 3.66 kB (baseline 3.66 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.28 MB (baseline 1.28 MB) • 🔴 +174 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed / 1 unchanged Views & Navigation — 112 kB (baseline 112 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 12 added / 12 removed / 4 unchanged Panels & Settings — 551 kB (baseline 551 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 11 added / 11 removed / 15 unchanged User & Accounts — 29.1 kB (baseline 29.1 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 7 added / 7 removed / 3 unchanged Editors & Dialogs — 121 kB (baseline 121 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 5 added / 5 removed / 1 unchanged UI Components — 64.8 kB (baseline 64.8 kB) • ⚪ 0 BReusable component library chunks
Status: 6 added / 6 removed / 8 unchanged Data & Services — 3.42 MB (baseline 3.42 MB) • 🔴 +974 BStores, services, APIs, and repositories
Status: 14 added / 14 removed / 3 unchanged Utilities & Hooks — 371 kB (baseline 371 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 15 added / 15 removed / 20 unchanged Vendor & Third-Party — 15.7 MB (baseline 15.7 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 16 unchanged Other — 12.5 MB (baseline 12.5 MB) • ⚪ 0 BBundles that do not match a named category
Status: 68 added / 68 removed / 208 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-07-29T21:14:29.307Z",
"gitSha": "44ebab69864a91175c292e7f80160e49f8743f82",
"branch": "fix/workspace-switch-restore-isolation",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2052.273000000014,
"styleRecalcs": 9,
"styleRecalcDurationMs": 15.594999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 535.205,
"heapDeltaBytes": 3581604,
"heapUsedBytes": 71308516,
"domNodes": 18,
"jsHeapTotalBytes": 20840448,
"scriptDurationMs": 24.054,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2037.6119999999673,
"styleRecalcs": 9,
"styleRecalcDurationMs": 9.045000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 516.6919999999999,
"heapDeltaBytes": 4007636,
"heapUsedBytes": 71953372,
"domNodes": 18,
"jsHeapTotalBytes": 20578304,
"scriptDurationMs": 24.964,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1865.556999999967,
"styleRecalcs": 77,
"styleRecalcDurationMs": 39.441,
"layouts": 12,
"layoutDurationMs": 3.593,
"taskDurationMs": 918.749,
"heapDeltaBytes": -18468176,
"heapUsedBytes": 49567780,
"domNodes": -271,
"jsHeapTotalBytes": 20967424,
"scriptDurationMs": 117.868,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1806.511999999998,
"styleRecalcs": 74,
"styleRecalcDurationMs": 39.897,
"layouts": 12,
"layoutDurationMs": 3.9240000000000004,
"taskDurationMs": 911.168,
"heapDeltaBytes": -18703524,
"heapUsedBytes": 49566784,
"domNodes": -273,
"jsHeapTotalBytes": 20967424,
"scriptDurationMs": 116.43799999999999,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1753.8870000000202,
"styleRecalcs": 31,
"styleRecalcDurationMs": 18.985000000000003,
"layouts": 6,
"layoutDurationMs": 0.776,
"taskDurationMs": 420.53,
"heapDeltaBytes": 7164960,
"heapUsedBytes": 75203244,
"domNodes": 78,
"jsHeapTotalBytes": 20840448,
"scriptDurationMs": 26.342,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1756.5809999999829,
"styleRecalcs": 33,
"styleRecalcDurationMs": 19.527999999999995,
"layouts": 6,
"layoutDurationMs": 0.6709999999999999,
"taskDurationMs": 412.74000000000007,
"heapDeltaBytes": 7059028,
"heapUsedBytes": 75365896,
"domNodes": 79,
"jsHeapTotalBytes": 20316160,
"scriptDurationMs": 26.014000000000003,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 732.6520000000301,
"styleRecalcs": 13,
"styleRecalcDurationMs": 9.165,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 433.46700000000004,
"heapDeltaBytes": -11849128,
"heapUsedBytes": 56092048,
"domNodes": 22,
"jsHeapTotalBytes": 21626880,
"scriptDurationMs": 64.23700000000001,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 639.2890000000762,
"styleRecalcs": 12,
"styleRecalcDurationMs": 8.465,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 406.0440000000001,
"heapDeltaBytes": -12352172,
"heapUsedBytes": 55576784,
"domNodes": 20,
"jsHeapTotalBytes": 21889024,
"scriptDurationMs": 60.312999999999995,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2027.571000000023,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 725.236,
"heapDeltaBytes": 6547624,
"heapUsedBytes": 65325016,
"domNodes": -278,
"jsHeapTotalBytes": 4521984,
"scriptDurationMs": 104.017,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2040.2119999999968,
"styleRecalcs": 10,
"styleRecalcDurationMs": 9.809999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 736.019,
"heapDeltaBytes": 6356928,
"heapUsedBytes": 65101440,
"domNodes": -274,
"jsHeapTotalBytes": 4259840,
"scriptDurationMs": 105.251,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2171.146999999962,
"styleRecalcs": 69,
"styleRecalcDurationMs": 16.790000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1280.568,
"heapDeltaBytes": -4609672,
"heapUsedBytes": 55337612,
"domNodes": -277,
"jsHeapTotalBytes": 5308416,
"scriptDurationMs": 405.397,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2163.03999999991,
"styleRecalcs": 68,
"styleRecalcDurationMs": 17.392,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1306.982,
"heapDeltaBytes": 4797976,
"heapUsedBytes": 65532064,
"domNodes": -276,
"jsHeapTotalBytes": 5513216,
"scriptDurationMs": 412.906,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3268.4070000000247,
"styleRecalcs": 63,
"styleRecalcDurationMs": 16.450999999999997,
"layouts": 60,
"layoutDurationMs": 9.336,
"taskDurationMs": 1549.584,
"heapDeltaBytes": 1416820,
"heapUsedBytes": 63334828,
"domNodes": -281,
"jsHeapTotalBytes": 6619136,
"scriptDurationMs": 499.312,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3344.4190000000162,
"styleRecalcs": 65,
"styleRecalcDurationMs": 17.682,
"layouts": 60,
"layoutDurationMs": 9.242,
"taskDurationMs": 1575.807,
"heapDeltaBytes": 4976052,
"heapUsedBytes": 66535192,
"domNodes": -281,
"jsHeapTotalBytes": 6094848,
"scriptDurationMs": 513.864,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2053.097999999977,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.247,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 734.7600000000001,
"heapDeltaBytes": 6981768,
"heapUsedBytes": 67828200,
"domNodes": -277,
"jsHeapTotalBytes": 4259840,
"scriptDurationMs": 113.811,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2041.1269999999604,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.748999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 726.2980000000001,
"heapDeltaBytes": 6503236,
"heapUsedBytes": 66962456,
"domNodes": -277,
"jsHeapTotalBytes": 4521984,
"scriptDurationMs": 103.51599999999999,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 615.2369999999792,
"styleRecalcs": 47,
"styleRecalcDurationMs": 11.711999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 405.14199999999994,
"heapDeltaBytes": -11813564,
"heapUsedBytes": 56199976,
"domNodes": 20,
"jsHeapTotalBytes": 21102592,
"scriptDurationMs": 118.36999999999999,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 659.9109999999655,
"styleRecalcs": 48,
"styleRecalcDurationMs": 11.614,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 405.302,
"heapDeltaBytes": -11720700,
"heapUsedBytes": 56240480,
"domNodes": 22,
"jsHeapTotalBytes": 21889024,
"scriptDurationMs": 116.41900000000001,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2012.3330000000124,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.127000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 546.7070000000001,
"heapDeltaBytes": 3869956,
"heapUsedBytes": 71773876,
"domNodes": 18,
"jsHeapTotalBytes": 20578304,
"scriptDurationMs": 20.939999999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 1998.3250000000226,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.493,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 501.50800000000004,
"heapDeltaBytes": 3500760,
"heapUsedBytes": 71496996,
"domNodes": 20,
"jsHeapTotalBytes": 21102592,
"scriptDurationMs": 20.526,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1749.042999999972,
"styleRecalcs": 75,
"styleRecalcDurationMs": 40.266999999999996,
"layouts": 16,
"layoutDurationMs": 5.113,
"taskDurationMs": 875.104,
"heapDeltaBytes": -20688304,
"heapUsedBytes": 47544188,
"domNodes": -274,
"jsHeapTotalBytes": 20180992,
"scriptDurationMs": 97.484,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1759.486000000038,
"styleRecalcs": 78,
"styleRecalcDurationMs": 46.97,
"layouts": 16,
"layoutDurationMs": 4.893000000000001,
"taskDurationMs": 847.422,
"heapDeltaBytes": -5617056,
"heapUsedBytes": 62405248,
"domNodes": 65,
"jsHeapTotalBytes": 21102592,
"scriptDurationMs": 99.237,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 1349.311000000057,
"styleRecalcs": 19,
"styleRecalcDurationMs": 28.848999999999993,
"layouts": 15,
"layoutDurationMs": 10.471000000000002,
"taskDurationMs": 946.1250000000001,
"heapDeltaBytes": 33288852,
"heapUsedBytes": 99377360,
"domNodes": 13673,
"jsHeapTotalBytes": 12845056,
"scriptDurationMs": 38.139,
"eventListeners": 2371,
"totalBlockingTimeMs": 123,
"frameDurationMs": 16.666666666666696,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8166.831000000002,
"styleRecalcs": 250,
"styleRecalcDurationMs": 46.589,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4532.533,
"heapDeltaBytes": 2217488,
"heapUsedBytes": 60911896,
"domNodes": -273,
"jsHeapTotalBytes": 6881280,
"scriptDurationMs": 1360.076,
"eventListeners": -128,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "viewport-pan-sweep",
"durationMs": 8196.402999999918,
"styleRecalcs": 250,
"styleRecalcDurationMs": 48.587999999999994,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4698.463000000001,
"heapDeltaBytes": 10370264,
"heapUsedBytes": 69092300,
"domNodes": -274,
"jsHeapTotalBytes": 6823936,
"scriptDurationMs": 1393.54,
"eventListeners": -128,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 15038.14699999998,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15011.506999999998,
"heapDeltaBytes": -44328120,
"heapUsedBytes": 165600700,
"domNodes": -8312,
"jsHeapTotalBytes": -13045760,
"scriptDurationMs": 554.0319999999999,
"eventListeners": -16391,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-idle",
"durationMs": 14840.36500000002,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 14812.170000000002,
"heapDeltaBytes": -64832272,
"heapUsedBytes": 166069696,
"domNodes": -8312,
"jsHeapTotalBytes": -13570048,
"scriptDurationMs": 528.121,
"eventListeners": -16391,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 18077.39699999996,
"styleRecalcs": 123,
"styleRecalcDurationMs": 19.91699999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 18036.389,
"heapDeltaBytes": -28239964,
"heapUsedBytes": 178998100,
"domNodes": -8312,
"jsHeapTotalBytes": -13656064,
"scriptDurationMs": 856.052,
"eventListeners": -16385,
"totalBlockingTimeMs": 81,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 18054.215,
"styleRecalcs": 125,
"styleRecalcDurationMs": 20.40900000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 18028.76,
"heapDeltaBytes": -42981920,
"heapUsedBytes": 166457576,
"domNodes": -8316,
"jsHeapTotalBytes": -12259328,
"scriptDurationMs": 838.5350000000001,
"eventListeners": -16385,
"totalBlockingTimeMs": 87,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 464.69600000000355,
"styleRecalcs": 13,
"styleRecalcDurationMs": 19.712999999999997,
"layouts": 3,
"layoutDurationMs": 0.804,
"taskDurationMs": 141.089,
"heapDeltaBytes": -15933056,
"heapUsedBytes": 51251212,
"domNodes": 130,
"jsHeapTotalBytes": 7471104,
"scriptDurationMs": 13.956,
"eventListeners": 67,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 479.6000000000049,
"styleRecalcs": 15,
"styleRecalcDurationMs": 22.088000000000005,
"layouts": 3,
"layoutDurationMs": 0.854,
"taskDurationMs": 134.39200000000002,
"heapDeltaBytes": -16009976,
"heapUsedBytes": 51012176,
"domNodes": 121,
"jsHeapTotalBytes": 7733248,
"scriptDurationMs": 11.198000000000002,
"eventListeners": 65,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
}
]
} |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughWorkflow persistence now flushes pending writes before workspace transitions, supports targeted restore-state cleanup while preserving workspace drafts, and blocks subsequent writes. Workspace flows invoke this preparation before context changes and reloads, with tests covering cleanup and ordering. ChangesWorkflow restore-state cleanup
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant WorkspaceAction
participant prepareWorkflowWorkspaceTransition
participant clearWorkspaceContext
participant PageReload
WorkspaceAction->>prepareWorkflowWorkspaceTransition: flush and block workflow persistence
WorkspaceAction->>clearWorkspaceContext: clear workspace context
WorkspaceAction->>PageReload: reload page
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 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 |
|
I have read and agree to the Contributor License Agreement |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@src/platform/workflow/persistence/base/storageIO.test.ts`:
- Around line 405-414: Update the clearWorkflowRestoreState test to seed an
unrelated sessionStorage key alongside the targeted restore keys, then assert
the targeted keys are removed while the unrelated key remains. Verify removal
behavior for each restore key explicitly rather than relying only on
sessionStorage length, using the existing clearWorkflowRestoreState test.
In `@src/platform/workspace/stores/teamWorkspaceStore.test.ts`:
- Around line 388-406: Extend the workspace-store tests beyond switchWorkspace
to cover revoked-workspace handling, workspace creation, active workspace
deletion, and leaving. For each path, assert the cleanup method
mockClearWorkflowRestoreState is called with blockWrites: true and verify it
runs before clearWorkspaceContext and any reload, matching the path’s expected
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 122032f0-720e-4d86-8abf-2e2b99874e9a
📒 Files selected for processing (4)
src/platform/workflow/persistence/base/storageIO.test.tssrc/platform/workflow/persistence/base/storageIO.tssrc/platform/workspace/stores/teamWorkspaceStore.test.tssrc/platform/workspace/stores/teamWorkspaceStore.ts
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #14290 +/- ##
==========================================
+ Coverage 79.21% 79.30% +0.08%
==========================================
Files 1754 1754
Lines 114874 114188 -686
Branches 38321 38911 +590
==========================================
- Hits 90998 90554 -444
+ Misses 23331 23083 -248
- Partials 545 551 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 15 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
efa798c to
bfb4e8a
Compare
|
recheck |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
|
Filed the state-machine consolidation from the review above as its own tracked issue: #14300 (proposes a single owned |
|
@dante01yoon Successfully backported to #14301 |
|
@dante01yoon Successfully backported to #14302 |
## Summary Follow-up to Comfy-Org#14290 and [review #4813556736](Comfy-Org#14290 (review)): closes the remaining draft-isolation holes in runtime auth recovery and `unified_cloud_auth` workspace scoping. The latest staging reproduction is captured in [this Slack report](https://comfy-organization.slack.com/archives/C0932CGKT5K/p1785370090022269?thread_ts=1785169746.169899&cid=C0932CGKT5K). Staging currently contains the Comfy-Org#14290 backport, but not this follow-up. ## Root cause There were two independent gaps: 1. Runtime auth recovery cleared `currentWorkspace` before workflow persistence crossed the terminal transition boundary. A pending team-workspace save could flush after scope resolution fell back to `personal`, and expiry paths could leave the mounted editor persisting under that scope. One throwing flush callback could also skip later callbacks, the write fence, and restore-state cleanup. 2. Under `unified_cloud_auth`, successful token minting populated only `unifiedToken`; it did not populate or persist the workspace identity. Workflow persistence derives its draft/tab namespace from `Comfy.Workspace.Current`, so every team workspace fell back to the shared `personal` namespace even during a normal workspace session. The review's initialization concern remains intentionally unchanged: `WorkspaceAuthGate` keeps the routed editor unmounted until initialization finishes, so no persistence debounce exists during startup fallback. Installing a terminal fence there without a reload would permanently block workflow writes. ## Reproduction 1. Enable `unified_cloud_auth` and open workspace A. 2. Open multiple workflow tabs and make an unsaved edit. 3. Switch to workspace B and wait for the reload. 4. Observe workspace A's tabs/active workflow/draft restored in workspace B. 5. Edit in B and switch back to A; B's state can now replace or appear alongside A's state. **AS IS:** both workspaces resolve workflow persistence to `Comfy.Workflow.*:personal`, so drafts and restore pointers are shared. **TO BE:** each successful unified mint commits the response workspace identity before the editor mounts or resumes. Workspace A and B resolve distinct draft/index/restore namespaces; terminal auth failure flushes and fences the source workspace before identity is cleared and the page reloads. ## Changes - Flush and fence workflow persistence while the source workspace identity is still active, then clear auth context and reload for terminal runtime recovery paths. - Keep revoked-workspace handling ordered before auth context removal and report whether it already requested reload. - Make transition flush callbacks independent and the transition boundary idempotent. - Persist the authoritative workspace returned by unified token minting without writing unified credentials into the legacy token slots. - Clear stale workspace identity before a unified switch and route permanent unified refresh/re-mint failures through the same terminal persistence boundary. ## Review focus Confirm: - unified workspace A and B resolve distinct workflow persistence keys; - unified credentials remain separate from legacy workspace token storage; - runtime recovery ordering is source flush → write fence → revoked-workspace handling → auth clear → reload; - startup initialization remains unchanged. ## Screenshots and recordings - [AS IS screenshot](https://ampcode.com/user-content/artifacts/5de321d78b00b1b147cbd0bdae37d8f4957ed65dba9e542d5da1c49d842bb441-file.png) and [reproduction GIF](https://ampcode.com/user-content/artifacts/6b84ba3dd1a98b1dbcae0df5ec7579d7501fe748b04fd391bd3f12d401ec6468-file.gif) - [TO BE screenshot](https://ampcode.com/user-content/artifacts/f5a4c0b0ddca66b9a5eb72dac19f296d1d65e341f58277890d376b2788b90693-file.png) and [verification GIF](https://ampcode.com/user-content/artifacts/a6cef058cfd29cbeec913fd3369adc3373ab730f861a37854d44bf4acb96f97a-file.gif) - [Latest staging AS IS recording](https://comfy-organization.slack.com/archives/C0932CGKT5K/p1785370090022269?thread_ts=1785169746.169899&cid=C0932CGKT5K) ## Red → Green proof The unified workspace-scoping regression test was run unchanged before and after the fix: - **RED:** unified switch completed, but `currentWorkspace` was `null`; persistence resolved to `personal` instead of `workspace-123`. - **GREEN:** sequential unified switches resolve `Comfy.Workflow.DraftIndex.v2:workspace-123` and `Comfy.Workflow.DraftIndex.v2:workspace-456`, while legacy token storage remains empty. The earlier runtime recovery tests also prove RED → GREEN for revocation ordering, expiry fencing/reload, and exception-safe persistence cleanup. ## Verification - `useWorkspaceAuth.test.ts`: 93 passed - `teamWorkspaceStore.test.ts`: 78 passed - `storageIO.test.ts`: 24 passed - `storageKeys.test.ts`: 12 passed - `useWorkflowPersistenceV2.test.ts`: 20 passed - `vue-tsc --noEmit` - ESLint and oxfmt on changed files - `git diff --check` Staging remains expected to reproduce until this PR is merged, backported to Cloud 1.48, deployed, and the workspace A → B → A flow is reverified there. --------- Co-authored-by: dante01yoon <6510430+dante01yoon@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com>
Summary
Follow-up to #14266: flushes the source workspace's pending draft, clears transient restore pointers, and blocks later persistence writes before a successful workspace switch changes auth context and reloads.
Denys' cross-check on the #14266 test environment confirmed that the successful-switch path still reproduced the Cloud 1.48 QA report.
Root cause
#14266 fixed failed token exchange and logout, but a successful switch still cleared the current workspace context before reload without first draining and stopping workflow persistence or removing transitional restore state. A save queued inside the 512 ms debounce window could be lost or resolve against the destination identity, while unscoped legacy and per-tab session pointers survived the reload. Workspace A tabs and dirty content could then restore in Workspace B.
The transition sequence was introduced with workspace switching in #8194 on 2026-01-21. The user-visible tabs/unsaved-edit leak became possible when draft and tab-state persistence shipped in #8519 on 2026-02-19; #8520 added workspace scoping two days later but did not add a transition write barrier.
The earlier #14266 browser fixture seeded already-scoped V2 state, which naturally stayed isolated and therefore missed this transition path.
Reproduction
personal).Changes
Review Focus
Confirm the transition ordering is flush source draft → block writes → clear transient pointers → clear auth context → reload, and that scoped draft keys are preserved.
Screenshots
AS IS
Workspace B is active, but Workspace A's private Markdown Note and dirty workflow remain visible.
Also see Denys' independent reproduction recording.
TO BE
After the same successful switch, Workspace B initializes without Workspace A's private note or workflow state. The default destination workflow may still be dirty in this mocked environment; the isolation assertion is that the source-only
Workspace A onlynote and restore pointers are absent.Verified at final head
4c102a62con the #14290 test deployment in both Team → Personal and Personal → Team directions. In both directions, source-only workflow content, the dirty source tab, unscoped workflow data, and per-tab active/open restore pointers were absent after the switch.Verification
bfb4e8a69): fails — a Workspace A edit queued inside the 512 ms debounce window has no A-scoped payload after transition (sourcePayloadisnull).4c102a62c): passes — Workspace A's final edit is stored under A, a post-barrier write cannot create a Workspace B payload, and per-tab active/open restore pointers are removed.9ef6fe55f): fails —clearWorkflowRestoreState({ blockWrites: true })received 0 calls during a valid workspace switch.pnpm test:unit src/platform/workflow/persistence/composables/useWorkflowPersistenceV2.test.ts src/platform/workflow/persistence/base/storageIO.test.ts src/platform/workspace/stores/teamWorkspaceStore.test.ts— 121 passedpnpm typecheckpnpm exec eslint src/platform/workflow/persistence/base/storageIO.ts src/platform/workflow/persistence/composables/useWorkflowPersistenceV2.ts src/platform/workflow/persistence/composables/useWorkflowPersistenceV2.test.ts src/platform/workspace/stores/teamWorkspaceStore.ts src/platform/workspace/stores/teamWorkspaceStore.test.tspnpm exec oxfmt --check ...pnpm knip(pre-push hook)git diff --checkThe deployment fixture separately verifies the browser-visible outcome using mocked Cloud workspace APIs. The checked-in unit regression is the CI gate for transition ordering and scoped-draft preservation; the screenshots and GIFs document the end-to-end user behavior.