Skip to content

Conversation

@tcheeric
Copy link
Owner

Summary

  • declare EventEncodingException on IDecoder and share the exception from the base module
  • replace FDecoder with IDecoder in FiltersDecoder and make Filters implement IElement
  • document decoder error handling across event JSON decoders

Testing

  • mvn -q verify (missing Docker environment for integration tests)

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

Copy link
Contributor

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 unifies the decoder interface across the codebase by standardizing on IDecoder and adding proper error handling documentation. The refactor eliminates the redundant FDecoder interface and ensures consistent exception handling across all JSON decoders.

  • Removes FDecoder interface and migrates FiltersDecoder to use IDecoder
  • Adds EventEncodingException to the IDecoder interface method signature
  • Documents all decoder methods with comprehensive Javadoc comments including exception handling

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
nostr-java-base/src/main/java/nostr/base/IDecoder.java Updates interface to declare EventEncodingException and adds documentation
nostr-java-event/src/main/java/nostr/event/json/codec/FDecoder.java Removes redundant interface entirely
nostr-java-event/src/main/java/nostr/event/json/codec/FiltersDecoder.java Migrates from FDecoder to IDecoder and adds import
nostr-java-event/src/main/java/nostr/event/filter/Filters.java Implements IElement interface
Multiple decoder classes Adds comprehensive Javadoc documentation to decode methods

import com.fasterxml.jackson.module.blackbird.BlackbirdModule;
import nostr.event.json.codec.EventEncodingException;

/**
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

The base module is importing an exception from the event module, creating a circular dependency. Consider moving EventEncodingException to the base module or creating a generic DecodingException in the base module.

Suggested change
/**
/**
* Exception thrown when decoding fails.
*/
class DecodingException extends Exception {
public DecodingException(String message) {
super(message);
}
public DecodingException(String message, Throwable cause) {
super(message, cause);
}
}
/**

Copilot uses AI. Check for mistakes.
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;
import lombok.NonNull;
import nostr.base.IDecoder;
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

[nitpick] The import order should follow Java conventions. Place the nostr.base import before the nostr.event imports to maintain alphabetical ordering of package imports.

Suggested change
import nostr.base.IDecoder;
import nostr.base.IDecoder;

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tcheeric tcheeric merged commit 94ea72e into develop Aug 22, 2025
3 of 4 checks passed
@tcheeric tcheeric deleted the codex/update-decoders-to-conform-to-new-interface branch August 22, 2025 08:04
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.

3 participants