Skip to content

Conversation

nsauk
Copy link
Contributor

@nsauk nsauk commented May 20, 2025

No description provided.

@nsauk nsauk requested a review from klobuczek May 20, 2025 12:58
@nsauk nsauk force-pushed the fix-notification-config branch 2 times, most recently from a7fe304 to 050b547 Compare May 20, 2025 13:09
@nsauk nsauk force-pushed the fix-notification-config branch from 050b547 to 34863fa Compare May 20, 2025 13:12
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) }
Copy link
Member

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.

Copy link
Member

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.

@nsauk nsauk marked this pull request as draft May 22, 2025 15:34
@nsauk
Copy link
Contributor Author

nsauk commented May 22, 2025

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) }
Copy link
Member

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) }

Copy link
Member

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.

Copy link
Contributor Author

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).

@klobuczek klobuczek requested a review from Copilot October 22, 2025 23:12
Copy link

@Copilot Copilot AI left a 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 to NotificationClassification
  • 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
Copy link

Copilot AI Oct 22, 2025

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.

@klobuczek klobuczek marked this pull request as ready for review October 23, 2025 00:36
@klobuczek klobuczek merged commit f9ac8d5 into 5.0 Oct 23, 2025
9 of 15 checks passed
@klobuczek klobuczek deleted the fix-notification-config branch October 23, 2025 00:36
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