Repository navigation
Description
Request
Expose explicit write transactions across all supported Minigraf language bindings, with behavior matching the Rust API: begin a transaction, run multiple reads and writes against its staged state, then commit or roll back.
The immediate consumer is ldbc-benchmarks. FinBench conditional read-write operations need tentative writes, reads that see those writes, and a conditional commit or abort within one operation. Separate auto-committed execute() calls cannot preserve that boundary. The benchmark will continue with a narrow JNI bridge to complete Rust operations for now; the official bindings should eventually make that workaround unnecessary.
Verified current state
Source inspection on 2026-11-03, using the immutable development revisions below. This is a binding API gap, not a claim that Minigraf lacks transactions or that every single-statement write is non-atomic.
- Rust already exposes
Minigraf::begin_write(),WriteTransaction::execute()with read-your-own-writes,commit(), and explicit/implicit rollback. - The v3 support table includes Python, browser WASM, WASI, Node.js, Java/JVM, Android, Swift, and C, in addition to Rust. Tier 2 targets remain in scope; their release schedule is separate.
- The inspected APIs below do not expose an explicit write-transaction handle:
| Binding | Revision / source | Observation |
|---|---|---|
| Python | ade0eead exported API |
Ordinary execute/query and other handles, but no exposed begin / transaction-local execute / commit / rollback handle. |
| Java/JVM | 68de43c6 exported API |
Ordinary execute/query and other handles, but no exposed begin / transaction-local execute / commit / rollback handle. |
| Android (Kotlin/Java) | 110a9dc5 exported API |
Ordinary execute/query and other handles, but no exposed begin / transaction-local execute / commit / rollback handle. |
| Swift (iOS/macOS) | 4f2b296d exported API |
Ordinary execute/query and other handles, but no exposed begin / transaction-local execute / commit / rollback handle. |
| Node.js | 823cf3a8 exported API |
Ordinary execute/query and other handles, but no exposed begin / transaction-local execute / commit / rollback handle. |
| C / FFI | 22e4a852 exported API |
Ordinary execute/query and other handles, but no exposed begin / transaction-local execute / commit / rollback handle. |
| Browser WASM | Core BrowserDb at d1d006b2 |
Exposes individual asynchronous execute() writes and query/prepared cursors, but no explicit multi-call transaction API. |
WASI is currently packaged as the REPL, not an embeddable database library. Include an explicit design decision for transaction control on that supported target instead of treating it as the same API as browser WASM or claiming it already has a library transaction handle.
The Java v3 branch is still 68de43c6, and its Cargo.toml pins core 02243f1656eedd987611a9babdfee4a8c6e22b6b. Core and binding revisions must be tracked separately. The benchmark's compatibility analysis records why transaction-local execution is needed.
Expected contract
- Begin an explicit write transaction through each binding's normal public API.
- Execute multiple transact/retract/query statements within that transaction. Queries must see tentative writes; ordinary database or prepared-query calls must not silently be mistaken for transaction-local calls.
- Commit all staged fact changes atomically, or explicitly roll them back.
- Make cleanup safe when callers abandon a transaction, throw an exception, close the database, or try to use a completed handle. Document ownership, thread affinity, concurrent access, and nested-transaction behavior.
- Preserve core error codes and durability semantics. Document browser persistence differences rather than promising native WAL behavior there.
- Keep scope aligned with the core's existing behavior. For example, Rust currently registers rules immediately in the shared registry; do not imply that rule registration is rolled back with staged facts.
Exact language-specific API shape can follow each binding's conventions (handle, context manager, scoped callback, or equivalent), provided callers can make a decision after reading tentative state. A batch of independent auto-committed statements is not sufficient.
Completion criteria
- Cover Python, Java/JVM, Android, Swift, Node.js, C, and browser WASM; record and implement the chosen transaction-control contract for WASI.
- Add binding-level tests for multi-statement commit, read-your-own-writes, explicit rollback, exception/abandonment cleanup, errors, and invalid/reused transaction handles.
- Test concurrent access and handle lifetimes so the binding cannot bypass the core's locking rules or leave locks held.
- For persistent targets, verify committed changes survive close/reopen and rolled-back changes do not.
- Publish usage examples and update API/support documentation, package declarations, and release artifacts.
- Record binding and embedded-core versions so downstream consumers can select and validate a transaction-capable build.
Related cross-binding API work: #462 (query cursors), #465 (open options), #467 (log writer).
Activity
Merge pull request #885 from project-minigraf/feat/824-binding-transa…
adityamukho commentedon Nov 11, 2026
Done on
v3. Explicit write transactions in every binding, built on core's newOwnedWriteTransaction(Send + 'static) and, in the browser,BrowserDb.beginWrite(). WASI stays auto-commit per REPL command.32d71ce052b9312a32d71ce04678be9b32d71ce06db2078732d71ce0eae34ff632d71ce01313157232d71ce0971d4a1132d71ce09e07238332d71ce07a38231532d71ce0@since v3.0.0Design:
docs/superpowers/specs/2026-11-10-824-binding-transactions-design.md.