feat: handle p and q measurement modification in battery#189
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBatteryModification was refactored to inherit from AbstractInjectionModification instead of managing modificationInfos directly. The check() and apply() methods now cast the inherited field locally. BatteryModificationTest was expanded with measurement constants and assertions, including a new test case for measurement updates with report node validation and helper methods for structured assertions. ChangesBatteryModification Refactoring and Measurement Validation
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ 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. Comment |
benrejebmoh
left a comment
There was a problem hiding this comment.
Both BatteryModificationTest.assertMeasurements() helpers (in network-modification and network-modification-server) only verify that measurement extensions are created when they don't previously exist on the battery. The
upsertMeasurement method in AbstractInjectionModification has a separate code path for updating an existing measurement — it reads oldValue/oldValidity, modifies them, and adds report nodes. That path is completely untested for Battery.
Suggestion: add a second test scenario where the battery already has a Measurements extension before the modification is applied, verify that the values are updated, (and optionally check that the report nodes reflect the old→new change)
| .qMeasurementValue(new AttributeModification<>(MEASUREMENT_Q_VALUE, OperationType.SET)) | ||
| .qMeasurementValidity(new AttributeModification<>(MEASUREMENT_Q_VALID, OperationType.SET)) | ||
| .properties(List.of(FreePropertyInfos.builder().name(PROPERTY_NAME) | ||
| .value(PROPERTY_VALUE).build())) |
There was a problem hiding this comment.
This appears to be an accidental formatting change.
The .value(...) continuation should be indented to align with .name(...)
| assertThat(activePowerMeasurements).allMatch(m -> m.getValue() == MEASUREMENT_P_VALUE && m.isValid() == MEASUREMENT_P_VALID); | ||
| assertThat(reactivePowerMeasurements).allMatch(m -> m.getValue() == MEASUREMENT_Q_VALUE && m.isValid() == MEASUREMENT_Q_VALID); |
There was a problem hiding this comment.
instead of using == on Double assertion, prefer using something like:
assertThat(activePowerMeasurements).allSatisfy(m -> {
assertThat(m.getValue()).isEqualTo(MEASUREMENT_P_VALUE);
assertThat(m.isValid()).isEqualTo(MEASUREMENT_P_VALID);
});
Did the changes with a new test called testMeasurementsUpdatedWithNewMeasurements |
Signed-off-by: Kamil MARUT <kamil.marut@rte-france.com>
ed67458 to
92c9b23
Compare
92c9b23 to
3379122
Compare
Signed-off-by: KoloMenek <kolomenek@gmail.com>
3379122 to
edb585a
Compare
|



PR Summary