Repository navigation
fix(frontend): fall back to a running unit on workflow load - #8935
eugenegujing wants to merge 1 commit into
Conversation
selectFromLastExecution now waits for the loaded unit list and selects the last execution's unit only while it is still listed, otherwise the first Running unit, and the no-history fallback waits for the same list instead of reading it synchronously.
Automated Reviewer SuggestionsBased on the
|
Backport auto-label reportThis
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8935 +/- ##
============================================
- Coverage 92.60% 92.59% -0.01%
Complexity 5043 5043
============================================
Files 1252 1252
Lines 53587 53592 +5
Branches 6673 6675 +2
============================================
+ Hits 49622 49624 +2
Misses 2317 2317
- Partials 1648 1651 +3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What changes were proposed in this PR?
Root cause. When a workflow opens,
ComputingUnitSelectionComponent.selectFromLastExecutionselects the unit the workflow last ran on without checking that the unit is still listed./api/executions/{wid}/latestalso returns terminated units, soComputingUnitStatusService.selectComputingUnitwaits forever for acuidthat never appears, and the workflow opens with no unit selected even while another unit is Running. The "first Running unit" fallback only ran when the lookup failed, and it read the unit list synchronously, so it could select nothing if the list had not loaded yet.Both screenshots: the workflow last ran on "Analytics Unit", which was then terminated, and the workflow was reloaded. "My Computing Unit" is Running.
Change. Both branches of
selectFromLastExecutionnow go through a newselectFromLoadedUnits, which waits for the first non-empty unit list, asselectInitialUnitalready does for a remembered unit. It then selects the last execution's unit if it is listed, else the first Running unit, else nothing. The warehouse preselect is unchanged.Not in scope:
Any related issues, documentation, discussions?
Closes #8933
The last-execution path dates from #3400. The remembered-unit path, which already checks the list, came with #8456.
How was this PR tested?
New tests in
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.spec.ts:Existing tests in the same
describethat go through the latest-execution path now pass their unit list tobootWithMetaStream(units), since the choice depends on the loaded list. Their expectations are unchanged. "prefers the remembered unit for this workflow over the latest execution" now also puts the latest execution's unit in the list; otherwise the new code would skip that unit anyway, and the test would no longer show that the remembered unit wins.The
NODE_OPTIONSsetting is only needed locally on Node 25, whose built-inlocalStorageshadows jsdom's. CI runs Node 24 withyarn --cwd frontend run test:ciand needs no flag.Mutation check: each of these makes at least one new test fail: dropping the list check, skipping a latest execution that has no unit, picking the last Running unit instead of the first, picking the first unit regardless of status, accepting any unit that is not Pending, dropping
untilDestroyed, dropping the workflow-change guard, dropping the non-empty-list wait, droppingtake(1), reading the list synchronously in the no-history branch, ignoringselectUnit = false, and preferring a Running unit over the last execution's unit.Manual check in Chrome, 1512x861 viewport, against a build of this branch on the local-dev stack with local computing units:
Also checked by hand: when the last execution's unit is still listed, that unit is selected rather than the first Running one; a workflow that has never run selects the first Running unit.
Was this PR authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Code (claude-fable-5-1, claude-opus-5-5). Co-authored with Claude; the author reviewed the change before submission.