-
Notifications
You must be signed in to change notification settings - Fork 28
Fix notification config #254
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
Conversation
a7fe304
to
050b547
Compare
050b547
to
34863fa
Compare
value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity), | ||
disabled_categories | ||
&.map { |value| value_of(org.neo4j.driver.internal.InternalNotificationCategory, value) } | ||
&.map { |value| org.neo4j.driver.NotificationCategory.const_get(value.to_s.upcase) } |
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.
We have been dealing with this issue the following way: https://github.com/neo4jrb/neo4j-ruby-driver/blob/5.0/ruby/neo4j/driver/access_mode.rb
to have some level of stronger typing compatible with java.
I could be swayed over but could end up with complex converting code when the configuration is deeply nested resulting in runtime errors as users would be using nested symbol hashes instead of higher level types.
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.
Using NotificationClassification serves as well as a type of documentation.
Converted to draft because the spec is incorrect |
org.neo4j.driver.internal.InternalNotificationConfig.new( | ||
value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity), | ||
disabled_categories | ||
&.map { |value| value_of(org.neo4j.driver.internal.InternalNotificationCategory, value) } |
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.
@nsauk could you check. It appears to me that the only change needed was this line:
&.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) }
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.
Maybe, additionally move the .or_else(nil)
from value_of
method to the line 71 as the value_of
of java enum, which NotificationClassification now is, does not return Optional
.
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.
I rewrote the rest of this method using the Java driver's public API so we rely less on internals.
InternalNotificationSeverity works with value_of
, but NotificationSeverity fails because it's an interface. As far as I can understand, we can't use the same approach for both (unless it's const_get
).
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.
Pull Request Overview
This PR fixes the notification configuration implementation by correcting the Java class references and handling of optional values. The changes ensure proper integration with Neo4j's notification filtering system for controlling warning/hint messages.
- Updates the
value_of
method to return Java Optional objects instead of immediately unwrapping them - Corrects the Java class reference from
InternalNotificationCategory
toNotificationClassification
- Adds comprehensive test coverage for notification configuration scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
jruby/neo4j/driver/ext/config_converter.rb | Fixes notification config implementation by correcting Java class references and Optional handling |
spec/neo4j/driver/dev_manual_examples_spec.rb | Adds test cases for default and custom notification configurations |
.github/workflows/specs.yml | Updates Ruby and Neo4j versions in CI matrix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
end | ||
|
||
context 'Example 2.12. Service unavailable' do | ||
context 'Example 2.13. Service unavailable' do |
Copilot
AI
Oct 22, 2025
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.
The context numbering has been incremented to 2.13, but verify that the documentation or examples being referenced align with this new numbering scheme to maintain consistency.
Copilot uses AI. Check for mistakes.
No description provided.