Skip to content

Fix VersionInformation ordering for a higher bugfix with a lower build - #636

Merged
urfeex merged 1 commit into
UniversalRobots:masterfrom
ranjithguggilla:fix/version-information-ordering
Nov 24, 2026
Merged

urfeex merged 1 commit into
UniversalRobots:masterfrom
ranjithguggilla:fix/version-information-ordering

Conversation

@ranjithguggilla

Copy link
Copy Markdown
Contributor

Summary

VersionInformation::operator< went on to compare build numbers after major and minor had matched, including when the left-hand bugfix was already higher. Both of these were therefore true at once:

5.9.4.100 < 5.9.3.200
5.9.3.200 < 5.9.4.100

<=, > and >= are written in terms of <, so they gave the wrong answer for the same inputs. fromString("5.9.4") > fromString("5.9.3.1010107") was false.

The build comparison was one brace outside the bugfix <= block. It now runs only when major, minor and bugfix are equal.

Comparisons inside the library pass a version constant with no build number (5.9.4, 10.0.0, and so on), and those results stay the same. The operator is public, and the wrong order shows up when both sides carry a build. A script template does that when the literal includes one, for example {% if ROBOT_SOFTWARE_VERSION >= v5.9.3-200 %}: on a robot reporting 5.9.4.100 that condition took the wrong branch.

I searched the issue tracker for VersionInformation and did not find an existing report.

If you would rather have the body as std::tie(major, minor, bugfix, build), I can switch it.

Validation

  • Added test_relations_higher_bugfix_with_lower_build. It fails on the previous operator and passes with this change. The whole version_information_tests binary passes (7 tests), including on this machine with AppleClang.
  • On Linux, the non-integration suite passed: 747 tests, one skipped (TestHelpers.writeFileAtomicallyUnwritableDirectory).
  • clang-format through pre-commit passed on src/ur/version_information.cpp and tests/test_version_information.cpp.
  • I did not build or run the URSim integration tests.

operator< compared the build number even when the bugfix of the left
operand was higher, so 5.9.4.100 < 5.9.3.200 was true (and so was the
reverse). The other relational operators are derived from operator<,
so they were wrong for the same inputs.

Only compare the build number when major, minor and bugfix are equal.
@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Public version comparison affects conditional logic (e.g. script templates comparing robot software with build suffixes); behavior changes only when bugfix differs and both sides have builds.

Overview
Fixes inconsistent VersionInformation ordering when two versions share major/minor but differ in bugfix while both carry build numbers. operator< compared build outside the bugfix-equality path, so pairs like 5.9.4.100 and 5.9.3.200 could satisfy both v1 < v2 and v2 < v1. The build check now runs only inside the branch where major, minor, and bugfix already match.

Because <=, >, and >= delegate to <, those operators inherit the corrected ordering. Added test_relations_higher_bugfix_with_lower_build to lock in bugfix precedence over build (including 5.9.4 vs 5.9.3.1010107).

Reviewed by Cursor Bugbot for commit ab3a952. Bugbot is set up for automated code reviews on this repo. Configure here.

@mergify

mergify Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@urfeex urfeex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That absolutely makes sense, thank you!

@urfeex urfeex added the bugfix label Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.89%. Comparing base (f53cd97) to head (ab3a952).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #636      +/-   ##
==========================================
- Coverage   83.90%   83.89%   -0.01%     
==========================================
  Files         128      128              
  Lines        8564     8565       +1     
  Branches     3914     3914              
==========================================
  Hits         7186     7186              
+ Misses        967      965       -2     
- Partials      411      414       +3     
Flag Coverage Δ
python_scripts 49.69% <ø> (ø)
start_ursim 89.08% <ø> (+0.02%) ⬆️
unit 64.24% <100.00%> (+0.01%) ⬆️
ur20-latest 81.53% <100.00%> (-0.06%) ⬇️
ur5-3.14.3 81.30% <100.00%> (-0.11%) ⬇️
ur5e-10.11.0 77.14% <100.00%> (ø)
ur5e-10.12.0 ?
ur5e-10.7.0 76.79% <100.00%> (+0.06%) ⬆️
ur5e-5.9.4 81.48% <100.00%> (-0.04%) ⬇️
ur7e-10.13.0 78.50% <100.00%> (+0.05%) ⬆️
ur7e-10.14.0 78.79% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@urfeex
urfeex merged commit bbbe4f5 into UniversalRobots:master Nov 24, 2026
58 of 61 checks passed
@ranjithguggilla

ranjithguggilla commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

The three red checks were outside this diff. The pull request was already merged, so no rerun is needed.

  • check_links: lychee timed out on https://manpages.ubuntu.com/manpages/noble/man5/limits.conf.5.html in doc/real_time.rst (unchanged). The page responds; the request was slow. The same workflow has failed on other open PRs this week.
  • run_tests (10.12.0-ur5e): DashboardClientTestX.upload_program_from_file. URSim answered the upload of resources/upload_prog.urpx with HTTP 500 Internal server Error. The test only accepts success, a conflict, or the "already exists" code. In that same job the version_information tests passed, including test_relations_higher_bugfix_with_lower_build. The other seven robot images passed the full suite.
  • codecov/project: 83.89% (−0.01%) against f53cd97. codecov/patch is 100% of the diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants