Skip to content

Commit 253a297

Browse files
morisilclaude
andauthored
New Neo4jOperations access layer, object mapping, full test coverage, fix critical bugs and improve error handling (#17)
* Fix critical bugs and improve error handling This commit addresses several issues found during code review: **Critical Fixes:** - Fix missing TransactionConfig parameter in InternalSession Previously, executeRead() and executeWrite() methods accepted a TransactionConfig parameter but did not pass it to the underlying Neo4j async methods. This caused transaction timeouts, metadata, and other configuration settings to be silently ignored. (src/main/kotlin/internal/InternalSession.kt:45, 56) **Medium Priority Fixes:** - Add consumption tracking to InternalResult.single() The single() method now uses the same AtomicBoolean mechanism as records() to prevent multiple consumption attempts and ensure consistent resource management. (src/main/kotlin/internal/InternalResult.kt:59-69) **User Experience Improvements:** - Improve error messages in NodeMapping.toObject() Enhanced error message when attempting to convert unsupported Value types, providing clear guidance on how to fix the issue with examples of common mistakes. (src/main/kotlin/NodeMapping.kt:130-134) - Add documentation to SessionConfigBuilder Added KDoc warnings to bookmarks and bookmarkManager properties explaining their mutual exclusivity and that bookmarkManager takes precedence when both are set. (src/main/kotlin/Session.kt:563-597) All changes verified with passing tests and API compatibility checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Add kotlinx.serialization mapping and Neo4jOperations API This commit adds comprehensive object mapping support using kotlinx.serialization and a high-level operations API. **New Features:** Object Mapping (NodeMapping.kt): - toProperties(): Convert @serializable objects to Neo4j property maps - toObject<T>(): Convert Neo4j nodes/relationships to Kotlin objects - Support for primitives, lists, enums, and kotlin.time.Instant - Validates against unsupported nested structures with clear errors High-Level API (Neo4jOperations.kt): - DispatchedNeo4jOperations: Session lifecycle management - Convenience methods: read(), write(), withSession() - Flow-based streaming with automatic resource cleanup - populate(): Quick test data insertion **API Changes:** - Result.singleOrNull(): Extension function for optional single records - Session.flow(): Streaming query results in read transactions - Updated API surface (api/xemantic-neo4j-kotlin-driver.api) **Dependencies:** - Added kotlinx-serialization-core (API dependency) - Added xemantic-kotlin-core for SuspendCloseable - Removed local SuspendCloseable implementation **Testing:** - Comprehensive test coverage for mapping and operations - Performance benchmarks for Result streaming - Integration tests for round-trip serialization - README examples as executable tests **Build:** - Updated Gradle wrapper to 9.2 - Dependency version updates - GitHub Actions workflow improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent b73aab5 commit 253a297

29 files changed

+4769
-837
lines changed

.github/workflows/build-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Java
2020
uses: actions/[email protected]
2121
with:
22-
distribution: 'temurin'
22+
distribution: ${{ vars.DEFAULT_JAVA_DISTRIBUTION }}
2323
java-version: ${{ vars.DEFAULT_JAVA_VERSION }}
2424

2525
- name: Setup Gradle

.github/workflows/build-main.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ jobs:
1616
- name: Setup Java
1717
uses: actions/[email protected]
1818
with:
19-
distribution: 'temurin'
19+
distribution: ${{ vars.DEFAULT_JAVA_DISTRIBUTION }}
2020
java-version: ${{ vars.DEFAULT_JAVA_VERSION }}
2121

2222
- name: Setup Gradle
2323
uses: gradle/actions/[email protected]
2424

25-
- name: Build
26-
run: ./gradlew build kotlinSourcesJar javadocJar publish
25+
- name: Build and Publish SNAPSHOT
2726
env:
28-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
29-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
30-
ORG_GRADLE_PROJECT_githubActor: ${{ secrets.GITHUBACTOR }}
31-
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUBTOKEN }}
27+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
28+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
29+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
30+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
31+
32+
run: ./gradlew build publishToMavenCentral --no-configuration-cache

.github/workflows/build-release.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,26 @@ jobs:
2525
- name: Setup Java
2626
uses: actions/[email protected]
2727
with:
28-
distribution: 'temurin'
28+
distribution: ${{ vars.DEFAULT_JAVA_DISTRIBUTION }}
2929
java-version: ${{ vars.DEFAULT_JAVA_VERSION }}
3030

3131
- name: Setup Gradle
3232
uses: gradle/actions/[email protected]
3333

34-
- name: Build
34+
- name: Build and Publish release
3535
env:
36-
ORG_GRADLE_PROJECT_githubActor: ${{ secrets.GITHUBACTOR }}
37-
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUBTOKEN }}
38-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
39-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
40-
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
41-
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
36+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
37+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
38+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
39+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
4240
JRELEASER_DISCORD_WEBHOOK: ${{ secrets.DISCORD_ANNOUCEMENTS_WEBHOOK }}
4341
JRELEASER_LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }}
4442
JRELEASER_LINKEDIN_OWNER: ${{ secrets.LINKEDIN_OWNER }}
4543
JRELEASER_BLUESKY_HOST: ${{ vars.BLUESKY_HOST }}
4644
JRELEASER_BLUESKY_HANDLE: ${{ vars.BLUESKY_HANDLE }}
4745
JRELEASER_BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }}
4846

49-
run: ./gradlew -Pversion=$VERSION build kotlinSourcesJar javadocJar publish jreleaserFullRelease
50-
51-
- name: Display JReleaser trace.log
52-
run: |
53-
if [ -f build/jreleaser/trace.log ]; then
54-
echo "trace.log Content:"
55-
cat build/jreleaser/trace.log
56-
else
57-
echo "trace.log file not found"
58-
fi
47+
run: ./gradlew -Pversion=$VERSION build publishToMavenCentral jreleaserAnnounce --no-configuration-cache
5948

6049
- name: Get target branch for tag
6150
run: |
@@ -70,11 +59,11 @@ jobs:
7059
ref: ${{ env.TARGET_BRANCH }}
7160
fetch-depth: 0
7261

73-
- name: Update README
74-
run: ./gradlew -Pversion=$VERSION updateVersionInReadme
62+
- name: Update versions after release
63+
run: ./gradlew -Pversion=$VERSION updateVersionsAfterRelease
7564

76-
- name: Commit README.md pointing to released version
65+
- name: Commit version updates after release
7766
uses: stefanzweifel/[email protected]
7867
with:
79-
commit_message: Dependency version in README.md updated to ${{ env.VERSION }}
80-
file_pattern: 'README.md'
68+
commit_message: Version updated to ${{ env.VERSION }} in README.md, next snapshot in gradle.properties
69+
file_pattern: 'README.md gradle.properties'

0 commit comments

Comments
 (0)