Skip to content

feat: add opt-in resumable SQLite RBU support - #453

Open
aballiet wants to merge 1 commit into
OP-Engineering:mainfrom
aballiet:create-upstream-issue
Open

aballiet wants to merge 1 commit into
OP-Engineering:mainfrom
aballiet:create-upstream-issue

Conversation

@aballiet

@aballiet aballiet commented Sep 8, 2026

Copy link
Copy Markdown

Summary

  • add opt-in rbu: true build configuration for Android CMake, CocoaPods, and SwiftPM
  • expose top-level isRBUEnabled() and asynchronous applyRBU() APIs
  • support bounded stepping, persistent state files, pause/resume, progress/state reporting, and structured SQLite error codes
  • document artifact ownership, recovery behavior, exact-base requirements, and SQLite RBU limitations
  • add synthetic end-to-end and validation/error coverage

RBU remains disabled by default and supports OP-SQLite's bundled vanilla SQLite backend. Configuring the dedicated toggle with SQLCipher, libSQL, Turso, or Apple's embedded SQLite fails at build time. Web and the Node test facade expose capability detection and a clear unsupported error.

sqliteFlags: "-DSQLITE_ENABLE_RBU=1" remains available for low-level configuration. The dedicated toggle is preferred because it validates backend compatibility.

API

const result = await applyRBU({
  targetPath: "/absolute/path/target.sqlite",
  updatePath: "/absolute/path/update.sqlite",
  statePath: "/absolute/path/update-state.sqlite",
  maxSteps: 100,
});

The native worker performs at most 1000 steps by default and always closes the RBU handle, including error paths. A paused close persists SQLite's resume state; a completed update returns status: "complete" and state: "done".

Verification

  • Android release build for all configured ABIs
  • Android runtime suite with RBU enabled, including bounded pause, separate state creation, resume, atomic target visibility, already-complete behavior, missing artifacts, and malformed artifacts
  • Android runtime suite with RBU disabled
  • TypeScript typecheck, package build, Node tests, web production build, and Docusaurus production build
  • CocoaPods Ruby syntax validation and SwiftPM manifest parsing

Local Apple compilation/runtime testing was unavailable in this environment; CI should exercise the CocoaPods and SwiftPM paths.

Build impact

Disabled builds do not compile the RBU extension. Enabled builds add SQLite's bundled RBU implementation and a small JSI adapter; no additional native dependency or SQLite library is linked.

Closes #452

@aballiet
aballiet marked this pull request as ready for review September 8, 2026 00:21
@ospfranco

Copy link
Copy Markdown
Contributor

I will merge this if there is more support or sponsorship, otherwise I'm stuck supporting this for years.

@aballiet

aballiet commented Sep 8, 2026

Copy link
Copy Markdown
Author

I will merge this if there is more support or sponsorship, otherwise I'm stuck supporting this for years.

OK got it! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Opt-in resumable SQLite RBU support

2 participants