fix: validate release POM coordinates - #24
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +0.00% coverage variation (-1.00%) |
| Diff coverage | ✅ ∅ diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (944de65) 1672 1532 91.63% Head commit (e0a34c5) 1672 (+0) 1532 (+0) 91.63% (+0.00%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#24) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
The PR introduces automated validation for Maven POM coordinates but contains critical logic inconsistencies in the validation script. Specifically, the thegreeklab-visualization module is missing from the update loop but included in the validation phase with inconsistent logic. Additionally, the use of non-portable sed commands may cause issues in non-Linux environments. While Codacy indicates the PR is technically up to standards, these logic gaps and the lack of unit/integration tests for the scripts represent a risk to the reliability of the release process.
About this PR
- No unit tests or integration tests were added for the new shell and Python validation logic in 'scripts/validate-release-poms.sh'. Given this script is critical for release integrity, consider adding automated tests.
- The PR lacks a description explaining the motivation or context for the changes. Providing context helps reviewers understand the 'why' behind the validation logic.
Test suggestions
- Verify script correctly updates the revision property in targeted POM files.
- Verify Python assertion fails if a module's flattened version deviates from the release version.
- Verify Python assertion fails if any flattened POM still contains 'SNAPSHOT'.
- Validate that the CI workflow correctly extracts the base version from a SNAPSHOT revision.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify script correctly updates the revision property in targeted POM files.
2. Verify Python assertion fails if a module's flattened version deviates from the release version.
3. Verify Python assertion fails if any flattened POM still contains 'SNAPSHOT'.
4. Validate that the CI workflow correctly extracts the base version from a SNAPSHOT revision.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| versions = [ | ||
| poms[0].find(namespace + "version").text, | ||
| poms[1].find(namespace + "version").text, | ||
| poms[2].find(namespace + "parent").find(namespace + "version").text, |
There was a problem hiding this comment.
🟡 MEDIUM RISK
This check is inconsistent with the logic used for the other modules. It should verify the version of the visualization module itself rather than its parent to ensure the artifact coordinates are correct.
| poms[2].find(namespace + "parent").find(namespace + "version").text, | |
| poms[2].find(namespace + "version").text, |
|
|
||
| release_version="${1:?Expected the release version as the first argument}" | ||
|
|
||
| for pom in pom.xml thegreeklab-core/pom.xml; do |
There was a problem hiding this comment.
🟡 MEDIUM RISK
The thegreeklab-visualization/pom.xml file is missing from this update loop. If it also uses the <revision> property (as the core module does), the subsequent verification will fail because the version won't be updated to the release value.
| for pom in pom.xml thegreeklab-core/pom.xml; do | |
| for pom in pom.xml thegreeklab-core/pom.xml thegreeklab-visualization/pom.xml; do |
|
|
||
| - name: Validate release POM coordinates | ||
| run: | | ||
| releaseVersion="$(sed -n 's#.*<revision>\(.*\)-SNAPSHOT</revision>.*#\1#p' pom.xml)" |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Suggestion: This command will fail if the POM revision does not end in '-SNAPSHOT'. Consider making the regex optional for the snapshot suffix if release-version POMs should also be valid for CI testing.
| release_version="${1:?Expected the release version as the first argument}" | ||
|
|
||
| for pom in pom.xml thegreeklab-core/pom.xml; do | ||
| sed -i "s#<revision>[^<]*</revision>#<revision>$release_version</revision>#" "$pom" |
There was a problem hiding this comment.
⚪ LOW RISK
Suggestion: The sed -i command is non-portable and will fail on macOS. Use a temporary file to ensure compatibility across development environments.
| sed -i "s#<revision>[^<]*</revision>#<revision>$release_version</revision>#" "$pom" | |
| sed "s#<revision>[^<]*</revision>#<revision>$release_version</revision>#" "$pom" > "$pom.tmp" && mv "$pom.tmp" "$pom" |
No description provided.