Repository navigation
fix: isolate drafts during workspace auth recovery - #14306
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWorkflow persistence now isolates flush failures and avoids repeated flushing after writes are blocked. Workspace authentication centralizes session termination across expiry, refresh, recovery, and unified-auth failures, while workspace switching tests verify workflow isolation. ChangesWorkflow and workspace session cleanup
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant WorkspaceAuth
participant WorkflowPersistence
participant TeamWorkspace
participant SessionStorage
participant Browser
WorkspaceAuth->>WorkflowPersistence: prepare workspace transition
WorkflowPersistence-->>WorkspaceAuth: flush pending writes
WorkspaceAuth->>TeamWorkspace: handle revoked active workspace
WorkspaceAuth->>SessionStorage: clear workspace and auth state
WorkspaceAuth->>Browser: reload when required
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 inconclusive)
✅ Passed checks (5 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 |
🎭 Playwright: ✅ 1756 passed, 0 failed · 2 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle: 8.18 MB gzip 🔴 +148 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) • ⚪ 0 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 — 124 kB (baseline 124 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 6 added / 6 removed / 1 unchanged UI Components — 70.7 kB (baseline 70.7 kB) • ⚪ 0 BReusable component library chunks
Status: 6 added / 6 removed / 9 unchanged Data & Services — 3.43 MB (baseline 3.43 MB) • 🔴 +819 BStores, services, APIs, and repositories
Status: 14 added / 14 removed / 3 unchanged Utilities & Hooks — 386 kB (baseline 386 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 16 added / 16 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.6 MB (baseline 12.6 MB) • ⚪ 0 BBundles that do not match a named category
Status: 69 added / 69 removed / 209 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-07-30T01:30:46.059Z",
"gitSha": "7789638b81f204cf1df2a7c3fdbdd0dec1bc656c",
"branch": "fix/workspace-auth-recovery-draft-isolation",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2135.1740000000063,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.367,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 568.087,
"heapDeltaBytes": 3703628,
"heapUsedBytes": 71582780,
"domNodes": 20,
"jsHeapTotalBytes": 20312064,
"scriptDurationMs": 15.75,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-idle",
"durationMs": 2028.3570000000282,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.5310000000000015,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 447.16100000000006,
"heapDeltaBytes": 3706516,
"heapUsedBytes": 71613628,
"domNodes": 20,
"jsHeapTotalBytes": 20574208,
"scriptDurationMs": 15.061000000000002,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1823.7489999999923,
"styleRecalcs": 75,
"styleRecalcDurationMs": 36.858000000000004,
"layouts": 12,
"layoutDurationMs": 3.4099999999999997,
"taskDurationMs": 842.87,
"heapDeltaBytes": -17938848,
"heapUsedBytes": 50250384,
"domNodes": -273,
"jsHeapTotalBytes": 21749760,
"scriptDurationMs": 118.60499999999999,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1791.0170000000107,
"styleRecalcs": 75,
"styleRecalcDurationMs": 34.882999999999996,
"layouts": 12,
"layoutDurationMs": 3.3879999999999995,
"taskDurationMs": 793.8770000000001,
"heapDeltaBytes": -1369792,
"heapUsedBytes": 66670008,
"domNodes": 57,
"jsHeapTotalBytes": 20836352,
"scriptDurationMs": 115.983,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1738.4859999999662,
"styleRecalcs": 31,
"styleRecalcDurationMs": 16.09,
"layouts": 6,
"layoutDurationMs": 0.678,
"taskDurationMs": 355.876,
"heapDeltaBytes": 7198896,
"heapUsedBytes": 75222696,
"domNodes": 78,
"jsHeapTotalBytes": 20836352,
"scriptDurationMs": 17.016,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1734.7760000000108,
"styleRecalcs": 31,
"styleRecalcDurationMs": 15.218,
"layouts": 6,
"layoutDurationMs": 0.5630000000000001,
"taskDurationMs": 351.73499999999996,
"heapDeltaBytes": 7052168,
"heapUsedBytes": 75168084,
"domNodes": 77,
"jsHeapTotalBytes": 20049920,
"scriptDurationMs": 17.137,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 594.6209999999894,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.552,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 373.82599999999996,
"heapDeltaBytes": -12288288,
"heapUsedBytes": 55752420,
"domNodes": 18,
"jsHeapTotalBytes": 21884928,
"scriptDurationMs": 57.120999999999995,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 568.7110000000075,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.775,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 372.455,
"heapDeltaBytes": -12357116,
"heapUsedBytes": 55544500,
"domNodes": 20,
"jsHeapTotalBytes": 21622784,
"scriptDurationMs": 57.95,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2058.503999999971,
"styleRecalcs": 8,
"styleRecalcDurationMs": 12.985000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 659.703,
"heapDeltaBytes": 7299292,
"heapUsedBytes": 66300068,
"domNodes": -278,
"jsHeapTotalBytes": 5566464,
"scriptDurationMs": 103.3,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2045.5600000000231,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.621999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 660.8349999999999,
"heapDeltaBytes": 6674548,
"heapUsedBytes": 65578132,
"domNodes": -277,
"jsHeapTotalBytes": 4517888,
"scriptDurationMs": 100.051,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2160.322000000008,
"styleRecalcs": 70,
"styleRecalcDurationMs": 16.699,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1247.963,
"heapDeltaBytes": 5419232,
"heapUsedBytes": 65135368,
"domNodes": -276,
"jsHeapTotalBytes": 4722688,
"scriptDurationMs": 421.161,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2136.4770000000135,
"styleRecalcs": 68,
"styleRecalcDurationMs": 13.101999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1229.8960000000002,
"heapDeltaBytes": 2655224,
"heapUsedBytes": 62442924,
"domNodes": -278,
"jsHeapTotalBytes": 5771264,
"scriptDurationMs": 424.725,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3182.181000000014,
"styleRecalcs": 65,
"styleRecalcDurationMs": 13.434000000000001,
"layouts": 60,
"layoutDurationMs": 6.834,
"taskDurationMs": 1463.9759999999999,
"heapDeltaBytes": -3586944,
"heapUsedBytes": 57876816,
"domNodes": -280,
"jsHeapTotalBytes": 7401472,
"scriptDurationMs": 509.329,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3168.2989999999336,
"styleRecalcs": 66,
"styleRecalcDurationMs": 14.670000000000002,
"layouts": 60,
"layoutDurationMs": 6.928999999999999,
"taskDurationMs": 1436.108,
"heapDeltaBytes": -4814408,
"heapUsedBytes": 56591576,
"domNodes": -279,
"jsHeapTotalBytes": 8187904,
"scriptDurationMs": 508.7379999999999,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2017.1399999999835,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.3720000000000026,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 642.2669999999999,
"heapDeltaBytes": 6128616,
"heapUsedBytes": 66896992,
"domNodes": -277,
"jsHeapTotalBytes": 5042176,
"scriptDurationMs": 99.307,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2008.6189999999533,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.539,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 638.847,
"heapDeltaBytes": 4133992,
"heapUsedBytes": 64830108,
"domNodes": -277,
"jsHeapTotalBytes": 5304320,
"scriptDurationMs": 96.27500000000002,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 566.551000000004,
"styleRecalcs": 48,
"styleRecalcDurationMs": 10.691999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 395.474,
"heapDeltaBytes": -12043968,
"heapUsedBytes": 56260304,
"domNodes": 22,
"jsHeapTotalBytes": 22147072,
"scriptDurationMs": 119.07699999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 554.5959999999468,
"styleRecalcs": 47,
"styleRecalcDurationMs": 10.043999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 377.31100000000004,
"heapDeltaBytes": -12745944,
"heapUsedBytes": 54540272,
"domNodes": 20,
"jsHeapTotalBytes": 23457792,
"scriptDurationMs": 114.83,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2021.6740000000186,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.479999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 469.769,
"heapDeltaBytes": -20961228,
"heapUsedBytes": 46994480,
"domNodes": -275,
"jsHeapTotalBytes": 20176896,
"scriptDurationMs": 13.161,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2021.4370000000486,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.266999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 481.7509999999999,
"heapDeltaBytes": -21662216,
"heapUsedBytes": 46374952,
"domNodes": -276,
"jsHeapTotalBytes": 20176896,
"scriptDurationMs": 13.456999999999999,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1700.665000000015,
"styleRecalcs": 76,
"styleRecalcDurationMs": 35.522999999999996,
"layouts": 16,
"layoutDurationMs": 4.118,
"taskDurationMs": 729.601,
"heapDeltaBytes": -5173192,
"heapUsedBytes": 62917620,
"domNodes": 63,
"jsHeapTotalBytes": 20312064,
"scriptDurationMs": 87.039,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1722.9939999999715,
"styleRecalcs": 77,
"styleRecalcDurationMs": 34.528999999999996,
"layouts": 16,
"layoutDurationMs": 4.337,
"taskDurationMs": 785.786,
"heapDeltaBytes": -19353088,
"heapUsedBytes": 48731472,
"domNodes": -273,
"jsHeapTotalBytes": 20439040,
"scriptDurationMs": 84.545,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1400.8959999999888,
"styleRecalcs": 19,
"styleRecalcDurationMs": 29.673999999999992,
"layouts": 15,
"layoutDurationMs": 12.308000000000003,
"taskDurationMs": 897.2699999999998,
"heapDeltaBytes": 29138040,
"heapUsedBytes": 98856728,
"domNodes": 13673,
"jsHeapTotalBytes": 15990784,
"scriptDurationMs": 32.995999999999995,
"eventListeners": 2371,
"totalBlockingTimeMs": 134,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8219.14099999998,
"styleRecalcs": 249,
"styleRecalcDurationMs": 35.166999999999994,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4284.833,
"heapDeltaBytes": 7582100,
"heapUsedBytes": 66386272,
"domNodes": -277,
"jsHeapTotalBytes": 6529024,
"scriptDurationMs": 1364.408,
"eventListeners": -128,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8171.715999999947,
"styleRecalcs": 250,
"styleRecalcDurationMs": 35.217999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4285.581999999999,
"heapDeltaBytes": 1256596,
"heapUsedBytes": 60634188,
"domNodes": -274,
"jsHeapTotalBytes": 7663616,
"scriptDurationMs": 1362.023,
"eventListeners": -128,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 16137.18399999999,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16116.559000000003,
"heapDeltaBytes": -61269044,
"heapUsedBytes": 170859812,
"domNodes": -8312,
"jsHeapTotalBytes": -9375744,
"scriptDurationMs": 563.079,
"eventListeners": -16387,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 16789.55899999994,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16773.428,
"heapDeltaBytes": -46705584,
"heapUsedBytes": 165906684,
"domNodes": -8312,
"jsHeapTotalBytes": -13045760,
"scriptDurationMs": 529.378,
"eventListeners": -16387,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 19950.228999999978,
"styleRecalcs": 137,
"styleRecalcDurationMs": 14.669000000000015,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 19911.867000000002,
"heapDeltaBytes": -52104176,
"heapUsedBytes": 168957096,
"domNodes": -8312,
"jsHeapTotalBytes": -15142912,
"scriptDurationMs": 841.733,
"eventListeners": -16381,
"totalBlockingTimeMs": 28,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 19959.109999999895,
"styleRecalcs": 137,
"styleRecalcDurationMs": 14.817999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 19922.056,
"heapDeltaBytes": -65354848,
"heapUsedBytes": 153708460,
"domNodes": -8312,
"jsHeapTotalBytes": -13045760,
"scriptDurationMs": 881.095,
"eventListeners": -16383,
"totalBlockingTimeMs": 128,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 466.96500000001606,
"styleRecalcs": 10,
"styleRecalcDurationMs": 16.016,
"layouts": 3,
"layoutDurationMs": 0.6529999999999999,
"taskDurationMs": 108.489,
"heapDeltaBytes": -15969436,
"heapUsedBytes": 51131144,
"domNodes": 126,
"jsHeapTotalBytes": 7729152,
"scriptDurationMs": 9.486999999999998,
"eventListeners": 67,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 464.3899999999803,
"styleRecalcs": 14,
"styleRecalcDurationMs": 18.573,
"layouts": 3,
"layoutDurationMs": 1.1030000000000002,
"taskDurationMs": 113.425,
"heapDeltaBytes": -16008328,
"heapUsedBytes": 51158192,
"domNodes": 119,
"jsHeapTotalBytes": 7729152,
"scriptDurationMs": 9.974999999999998,
"eventListeners": 65,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
}
]
} |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 400-416: The test should use an isolated module instance so
prepareWorkflowWorkspaceTransition’s workflowWritesBlocked state cannot affect
other tests. Update the test setup around prepareWorkflowWorkspaceTransition,
registerWorkflowPersistenceFlush, and the storage helpers to follow the
neighboring test’s module-isolation pattern, ensuring writeIndex and
writePayload state remains local to this test.
In `@src/platform/workflow/persistence/base/storageIO.ts`:
- Around line 27-35: Update flushPendingWorkflowPersistence so each caught flush
failure is logged with a clear, user-friendly message and the original error
details before continuing to process remaining callbacks; preserve the existing
behavior of attempting all pending flushes.
In `@src/platform/workspace/stores/teamWorkspaceStore.ts`:
- Around line 422-432: Update forgetRevokedActiveWorkspace to distinguish an
inactive workspace mismatch from a revoked personal workspace that was
intentionally handled without reloading, using a boolean contract the caller can
interpret without retrying the personal case. Preserve reload behavior for
revoked non-personal active workspaces and update the function’s docstring to
document the new return semantics.
In `@src/platform/workspace/stores/workspaceAuthStore.ts`:
- Around line 964-974: The fallback reload in endWorkspaceSession must not
override the personal-workspace loop guard in forgetRevokedActiveWorkspace.
Update the revoked-workspace handling so it distinguishes a revoked personal
workspace that is intentionally skipped from an unmatched or otherwise unhandled
ID, and only call window.location.reload() for the latter while preserving
reload behavior for active context cleanup and fully handled non-personal
revocations.
🪄 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: 96cc3973-749f-4e22-a674-14b61836f3d8
📒 Files selected for processing (5)
src/platform/workflow/persistence/base/storageIO.test.tssrc/platform/workflow/persistence/base/storageIO.tssrc/platform/workspace/stores/teamWorkspaceStore.tssrc/platform/workspace/stores/useWorkspaceAuth.test.tssrc/platform/workspace/stores/workspaceAuthStore.ts
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #14306 +/- ##
==========================================
- Coverage 79.83% 79.81% -0.03%
==========================================
Files 1759 1759
Lines 108631 108723 +92
Branches 36151 36157 +6
==========================================
+ Hits 86729 86780 +51
- Misses 21431 21465 +34
- Partials 471 478 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/workspace/stores/useWorkspaceAuth.test.ts`:
- Line 116: Replace the ad-hoc
mockPrepareWorkflowWorkspaceTransition.mockReset() call with vi.resetAllMocks()
in the test setup’s beforeEach, and recreate any required default mock
implementations there so each test starts with isolated mock state.
🪄 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: aa33344d-f16d-49d7-86ba-0134b7631b9f
📒 Files selected for processing (2)
src/platform/workspace/stores/useWorkspaceAuth.test.tssrc/platform/workspace/stores/workspaceAuthStore.ts
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
|
Addressed the four findings from review #4813830761 in
Also applied the same revoked-workspace handling to permanent unified refresh/re-mint failures. Reverified 93 auth-store tests, 78 team-workspace tests, 24 storage I/O tests, 20 workflow persistence tests, typecheck, ESLint, oxfmt, and |
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@browser_tests/tests/workspaceSwitcher.spec.ts`:
- Around line 189-195: Replace the deprecated page.waitForNavigation() calls in
the workspace-switching flows with a deterministic post-switch waiter, such as
page.waitForURL() when the URL changes or an appropriate workspace-loaded
condition otherwise. Apply the same fix to each repeated switch flow around the
workspace-switcher-panel clicks, and reuse a helper if suitable.
🪄 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: 0947c2e3-409f-4745-93cb-d7ce6731df72
📒 Files selected for processing (1)
browser_tests/tests/workspaceSwitcher.spec.ts
Amp-Thread-ID: https://ampcode.com/threads/T-019fae7d-4890-70f6-9124-9bd576fc2b3c Co-authored-by: Amp <amp@ampcode.com>
christian-byrne
left a comment
There was a problem hiding this comment.
Follow-up review — checked against #14290's review findings
Verified this against the source (not just the description) — traced endWorkspaceSession(), the flush-loop guard, and the WorkspaceAuthGate mount-ordering claim directly in the code.
C1 (initialize() fallback leak) — verified genuinely closed, but not the way I expected
initialize()'s fallback branch is byte-for-byte unchanged (still bare clearWorkflowRestoreState(), no block, no reload) — and that's fine. Traced WorkspaceAuthGate.vue → LayoutDefault.vue: <router-view> is a slot child gated by v-if="isReady", and isReady only flips after initializeWorkspaceMode() (which awaits teamWorkspaceStore.initialize() to completion) resolves. useWorkflowPersistenceV2() — the only thing that registers a graphChanged listener capable of producing the debounced write C1 worried about — is only invoked from GraphCanvas.vue, which can't mount until the gate opens. So no debounced write can exist during initialize()'s async gap. Good catch keeping this path unchanged rather than adding an unnecessary reload/block here — confirmed correct, not just asserted.
Recommend closing #14308 with this as the explanation, rather than leaving it open as if still outstanding.
H1/H2 (module-global flag + hand-copied sequence) — substantially addressed
endWorkspaceSession() is close to the transitionWorkspace() shape proposed in #14300 — it's now the single place that decides flush-then-block-then-clear-then-maybe-reload, and it's wired into the workspaceAuthStore.ts-internal clearWorkspaceContext() callers we flagged as unpaired (scheduleClearAtExpiry, scheduleTokenRefreshRetry, handleRecoveryFailure, the refresh-retry catch, both unified re-mint catches). That closes the specific gap H2 called out — those paths no longer clear session storage without flushing first.
Remaining from H1: workflowWritesBlocked still has zero reset-to-false sites anywhere (confirmed via grep) — it's still a permanent one-way flag, just now flipped from one funnel point instead of many. And useAuthActions.ts's logout() — the specific no-guaranteed-reload path H1 called out — wasn't touched by this PR, so that scenario (extension/handler intercepts window.location.href navigation → no reload → writes blocked for the rest of the session with no recovery) is still live. Worth confirming whether that's intentionally out of scope here or should route through endWorkspaceSession() too.
M3 (unguarded flush loop) — fixed, and correctly anticipates a new double-call case
flushPendingWorkflowPersistence() now wraps each callback in try/catch (console.warn on failure, continues). Also prepareWorkflowWorkspaceTransition() gained an if (!workflowWritesBlocked) guard, which — traced through endWorkspaceSession() calling prepareWorkflowWorkspaceTransition() directly AND forgetRevokedActiveWorkspace() calling it again internally when a revoked workspace is handled — means the second call is now a correct no-op (skips re-flushing, still safely re-clears restore-state keys). That double-call shape is introduced by this PR's own endWorkspaceSession + forgetRevokedActiveWorkspace composition, and the guard added to storageIO.ts handles it. Good — this was clearly considered, not accidental.
H3 (no real-storage ordering test) — improved for the paths this PR touches
New useWorkspaceAuth.test.ts test ("ends an expired workspace session behind the workflow write barrier") asserts via a mock implementation that sessionStorage.CURRENT_WORKSPACE is still populated at the moment prepareWorkflowWorkspaceTransition is called — a real ordering assertion, not just call-order. Still no single test exercises the full teamWorkspaceStore → workspaceAuthStore → storageIO chain unmocked end-to-end, but this is a meaningful improvement over #14290's pure invocationCallOrder mocking.
New finding this PR fixes that we didn't catch
Under unified_cloud_auth, successful token minting only populated unifiedToken — never currentWorkspace or CURRENT_WORKSPACE in sessionStorage. Since getWorkspaceId() reads that key, every team workspace fell back to the shared personal draft/tab namespace even during a normal (non-error) session — a broader, always-on version of the leak, gated only by the unified_cloud_auth flag. Fixed by having performUnifiedMint() set currentWorkspace.value and call the new persistWorkspaceIdentity() helper. Real regression test (getWorkspaceId() resolving to the actual workspace id, distinct DraftIndex.v2 keys for two sequential unified switches) backs this up. This is a good find — outside what our review scope covered (we were focused on the transition/cleanup ordering, not the unified mint path's write-side of workspace identity).
Still open (tracked separately, not this PR's job)
- M1 (storageAvailable/workflowWritesBlocked AND, no discriminated union) — untouched, as expected, tracked in #14300.
- M2 (
clearWorkflowRestoreState({blockWrites: true})disguised alias) — untouched, tracked in #14300. - L1/L2 — untouched, tracked in #14300.
- H1's
logout()gap specifically — not addressed here; worth a follow-up comment or scoping into #14300.
Nice work closing the loop on the transition-ordering findings and catching the unified-auth namespace collapse independently. Recommend merging, then closing #14308 with an explanation rather than leaving it open, and updating #14300 to strike the now-closed items while keeping M1/M2/L1/L2 plus the logout() gap as the remaining scope.
|
@dante01yoon Successfully backported to #14318 |
|
@dante01yoon Successfully backported to #14319 |
## Summary Follow-up to Comfy-Org#14306 and [Christian's architectural review](Comfy-Org#14306 (review)): make workflow storage transitions explicit and recoverable without weakening workspace isolation. ## Root cause `storageAvailable` and `workflowWritesBlocked` were independent booleans. Cleanup APIs could mutate the write fence as a side effect, transitions had no safe terminal operation, and logout relied on navigation/unmount to end the blocked state. If the mounted editor survived logout, reauthentication could either remain permanently blocked or resume before the destination workspace identity was ready. **AS IS:** workspace and logout transitions share an implicit one-way write fence. A pending pre-logout debounce can survive cleanup, and raw Firebase user resolution can precede workspace identity readiness. **TO BE:** one discriminated state tracks ready vs. workspace/logout transition and preserves prior storage availability. Logout cancels pending persistence, remains fenced until workspace readiness, then explicitly resumes. Workspace transition cancellation is owner-scoped so duplicate preparation cannot reopen writes. ## Changes - **What**: Replace independent availability/write-fence booleans with a discriminated transition state. - **What**: Separate restore/full cleanup from workspace/logout transition control. - **What**: Return an owner-scoped cancellation handle for resumable workspace transitions. - **What**: Cancel pending debounce on logout and resume only after team workspace identity is ready (or immediately when workspace mode is disabled). - **What**: Add real storage/debounce tests for source flush isolation, stale logout edits, destination readiness, degraded-state preservation, and duplicate transition ownership. ## Red → Green The new regression scenarios fail against the previous implementation because it has no resumable state, no owner-safe cancellation, and no workspace-readiness completion boundary. They pass with this change: - source edit flushes only to workspace A before a workspace transition; - late writes reach neither workspace B nor `personal`; - a pending pre-logout edit is discarded; - writes remain blocked after user resolution until workspace B is ready; - the first post-recovery edit is stored only in workspace B; - quota-degraded state survives transition cancellation and logout recovery. ## Review Focus - Transition ownership and duplicate `prepareWorkflowWorkspaceTransition()` calls. - Logout ordering: successful sign-out → fence/clear → workspace-ready resume. - Preservation of read behavior and quota-degraded state while writes are fenced. ## Verification - `storageIO.test.ts`: 29 passed - `useWorkflowPersistenceV2.test.ts`: 22 passed - `useAuthActions.test.ts`: 20 passed - `vue-tsc --noEmit` - ESLint, oxlint type-aware, oxfmt, and `git diff --check` on changed files Addresses the correctness items H1/M1/M2 in Comfy-Org#14300. Watcher-command refactoring and zero-registrant diagnostics remain intentionally out of scope. --------- Co-authored-by: bymyself <cbyrne@comfy.org>
Summary
Follow-up to #14290 and review #4813556736: closes the remaining draft-isolation holes in runtime auth recovery and
unified_cloud_authworkspace scoping.The latest staging reproduction is captured in this Slack report. Staging currently contains the #14290 backport, but not this follow-up.
Root cause
There were two independent gaps:
currentWorkspacebefore workflow persistence crossed the terminal transition boundary. A pending team-workspace save could flush after scope resolution fell back topersonal, 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.unified_cloud_auth, successful token minting populated onlyunifiedToken; it did not populate or persist the workspace identity. Workflow persistence derives its draft/tab namespace fromComfy.Workspace.Current, so every team workspace fell back to the sharedpersonalnamespace even during a normal workspace session.The review's initialization concern remains intentionally unchanged:
WorkspaceAuthGatekeeps 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
unified_cloud_authand open workspace A.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
Review focus
Confirm:
Screenshots and recordings
Red → Green proof
The unified workspace-scoping regression test was run unchanged before and after the fix:
currentWorkspacewasnull; persistence resolved topersonalinstead ofworkspace-123.Comfy.Workflow.DraftIndex.v2:workspace-123andComfy.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 passedteamWorkspaceStore.test.ts: 78 passedstorageIO.test.ts: 24 passedstorageKeys.test.ts: 12 passeduseWorkflowPersistenceV2.test.ts: 20 passedvue-tsc --noEmitgit diff --checkStaging 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.