Skip to content

Conversation

@jslee02
Copy link
Member

@jslee02 jslee02 commented Jan 17, 2026

Summary

  • Replace DART_ASSERT(radius > 0.0) with proper validation using std::isfinite() and DART_WARN()
  • Invalid values (NaN, infinity, non-positive) are now rejected with a warning instead of crashing
  • Add unit tests covering all validation cases

Motivation

Addresses gz-physics#843 where DART crashes with an assertion failure when SphereShape::setRadius() receives invalid radius values from upstream physics interfaces.

Changes

  • dart/dynamics/SphereShape.cpp: Added validation with graceful rejection
  • tests/unit/dynamics/test_SphereShape.cpp: New test file with 5 test cases
  • tests/unit/dynamics/CMakeLists.txt: New CMake config for dynamics tests
  • tests/unit/CMakeLists.txt: Added dynamics subdirectory
  • CHANGELOG.md: Added entry under DART 6.16.5

Testing

  • Unit tests verify valid radius acceptance and invalid value rejection (NaN, Inf, zero, negative)
  • Follows existing validation pattern from World::setTimeStep()

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef60a68990

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jslee02 jslee02 added this to the DART 6.16.5 milestone Jan 17, 2026
@jslee02 jslee02 changed the title fix: validate SphereShape radius to prevent assertion failures (DART 6.16) Fix: Validate SphereShape radius to prevent assertion failures (DART 6.16) Jan 17, 2026
@jslee02 jslee02 force-pushed the fix/gz-physics-843-sphere-nan-validation-6.16 branch from a1a90aa to 8677786 Compare January 17, 2026 19:22
@jslee02
Copy link
Member Author

jslee02 commented Jan 17, 2026

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov
Copy link

codecov bot commented Jan 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.81%. Comparing base (991315e) to head (9cec639).
⚠️ Report is 6 commits behind head on release-6.16.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-6.16    #2441      +/-   ##
================================================
+ Coverage         58.74%   58.81%   +0.07%     
================================================
  Files               385      385              
  Lines             32194    32201       +7     
  Branches           3884     3888       +4     
================================================
+ Hits              18911    18939      +28     
+ Misses            13283    13262      -21     
Flag Coverage Δ
unittests 58.81% <100.00%> (+0.07%) ⬆️

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

Files with missing lines Coverage Δ
dart/dynamics/SphereShape.cpp 75.67% <100.00%> (+1.38%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jslee02 jslee02 force-pushed the fix/gz-physics-843-sphere-nan-validation-6.16 branch from 69ccb9e to a9db95d Compare January 18, 2026 05:51
@jslee02
Copy link
Member Author

jslee02 commented Jan 18, 2026

@codex review

This PR branch is up to date with release-6.16. The validation approach using DART_WARN with fallback to default value is appropriate for this use case (handling invalid radius values from upstream physics interfaces like gz-physics).

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jslee02 jslee02 merged commit a6e1507 into release-6.16 Jan 18, 2026
28 checks passed
@jslee02 jslee02 deleted the fix/gz-physics-843-sphere-nan-validation-6.16 branch January 18, 2026 15:05
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