Skip to content

Commit 368eeec

Browse files
authored
Merge pull request #449 from tcheeric/feat/bom-migration
feat/bom-migration
2 parents c400c3d + 08b1d6c commit 368eeec

20 files changed

Lines changed: 309 additions & 208 deletions

File tree

.github/labeler.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
name: CI
22

33
on:
4-
workflow_run:
5-
workflows: ["Format"]
6-
types: [completed]
4+
pull_request:
5+
branches:
6+
- develop
7+
- main
8+
- master
9+
push:
10+
branches:
11+
- develop
12+
- main
13+
- master
714

815
jobs:
916
build:
10-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1117
runs-on: ubuntu-latest
1218
permissions:
1319
contents: read

.github/workflows/google-java-format.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Format
33
on:
44
pull_request:
55
branches:
6-
- develop
6+
- main
7+
- master
78

89
jobs:
910

.github/workflows/issue-labeler.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/qodana_code_quality.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Qodana
22
on:
33
workflow_dispatch:
4-
pull_request:
54
push:
6-
branches: # Specify your branches here
7-
- main # The 'main' branch
8-
- 'releases/*' # The release branches
5+
branches:
6+
- develop
7+
- main
8+
- master
99

1010
jobs:
1111
qodana:

.mvn/maven.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-T 2
1+
-T2

PR.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Proposed title: fix: Fix CalendarContent addTag duplication; address Qodana findings and add tests
2+
3+
## Summary
4+
This PR fixes a duplication bug in `CalendarContent.addTag`, cleans up Qodana-reported issues (dangling Javadoc, missing Javadoc descriptions, fields that can be final, and safe resource usage), and adds unit tests to validate correct tag handling.
5+
6+
Related issue: #____
7+
8+
## What changed?
9+
- Fix duplication in calendar tag collection
10+
- F:nostr-java-event/src/main/java/nostr/event/entities/CalendarContent.java†L184-L188
11+
- Replace re-put/addAll pattern with `computeIfAbsent(...).add(...)` to append a single element without duplicating the list.
12+
- F:nostr-java-event/src/main/java/nostr/event/entities/CalendarContent.java†L40-L40
13+
- Make `classTypeTagsMap` final.
14+
15+
- Unit tests for calendar tag handling
16+
- F:nostr-java-event/src/test/java/nostr/event/unit/CalendarContentAddTagTest.java†L16-L31
17+
- F:nostr-java-event/src/test/java/nostr/event/unit/CalendarContentAddTagTest.java†L33-L45
18+
- F:nostr-java-event/src/test/java/nostr/event/unit/CalendarContentAddTagTest.java†L47-L64
19+
20+
- Javadoc placement fixes (resolve DanglingJavadoc by placing Javadoc above `@Override`)
21+
- F:nostr-java-api/src/main/java/nostr/api/NostrSpringWebSocketClient.java†L112-L116, L132-L136, L146-L150, L155-L159, L164-L168, L176-L180, L206-L210, L293-L297, L302-L306, L321-L325
22+
- F:nostr-java-event/src/main/java/nostr/event/json/codec/GenericEventDecoder.java†L25-L33
23+
- F:nostr-java-event/src/main/java/nostr/event/json/codec/Nip05ContentDecoder.java†L22-L30
24+
- F:nostr-java-event/src/main/java/nostr/event/json/codec/BaseTagDecoder.java†L22-L30
25+
- F:nostr-java-event/src/main/java/nostr/event/json/codec/BaseMessageDecoder.java†L27-L35
26+
- F:nostr-java-event/src/main/java/nostr/event/json/codec/GenericTagDecoder.java†L26-L34
27+
28+
- Javadoc description additions (fix `@param`, `@return`, `@throws` missing)
29+
- F:nostr-java-crypto/src/main/java/nostr/crypto/schnorr/Schnorr.java†L20-L28, L33-L41
30+
- F:nostr-java-crypto/src/main/java/nostr/crypto/bech32/Bech32.java†L80-L89, L91-L100, L120-L128
31+
32+
- Fields that may be final
33+
- F:nostr-java-api/src/main/java/nostr/api/WebSocketClientHandler.java†L31-L32
34+
- F:nostr-java-event/src/main/java/nostr/event/entities/CalendarContent.java†L40-L40
35+
36+
- Resource inspections: explicitly managed or non-closeable resources
37+
- F:nostr-java-api/src/main/java/nostr/api/WebSocketClientHandler.java†L87-L90, L101-L103
38+
- Suppress false positives for long-lived `SpringWebSocketClient` managed by handler lifecycle.
39+
- F:nostr-java-util/src/main/java/nostr/util/validator/Nip05Validator.java†L95-L96
40+
- Suppress on JDK `HttpClient` which is not AutoCloseable and intended to be reused.
41+
42+
- Remove redundant catch and commented-out code
43+
- F:nostr-java-event/src/main/java/nostr/event/impl/CreateOrUpdateProductEvent.java†L59-L61
44+
- F:nostr-java-event/src/main/java/nostr/event/entities/ZapRequest.java†L12-L19
45+
46+
## BREAKING
47+
None.
48+
49+
## Review focus
50+
- Confirm the intention for `CalendarContent` is to accumulate tags per code without list duplication.
51+
- Sanity-check placement of `@SuppressWarnings("resource")` where resources are explicitly lifecycle-managed.
52+
53+
## Checklist
54+
- [x] Scope ≤ 300 lines (or split/stack)
55+
- [x] Title is verb + object (Conventional Commits: `fix: ...`)
56+
- [x] Description links the issue and answers “why now?”
57+
- [x] BREAKING flagged if needed
58+
- [x] Tests/docs updated (if relevant)
59+
60+
## Testing
61+
-`mvn -q -DskipTests package`
62+
- Build succeeded for all modules.
63+
-`mvn -q -Dtest=CalendarContentAddTagTest test` (run in `nostr-java-event`)
64+
- Tests executed successfully. New tests validate:
65+
- Two hashtags produce exactly two items without duplication.
66+
- Single participant `PubKeyTag` stored once with expected key.
67+
- Different tag types tracked independently.
68+
- ⚠️ `mvn -q verify`
69+
- Fails in this sandbox due to Mockito’s inline mock-maker requiring a Byte Buddy agent attach, which is blocked:
70+
- Excerpt:
71+
- `Could not initialize plugin: interface org.mockito.plugins.MockMaker`
72+
- `MockitoInitializationException: Could not initialize inline Byte Buddy mock maker.`
73+
- `Could not self-attach to current VM using external process`
74+
- Local runs in a non-restricted environment should pass once the agent is allowed or Mockito is configured accordingly.
75+
76+
## Network Access
77+
- No external network calls required by these changes.
78+
- No blocked domains observed. Test failures are unrelated to network and stem from sandbox agent-attach restrictions.
79+
80+
## Notes
81+
- `CalendarContent.addTag` previously reinserted the list and added all elements again, causing duplication. The fix uses `computeIfAbsent` and appends exactly one element.
82+
- I intentionally placed `@SuppressWarnings("resource")` where objects are long-lived or non-`AutoCloseable` (e.g., Java `HttpClient`) to silence false positives noted by Qodana.

PR_BOM_MIGRATION.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
title: feat: migrate to nostr-java-bom for centralized version management
2+
3+
## Summary
4+
Related issue: #____
5+
Migrate nostr-java to use `nostr-java-bom` for centralized dependency version management across the Nostr Java ecosystem. This eliminates duplicate version properties and ensures consistent dependency versions.
6+
7+
## What changed?
8+
- **Version bump**: `0.4.0``0.5.0`
9+
- **BOM updated**: nostr-java-bom `1.0.0``1.1.0` (now includes Spring Boot dependencies)
10+
- Remove Spring Boot parent POM dependency
11+
- Replace 30+ version properties with single `nostr-java-bom.version` property (F:pom.xml†L77)
12+
- Import `nostr-java-bom:1.1.0` in `dependencyManagement` (F:pom.xml†L87-L93)
13+
- Remove version tags from all dependencies across modules:
14+
- `nostr-java-crypto`: removed bcprov-jdk18on version (F:nostr-java-crypto/pom.xml†L37)
15+
- `nostr-java-util`: removed commons-lang3 version (F:nostr-java-util/pom.xml†L28)
16+
- `nostr-java-client`: removed Spring Boot versions, added compile scope for awaitility (F:nostr-java-client/pom.xml†L56)
17+
- `nostr-java-api`: removed Spring Boot versions
18+
- Simplify plugin management - versions now inherited from BOM (F:pom.xml†L100-L168)
19+
- Update nostr-java-bom to import Spring Boot dependencies BOM
20+
21+
## BOM Architecture Changes
22+
```
23+
nostr-java-bom 1.1.0 (updated)
24+
├─ imports spring-boot-dependencies (NEW)
25+
├─ defines nostr-java modules (updated to 0.5.0)
26+
└─ defines shared dependencies (BouncyCastle, Jackson, Lombok, test deps)
27+
```
28+
29+
## Benefits
30+
- **Single source of truth**: All Nostr Java dependency versions managed in one place
31+
- **Consistency**: Identical dependency versions across all Nostr projects
32+
- **Simplified updates**: Bump dependency versions once in BOM, all projects inherit it
33+
- **Reduced duplication**: From 30+ version properties to 1
34+
- **Spring Boot integration**: Now imports Spring Boot BOM for Spring dependencies
35+
36+
## BREAKING
37+
None. Internal build configuration change only; no API or runtime behavior changes.
38+
39+
## Protocol Compliance
40+
- No change to NIP (Nostr Implementation Possibilities) compliance
41+
- Behavior remains compliant with Nostr protocol specifications
42+
43+
## Testing
44+
-`mvn clean install -DskipTests -U` - BUILD SUCCESS
45+
- All modules compile successfully with BOM-managed versions
46+
- Plugin version warnings are non-blocking
47+
48+
## Checklist
49+
- [x] Title uses `type: description`
50+
- [x] File citations included
51+
- [x] Version bumped to 0.5.0
52+
- [x] nostr-java-bom updated to 1.1.0 with Spring Boot support
53+
- [x] Build verified with BOM
54+
- [x] No functional changes; protocol compliance unchanged
55+
- [x] BOM deployed to https://maven.398ja.xyz/releases/xyz/tcheeric/nostr-java-bom/1.1.0/

nostr-java-api/pom.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>xyz.tcheeric</groupId>
66
<artifactId>nostr-java</artifactId>
7-
<version>0.4.0</version>
7+
<version>0.5.0</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010

@@ -26,42 +26,42 @@
2626
<dependency>
2727
<groupId>org.apache.commons</groupId>
2828
<artifactId>commons-text</artifactId>
29-
<version>${commons-text.version}</version>
29+
3030
</dependency>
3131
<dependency>
3232
<groupId>${project.groupId}</groupId>
3333
<artifactId>nostr-java-client</artifactId>
34-
<version>${nostr-java.version}</version>
34+
3535
</dependency>
3636
<dependency>
3737
<groupId>${project.groupId}</groupId>
3838
<artifactId>nostr-java-encryption</artifactId>
39-
<version>${nostr-java.version}</version>
39+
4040
</dependency>
4141
<dependency>
4242
<groupId>${project.groupId}</groupId>
4343
<artifactId>nostr-java-id</artifactId>
44-
<version>${nostr-java.version}</version>
44+
4545
</dependency>
4646
<dependency>
4747
<groupId>${project.groupId}</groupId>
4848
<artifactId>nostr-java-event</artifactId>
49-
<version>${nostr-java.version}</version>
49+
5050
</dependency>
5151
<dependency>
5252
<groupId>${project.groupId}</groupId>
5353
<artifactId>nostr-java-util</artifactId>
54-
<version>${nostr-java.version}</version>
54+
5555
</dependency>
5656
<dependency>
5757
<groupId>${project.groupId}</groupId>
5858
<artifactId>nostr-java-crypto</artifactId>
59-
<version>${nostr-java.version}</version>
59+
6060
</dependency>
6161
<dependency>
6262
<groupId>org.springframework.boot</groupId>
6363
<artifactId>spring-boot-starter</artifactId>
64-
<version>${spring-boot.version}</version>
64+
6565
</dependency>
6666
<dependency>
6767
<groupId>com.fasterxml.jackson.core</groupId>
@@ -70,7 +70,7 @@
7070
<dependency>
7171
<groupId>org.projectlombok</groupId>
7272
<artifactId>lombok</artifactId>
73-
<version>${lombok.version}</version>
73+
7474
<scope>provided</scope>
7575
</dependency>
7676
<dependency>
@@ -85,19 +85,19 @@
8585
<dependency>
8686
<groupId>org.springframework.boot</groupId>
8787
<artifactId>spring-boot-starter-test</artifactId>
88-
<version>${spring-boot.version}</version>
88+
8989
<scope>test</scope>
9090
</dependency>
9191
<dependency>
9292
<groupId>com.google.guava</groupId>
9393
<artifactId>guava</artifactId>
94-
<version>${guava.version}</version>
94+
9595
<scope>test</scope>
9696
</dependency>
9797
<dependency>
9898
<groupId>org.junit.jupiter</groupId>
9999
<artifactId>junit-jupiter</artifactId>
100-
<version>${junit-jupiter.version}</version>
100+
101101
<scope>test</scope>
102102
</dependency>
103103
</dependencies>

0 commit comments

Comments
 (0)