Skip to content

Capture notification to fetch new path when study is renamed in gridExplroe#4093

Open
basseche wants to merge 2 commits into
mainfrom
move_item_oneNotification
Open

Capture notification to fetch new path when study is renamed in gridExplroe#4093
basseche wants to merge 2 commits into
mainfrom
move_item_oneNotification

Conversation

@basseche

Copy link
Copy Markdown
Contributor

PR Summary

…xplore

Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
@basseche basseche self-assigned this Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@basseche, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 75b5b555-8953-4d20-9c5b-88e88c9c90dc

📥 Commits

Reviewing files that changed from the base of the PR and between a9db5dd and 92e7d6b.

📒 Files selected for processing (1)
  • src/types/directory-server-types.ts
📝 Walkthrough

Walkthrough

The directory server types now expose directory metadata and its header key. useStudyPath parses that metadata from directory update events and refreshes the study path when any affected directory matches a tracked parent directory.

Changes

Directory path refresh

Layer / File(s) Summary
Directory metadata and update handling
src/types/directory-server-types.ts, src/hooks/use-study-path.ts
Adds the DirectoryInfos contract and DIRECTORIES_INFOS header constant, then uses parsed directory UUIDs to detect changes affecting the current study’s parent directories.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is only a template placeholder and does not describe the actual changes. Replace the placeholder with a short summary of what changed and why it matters.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title correctly reflects the main change: fetching a new study path after a rename notification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

@github-actions github-actions 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.

license-eye has totally checked 816 files.

Valid Invalid Ignored Fixed
767 1 48 0
Click to see the invalid file list
  • src/types/directory-server-types.ts

Comment thread src/types/directory-server-types.ts
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>

@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: 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/hooks/use-study-path.ts`:
- Around line 71-72: In the WebSocket message handler, guard access to the
DIRECTORIES_INFOS header before parsing and wrap JSON.parse in a try/catch to
handle absent or malformed values without escaping the callback. Update the
directory-processing logic in the onMessage callback to continue safely when
parsing fails, while preserving the existing
studyParentDirectoriesUuidsRef.current matching behavior.
🪄 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: 7c8fccc1-1d7e-457d-a84d-4eb85485466b

📥 Commits

Reviewing files that changed from the base of the PR and between 17eaff9 and a9db5dd.

📒 Files selected for processing (2)
  • src/hooks/use-study-path.ts
  • src/types/directory-server-types.ts

Comment on lines +71 to +72
const directoryInfos: DirectoryInfos[] = JSON.parse(eventData.headers[DIRECTORIES_INFOS]);
if (directoryInfos.some((info) => studyParentDirectoriesUuidsRef.current.includes(info.uuid))) {

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

Guard against missing or malformed DIRECTORIES_INFOS header.

JSON.parse(eventData.headers[DIRECTORIES_INFOS]) will throw a SyntaxError if the header is absent (undefined) or contains invalid JSON. This runs inside a WebSocket onMessage callback — an uncaught exception here could silently break the notification listener. Add a guard for header existence and wrap the parse in a try/catch.

🛡️ Proposed defensive guard
-                    const directoryInfos: DirectoryInfos[] = JSON.parse(eventData.headers[DIRECTORIES_INFOS]);
-                    if (directoryInfos.some((info) => studyParentDirectoriesUuidsRef.current.includes(info.uuid))) {
-                        fetchStudyPath();
-                    }
+                    const rawInfos = eventData.headers[DIRECTORIES_INFOS];
+                    if (rawInfos) {
+                        try {
+                            const directoryInfos: DirectoryInfos[] = JSON.parse(rawInfos);
+                            if (directoryInfos.some((info) => studyParentDirectoriesUuidsRef.current.includes(info.uuid))) {
+                                fetchStudyPath();
+                            }
+                        } catch {
+                            // Ignore malformed payload
+                        }
+                    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const directoryInfos: DirectoryInfos[] = JSON.parse(eventData.headers[DIRECTORIES_INFOS]);
if (directoryInfos.some((info) => studyParentDirectoriesUuidsRef.current.includes(info.uuid))) {
const rawInfos = eventData.headers[DIRECTORIES_INFOS];
if (rawInfos) {
try {
const directoryInfos: DirectoryInfos[] = JSON.parse(rawInfos);
if (directoryInfos.some((info) => studyParentDirectoriesUuidsRef.current.includes(info.uuid))) {
fetchStudyPath();
}
} catch {
// Ignore malformed payload
}
}
🤖 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/hooks/use-study-path.ts` around lines 71 - 72, In the WebSocket message
handler, guard access to the DIRECTORIES_INFOS header before parsing and wrap
JSON.parse in a try/catch to handle absent or malformed values without escaping
the callback. Update the directory-processing logic in the onMessage callback to
continue safely when parsing fails, while preserving the existing
studyParentDirectoriesUuidsRef.current matching behavior.

@sonarqubecloud

Copy link
Copy Markdown

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