feat: port Rust core runtime#104
Draft
pgherveou wants to merge 127 commits into
Draft
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
pgherveou
added a commit
that referenced
this pull request
May 18, 2026
Bug fixes: - Makefile uniffi target now writes Swift bindings through a tempdir and copies into the actual SwiftPM layout (Sources/TrUAPIHost/ for the .swift file, Sources/truapi_serverFFI/include/ for the C header and module.modulemap). Cdylib path picks .dylib on macOS. - electron provider: onClose sets disposed=true and clears listener sets so subsequent postMessage no-ops cleanly and close listeners don't fire twice if the caller also calls dispose(). - web worker provider: init-failure paths call worker.terminate() before rejecting so a failed core init doesn't leak the worker. - createWebSocketProvider: subscribe / subscribeClose use Set instead of Array+indexOf so double-registration of the same callback is idempotent (matches the other providers in the package). Test coverage: - New js/packages/truapi/test/ws-provider.test.mjs exercises the WS provider against a stubbed WebSocket constructor (queue+flush, fan-out, set semantics, close fan-out, post-after-close throws). Doc + style fixes: - docs/design/dotli-architecture-change.md describes featureSupported as a current callback with a planned removal, matching the platform trait and the host shells. The implementation-vs-doc contradiction is gone. - Migration narrative stripped from runtime.rs, wasm.rs, native.rs, host_logic/features.rs, the Kotlin shell, and the Swift shell. - Em-dashes swept from 18 PR-scope files (CLAUDE.md, both design docs, both native READMEs, the TS host packages, a few platform doc comments). - create-iframe-host.ts comment now describes current behaviour without referencing the "legacy fallback". - tests/object_safety.rs renamed to tests/bounds.rs with a docstring that matches what the test actually asserts (the trait isn't object-safe; the bound check is on Send + Sync + 'static). - iOS: drop dead `_ = self.callbackRetainer` line; explain the retainer in plain prose instead of via a no-op suppression. - Android: drop redundant @Suppress("unused") on a property that is read in init. Deferred to follow-up issues (#105-#111).
pgherveou
added a commit
that referenced
this pull request
May 30, 2026
Harden the Rust core runtime and host SDKs against the review of the core port. No change to the wire protocol or the generated artifacts (codegen regenerates byte-identically; the committed WASM bundle is rebuilt). truapi-server: - Subscriptions use generation-stamped reservation slots: a reused or raced request_id stops-and-replaces instead of leaking an unstoppable stream, and a _stop arriving before activation cancels the pending subscription. Unregistered methods answer Unsupported instead of leaving the caller to hang. Dead negotiated_version slot and interrupt API removed. - chainHead-v1 runtime: single-flight follow setup (no duplicate or leaked remote subscriptions), the close-vs-insert race in request_value is closed so a caller can no longer hang forever, the pending follow-event buffer is bounded, and an orphaned remote follow is unfollowed when its local follow is torn down mid-setup. - WS bridge: constant-time token comparison, bounded inbound message size, bounded outbound queue and connection count, documented loopback trust model. - wasm surface registers a panic hook and surfaces non-boolean / non-string host returns as errors; permissions persist only genuine user decisions, so a transient prompt-callback error no longer locks a capability out; dotns classifies trailing-dot FQDNs and lowercases/de-dupes remote domains; navigate_to returns an error instead of panicking on a contract violation. - smoldot provider is wired into the runtime behind its feature (with a platform fallback), with finite json-rpc ceilings, a distinguishable reconnect error, and Apache-2.0 attribution (SPDX headers + THIRD_PARTY_NOTICES.md). - Tests: subscription-race regressions, malformed-frame drop, subscription lifecycle through the wire boundary, and a hardened Rust<->TS wire-table parity check (panics on unparseable ids, compares all four subscription ids, asserts a row-count floor). codegen: Rust dispatcher/wire-table emitters use writedoc!/formatdoc! (byte-identical output); TS host-callbacks handles bare trait-object returns. JS hosts: worker-runtime faults now reach close subscribers; the WebSocket provider is built on the shared close-once base provider; the electron provider detaches port listeners on remote close; new tests for the node WASM round-trip, WS error/non-binary/CLOSING paths, and the iframe handshake/origin/dispose paths. native: Android and iOS HostBridge document that callbacks fire on the truapi-ws-bridge worker thread; the iOS bootstrap uses a JSONEncoder-based JS string-literal escaper; Maven coordinates reconciled across build.gradle.kts, jitpack.yml, and the README. CI/docs: host-packages CI runs the host-shared smoke test against the freshly built WASM bundle and triggers on truapi-platform changes; the Makefile wasm target no longer hides the committed bundle; design docs and the truapi-platform README are reconciled to the shipped trait set.
This was referenced Jun 11, 2026
Collaborator
Author
|
Superseded by a 3-PR stack carved from this branch, each independently reviewable and green on CI:
Review bottom-up. Authored with assistance from Claude Code. |
pgherveou
commented
Jun 12, 2026
Collaborator
Author
341366d to
c5fb5c9
Compare
This was referenced Jun 25, 2026
pgherveou
added a commit
that referenced
this pull request
Jun 26, 2026
The truapi-ready/truapi-init handshake pairs with the WASM host's createIframeHost (#104). Keep sandbox.ts at base so merging to main does not break the deployed playground against the current host.
a0793b9 to
5f03570
Compare
This was referenced Jun 29, 2026
Cross-product account lookup discloses a product-scoped key. Require an explicit host confirmation before deriving it.
Use product-account signing for createProof and statement-store allowance keys for createProofAuthorized. Pairing hosts reject exact proof signing when the SSO channel cannot support it.
Generate short nanoid values for SSO statement and remote-message correlation instead of reusing product request IDs, while preserving product-facing cancellation diagnostics.
Use opaque SSO ids, keep transient permission dismissals out of storage, and guard login/session races. Add follow setup cancellation and fail preimage submit before backend work when no session exists. Update dotli e2e/UI submodule to match runtime behavior.
decrypto21
added a commit
that referenced
this pull request
Jul 8, 2026
decrypto21
added a commit
that referenced
this pull request
Jul 8, 2026
decrypto21
added a commit
that referenced
this pull request
Jul 8, 2026
…igner, new review/storage variants)
decrypto21
added a commit
that referenced
this pull request
Jul 8, 2026
decrypto21
added a commit
that referenced
this pull request
Jul 8, 2026
…ductRuntimeConfig, WasmPairingHostRuntime, mock.dot id)
6 tasks
Publish the host runtime as @parity/truapi-host and move the dotli diagnosis harness into the playground repo.
…t-core-port # Conflicts: # rust/crates/truapi-codegen/tests/golden/host-callbacks-adapter.ts # rust/crates/truapi-codegen/tests/golden/host-callbacks.ts # rust/crates/truapi-codegen/tests/golden/worker-callbacks.ts # rust/crates/truapi-codegen/tests/golden_rust_emit.rs # rust/crates/truapi-server/src/lib.rs
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
Umbrella 👉 #104 ports dotli onto the shared Rust TrUAPI core and makes the Rust crates the source of truth for protocol dispatch, generated product/client types, host capability bindings, auth/session state, permissions, SSO/signing orchestration, chainHead, preimage, theme, notification, and host-wasm plumbing.
Recent updates tighten the runtime permission model and lifecycle cleanup, generate the wasm host bridge from platform trait metadata, switch the JS host callback surface to namespaces, and update dotli to consume that surface.
Reviewable Stack
This PR is the cumulative view. Please review and merge the active child PRs bottom-up; the top child PR has the same tree as this umbrella branch.
truapitesting API and versioned wiring.truapi-platformhost capability traits.@parity/truapi-host-wasmnamespaced callback consumer.This umbrella is the cumulative review target for the whole port; active child #253 is kept tree-equivalent with it.
Architecture
Validation
cargo fmt --all --checkcargo check -p truapi-servercargo test -p truapi-codegen golden_cargo test -p truapi-servercd js/packages/truapi-host-wasm && npm run build && npm testmake devcd hosts/dotli && bun run typecheck && bun run testThe remote top stack tree was verified equal to this umbrella tree locally before push.