adjust getting computation status#4068
Conversation
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
📝 WalkthroughWalkthrough
ChangesBuild Status Guard for Computing Status
Suggested Reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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 |
|
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/components/computing-status/use-all-computing-status.ts`:
- Around line 129-134: The BuildStatus is only handled in
useAllComputingStatusAtOnce, while useComputingStatus still runs independently
for each computation type and can repopulate status after a batch reset. Thread
currentNodeStatusBuildStatus through useAllComputingStatus into the per-type
hook path, and update useComputingStatus to accept and honor that status so
NOT_BUILT continues to map to IDLE instead of being overwritten by its own
fetch/listen logic.
In `@src/components/computing-status/use-computing-status-at-once.ts`:
- Around line 214-220: The NOT_BUILT branch in useComputingStatusAtOnce is only
resetting statuses and nodeUuidRef, but it does not cancel any in-flight
updateAll request or clear its completion marker. Update this branch to also
invalidate the pending request state used by shouldRequestBeCanceled and reset
the last-completed computation tracking the same way updateAll does when the
node changes, so stale responses cannot overwrite the forced IDLE 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 897a4970-76f8-4af4-bd82-66167edae0e3
📒 Files selected for processing (3)
src/components/computing-status/use-all-computing-status.tssrc/components/computing-status/use-computing-status-at-once.tssrc/components/study-container.jsx
| export const useAllComputingStatus = ( | ||
| studyUuid: UUID, | ||
| currentNodeUuid: UUID, | ||
| currentRootNetworkUuid: UUID, | ||
| currentNodeStatusBuildStatus: BuildStatus | ||
| ): void => { |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="$(fd -i 'use-computing-status.ts' src/components/computing-status | head -n1)"
echo "Inspecting: $file"
ast-grep outline "$file" --view expanded
echo
rg -n -C3 'BuildStatus|NOT_BUILT|useNotificationsListener|setComputingStatus|fetch.*Status' "$file"
echo
sed -n '1,260p' "$file"Repository: gridsuite/gridstudy-app
Length of output: 13338
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="src/components/computing-status/use-all-computing-status.ts"
echo "Inspecting: $file"
ast-grep outline "$file" --view expanded
echo
rg -n -C4 'useComputingStatus|useAllComputingStatusAtOnce|currentNodeStatusBuildStatus|BuildStatus|NOT_BUILT' "$file"
echo
sed -n '1,260p' "$file"Repository: gridsuite/gridstudy-app
Length of output: 18556
Thread currentNodeStatusBuildStatus into the per-type hooks too — useAllComputingStatusAtOnce(...) is the only place that sees the BuildStatus, but useComputingStatus(...) is still mounted for every computation type and still fetches/listens on its own. If NOT_BUILT should stay IDLE, those hooks can repopulate status after the batch reset.
🤖 Prompt for 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.
In `@src/components/computing-status/use-all-computing-status.ts` around lines 129
- 134, The BuildStatus is only handled in useAllComputingStatusAtOnce, while
useComputingStatus still runs independently for each computation type and can
repopulate status after a batch reset. Thread currentNodeStatusBuildStatus
through useAllComputingStatus into the per-type hook path, and update
useComputingStatus to accept and honor that status so NOT_BUILT continues to map
to IDLE instead of being overwritten by its own fetch/listen logic.
| // no need to request the back if node is not built | ||
| if (currentNodeBuildStatus === BuildStatus.NOT_BUILT) { | ||
| Object.values(ComputingType).forEach((computingType: ComputingType) => { | ||
| dispatch(setComputingStatus(computingType, RunningStatus.IDLE)); | ||
| }); | ||
| nodeUuidRef.current = nodeUuid; | ||
| return; |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Invalidate outstanding updates before returning for NOT_BUILT.
This branch forces IDLE and exits, but it does not invalidate an updateAll() request that was already in flight for the same node/root. When that response lands, shouldRequestBeCanceled(...) still passes and can repopulate stale statuses, undoing this reset. It also skips the setLastCompletedComputation() reset that updateAll() performs for node changes.
🤖 Prompt for 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.
In `@src/components/computing-status/use-computing-status-at-once.ts` around lines
214 - 220, The NOT_BUILT branch in useComputingStatusAtOnce is only resetting
statuses and nodeUuidRef, but it does not cancel any in-flight updateAll request
or clear its completion marker. Update this branch to also invalidate the
pending request state used by shouldRequestBeCanceled and reset the
last-completed computation tracking the same way updateAll does when the node
changes, so stale responses cannot overwrite the forced IDLE state.



PR Summary