-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Encapsulate warnings in generalized node::Warnings and remove globals #30058
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
Encapsulate warnings in generalized node::Warnings and remove globals #30058
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
cd8b420
to
4f06da2
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
Concept ACK on removing the warnings globals. |
3b2b72f
to
445e6de
Compare
Force-pushed to address compilation failure on non-macOS systems:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 445e6de. It was a little unclear in some places what behavior was supposed to be changing, and I think that could be documented better. But overall the changes look good and seem very positive.
445e6de
to
674da14
Compare
674da14
to
5dfbc35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review, @TheCharlatan and @ryanofsky .
In this force push, I've:
- rebased to address merge conflict from #30115
- incorporated @TheCharlatan's suggestion to use
enum class
instead ofstd::string
for the warning identifiers - addressed @ryanofsky's comments:
- improved commit messages to describe the introduced behaviour change and improved a couple of docstrings
- added release notes to describe the new
-alertnotify
behaviour - updated the
Warnings::Set()
signature to pass by value and use move semantics
- removed an unnecessary include in
kernel/warning.h
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
5dfbc35
to
66d4f31
Compare
468cf53
to
4ca48b3
Compare
Force pushed to:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 4ca48b3. Just rebase and a change to internal commits (removing DoWarning earlier) since last review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-ACK 4ca48b3
Since rpc/util.cpp is in common, also move GetNodeWarnings() to node::GetWarningsForRPC()
Instead of having separate warning functions (and globals) for each different warning that can be raised, encapsulate this logic into a single class and allow to (un)set any number of warnings. Introduces behaviour change: - the `-alertnotify` command is executed for all `KernelNotifications::warningSet` calls, which now also covers the `LARGE_WORK_INVALID_CHAIN` warning. - previously, warnings were returned based on a predetermined order, e.g. with the "pre-release test build" warning always first. This is no longer the case, and Warnings::GetMessages() will return messages sorted by the id of the warning. Removes warnings.cpp from kernel.
This commit introduces slight behaviour change. Previously, the GUI status bar would be updated for most warnings, namely UNKNOWN_NEW_RULES_ACTIVATED, CLOCK_OUT_OF_SYNC and PRE_RELEASE_TEST_BUILD, but not for LARGE_WORK_INVALID_CHAIN (and not for FATAL_INTERNAL_ERROR, but that is not really meaningful). Fix this by always updating the status bar when the warnings are changed.
4ca48b3
to
260f8da
Compare
Force pushed to address merge conflict from #29015, no changes otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 260f8da. Only change since last review was rebasing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-ACK 260f8da
ACK 260f8da |
Ported to the CMake-based build system in hebasto#264. |
This PR:
Warnings::Set()
andWarnings::Unset()
methods, instead of having a separate function and globals for each warning. As a result, this simplifies thekernel::Notifications
interface.Behaviour change introduced:
-alertnotify
command is executed for allKernelNotifications::warningSet
calls, which now also covers theLARGE_WORK_INVALID_CHAIN
warningnode::AbortNode()
is called, or for theLARGE_WORK_INVALID_CHAIN
warningSome discussion points:
isedit: updated approach to useconst std::string& id
the best way to refer to warnings? Enums are an obvious alternative, but since we need to define warnings across libraries, strings seem like a straightforward solution.node::Warning
andkernel::Warning
enums.