Repository navigation
fix: prevent tab removal on failed workflow switch - #11389
christian-byrne wants to merge 3 commits into
Conversation
|
Warning Review limit reachedNext included review available in 36 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughEnhanced workflow switching logic by introducing Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant closeWorkflow as closeWorkflow
participant switchAwayFrom as switchAwayFrom
participant trySwitch as trySwitch
participant workflowStore
participant app
Client->>closeWorkflow: closeWorkflow(active)
alt Workflow is active
closeWorkflow->>switchAwayFrom: Switch away from active
switchAwayFrom->>trySwitch: openWorkflow(replacement)
rect rgba(100, 150, 200, 0.5)
Note over trySwitch,app: Try opening replacement workflow
trySwitch->>app: loadGraphData(replacement)
app-->>trySwitch: Success/Failure
end
alt Replacement workflow activated
trySwitch-->>switchAwayFrom: true
switchAwayFrom-->>closeWorkflow: true (switched successfully)
else Replacement failed
switchAwayFrom->>trySwitch: loadDefaultWorkflow()
trySwitch->>app: loadGraphData(default)
app-->>trySwitch: Success/Failure
alt Default workflow activated
trySwitch-->>switchAwayFrom: true
switchAwayFrom-->>closeWorkflow: true
else Both failed
switchAwayFrom-->>closeWorkflow: false
end
end
alt Switch succeeded
closeWorkflow->>workflowStore: Close the original workflow
closeWorkflow-->>Client: true
else Switch failed
closeWorkflow-->>Client: false (workflow remains open)
end
else Workflow is not active
closeWorkflow->>workflowStore: Close workflow directly
closeWorkflow-->>Client: true
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🎨 Storybook: ✅ Built — View Storybook |
🎭 Playwright: ✅ 1584 passed, 0 failed · 5 flaky📊 Browser Reports
|
📦 Bundle: 5.35 MB gzip 🔴 +19 BDetailsSummary
Category Glance App Entry Points — 31.8 kB (baseline 31.8 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.24 MB (baseline 1.24 MB) • 🟢 -200 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 82.6 kB (baseline 82.6 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 9 added / 9 removed / 2 unchanged Panels & Settings — 526 kB (baseline 526 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 10 added / 10 removed / 14 unchanged User & Accounts — 17.7 kB (baseline 17.7 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 5 added / 5 removed / 2 unchanged Editors & Dialogs — 112 kB (baseline 112 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 4 added / 4 removed UI Components — 57.9 kB (baseline 57.9 kB) • ⚪ 0 BReusable component library chunks
Status: 5 added / 5 removed / 8 unchanged Data & Services — 3.16 MB (baseline 3.16 MB) • 🔴 +396 BStores, services, APIs, and repositories
Status: 13 added / 13 removed / 4 unchanged Utilities & Hooks — 369 kB (baseline 369 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 13 added / 13 removed / 19 unchanged Vendor & Third-Party — 9.94 MB (baseline 9.94 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 16 unchanged Other — 9.13 MB (baseline 9.13 MB) • ⚪ 0 BBundles that do not match a named category
Status: 57 added / 57 removed / 85 unchanged ⚡ Performance Report
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-05-13T21:01:10.231Z",
"gitSha": "6cd4ba3582b13fb42914ad64d12b4c6a82bced63",
"branch": "batch-dispatch/issue-7840",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2008.942999999988,
"styleRecalcs": 7,
"styleRecalcDurationMs": 5.123000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 433.057,
"heapDeltaBytes": 23224720,
"heapUsedBytes": 71823600,
"domNodes": 14,
"jsHeapTotalBytes": 14680064,
"scriptDurationMs": 21.534999999999997,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-idle",
"durationMs": 2006.505000000061,
"styleRecalcs": 11,
"styleRecalcDurationMs": 8.719,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 346.449,
"heapDeltaBytes": 23620756,
"heapUsedBytes": 73000432,
"domNodes": 22,
"jsHeapTotalBytes": 14417920,
"scriptDurationMs": 20.516,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1791.95500000003,
"styleRecalcs": 74,
"styleRecalcDurationMs": 33.279,
"layouts": 12,
"layoutDurationMs": 3.1479999999999997,
"taskDurationMs": 710.1840000000001,
"heapDeltaBytes": 14503004,
"heapUsedBytes": 61469056,
"domNodes": 55,
"jsHeapTotalBytes": 17825792,
"scriptDurationMs": 117.576,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1812.0420000000195,
"styleRecalcs": 73,
"styleRecalcDurationMs": 36.473,
"layouts": 12,
"layoutDurationMs": 3.7270000000000003,
"taskDurationMs": 774.874,
"heapDeltaBytes": -1738208,
"heapUsedBytes": 47349872,
"domNodes": -263,
"jsHeapTotalBytes": 15855616,
"scriptDurationMs": 117.14799999999998,
"eventListeners": -133,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1721.0139999999683,
"styleRecalcs": 31,
"styleRecalcDurationMs": 16.244,
"layouts": 6,
"layoutDurationMs": 0.6309999999999998,
"taskDurationMs": 279.87399999999997,
"heapDeltaBytes": 433616,
"heapUsedBytes": 48838052,
"domNodes": 77,
"jsHeapTotalBytes": 15466496,
"scriptDurationMs": 17.278,
"eventListeners": 21,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1710.617999999954,
"styleRecalcs": 29,
"styleRecalcDurationMs": 13.881999999999998,
"layouts": 6,
"layoutDurationMs": 0.659,
"taskDurationMs": 347.64300000000003,
"heapDeltaBytes": 24880860,
"heapUsedBytes": 74126720,
"domNodes": -188,
"jsHeapTotalBytes": 14544896,
"scriptDurationMs": 18.189999999999998,
"eventListeners": -110,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 545.1730000000339,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.828999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 318.16999999999996,
"heapDeltaBytes": 8338096,
"heapUsedBytes": 57317664,
"domNodes": 19,
"jsHeapTotalBytes": 16515072,
"scriptDurationMs": 53.754,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999727
},
{
"name": "dom-widget-clipping",
"durationMs": 552.7009999999564,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.401000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 327.3619999999999,
"heapDeltaBytes": 9491432,
"heapUsedBytes": 58587896,
"domNodes": 17,
"jsHeapTotalBytes": 15204352,
"scriptDurationMs": 55.719,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.663333333333338,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "large-graph-idle",
"durationMs": 2033.614,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.411000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 518.537,
"heapDeltaBytes": 9216988,
"heapUsedBytes": 66497048,
"domNodes": -261,
"jsHeapTotalBytes": -237568,
"scriptDurationMs": 83.401,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2015.282999999954,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.9570000000000025,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 551.901,
"heapDeltaBytes": 12558988,
"heapUsedBytes": 71992468,
"domNodes": -262,
"jsHeapTotalBytes": 3751936,
"scriptDurationMs": 82.91999999999999,
"eventListeners": -131,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2120.9100000000376,
"styleRecalcs": 69,
"styleRecalcDurationMs": 18.367999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 998.0530000000001,
"heapDeltaBytes": 23678600,
"heapUsedBytes": 83439148,
"domNodes": -263,
"jsHeapTotalBytes": 6258688,
"scriptDurationMs": 348.59499999999997,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2138.249000000087,
"styleRecalcs": 69,
"styleRecalcDurationMs": 22.934,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1114.4209999999998,
"heapDeltaBytes": 48257380,
"heapUsedBytes": 108020008,
"domNodes": -260,
"jsHeapTotalBytes": 39813120,
"scriptDurationMs": 359.524,
"eventListeners": -127,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3148.721000000023,
"styleRecalcs": 66,
"styleRecalcDurationMs": 18.249,
"layouts": 60,
"layoutDurationMs": 7.7940000000000005,
"taskDurationMs": 1285.3700000000001,
"heapDeltaBytes": 8578736,
"heapUsedBytes": 69789608,
"domNodes": -268,
"jsHeapTotalBytes": 548864,
"scriptDurationMs": 467.85699999999997,
"eventListeners": -125,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3058.450999999991,
"styleRecalcs": 63,
"styleRecalcDurationMs": 17.6,
"layouts": 60,
"layoutDurationMs": 8.107999999999999,
"taskDurationMs": 1239.1610000000003,
"heapDeltaBytes": 11008648,
"heapUsedBytes": 64296448,
"domNodes": 8,
"jsHeapTotalBytes": 2359296,
"scriptDurationMs": 479.218,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2004.8319999999649,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.363999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 473.36000000000007,
"heapDeltaBytes": 10451100,
"heapUsedBytes": 68306224,
"domNodes": 18,
"jsHeapTotalBytes": 10485760,
"scriptDurationMs": 78.28999999999999,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2028.016999999977,
"styleRecalcs": 7,
"styleRecalcDurationMs": 7.002999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 545.8829999999999,
"heapDeltaBytes": 7183000,
"heapUsedBytes": 67792352,
"domNodes": -264,
"jsHeapTotalBytes": 1073152,
"scriptDurationMs": 82.76600000000002,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 567.2440000000165,
"styleRecalcs": 46,
"styleRecalcDurationMs": 9.399999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 373.51399999999995,
"heapDeltaBytes": 15336088,
"heapUsedBytes": 64735868,
"domNodes": 18,
"jsHeapTotalBytes": 17301504,
"scriptDurationMs": 132.115,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999727
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 527.533999999946,
"styleRecalcs": 46,
"styleRecalcDurationMs": 10.317,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 354.82099999999997,
"heapDeltaBytes": 9599368,
"heapUsedBytes": 59443348,
"domNodes": 18,
"jsHeapTotalBytes": 15990784,
"scriptDurationMs": 122.954,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-idle",
"durationMs": 2004.620999999986,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.906000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 327.03299999999996,
"heapDeltaBytes": 23031824,
"heapUsedBytes": 71945528,
"domNodes": 18,
"jsHeapTotalBytes": 15204352,
"scriptDurationMs": 12.645999999999997,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2039.0019999999822,
"styleRecalcs": 11,
"styleRecalcDurationMs": 9.08,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 385.308,
"heapDeltaBytes": 23139592,
"heapUsedBytes": 71655320,
"domNodes": 21,
"jsHeapTotalBytes": 14680064,
"scriptDurationMs": 22.169,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1731.9779999999696,
"styleRecalcs": 74,
"styleRecalcDurationMs": 32.848,
"layouts": 16,
"layoutDurationMs": 4.1930000000000005,
"taskDurationMs": 695.2740000000001,
"heapDeltaBytes": 15466300,
"heapUsedBytes": 64712548,
"domNodes": -265,
"jsHeapTotalBytes": 18739200,
"scriptDurationMs": 81.55999999999999,
"eventListeners": -131,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1730.4619999999886,
"styleRecalcs": 76,
"styleRecalcDurationMs": 35.928000000000004,
"layouts": 16,
"layoutDurationMs": 4.313,
"taskDurationMs": 743.044,
"heapDeltaBytes": 19309828,
"heapUsedBytes": 67974976,
"domNodes": -260,
"jsHeapTotalBytes": 17428480,
"scriptDurationMs": 94.42800000000001,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 931.7800000000034,
"styleRecalcs": 17,
"styleRecalcDurationMs": 28.837000000000003,
"layouts": 5,
"layoutDurationMs": 12.451,
"taskDurationMs": 724.628,
"heapDeltaBytes": 4601908,
"heapUsedBytes": 76955852,
"domNodes": 13513,
"jsHeapTotalBytes": 14155776,
"scriptDurationMs": 26.166999999999994,
"eventListeners": 2527,
"totalBlockingTimeMs": 142,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "viewport-pan-sweep",
"durationMs": 8170.144999999991,
"styleRecalcs": 250,
"styleRecalcDurationMs": 53.891999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 3410.708,
"heapDeltaBytes": 12882468,
"heapUsedBytes": 71454856,
"domNodes": -261,
"jsHeapTotalBytes": 6782976,
"scriptDurationMs": 1112.13,
"eventListeners": -113,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "viewport-pan-sweep",
"durationMs": 8138.330999999994,
"styleRecalcs": 249,
"styleRecalcDurationMs": 54.88999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 3439.13,
"heapDeltaBytes": 12683240,
"heapUsedBytes": 71290660,
"domNodes": -264,
"jsHeapTotalBytes": 6782976,
"scriptDurationMs": 1154.782,
"eventListeners": -113,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 12244.37599999999,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12234.556999999999,
"heapDeltaBytes": -14238180,
"heapUsedBytes": 185257108,
"domNodes": -8330,
"jsHeapTotalBytes": 22867968,
"scriptDurationMs": 532.012,
"eventListeners": -16464,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 13031.00100000006,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12999.157000000001,
"heapDeltaBytes": -45903764,
"heapUsedBytes": 171821840,
"domNodes": -8331,
"jsHeapTotalBytes": 26800128,
"scriptDurationMs": 581.1919999999999,
"eventListeners": -16464,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333237,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 17328.18500000002,
"styleRecalcs": 111,
"styleRecalcDurationMs": 20.69700000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17307.613,
"heapDeltaBytes": 160414572,
"heapUsedBytes": 398445408,
"domNodes": -3302,
"jsHeapTotalBytes": 140685312,
"scriptDurationMs": 1013.0540000000001,
"eventListeners": -16465,
"totalBlockingTimeMs": 5,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 14794.937000000005,
"styleRecalcs": 69,
"styleRecalcDurationMs": 17.92499999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 14765.164000000002,
"heapDeltaBytes": -26982856,
"heapUsedBytes": 175258796,
"domNodes": -8329,
"jsHeapTotalBytes": -1859584,
"scriptDurationMs": 858.1600000000001,
"eventListeners": -16488,
"totalBlockingTimeMs": 29,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 129.85200000002806,
"styleRecalcs": 11,
"styleRecalcDurationMs": 20.934,
"layouts": 5,
"layoutDurationMs": 1.884,
"taskDurationMs": 105.07,
"heapDeltaBytes": 3660352,
"heapUsedBytes": 53583016,
"domNodes": 151,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 25.906,
"eventListeners": 37,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "workflow-execution",
"durationMs": 458.8850000000093,
"styleRecalcs": 15,
"styleRecalcDurationMs": 23.054,
"layouts": 5,
"layoutDurationMs": 1.359,
"taskDurationMs": 116.269,
"heapDeltaBytes": 5039540,
"heapUsedBytes": 55863560,
"domNodes": 153,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 24.724000000000004,
"eventListeners": 69,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
}
]
} |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/platform/workflow/core/services/workflowService.test.ts (1)
1235-1247: Consider extractingcreateLoadedWorkflowhelper to reduce duplication.This helper is very similar to
createModeTestWorkflow(lines 25-46) andcreateSaveableWorkflow(lines 1111-1121). The key differences are in the default options and type assertions. Consider consolidating these into a single flexible helper or extracting common setup logic to improve maintainability.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platform/workflow/core/services/workflowService.test.ts` around lines 1235 - 1247, The three test helpers createLoadedWorkflow, createModeTestWorkflow, and createSaveableWorkflow duplicate setup logic; refactor by extracting a single flexible factory (e.g., buildTestWorkflow) that accepts options for path, modified, size, content, originalContent and a flag/type override for LoadedComfyWorkflow vs other assertions, and that sets workflow.changeTracker via createMockChangeTracker and instantiates via ComfyWorkflowClass; replace the three helpers with thin wrappers or calls to this new buildTestWorkflow to preserve specific defaults and type assertions.src/platform/workflow/core/services/workflowService.ts (1)
296-298: Consider adding error handling for the single-workflow case.When closing the last workflow (line 296-298),
loadDefaultWorkflow()is called without try/catch. If this throws (e.g., due to the same configure errors that affect the new switch logic), the error would propagate up unhandled.This may be intentional (catastrophic failure), but for consistency with the new error handling pattern, you might consider wrapping this in try/catch as well.
Optional: Add error handling for consistency
// If this is the last workflow, create a new default temporary workflow if (workflowStore.openWorkflows.length === 1) { - await loadDefaultWorkflow() + try { + await loadDefaultWorkflow() + } catch (error) { + console.error('Failed to load default workflow for last tab', error) + return false + } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platform/workflow/core/services/workflowService.ts` around lines 296 - 298, When closing the last workflow (checking workflowStore.openWorkflows.length === 1) the call to loadDefaultWorkflow() should be wrapped in a try/catch to avoid an unhandled rejection; update the block in workflowService.ts so loadDefaultWorkflow() is invoked inside try { await loadDefaultWorkflow() } catch (err) { /* mirror the new error handling pattern: log the error with context and recover or rethrow as appropriate */ }, referencing workflowStore.openWorkflows and loadDefaultWorkflow to locate the code and using the same logging/handling mechanism used elsewhere in this file for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/platform/workflow/core/services/workflowService.test.ts`:
- Around line 1249-1271: The test mocks workflowStore.openWorkflow which skips
the real implementation that populates workflowStore.openWorkflowPaths, so
workflowStore.isOpen(active) will be false; fix by ensuring the store reflects
opened paths before calling service.closeWorkflow: after creating active and
other via createLoadedWorkflow and after mocking openWorkflow, push active.path
and other.path into workflowStore.openWorkflowPaths (or alternatively mock
workflowStore.isOpen to return true for those workflow objects) so the
expectation in the test (expect(workflowStore.isOpen(active)).toBe(true)) is
satisfied.
---
Nitpick comments:
In `@src/platform/workflow/core/services/workflowService.test.ts`:
- Around line 1235-1247: The three test helpers createLoadedWorkflow,
createModeTestWorkflow, and createSaveableWorkflow duplicate setup logic;
refactor by extracting a single flexible factory (e.g., buildTestWorkflow) that
accepts options for path, modified, size, content, originalContent and a
flag/type override for LoadedComfyWorkflow vs other assertions, and that sets
workflow.changeTracker via createMockChangeTracker and instantiates via
ComfyWorkflowClass; replace the three helpers with thin wrappers or calls to
this new buildTestWorkflow to preserve specific defaults and type assertions.
In `@src/platform/workflow/core/services/workflowService.ts`:
- Around line 296-298: When closing the last workflow (checking
workflowStore.openWorkflows.length === 1) the call to loadDefaultWorkflow()
should be wrapped in a try/catch to avoid an unhandled rejection; update the
block in workflowService.ts so loadDefaultWorkflow() is invoked inside try {
await loadDefaultWorkflow() } catch (err) { /* mirror the new error handling
pattern: log the error with context and recover or rethrow as appropriate */ },
referencing workflowStore.openWorkflows and loadDefaultWorkflow to locate the
code and using the same logging/handling mechanism used elsewhere in this file
for consistency.
🪄 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: CHILL
Plan: Pro
Run ID: 5e2a2d81-bf0e-413e-a7ad-af9ad7dba042
📒 Files selected for processing (3)
src/platform/workflow/core/services/workflowService.test.tssrc/platform/workflow/core/services/workflowService.tssrc/scripts/app.ts
2b20f9e to
91e442e
Compare
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #11389 +/- ##
===========================================
- Coverage 73.98% 59.44% -14.55%
===========================================
Files 1519 1410 -109
Lines 86808 71827 -14981
Branches 24296 19014 -5282
===========================================
- Hits 64227 42699 -21528
- Misses 21769 28652 +6883
+ Partials 812 476 -336
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1003 files with indirect coverage changes 🚀 New features to boost your workflow:
|
christian-byrne
left a comment
There was a problem hiding this comment.
Make sure all lines/functions in the diff also have 80%+ unit test code coverage.
Also, fetch/rebase/fix conflicts before anything else.
Addresses review feedback: #11389 (comment)
Addresses review feedback: #11389 (comment)
dante01yoon
left a comment
There was a problem hiding this comment.
One blocking gap remains before I can approve.
The new trySwitch() logic is meant to protect both thrown switch failures and the silent case where loadGraphData() returns without ever switching the active workflow. Right now the added regression tests only cover the thrown path, so the exact !workflowStore.isActive(workflow) postcondition in trySwitch() could regress without any test failing.
Separate scope note: the current head no longer changes src/scripts/app.ts, and both main and this PR still have the same unawaited A1111 fallback at src/scripts/app.ts:2008-2015. Since that half of #7840 was split out earlier, please update the PR body / issue linkage so this PR only claims the close-workflow fix instead of Fixes #7840.
Previously the last-tab path in closeWorkflow called loadDefaultWorkflow() directly. loadGraphData() only swallows configure() errors; it can still reject from validation, extension hooks, or node-replacement loading, which would throw out of closeWorkflow instead of returning false like the multi-tab path does. Wrap the call in trySwitch() so the last-tab case follows the same 'do not close if we failed to activate a replacement' contract. Addresses review feedback: #11389 (comment)
The two existing closeWorkflow regression tests only cover thrown errors from app.loadGraphData. The actual #7840 regression is the silent path where loadGraphData() catches the configure() error internally and resolves without ever switching the active workflow. Without this case the suite would still pass if someone removed the !workflowStore.isActive(workflow) postcondition from trySwitch() and kept only the catch block. Mock loadGraphData to resolve unconditionally, leaving activeWorkflow on the closing workflow, and assert closeWorkflow returns false and keeps the tab open. Addresses review feedback: #11389 (comment) #11389 (comment)
christian-byrne
left a comment
There was a problem hiding this comment.
We need an e2e test for this. Ideally we can use the original workflow from the user who reported the bug #7840 in assets of browser_tests. Alternatively, can 1:1 emulate the scenario if possible.
christian-byrne
left a comment
There was a problem hiding this comment.
This needs an e2e test demonstrating that the bug even can still be reproduced. See markdown files and existing test infrastructure in the browser_tests top level folder in the repo.
Review Feedback Addressed@dante01yoon — addressed your review comments: 1. Silent-resolve regression test (workflowService.test.ts:1284)Added test case where 2. Route single-tab path through trySwitch (workflowService.ts:331)Single-tab close now uses Ready for re-review. |
dante01yoon
left a comment
There was a problem hiding this comment.
Both blocking items from my earlier reviews are resolved at 2f6461dd:
trySwitch()now has the!workflowStore.isActive(workflow)postcondition, and the new "loadGraphData resolves but active workflow does not change" test pins the silent-failure branch.removeDraftis moved below the switch and only runs ondidSwitch === true, so the persisted draft is preserved when close is aborted.- PR body is scoped to the close-workflow fix and no longer auto-closes #7840.
Validation: re-read closeWorkflow / trySwitch / switchAwayFrom on the PR head, confirmed CI green on head, no remaining Fixes #7840 keyword in the body. Christian's request for an e2e reproduction (the comment from May 14) is still open — leaving that between you two since it's not a regression introduced by this PR.
Approving on the close-workflow scope only.
|
@coderabbitai review |
|
…rt overwriting current tab (#7840) - closeWorkflow: wrap replacement switch in try-catch with postcondition check; fall back to loadDefaultWorkflow if first switch fails; return false without removing the tab if both fail - handleFile (A1111): clean graph before import, properly await importA1111() and afterLoadNewGraph() - Add 2 regression tests for closeWorkflow resilience Fixes #7840
The two existing closeWorkflow regression tests only cover thrown errors from app.loadGraphData. The actual #7840 regression is the silent path where loadGraphData() catches the configure() error internally and resolves without ever switching the active workflow. Without this case the suite would still pass if someone removed the !workflowStore.isActive(workflow) postcondition from trySwitch() and kept only the catch block. Mock loadGraphData to resolve unconditionally, leaving activeWorkflow on the closing workflow, and assert closeWorkflow returns false and keeps the tab open. Addresses review feedback: #11389 (comment) #11389 (comment)
Moves removeDraft() call to after the switch/close logic completes, preserving the draft if closeWorkflow returns false due to a failed switch. Adds test coverage for draft preservation on switch failure. Addresses review feedback: #11389 (review) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2f6461d to
43b990b
Compare
|
Rebased onto Every commit on this branch turned out to be fully superseded by work already merged to I removed the one now-stale test block ( |
|
question: this branch has a zero net diff against Is the fix already on Full context for agent readersFound by the hourly Two other open principal FE PRs are in the same state and carry the same comment: #16565 and #16381. |
|
Zero-diff branch closed. Full context for agent readersAt head Merged #16075 subsequently replaced the relevant workflow-close path on |
Summary
Fixes the workflow close bug reported in #7840 (part 1 of 2):
Closing a workflow with missing nodes causes white screen:
closeWorkflowcalledopenWorkflow(replacement)then unconditionally removed the tab. IfloadGraphDatainternally caught aconfigure()error and returned early, the active workflow was never switched but the tab was still removed — leaving the user with a blank canvas.Changes
closeWorkflow(workflowService.ts): Wrap replacement switch in try-catch with postcondition check (workflowStore.isActive(workflow)); fall back toloadDefaultWorkflow()if first switch fails; returnfalsewithout removing the tab if both fail.removeDraft()after switch succeeds to keep draft intact if close is aborted.Related to #7840 (A1111 import fix will be addressed in a separate PR)
┆Issue is synchronized with this Notion page by Unito