Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go back to SDF_ASSERT instead of FATAL_ERROR #1235

Merged
merged 5 commits into from
Feb 10, 2023

Conversation

marcoag
Copy link
Member

@marcoag marcoag commented Feb 8, 2023

🦟 Bug fix

Summary

It seems quite hard to guarantee the same flow of the execution of SDF_ASSERT when using a FATAL_ERROR instead. Because of this, as explained by this comment, this PR reverts all previous SDF_ASSERT changes into FATAL_ERROR done by the following PRs:

#1123
#1095

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

Signed-off-by: Marco A. Gutierrez <marco@openrobotics.org>
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Feb 8, 2023
Signed-off-by: Marco A. Gutierrez <marco@openrobotics.org>
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #1235 (6b9c929) into sdf13 (811760d) will increase coverage by 0.30%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##            sdf13    #1235      +/-   ##
==========================================
+ Coverage   87.19%   87.49%   +0.30%     
==========================================
  Files         126      126              
  Lines       16301    16239      -62     
==========================================
- Hits        14214    14209       -5     
+ Misses       2087     2030      -57     
Impacted Files Coverage Δ
src/Converter.cc 92.08% <100.00%> (+7.69%) ⬆️
src/Element.cc 97.22% <100.00%> (+1.40%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Unfortunately, we can't remove Element::RemoveChild because it would break ABI since it's already been released. We should make sure it works the same as the other RemoveChild with a test. Otherwise, LGTM.

/// \brief Remove a child element.
/// \param[in] _child Pointer to the child to remove.
/// \param[out] _errors Vector of errors.
public: void RemoveChild(ElementPtr _child, sdf::Errors &_errors);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't remove this because it breaks ABI :(.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh true! shall we deprecate it instead and remove it on the the next release?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't deprecate it either since our policy is to start a deprecation cycle on a new major release. So, if we want to do that, we'd have to do it in main.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll open a PR to main then. Would an sdf::Error with an ErrorCode::WARNING message suffice?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure what the ErrorCode::WARNING would be for.

Copy link
Member Author

Choose a reason for hiding this comment

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

Deprecation message?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, we'd use the SDF_DEPRECATED macro for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

GZ_DEPRECATED maybe?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, GZ_DEPRECATED. I guess SDF_DEPRECATED is deprecated 😁

We can discuss this on the followup PR, but if there's a chance the sdf::Error might be used by RemoveChild, it might be better to deprecate the overload that doesn't take sdf::Error.

Marco A. Gutierrez added 2 commits February 9, 2023 21:36
Signed-off-by: Marco A. Gutierrez <marco@openrobotics.org>
Signed-off-by: Marco A. Gutierrez <marco@openrobotics.org>
@marcoag
Copy link
Member Author

marcoag commented Feb 9, 2023

Brought Element::RemoveChild with the sdf::Errors param back and added a test to make sure both throw: d9474b3.

@azeey
Copy link
Collaborator

azeey commented Feb 9, 2023

Ah, now there's a compiler warning saying _errors is not used.

@marcoag
Copy link
Member Author

marcoag commented Feb 9, 2023

Yup, any suggestion on how to avoid it or shall we just live with it?

/// \brief Remove a child element.
/// \param[in] _child Pointer to the child to remove.
/// \param[out] _errors Vector of errors.
public: void RemoveChild(ElementPtr _child, sdf::Errors &_errors);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure what the ErrorCode::WARNING would be for.

Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org>
i
Signed-off-by: Marco A. Gutierrez <marco@openrobotics.org>
@marcoag marcoag force-pushed the marcoag/rollback_fatal_errors_to_throws branch from f91e3d0 to 6b9c929 Compare February 9, 2023 22:38
@azeey azeey changed the title Going back to SDF_ASSERT instead of FATAL_ERROR Go back to SDF_ASSERT instead of FATAL_ERROR Feb 10, 2023
@azeey azeey merged commit f1d13b4 into sdf13 Feb 10, 2023
@azeey azeey deleted the marcoag/rollback_fatal_errors_to_throws branch February 10, 2023 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants