Skip to content

Conversation

@sgammon
Copy link
Member

@sgammon sgammon commented Jul 21, 2025

Ready for review Powered by Pull Request Badge

Summary

Makes SQLiteObject instances ReadOnlyProxyObjects, which lets them stringify properly during JSON.stringify.

Changelog

fix(cli): add reachability metadata for `kotlin.Unit.toString()`
fix(graalvm): make sqlite results read-only proxy objects
fix(graalvm): make sqlite layer return undefined instead of unit
test(graalvm): add test for sqlite JSON serialization
test(cli): add smoke test for sqlite JSON serialization

@sgammon sgammon added this to the Release R18: Beta milestone Jul 21, 2025
@sgammon sgammon self-assigned this Jul 21, 2025
@sgammon sgammon added bug Something isn't working lang:javascript Issues relating to JavaScript labels Jul 21, 2025
@sgammon sgammon added this to Elide Jul 21, 2025
@sgammon sgammon added the sqlite Features or issues relating to SQLite support label Jul 21, 2025
@sgammon sgammon moved this to Done in Elide Jul 21, 2025
@sgammon sgammon changed the title fix(graalvm): sqlite results should jsonify fix(graalvm): sqlite results should JSON.stringify Jul 21, 2025
@codecov
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 39.84%. Comparing base (590ae3e) to head (0c2dea3).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...elide/runtime/gvm/internals/sqlite/SqliteModule.kt 83.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1569   +/-   ##
=======================================
  Coverage   39.84%   39.84%           
=======================================
  Files         769      769           
  Lines       37010    37014    +4     
  Branches     5230     5232    +2     
=======================================
+ Hits        14745    14748    +3     
- Misses      20499    20500    +1     
  Partials     1766     1766           
Flag Coverage Δ
jvm 39.84% <83.33%> (+<0.01%) ⬆️
lib 39.84% <83.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../elide/runtime/intrinsics/sqlite/SQLiteDatabase.kt 100.00% <ø> (+6.25%) ⬆️
...elide/runtime/gvm/internals/sqlite/SqliteModule.kt 85.05% <83.33%> (+0.01%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 590ae3e...0c2dea3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fix(cli): add reachability metadata for `kotlin.Unit.toString()`
fix(graalvm): make sqlite results read-only proxy objects
fix(graalvm): make sqlite layer return undefined instead of unit
test(graalvm): add test for sqlite JSON serialization
test(cli): add smoke test for sqlite JSON serialization

Fixes: #1356
Signed-off-by: Sam Gammon <sam@elide.dev>
@sgammon sgammon force-pushed the fix/sqlite-json-stringify branch from 6249376 to 0c2dea3 Compare July 21, 2025 20:35
@sgammon sgammon requested review from a team and Copilot July 21, 2025 20:36
Copy link

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 fixes SQLite result objects to properly stringify with JSON.stringify by making them ReadOnlyProxyObjects instead of regular proxy objects. The changes ensure SQLite query results can be serialized to JSON, which addresses issue #1356.

Key changes:

  • Modified SQLite interfaces to extend ReadOnlyProxyObject for proper JSON serialization
  • Updated method signatures to return JSDynamicObject instead of Unit for consistency
  • Added comprehensive test coverage for JSON encoding/decoding of SQLite results

Reviewed Changes

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

Show a summary per file
File Description
tools/scripts/sqlite-json.mts New test script demonstrating SQLite JSON serialization
packages/graalvm/src/test/kotlin/elide/runtime/gvm/internals/sqlite/SQLiteModuleTest.kt Added test for JSON encoding of SQLite results, removed redundant null checks
packages/graalvm/src/main/kotlin/elide/runtime/intrinsics/sqlite/SQLiteObject.kt Made SQLiteObject extend ReadOnlyProxyObject for JSON compatibility
packages/graalvm/src/main/kotlin/elide/runtime/intrinsics/sqlite/SQLiteDatabase.kt Updated to use ReadOnlyProxyObject and return JSDynamicObject from exec methods
packages/graalvm/src/main/kotlin/elide/runtime/gvm/internals/sqlite/SqliteModule.kt Implemented proxy object methods for SQLiteObject and updated exec return types
packages/graalvm/api/graalvm.api API changes reflecting interface updates
packages/cli/src/test/kotlin/elide/tool/cli/ElideSmokeTests.kt Added new test script to smoke tests
packages/cli/src/main/resources/META-INF/native-image/dev/elide/elide-cli/reachability-metadata.json Added SQLite and reflection metadata for native compilation

@sgammon sgammon changed the title fix(graalvm): sqlite results should JSON.stringify fix: sqlite results should JSON.stringify Jul 21, 2025
@sgammon sgammon merged commit 3fae953 into main Jul 21, 2025
19 checks passed
@sgammon sgammon mentioned this pull request Sep 21, 2025
31 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lang:javascript Issues relating to JavaScript sqlite Features or issues relating to SQLite support

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

SQLite results don't JSONify as expected

3 participants