Skip to content

feat(truapi-server): add host logic primitives#255

Open
pgherveou wants to merge 3 commits into
rust-core/04-codegenfrom
rust-core/04a-server-host-logic
Open

feat(truapi-server): add host logic primitives#255
pgherveou wants to merge 3 commits into
rust-core/04-codegenfrom
rust-core/04a-server-host-logic

Conversation

@pgherveou

@pgherveou pgherveou commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Adds the host-agnostic truapi-server logic primitives for session state, permissions, product accounts, SSO pairing/messages, dotns routing, and statement-store handling.


Stack

Part of the Rust core runtime port (umbrella: #104), split into a reviewable stack. Merge bottom-up.

  1. feat(truapi): add testing API and versioned wiring #248 — truapi: testing API + versioned wiring
  2. feat(truapi-platform): add host capability traits #249 — truapi-platform: host capability traits
  3. feat(truapi-codegen): emit Rust dispatcher, wire table, and host callbacks #254 — truapi-codegen: Rust dispatcher + wire table
  4. feat(truapi-server): add host logic primitives #255 — truapi-server: host logic primitives 👈
  5. feat(truapi-server): add wire and chain infrastructure #256 — truapi-server: wire and chain infrastructure
  6. feat(truapi-server): add platform runtime and host bridge #250 — truapi-server: platform runtime and host bridge
  7. feat(host-wasm): add @parity/truapi-host-wasm runtime #252 — host-wasm: @parity/truapi-host-wasm runtime
  8. chore: docs, CI, tooling, and dotli integration for the Rust core #253 — docs, CI, tooling, dotli integration

Local verification

  • cargo build --workspace --all-targets --all-features
  • cargo +nightly fmt --check
  • cargo +nightly clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-features

@replghost

Copy link
Copy Markdown
Contributor

Boundary question before this layer settles: #254 looks like protocol/runtime mechanics, but this PR makes truapi-server start owning reusable host SDK behavior.

The concern is mostly architectural, not a correctness nit. host_logic.rs says the core owns the canonical implementation for everything outside platform syscalls, and the modules here include product account derivation, product entropy, permission grant caching, statement-store signing/proof helpers, SSO pairing/session material, and People identity parsing. Those overlap with existing useragent-kit modules and public SDK surfaces: useragent-wallet derivation/pairing, useragent-sso, useragent-encoding / useragent-chain statement-store code, useragent-product-view permissions, and the Swift/Android/JS wrappers already consumed downstream.

If the intended architecture is that useragent-kit becomes the modular host-building toolkit while TrUAPI remains the protocol/dispatcher/conformance source of truth, I think this PR should either:

  1. keep only protocol/runtime-neutral primitives in truapi-server and move host capability implementations into useragent-kit, or
  2. explicitly mark these modules as temporary/reference/dotli integration code with a follow-up to re-home reusable host logic before mobile/app integrations build on it.

That would let the stack land without locking us into two competing host SDKs. The app migration path can then be: generated TrUAPI dispatcher -> useragent-kit implementation -> platform callbacks only for UI/storage/permissions/navigation.

@pgherveou pgherveou force-pushed the rust-core/04-codegen branch from 8ad3cf9 to 8ddbe78 Compare July 1, 2026 21:23
@pgherveou pgherveou force-pushed the rust-core/04a-server-host-logic branch 2 times, most recently from 96bec3b to 8035a9d Compare July 2, 2026 08:14
@pgherveou pgherveou force-pushed the rust-core/04-codegen branch 2 times, most recently from 3202591 to fb3e219 Compare July 2, 2026 08:59
@pgherveou pgherveou force-pushed the rust-core/04a-server-host-logic branch from 8035a9d to a696d4e Compare July 2, 2026 08:59
@pgherveou

Copy link
Copy Markdown
Collaborator Author

@replghost
agreed we should do 1 or 2 - let me see what it would take.

  1. keep only protocol/runtime-neutral primitives in truapi-server and move host capability implementations into useragent-kit, or
  2. explicitly mark these modules as temporary/reference/dotli integration code with a follow-up to re-home reusable host logic before mobile/app integrations build on it.

That would let the stack land without locking us into two competing host SDKs. The app migration path can then be: generated TrUAPI dispatcher -> useragent-kit implementation -> platform callbacks only for UI/storage/permissions/navigation.

@pgherveou pgherveou force-pushed the rust-core/04a-server-host-logic branch from a696d4e to a3e6efa Compare July 2, 2026 10:59

@valentinfernandez1 valentinfernandez1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just small nit about versioned enums but aside from that this PR looks solid


/// Versioned remote message body.
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
pub enum RemoteMessageData {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan for versioning here to expand the RemoteMessageData enum with new versions as new messages are needed?

Would be a good thing to have this documented


/// Versioned legacy transaction-creation payload.
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
pub enum CreateTransactionLegacyPayload {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, would be good to have documentation on what should be the process for adding new versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants