Summary
Ship idiomatic typed plan-authoring facades for Python and TypeScript
over the V2 prepared-query surface. Both bindings can already execute
prepared V2 plans (canonical plan bytes plus invocation JSON through the
native query_v2_runtime modules), but plans themselves can only be
authored in Rust; the cross-binding smoke tests embed Rust-generated
base64 plan fixtures.
Problem
The 2.0.0 contract deliberately scopes plan authoring to Rust: the
upgrade guide states binding facades follow in a later 2.0.x release.
Until they exist, a Python or TypeScript application that wants a new
query shape needs a Rust toolchain to produce the canonical plan bytes,
which undercuts the promise of one semantic engine reachable from every
binding.
Why
This is a multi-flight feature — a new native API surface across two
bindings plus full test matrices — and it no longer blocks 2.0.0: no
released document claims binding-level authoring exists, and no removal
is justified by it. It deserves its own tracked delivery rather than a
tail-end slice of the audit-remediation program.
Proposed change
- Opaque native builder handles. Plan construction happens inside
the native module through PyO3 / N-API handles; host languages never
see or assemble serialized plan structure. The existing Rust
QueryPlan constructors remain the single validation authority.
- Python facade with complete type stubs. A typed builder API in
type_bridge producing prepared plans that feed the existing
execute/encode/decode functions unchanged.
- TypeScript facade with generated declarations. The same builder
shape through N-API, with .d.ts coverage and no never/unsafe
casts in the public path.
- Authoring test matrices. Representative basic and advanced plans
(function calls, reduce, try, documents, bounded reachability)
authored through the public facades in both bindings and executed
both locally and through the versioned remote envelope against
released artifacts — no embedded plan bytes anywhere in the suites.
- Docs. The upgrade guide's plan-authoring scoping disclosure is
replaced by documentation of the shipped surface.
Acceptance criteria
Related
Summary
Ship idiomatic typed plan-authoring facades for Python and TypeScript
over the V2 prepared-query surface. Both bindings can already execute
prepared V2 plans (canonical plan bytes plus invocation JSON through the
native
query_v2_runtimemodules), but plans themselves can only beauthored in Rust; the cross-binding smoke tests embed Rust-generated
base64 plan fixtures.
Problem
The 2.0.0 contract deliberately scopes plan authoring to Rust: the
upgrade guide states binding facades follow in a later 2.0.x release.
Until they exist, a Python or TypeScript application that wants a new
query shape needs a Rust toolchain to produce the canonical plan bytes,
which undercuts the promise of one semantic engine reachable from every
binding.
Why
This is a multi-flight feature — a new native API surface across two
bindings plus full test matrices — and it no longer blocks 2.0.0: no
released document claims binding-level authoring exists, and no removal
is justified by it. It deserves its own tracked delivery rather than a
tail-end slice of the audit-remediation program.
Proposed change
the native module through PyO3 / N-API handles; host languages never
see or assemble serialized plan structure. The existing Rust
QueryPlanconstructors remain the single validation authority.type_bridgeproducing prepared plans that feed the existingexecute/encode/decode functions unchanged.
shape through N-API, with
.d.tscoverage and nonever/unsafecasts in the public path.
(function calls, reduce, try, documents, bounded reachability)
authored through the public facades in both bindings and executed
both locally and through the versioned remote envelope against
released artifacts — no embedded plan bytes anywhere in the suites.
replaced by documentation of the shipped surface.
Acceptance criteria
admits through a typed public facade with full stubs
and no unsafe casts in the public path
public facades instead of embedded base64 fixtures
with outcomes identical to Rust-authored equivalents
Related