Skip to content

adjust getting computation status#4068

Open
EtienneLt wants to merge 1 commit into
mainfrom
adjust-get-computation-status
Open

adjust getting computation status#4068
EtienneLt wants to merge 1 commit into
mainfrom
adjust-get-computation-status

Conversation

@EtienneLt

Copy link
Copy Markdown
Contributor

PR Summary

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@EtienneLt EtienneLt self-assigned this Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

useAllComputingStatusAtOnce gains a currentNodeBuildStatus: BuildStatus parameter. When the node is NOT_BUILT, it sets all computation statuses to IDLE and returns early. Notification filtering now skips updates targeting a different node. This parameter is threaded through useAllComputingStatus and called from StudyContainer with currentNode?.data.globalBuildStatus.

Changes

Build Status Guard for Computing Status

Layer / File(s) Summary
Core update logic in useAllComputingStatusAtOnce
src/components/computing-status/use-computing-status-at-once.ts
Adds BuildStatus import and currentNodeBuildStatus prop to UseComputingStatusProps; extends isWorthUpdate to skip updates when the notification targets a different node; adds a NOT_BUILT branch in evaluateUpdate that dispatches IDLE for all ComputingType statuses and returns early; adds currentNodeBuildStatus to the callback dependency list.
Propagation through hooks and container
src/components/computing-status/use-all-computing-status.ts, src/components/study-container.jsx
useAllComputingStatus adds currentNodeStatusBuildStatus: BuildStatus to its signature and forwards it to useAllComputingStatusAtOnce; StudyContainer passes currentNode?.data.globalBuildStatus at the call site.

Suggested Reviewers

  • SlimaneAmar
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the change but too vague to clearly describe the main behavior update. Use a more specific title like 'Skip computation-status updates for NOT_BUILT nodes'.
Description check ❓ Inconclusive The description is just a placeholder template and does not meaningfully describe the changeset. Add a brief summary of the hook signature update and the node/build-status handling changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a0f69d and a524251.

📒 Files selected for processing (3)
  • src/components/computing-status/use-all-computing-status.ts
  • src/components/computing-status/use-computing-status-at-once.ts
  • src/components/study-container.jsx

Comment on lines +129 to +134
export const useAllComputingStatus = (
studyUuid: UUID,
currentNodeUuid: UUID,
currentRootNetworkUuid: UUID,
currentNodeStatusBuildStatus: BuildStatus
): void => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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 toouseAllComputingStatusAtOnce(...) 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.

Comment on lines +214 to +220
// 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant