Skip to content

feat: handle p and q measurement modification in battery modification…#3949

Open
KoloMenek wants to merge 1 commit into
mainfrom
marutk/feat/add_battery_measurement_modifications
Open

feat: handle p and q measurement modification in battery modification…#3949
KoloMenek wants to merge 1 commit into
mainfrom
marutk/feat/add_battery_measurement_modifications

Conversation

@KoloMenek
Copy link
Copy Markdown
Member

… dialog

PR Summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Review Change Stack

Warning

Rate limit exceeded

@KoloMenek has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 20 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8d46b427-3cde-4f01-b2bc-deac4d2dccdc

📥 Commits

Reviewing files that changed from the base of the PR and between cd5b181 and e163e7a.

📒 Files selected for processing (4)
  • src/components/dialogs/network-modifications/battery/battery-dialog.type.ts
  • src/components/dialogs/network-modifications/battery/modification/BatteryDialogTabsContent.tsx
  • src/components/dialogs/network-modifications/battery/modification/battery-modification-dialog.tsx
  • src/services/network-modification-types.ts
📝 Walkthrough

Walkthrough

This PR extends battery modification dialogs to capture state estimation measurement data for active and reactive power. It updates type contracts, adds a new measurements UI section, and wires form initialization, validation, editing, and submission to handle the measurement fields through the backend API.

Changes

Battery State Estimation Measurements

Layer / File(s) Summary
Type and service contracts
src/components/dialogs/network-modifications/battery/battery-dialog.type.ts, src/services/network-modification-types.ts
MeasurementInfo import added; BatteryModificationDialogSchemaForm extended with optional state-estimation section containing MEASUREMENT_P and MEASUREMENT_Q fields; BatteryFormInfos gains measurementP and measurementQ properties; BatteryModificationInfos service contract adds pMeasurementValue, pMeasurementValidity, qMeasurementValue, and qMeasurementValidity fields.
Measurements section rendering
src/components/dialogs/network-modifications/battery/modification/BatteryDialogTabsContent.tsx
PowerMeasurementsForm imported and rendered in a new "MeasurementsSection" within the battery dialog tabs, displaying active and reactive power measurement values from batteryToModify.
Form logic and submission
src/components/dialogs/network-modifications/battery/modification/battery-modification-dialog.tsx
Form initialization extended with state-estimation default values using injection helpers; validation schema updated to validate measurement fields; edit-data population maps existing battery measurements to the state-estimation form section; form submission extracts state-estimation data and includes measurement value and validity fields wrapped in modification operations in the submitted payload.

Suggested reviewers

  • benrejebmoh
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main purpose of the changeset: adding p and q measurement modification handling to the battery modification dialog.
Description check ✅ Passed The description is minimal but related to the changeset. It correctly identifies the feature being added (p and q measurement modification in battery modification dialog).
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@KoloMenek KoloMenek requested a review from benrejebmoh May 20, 2026 07:34
@KoloMenek
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/dialogs/network-modifications/battery/modification/battery-modification-dialog.tsx (1)

62-63: ⚡ Quick win

Use one constant source for measurement keys (FieldConstants)

Schema/types in this PR define measurement paths with FieldConstants.MEASUREMENT_P/Q, but submit mapping reads with MEASUREMENT_P/Q from another constants module. Unifying this avoids silent key drift.

Proposed patch
-import { MEASUREMENT_P, MEASUREMENT_Q, VALIDITY } from '../../../../utils/field-constants';
+import { VALIDITY } from '../../../../utils/field-constants';
@@
                 pMeasurementValue: toModificationOperation(
-                    stateEstimationData?.[MEASUREMENT_P]?.[FieldConstants.VALUE]
+                    stateEstimationData?.[FieldConstants.MEASUREMENT_P]?.[FieldConstants.VALUE]
                 ),
-                pMeasurementValidity: toModificationOperation(stateEstimationData?.[MEASUREMENT_P]?.[VALIDITY]),
+                pMeasurementValidity: toModificationOperation(
+                    stateEstimationData?.[FieldConstants.MEASUREMENT_P]?.[VALIDITY]
+                ),
                 qMeasurementValue: toModificationOperation(
-                    stateEstimationData?.[MEASUREMENT_Q]?.[FieldConstants.VALUE]
+                    stateEstimationData?.[FieldConstants.MEASUREMENT_Q]?.[FieldConstants.VALUE]
                 ),
-                qMeasurementValidity: toModificationOperation(stateEstimationData?.[MEASUREMENT_Q]?.[VALIDITY]),
+                qMeasurementValidity: toModificationOperation(
+                    stateEstimationData?.[FieldConstants.MEASUREMENT_Q]?.[VALIDITY]
+                ),

Also applies to: 322-329

🤖 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/dialogs/network-modifications/battery/modification/battery-modification-dialog.tsx`
around lines 62 - 63, The submit mapping in BatteryModificationDialog is using
MEASUREMENT_P and MEASUREMENT_Q from a different constants module instead of the
canonical FieldConstants used by your schema/types; update the code to import
and use FieldConstants.MEASUREMENT_P and FieldConstants.MEASUREMENT_Q (and the
VALIDITY key from FieldConstants if present) everywhere in this
file—specifically in the submit/mapping logic (e.g., the function that builds
the submission payload or handleSubmit) so the same FieldConstants keys are the
single source of truth and avoid key drift.
🤖 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.

Nitpick comments:
In
`@src/components/dialogs/network-modifications/battery/modification/battery-modification-dialog.tsx`:
- Around line 62-63: The submit mapping in BatteryModificationDialog is using
MEASUREMENT_P and MEASUREMENT_Q from a different constants module instead of the
canonical FieldConstants used by your schema/types; update the code to import
and use FieldConstants.MEASUREMENT_P and FieldConstants.MEASUREMENT_Q (and the
VALIDITY key from FieldConstants if present) everywhere in this
file—specifically in the submit/mapping logic (e.g., the function that builds
the submission payload or handleSubmit) so the same FieldConstants keys are the
single source of truth and avoid key drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ff5fd8d4-ce21-4f22-9205-3291692c30f9

📥 Commits

Reviewing files that changed from the base of the PR and between ed0662f and cd5b181.

📒 Files selected for processing (4)
  • src/components/dialogs/network-modifications/battery/battery-dialog.type.ts
  • src/components/dialogs/network-modifications/battery/modification/BatteryDialogTabsContent.tsx
  • src/components/dialogs/network-modifications/battery/modification/battery-modification-dialog.tsx
  • src/services/network-modification-types.ts

… dialog

Signed-off-by: Kamil MARUT <kamil.marut@rte-france.com>
@KoloMenek KoloMenek force-pushed the marutk/feat/add_battery_measurement_modifications branch from cd5b181 to e163e7a Compare May 20, 2026 08:23
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@benrejebmoh benrejebmoh left a comment

Choose a reason for hiding this comment

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

Test OK

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.

2 participants