Summary
For some Node bindings, generated call sites pass the raw result of FfiConverterBytes.lower(...) into ffi-rs calls even though the emitted ffi signatures for those parameters expect UniffiRustBufferStruct.
Repro
Generate Node bindings with uniffi-bindgen-node generate ... for a UniFFI API that takes byte-array arguments. In the generated slatedb-node.ts, call sites look like:
let keyArg = FfiConverterBytes.lower(key);
...
FFI_DYNAMIC_LIB.uniffi_...([..., keyArg]);
But in the generated slatedb-sys.ts, the corresponding ffi signature expects a Rust buffer struct:
uniffi_..._db_delete: (args: [
/* handle */ bigint,
/* key */ UniffiRustBufferStruct
]) => bigint
Why this looks inconsistent
FfiConverterBytes.lower(...) comes from AbstractFfiConverterByteArray.lower() and returns UniffiByteArray / Uint8Array, not UniffiRustBufferStruct.
So the generated call site shape is:
- lowered value:
Uint8Array
- emitted ffi param type:
UniffiRustBufferStruct
Expected
The generated call site and emitted ffi signature should agree. If the ffi side expects UniffiRustBufferStruct, the generated call site should wrap the lowered bytes accordingly. If Uint8Array is the intended argument shape, the emitted signature should reflect that.
Current downstream workaround
Consumers currently patch generated code after codegen so byte-array arguments are wrapped into the Rust-buffer struct shape before being passed to ffi-rs.
Summary
For some Node bindings, generated call sites pass the raw result of
FfiConverterBytes.lower(...)into ffi-rs calls even though the emitted ffi signatures for those parameters expectUniffiRustBufferStruct.Repro
Generate Node bindings with
uniffi-bindgen-node generate ...for a UniFFI API that takes byte-array arguments. In the generatedslatedb-node.ts, call sites look like:But in the generated
slatedb-sys.ts, the corresponding ffi signature expects a Rust buffer struct:Why this looks inconsistent
FfiConverterBytes.lower(...)comes fromAbstractFfiConverterByteArray.lower()and returnsUniffiByteArray/Uint8Array, notUniffiRustBufferStruct.So the generated call site shape is:
Uint8ArrayUniffiRustBufferStructExpected
The generated call site and emitted ffi signature should agree. If the ffi side expects
UniffiRustBufferStruct, the generated call site should wrap the lowered bytes accordingly. IfUint8Arrayis the intended argument shape, the emitted signature should reflect that.Current downstream workaround
Consumers currently patch generated code after codegen so byte-array arguments are wrapped into the Rust-buffer struct shape before being passed to ffi-rs.