Rust semantic backend¶
Rust is the only semantic execution path for generated Python, TypeScript/Node, and Rust applications. Generated packages install canonical projection evidence and route CRUD, immutable queries, hydration, transactions, migration, and provider work through the shared engine.
There is no Python or Node ORM fallback. If TYPE_BRIDGE_BACKEND is supplied,
only rust is accepted.
The backend supports the exact operation set recorded in
tests/fixtures/generated-only-operation-parity-inventory.json, including:
- generated entity and relation CRUD, batches, IID/key fallback, and hooks;
- exact field, ownership, role-player, subtype, and scalar validation;
- concise filters and immutable multi-model direct/remote queries;
- rows, pages, count/existence, reducers, and grouping;
- caller-owned transactions and exact generated hydration;
- TypeDB 3.11–3.14 provider selection and fail-closed version checks.
Private dynamic managers and descriptors are execution machinery for verified generated projections. They are not a public target-language declaration API.
Run focused Rust tests while changing the engine, then generated cross-language acceptance and the live suite:
cd type-bridge-core
cargo test -p type-bridge-orm
cargo test -p type-bridge-schema-codegen
cd ..
./test.sh
Python Database and TransactionContext objects wrap Rust-owned handles. Raw
Python-driver transactions are separate and cannot be shared with generated
manager operations.
The ORM also provides deferred raw execution through
Database::transaction(session::staged::TransactionOptions). Stage TypeQL
with session::staged::StagedQuery, then call commit() to execute the
ordered statements in one provider transaction. Pending answers become
readable only after the entire execution succeeds. Rollback discards queued
work; successful commits leave an empty queue ready for reuse. Close ends
the logical transaction. Dropping it never commits.
The released eager session::Transaction and session::transaction::Transaction
names remain deprecated aliases of OwnedTransaction until 3.0, when the
staged type takes the session-level name. Internal eager execution supports
migration assertions and legacy prerequisite reads. Its internal-eager
feature is restricted to the ORM and schema migration provider by
scripts/ci/check_internal_eager.py. The export is doc-hidden, not isolated
from Cargo feature unification: linking the migration provider can expose
session::eager elsewhere in the graph. The probe also rejects references
to that module outside the allowlist.
Owned ORM transactions and shared contexts retain their provider after a
successful rollback. A context reports RolledBack until new work resumes;
new work is permitted and can commit. Call close to release it explicitly.
Rollback failures and cancelled rollback futures still make it terminal.