Skip to content

Conversation

@tcheeric
Copy link
Owner

@tcheeric tcheeric commented Oct 3, 2025

Summary

Related issue: #____

What changed?

  • Deduplicated the java.io.IOException import in SpringWebSocketClient to keep the implementation clean and warning-free.
  • Added plain-English comments above the Spring client retry tests to satisfy repository testing conventions.

BREAKING

None.

Review focus

  • Confirm the added test descriptions align with the expected tone and guidance.

Checklist

  • Scope ≤ 300 lines (or split/stack)
  • Title is verb + object (e.g., “Refactor auth middleware to async”)
  • Description links the issue and answers “why now?”
  • BREAKING flagged if needed
  • Tests/docs updated (if relevant)

Testing

  • mvn -q verify (fails because .mvn/maven.config injects an invalid -T 2 threads flag in this environment)

Network Access

  • No external network requests were attempted.

Notes

  • Maven cannot honor the default multithreaded flag in this environment; rerun with -T1 if a full build is required.

https://chatgpt.com/codex/tasks/task_b_68e008f70d6083319efb6ff3f85b9c1e

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.

ℹ️ 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

Comment on lines 124 to 128
return () -> {
IOException ioFailure = null;
Exception nonIoFailure = null;
try {
client.send(new CloseMessage(subscriptionId));

Choose a reason for hiding this comment

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

P1 Badge Avoid blocking on CLOSE during subscription teardown

Calling client.send(new CloseMessage(subscriptionId)) in the unsubscribe path uses StandardWebSocketClient.send, which always waits for a relay response or a 60s timeout before returning. Relays are not required to reply to a NIP-01 CLOSE, so cancelling a subscription can block the caller for the full timeout per relay before the socket is closed. This turns an otherwise asynchronous cancel into a minute-long pause and will accumulate if multiple subscriptions are torn down. Send the CLOSE frame without the blocking send() loop or close the socket first so teardown returns promptly.

Useful? React with 👍 / 👎.

Copy link
Owner Author

@tcheeric tcheeric Oct 3, 2025

Choose a reason for hiding this comment

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

@codex address that feedback

@github-actions
Copy link

github-actions bot commented Oct 3, 2025

Qodana Community for JVM

127 new problems were found

Inspection name Severity Problems
Unchecked warning 🔶 Warning 61
Link specified as plain text 🔶 Warning 24
Redundant local variable 🔶 Warning 11
Dangling Javadoc comment 🔶 Warning 5
Redundant type cast 🔶 Warning 3
Constant values 🔶 Warning 2
Deprecated API usage 🔶 Warning 2
'size() == 0' can be replaced with 'isEmpty()' 🔶 Warning 2
AutoCloseable used without 'try'-with-resources 🔶 Warning 1
Default annotation parameter value 🔶 Warning 1
Deprecated member is still used 🔶 Warning 1
Javadoc declaration problems 🔶 Warning 1
Lombok @Getter may be used 🔶 Warning 1
@NotNull/@Nullable problems 🔶 Warning 1
Redundant type arguments 🔶 Warning 1
Redundant character escape 🔶 Warning 1
Suspicious variable/parameter name combination 🔶 Warning 1
Type parameter hides visible type 🔶 Warning 1
Commented out code ◽️ Notice 4
Multiple occurrences of the same expression ◽️ Notice 2
@NotNull/@Nullable problems ◽️ Notice 1

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

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.

ℹ️ 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

Comment on lines 127 to 132
try {
client.send(new CloseMessage(subscriptionId));
} catch (IOException e) {
safeError.accept(e);
ioFailure = e;
}

try {
delegate.close();

Choose a reason for hiding this comment

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

P1 Badge Avoid blocking when closing subscriptions

The returned AutoCloseable sends a CloseMessage via client.send(...) before removing the listener. SpringWebSocketClient.send ultimately calls StandardWebSocketClient.send, which blocks until a relay message arrives or the 60‑second await timeout elapses and then forcibly closes the session. Nostr relays are not required to send any response to a CLOSE command, so calling close() on the subscription handle will typically hang for up to the await timeout and may tear down the socket even though the caller only wanted to unsubscribe. The close sequence should transmit the CLOSE frame without waiting for a reply (e.g., using the asynchronous subscribe transport) so that subscription cleanup is immediate.

Useful? React with 👍 / 👎.

Copy link
Owner Author

Choose a reason for hiding this comment

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

@codex address that feedback

Choose a reason for hiding this comment

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

Summary

Testing

  • ./mvnw -q -T1 verify (fails: Maven wrapper download cannot reach repo.maven.apache.org through the proxy)

View task →

tcheeric and others added 19 commits October 3, 2025 19:30
- Updated the decode method to ensure non-blocking behavior
  during subscription closure. This change improves the
  responsiveness of the API and enhances user experience.
- Reintroduced the @OverRide annotation for the decode method
  to enhance code clarity and maintain consistency with
  Java best practices.
- Clarified parameter descriptions and return values for the
  encode and decode methods in the Bech32 class.
- Enhanced exception handling details to provide better
  guidance on potential errors.
- Changed classTypeTagsMap to be final to prevent reassignment.
- This enhances code safety and clarity regarding the intended usage.
- Clarify parameters and return values for the sign and verify methods.
- Improve overall understanding of the Schnorr signature process.
- The id field was commented out and is no longer needed.
- This change simplifies the class structure and improves clarity.
…alidation

- Simplified exception handling by removing the redundant catch block
  for AssertionError. This improves code clarity and maintains the
  existing validation logic.
- Added the @OverRide annotation back to the decode method for clarity.
- This improves code readability and ensures proper method overriding.
- Reintroduces the @OverRide annotation for the decode method to ensure
  proper method overriding and improve code clarity.
- Added a suppression annotation to avoid resource warnings when
  creating an HttpClient instance in the Nip05Validator class.
…entation

- Added missing override annotations to several methods for clarity.
- Cleaned up method documentation by removing redundant comments.
- Improved code readability and maintainability.
- Updated relayName and relayUri to be final, ensuring they are immutable.
- This change enhances the integrity of the WebSocketClientHandler class.
- Streamlined the process of adding tags by using computeIfAbsent
  to reduce code complexity and improve readability.
@tcheeric tcheeric merged commit 18de8cd into develop Oct 3, 2025
3 checks passed
@tcheeric tcheeric deleted the codex/add-non-blocking-subscription-api branch October 3, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants