change segment disctance sql type#842
Conversation
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughUpdated the ChangesSegment Distance Type Migration
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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 |
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/resources/db/changelog/changesets/changelog_20260701T113605Z.xml (1)
3-7: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winConsider adding explicit rollback for this
modifyDataTypechangeset.
modifyDataTypeis one of the Liquibase change types that does not support automatic rollback generation, per Liquibase docs. INT → FLOAT8 is a safe widening conversion for existing data, but without a<rollback>block,liquibase rollbackwill fail for this changeset if ever needed.♻️ Suggested addition
<changeSet author="lesoteti" id="1782905794769-2"> <modifyDataType columnName="segment_distance_value" newDataType="FLOAT8" tableName="line_segments"/> + <rollback> + <modifyDataType columnName="segment_distance_value" + newDataType="INT" + tableName="line_segments"/> + </rollback> </changeSet>Confirm whether this repository's Liquibase workflow relies on rollback support before deciding if this is necessary.
🤖 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/main/resources/db/changelog/changesets/changelog_20260701T113605Z.xml` around lines 3 - 7, The `modifyDataType` changeset for `line_segments.segment_distance_value` has no explicit rollback, so Liquibase cannot reverse it reliably. In the same changeset, add a rollback block for the `modifyDataType` change in `changelog_20260701T113605Z.xml` using the existing `changeSet` identifier, and choose the prior column type that matches the pre-change schema. If this repository does not require rollback support, confirm that explicitly; otherwise keep the rollback alongside this changeSet.
🤖 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/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java`:
- Around line 38-39: The `segmentDistanceValue` type is inconsistent between
`LineSegmentEntity` and `LineSegmentInfos`, and both conversion paths currently
pass it through unchanged. Align the types on one side so the entity and DTO
match, then verify the mapping methods that convert between `LineSegmentEntity`
and `LineSegmentInfos` still compile and preserve the value correctly.
---
Nitpick comments:
In `@src/main/resources/db/changelog/changesets/changelog_20260701T113605Z.xml`:
- Around line 3-7: The `modifyDataType` changeset for
`line_segments.segment_distance_value` has no explicit rollback, so Liquibase
cannot reverse it reliably. In the same changeset, add a rollback block for the
`modifyDataType` change in `changelog_20260701T113605Z.xml` using the existing
`changeSet` identifier, and choose the prior column type that matches the
pre-change schema. If this repository does not require rollback support, confirm
that explicitly; otherwise keep the rollback alongside this changeSet.
🪄 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: becdad1e-88e3-439b-822a-b9d3af6d3799
📒 Files selected for processing (4)
pom.xmlsrc/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.javasrc/main/resources/db/changelog/changesets/changelog_20260701T113605Z.xmlsrc/main/resources/db/changelog/db.changelog-master.yaml
| @Column(name = "segment_distance_value") | ||
| private Integer segmentDistanceValue; | ||
| private Double segmentDistanceValue; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect the LineSegmentInfos DTO shipped in the resolved dependency version, and check for any remaining int-literal usages of segmentDistanceValue in this repo.
fd -e jar network-modification | xargs -I{} sh -c 'echo {}; unzip -p {} org/gridsuite/modification/dto/LineSegmentInfos.class 2>/dev/null | javap - 2>/dev/null || true'
rg -n 'new LineSegmentInfos\(' -A1Repository: gridsuite/network-modification-server
Length of output: 175
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== pom version ==\n'
rg -n 'network-modification\.version|gridsuite-network-modification' pom.xml
printf '\n== relevant files ==\n'
git ls-files 'src/main/java/**/LineSegmentEntity.java' 'src/main/java/**/LineCreationEntity.java' 'src/test/java/**/LineModificationTest.java'
printf '\n== outlines ==\n'
ast-grep outline src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java --view expanded || true
ast-grep outline src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java --view expanded || true
printf '\n== usages ==\n'
rg -n 'LineSegmentInfos|segmentDistanceValue|new LineSegmentInfos\(' src/main/java src/test/javaRepository: gridsuite/network-modification-server
Length of output: 5786
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the exact files and inspect the relevant ranges only.
printf '== files ==\n'
fd 'LineSegmentEntity.java|LineCreationEntity.java|LineModificationTest.java|pom.xml' .
printf '\n== LineSegmentEntity.java ==\n'
sed -n '1,220p' src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java
printf '\n== LineCreationEntity.java ==\n'
sed -n '1,240p' src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java
printf '\n== LineModificationTest.java usages ==\n'
rg -n 'new LineSegmentInfos\(|segmentDistanceValue' src/test/java src/main/java
printf '\n== pom.xml version pin ==\n'
rg -n 'network-modification\.version|gridsuite-network-modification' pom.xmlRepository: gridsuite/network-modification-server
Length of output: 10957
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '== repo hits =='
rg -n 'LineSegmentInfos|segmentDistanceValue' src/main/java src/test/java
echo
echo '== line entity and creation entity =='
sed -n '1,220p' src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java
printf '\n---\n'
sed -n '1,260p' src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java
echo
echo '== javac conversion probe =='
tmpdir="$(mktemp -d)"
cat >"$tmpdir/Probe.java" <<'JAVA'
class Probe {
static final class X {
X(Double d) {}
X(Integer i) {}
}
static void f() {
new X(1);
}
}
JAVA
if javac "$tmpdir/Probe.java" 2>"$tmpdir/err"; then
echo "compiled"
else
cat "$tmpdir/err"
fi
rm -rf "$tmpdir"Repository: gridsuite/network-modification-server
Length of output: 12028
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '== local m2 artifacts ==\n'
fd -a 'gridsuite-network-modification*' "$HOME/.m2/repository" 2>/dev/null | head -n 50
printf '\n== candidate class files ==\n'
fd -a 'LineSegmentInfos.class|LineSegmentInfos.java' "$HOME/.m2/repository" 2>/dev/null | head -n 50
printf '\n== candidate jars ==\n'
fd -a 'gridsuite-network-modification-1.1.0.jar|gridsuite-network-modification-1.1.0-sources.jar' "$HOME/.m2/repository" 2>/dev/null | head -n 50Repository: gridsuite/network-modification-server
Length of output: 200
🏁 Script executed:
#!/bin/bash
set -euo pipefail
tmpdir="$(mktemp -d)"
cat >"$tmpdir/Probe.java" <<'JAVA'
class Probe {
static final class X {
X(Double d) {}
}
static void f() {
new X(1);
}
}
JAVA
if javac "$tmpdir/Probe.java" 2>"$tmpdir/err"; then
echo "compiled"
else
cat "$tmpdir/err"
fi
rm -rf "$tmpdir"Repository: gridsuite/network-modification-server
Length of output: 396
🌐 Web query:
"gridsuite-network-modification 1.1.0 LineSegmentInfos segmentDistanceValue"
💡 Result:
In the gridsuite-network-modification library, LineSegmentInfos is a Java record introduced in version 0.75.0 to manage line segment information, which is used to generate operational limits from a catalog [1]. The segmentDistanceValue is an Integer field within this record [1]. The record is defined as follows: public record LineSegmentInfos(String segmentTypeId, Integer segmentDistanceValue, String area, String temperature, Double shapeFactor) { } This structure was added to the library as part of pull request #172 in April 2026 [1]. Subsequently, in version 0.76.0, support for these line segments was integrated into the LineModificationInfos class to allow modifications involving these segments [2][3]. There is no "version 1.1.0" documented in the available repository history as of July 2026; the library reached version 0.78.0 by that time [4]. It is likely that the version number referenced in your query is either a misunderstanding or refers to a different context. The implementation details provided above are based on the actual codebase evolution of the gridsuite-network-modification library [1][3].
Citations:
- 1: gridsuite/network-modification@v0.74.0...v0.75.0
- 2: gridsuite/network-modification@c15a04d
- 3: gridsuite/network-modification@v0.75.0...v0.76.0
- 4: https://central.sonatype.com/artifact/org.gridsuite/gridsuite-network-modification/0.78.0
🌐 Web query:
"site:github.com/gridsuite/network-modification LineSegmentInfos record Integer Double segmentDistanceValue"
💡 Result:
The LineSegmentInfos class in the gridsuite/network-modification repository is a Java record defined in the package org.gridsuite.modification.dto [1]. It includes an Integer field named segmentDistanceValue [1]. The full definition of the record is as follows [1]: public record LineSegmentInfos(String segmentTypeId, Integer segmentDistanceValue, String area, String temperature, Double shapeFactor) { } This record was introduced in version v0.76.0 (via pull request #175) to support line modification functionality by defining segment information used from the catalog [1][2][3]. The segmentDistanceValue field is one of several properties, alongside segmentTypeId, area, temperature, and shapeFactor [1].
Citations:
- 1: gridsuite/network-modification@v0.74.0...v0.75.0
- 2: gridsuite/network-modification@c15a04d
- 3: gridsuite/network-modification@v0.75.0...v0.76.0
Align segmentDistanceValue with LineSegmentInfos. LineSegmentInfos.segmentDistanceValue is still Integer, while this entity uses Double; both conversion methods pass the value through unchanged, so the entity/DTO pair is type-incompatible. Update one side to match the other before merging.
🤖 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/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java`
around lines 38 - 39, The `segmentDistanceValue` type is inconsistent between
`LineSegmentEntity` and `LineSegmentInfos`, and both conversion paths currently
pass it through unchanged. Align the types on one side so the entity and DTO
match, then verify the mapping methods that convert between `LineSegmentEntity`
and `LineSegmentInfos` still compile and preserve the value correctly.
|



PR Summary