Repository navigation
feat!: rebuild WeaveFFI on C ABI 4, one model, and library mode - #55
Merged
Merged
Conversation
…mode
Engine v2 overhaul. No compatibility shims: old code paths are removed.
Crates
- Four published crates: `weaveffi` (facade plus the runtime as
`weaveffi::abi`), `weaveffi-macros`, `weaveffi-model`, and `weaveffi-cli`
(library plus binary, absorbing the generators). `weaveffi-abi` and
`weaveffi-gen` are gone.
Model and schema 0.11.0
- One `Model` built once by `validate(&Api, &Identity)`; `ResolvedApi` is
deleted and generators never see the document IR.
- Global names: types, free functions, and error codes are unique across
the API; qualified type references are removed; `Ty::Prim` wraps one
primitive enum. Better diagnostics (scoped spans, unsupported primitives).
C ABI revision 4
- Per-declaration contract tables replace per-module checksums, so adding a
declaration no longer breaks older bindings.
- Callback vtables carry a `{size, flags, free}` header; callback methods
return every family (consumer runs allocated with `{p}_alloc`), may
`throw` typed domain errors with payloads, and callback parameters may be
optional.
- Soundness: token-adopting decoders are `unsafe`, thunks adopt every input
before failing, duplicate map keys are rejected, iterators never hold a
lock across `next()`, and the foreign-error unwinding machinery is gone.
- A pooled default executor and a `tokio` feature replace thread-per-call;
wasm32 no longer spins on a stalled future.
Producer macro and library mode
- The macro runs the shared validator with real spans, honors item `#[cfg]`,
resolves type aliases, and emits much smaller thunks through runtime
helpers.
- The macro embeds the API as metadata in the built library; `generate`,
`diff`, `validate`, and `extract` build the crate and read it, replacing
the Rust source parser. New `weaveffi dev` and a `Project` library API.
Generators
- A slim backend trait; the capability gate and hash cache are removed.
- All eleven targets implement ABI 4 with one codec per composite type,
documented trap policy, and reserved-member-name escaping. Python drops
its `.pyi`; Kotlin uses unsigned types; Node.js guards against callback
deadlocks; Dart loads natives relative to the package.
Build and packaging
- New `weaveffi build` cross-compiles per platform with `@rpath` install
names, iOS static libraries, NDK detection, deployment targets, and
prebuilt Node.js and JNI glue. `weaveffi package` writes installable
artifacts: wheels, npm tarballs, gems, NuGet packages, an XCFramework zip
with its checksum, and C/C++ tarballs.
- Config cleanup: one `name` override key, `[build]`, `[package] dist`;
hooks, `[global]`, and `--force` are removed.
Samples, tests, CI, docs
- Three samples (calculator, codec with shared vectors, feature-complete
kvstore) with consumers in all eleven languages; 34 conformance lanes.
- Snapshot corpus cut by about a third; missing tools fail CI; fuzz, bench,
and release workflows fixed; a package-install smoke job.
- Every documentation page updated, including a normative ABI 4 contract,
migration notes, roadmap, and comparison.
- Define _GNU_SOURCE on Linux in the Node.js addon so libuv's headers compile under a strict -std=c11. - Find the Swift module beside its C shim instead of relying on ls order, which differs by locale. - Check that Swift listeners notify on the subscribing thread with pthread_equal instead of Thread.isMainThread, which is false for top-level async code on Linux. - Match CLI error messages with miette's line wrapping undone.
Merged
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.
Summary
Engine v2: a pre-1.0 overhaul with no compatibility shims. Old code paths are deleted, not kept behind flags.
weaveffi(facade plus the runtime asweaveffi::abi),weaveffi-macros,weaveffi-model, andweaveffi-cli(now a library plus the binary, absorbing the generators).weaveffi-abiandweaveffi-genare removed.validate(&Api, &Identity)builds a singleModelonce per run, andResolvedApiis gone.Ty::Primwraps a single primitive enum.{size, flags, free}header. Callback methods can return any type (allocated with{p}_alloc), throw typed domain errors with payloads, and be optional parameters.next(). The foreign-error unwinding machinery is removed.tokiofeature replace one thread per async call.#[cfg], resolves type aliases, and emits much smaller thunks.generate,diff,validate, andextractbuild the crate and read that metadata, replacing the Rust source parser.weaveffi devand aProjectlibrary API..pyi, Kotlin uses unsigned types, Node.js guards against callback deadlocks, and Dart loads natives relative to the package.weaveffi buildcross-compiles per platform:@rpathinstall names, iOS static libraries, Android NDK detection, deployment targets, and prebuilt Node.js and JNI glue.weaveffi packagewrites installable artifacts: wheels, npm tarballs, gems, NuGet packages, an XCFramework zip with its checksum, and C/C++ tarballs.docs/src/stability.md.Test plan
cargo insta test --workspace --check(passes), pluscargo clippy --workspace --all-targets -D warnings,cargo test -p weaveffi --features tokio, and the strict rustdoc buildCI=true bash scripts/check-fixtures.shfor all 11 targets (with mypy): passesbash conformance/run.sh: 34 passed, 0 failed, leak counters at zerobash scripts/package-smoke.sh: the packaged Python wheel, npm tarball, and Swift XCFramework each install and calladd(2, 3)Notes for reviewers
input = ".", anameoverride key,[build]/[package] dist;--force,--lenient, hooks, and[global]removed) are all covered indocs/src/stability.md.snapshot_c) anddocs/src/reference/abi.mdare the best places to start reviewing.dart:ffican't route it.-4if the JS thread is blocked in one synchronous call for more than 1 s. This prevents a deadlock, but it also catches legitimately long synchronous calls.SECURITY.mdstill has its placeholder contact address.