chore(api): deprecate raw transaction trio; migrate MCP async paths to RAII (#69)#73
Merged
StefanSteiner merged 1 commit intoMay 28, 2026
Conversation
…o RAII (tableau#69) Consolidates the public transaction API around the RAII Transaction / AsyncTransaction guards. The raw &self begin_transaction / commit / rollback methods on Connection and AsyncConnection are now #[doc(hidden)] #[deprecated] -- still callable, but hidden from rustdoc and emitting a compiler warning at every call site. Lands as `chore:` to defer release-please from cutting an early version. The v0.3.0 bump happens after the rest of the bundle merges. See MIGRATING-0.3.md for the consolidated migration guide. What changed: - hyperdb-api Connection/AsyncConnection: added pub(crate) canonical begin_transaction_raw / commit_raw / rollback_raw siblings. The original pub methods became thin wrappers calling the _raw family, marked #[doc(hidden)] #[deprecated]. The RAII guards (Transaction, AsyncTransaction) call _raw directly so they don't self-warn. - hyperdb-mcp: 4 async pool-path ingest functions migrated to use the RAII guard (ingest_csv_file_async, ingest_json_async, ingest_parquet_file_async, ingest_arrow_ipc_file_async). Their signature changed from &AsyncConnection to &mut AsyncConnection; ~7 caller sites in server.rs, watcher.rs, and ingest_arrow_tests.rs updated to bind `let mut conn = pool.get().await?` and pass `&mut conn`. - Engine::execute_in_transaction (sync, &self constraint) cannot migrate without reshaping the Engine lock model. Annotated with #[allow(deprecated, reason = "...")]. Followup scope in .issue-body-mcp-engine-raii-migration.md. - Tests intentionally exercising the deprecated API (transaction_tests.rs, wire_desync_tests.rs) and the transactions example carry file-level #![allow(deprecated, reason = "...")]. - docs/TRANSACTIONS.md reorganized: RAII as the only documented path, "Deprecated raw methods" section at the bottom with the migration recipe. MIGRATING-0.3.md adds a tableau#69 section. Soft-deprecation rationale: the original issue proposed full removal of the trio, but Engine::execute_in_transaction's &self constraint makes a clean removal a structural change beyond tableau#69's scope. The deprecation + hide gets the public-API safety win now; the followup issue tracks the structural migration. Verification: - cargo build --workspace --all-targets -- clean - cargo clippy --workspace --all-targets -- -D warnings -- clean - cargo test --workspace -- 300+ tests, 0 failures (including doctests) - cargo fmt --check -- clean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #69.
Consolidates the public transaction API around the RAII
Transaction<'conn>/AsyncTransaction<'conn>guards. The raw&selfbegin_transaction/commit/rollbackmethods onConnectionandAsyncConnectionare now#[doc(hidden)] #[deprecated]— they remain callable for now but are hidden from generated rustdoc and emit a compiler warning at every call site. The MCP server's async pool-path ingest functions are migrated to use the RAII guard, demonstrating the recommended pattern in 4 production code sites.Lands as
chore:to defer release-please from cutting an early version; the v0.3.0 bump happens after the rest of the bundle merges. SeeMIGRATING-0.3.mdfor the consolidated migration guide.What changed
hyperdb-apipub(crate)canonical implementations:Connection::{begin_transaction_raw, commit_raw, rollback_raw}(sync)AsyncConnection::{begin_transaction_raw, commit_raw, rollback_raw}(async)pubmethods became thin wrappers calling the_rawfamily, marked#[doc(hidden)] #[deprecated(note = "Use ...transaction() for an RAII guard. ...")].Transaction,AsyncTransaction) switched their internal calls to the_rawfamily — no#[allow(deprecated)]annotation needed. They model the recommended pattern from inside the crate.hyperdb-mcpFour async pool-path ingest functions migrated to the RAII guard:
ingest_csv_file_asyncingest_json_asyncingest_parquet_file_asyncingest_arrow_ipc_file_asyncEach rewrote the
conn.begin_transaction().await? ... conn.commit().await?pattern into:The function signatures changed from
&AsyncConnectionto&mut AsyncConnection(the borrow-checker truth: a transaction needs exclusive use of the session). ~7 caller sites inserver.rs,watcher.rs, andtests/ingest_arrow_tests.rsupdated to bindlet mut conn = pool.get().await?and pass&mut conn.Engine::execute_in_transactionretained the deprecated raw methods under#[allow(deprecated, reason = "...")]. It cannot migrate without reshaping theEnginelock model — tracked as the follow-up issue.Tests / examples / docs
hyperdb-api/tests/transaction_tests.rsandwire_desync_tests.rsexercise the deprecated raw API on purpose to lock in its behavior. File-level#![allow(deprecated, reason = "...")]documents the intent.hyperdb-api/examples/additional_examples/transactions.rskeeps both the raw and RAII demonstrations side-by-side for educational purposes; same file-level allow.docs/TRANSACTIONS.mdreorganized: RAII is the only documented path, with a "Deprecated raw methods" section at the bottom carrying the migration recipe.MIGRATING-0.3.mdadds a#69section with sync + async migration recipes and the pooled-connection caveat.Verification
cargo build --workspace --all-targets— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— all targets pass (300+ tests, 0 failures, including doctests)cargo fmt --check— cleanProcess notes
create_table_asyncrecommending the deprecated pattern (fixed).issue-body-mcp-engine-raii-migration.md(added)Related
MIGRATING-0.3.md— consolidated migration guide for the v0.3.0 bundle.issue-body-mcp-engine-raii-migration.md— followup scope for the remainingEngine::execute_in_transactionmigrationfeat!:commit cuts v0.3.0Test plan
cargo run --example transactionsandcargo run --example async_parity_smokeagainst a local hyperdMIGRATING-0.3.mdrecipes against the actual public API