Add experimental scoped native access API - #216
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds experimental native-context access and native cleanup callbacks for JVM and Kotlin/Native. It separates general and native-access integration tests. It adds published-artifact extraction, native build wiring, and native binding tests. ChangesNative context API and lifecycle
General integration execution
Native-access build and platform wiring
Native binding operations and validation
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant QuickJs
participant QuickJsNativeContext
participant NativeOperations
participant QuickJsClose
QuickJs->>QuickJsNativeContext: withNativeContext(callback)
QuickJsNativeContext->>NativeOperations: pass context and runtime addresses
NativeOperations-->>QuickJsNativeContext: execute native operation
QuickJs->>QuickJsClose: close()
QuickJsClose->>NativeOperations: invoke cleanup callbacks in reverse order
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
CodeRabbit configuration file (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@integration-test/native-access/native/native_operations.c`:
- Line 18: Update native_sum so left and right are promoted and added using
int64_t before constructing the QuickJS result, then pass that accumulated
result through the appropriate QuickJS integer API instead of evaluating left +
right as int32_t.
In `@quickjs/src/jniMain/kotlin/com/dokar/quickjs/QuickJsNativeContext.jni.kt`:
- Around line 5-8: Update the KDoc for contextAddress and runtimeAddress in
QuickJsNativeContext to state that both addresses are valid only during the
QuickJs.withNativeContext callback and must not be retained or used after the
callback returns.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d3c426a9-ab7e-4619-a9b6-5a157592d066
📒 Files selected for processing (21)
README.mdintegration-test/general/build.gradle.ktsintegration-test/general/src/commonMain/kotlin/com/dokar/quickjs/integration/QuickJsIntegrationScenario.ktintegration-test/general/src/commonTest/kotlin/QuickJsIntegrationTest.ktintegration-test/general/src/jvmMain/kotlin/com/dokar/quickjs/integration/Main.ktintegration-test/native-access/build.gradle.ktsintegration-test/native-access/native/CMakeLists.txtintegration-test/native-access/native/native_operations.cintegration-test/native-access/native/native_operations.hintegration-test/native-access/src/commonTest/kotlin/com/dokar/quickjs/nativeintegration/NativeOperations.ktintegration-test/native-access/src/commonTest/kotlin/com/dokar/quickjs/nativeintegration/NativeOperationsTest.ktintegration-test/native-access/src/jvmTest/kotlin/com/dokar/quickjs/nativeintegration/NativeOperations.jvm.ktintegration-test/native-access/src/nativeTest/kotlin/com/dokar/quickjs/nativeintegration/NativeOperations.native.ktquickjs/native/jni/quickjs_jni.cquickjs/src/commonMain/kotlin/com/dokar/quickjs/ExperimentalQuickJsApi.ktquickjs/src/commonMain/kotlin/com/dokar/quickjs/QuickJs.ktquickjs/src/jniMain/kotlin/com/dokar/quickjs/QuickJs.jni.ktquickjs/src/jniMain/kotlin/com/dokar/quickjs/QuickJsNativeContext.jni.ktquickjs/src/nativeMain/kotlin/com/dokar/quickjs/QuickJs.native.ktquickjs/src/nativeMain/kotlin/com/dokar/quickjs/QuickJsNativeContext.native.ktsettings.gradle.kts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@integration-test/general/build.gradle.kts`:
- Around line 99-124: Update the extractQuickJsLibrary task to delete
quickJsExtractedDir before copying, preventing stale extracted files from
persisting. After the copy, verify that both the platform-specific native
library and the META-INF/native-image/com.dokar.quickjs/quickjs metadata
directory exist, and fail the task with a clear error if either required entry
is missing.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e433bf3f-ba42-4167-95ad-0b077d2e1ab4
📒 Files selected for processing (5)
integration-test/general/build.gradle.ktsintegration-test/native-access/build.gradle.ktsintegration-test/native-access/native/CMakeLists.txtquickjs/native/CMakeLists.txtquickjs/native/quickjs.def
Summary by CodeRabbit
New Features
Tests