Skip to content

adds Modification reference basic handling#1172

Open
Mathieu-Deharbe wants to merge 21 commits into
mainfrom
modification-reference
Open

adds Modification reference basic handling#1172
Mathieu-Deharbe wants to merge 21 commits into
mainfrom
modification-reference

Conversation

@Mathieu-Deharbe

@Mathieu-Deharbe Mathieu-Deharbe commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

uses #1150

SOUISSI Maissa (Externe) and others added 6 commits May 27, 2026 12:08
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@Mathieu-Deharbe Mathieu-Deharbe marked this pull request as draft June 5, 2026 14:45
@coderabbitai

This comment was marked as low quality.

@Mathieu-Deharbe Mathieu-Deharbe changed the base branch from main to inline-mode-treeViewFinder June 5, 2026 14:47
Base automatically changed from inline-mode-treeViewFinder to main June 9, 2026 11:24
@Mathieu-Deharbe Mathieu-Deharbe self-assigned this Jun 16, 2026
@Mathieu-Deharbe Mathieu-Deharbe marked this pull request as ready for review June 17, 2026 12:04

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/network-modification-table/use-modifications-drag-and-drop.tsx (1)

117-129: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Shared-modification guard is bypassed for composite source rows

At Line 117-126, the early return for composite sources prevents the shared check at Line 127-129 from running. This allows drops onto shared targets when the source is composite, which breaks the new restriction (“either source or target shared” should be forbidden).

Suggested fix
 const isDropForbidden = useCallback(
     (sourceRow: Row<ComposedModificationMetadata>, targetRow: Row<ComposedModificationMetadata>): boolean => {
+        // Temporary: shared modifications are not draggable/droppable yet
+        if (isSharedModification(sourceRow.original) || isSharedModification(targetRow.original)) {
+            return true;
+        }
+
         if (isCompositeModification(sourceRow.original)) {
             const targetDepth = computeTargetDepth(sourceRow, targetRow);
             return (
                 (sourceRow.original.maxDepth ?? 0) + targetDepth > MAX_COMPOSITE_NESTING_DEPTH ||
                 !!(
                     isCompositeModification(sourceRow.original) &&
                     findModificationInTree(targetRow.original.uuid, [sourceRow.original])
                 )
             );
         }
-        // TODO : this is temporary, until drag and drop is done for the shared modifications :
-        if (isSharedModification(sourceRow.original) || isSharedModification(targetRow.original)) return true;
 
         return false;
     },
     [computeTargetDepth]
 );
🤖 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/features/network-modification-table/use-modifications-drag-and-drop.tsx`
around lines 117 - 129, The shared modification validation check
(isSharedModification for both sourceRow and targetRow) is unreachable when the
source is a composite modification because the early return statement in the
composite modification condition block prevents execution from reaching the
shared modification guard. Move the shared modification check to execute before
or alongside the composite modification checks, ensuring that restrictions on
shared modifications are enforced regardless of whether the source is composite.
This will prevent composite source rows from bypassing the shared modification
guard that should forbid drops when either source or target is a shared
modification.
🤖 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.

Outside diff comments:
In `@src/features/network-modification-table/use-modifications-drag-and-drop.tsx`:
- Around line 117-129: The shared modification validation check
(isSharedModification for both sourceRow and targetRow) is unreachable when the
source is a composite modification because the early return statement in the
composite modification condition block prevents execution from reaching the
shared modification guard. Move the shared modification check to execute before
or alongside the composite modification checks, ensuring that restrictions on
shared modifications are enforced regardless of whether the source is composite.
This will prevent composite source rows from bypassing the shared modification
guard that should forbid drops when either source or target is a shared
modification.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 81ea9673-e8bd-4824-a756-f46053a2e419

📥 Commits

Reviewing files that changed from the base of the PR and between 20e01b3 and 99e8304.

📒 Files selected for processing (6)
  • src/features/network-modification-table/use-modifications-drag-and-drop.tsx
  • src/features/network-modification-table/utils.ts
  • src/hooks/useModificationLabelComputer.tsx
  • src/translations/en/networkModificationsEn.ts
  • src/translations/fr/networkModificationsFr.ts
  • src/utils/types/modificationType.ts

@flomillot flomillot self-requested a review July 2, 2026 14:22
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

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.

3 participants