Skip to content

feat(truapi)!: funding provider trait, reports and settlement - #1317

Draft
filvecchiato wants to merge 22 commits into
funding/sessionsfrom
funding/worker
Draft

filvecchiato wants to merge 22 commits into
funding/sessionsfrom
funding/worker

Conversation

@filvecchiato

@filvecchiato filvecchiato commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1145. Stacked on #1315, with #1314 (payments) merged in, so until #1314 lands its changes show here too.

  • FundingProvider trait for the provider's worker (wire id 24):
    • serveSubscribe replays the sessions in flight, then streams new assignments and cancel requests.
    • report stores each update on the session. Only the assigned provider can report, updates only move forward, and a top-up or payment id used by another of the provider's sessions is refused with DuplicateId.
    • presentFrame shows one of the provider's screens in a host frame.
  • select_funding_provider hands a session to the provider the user chose. The core holds that provider's worker while the session is open.
  • Settlement is decided by the core, not the provider:
    • Delivered from what the named top-ups claimed (Crediting, up to 3, then Delivered).
    • Released once the named payment completes (Collecting).
  • Only a session with no provider expires; an assigned one waits for its provider or a cancel. Per-rail windows are Cancel and expiry #1141.
  • api.rs lists every trait id, with 23 reserved for the open expanded-card work.
  • Cancel is sent to the assigned provider, and refused once the provider has seen the user's payment.
  • The battery runs a provider worker that serves sessions, including one resumed after a host restart (13 cases).

# Conflicts:
#	rust/crates/truapi-codegen/tests/golden/wire_table.rs
#	rust/crates/truapi/src/host_core.rs
#	rust/crates/truapi/src/native.rs
#	rust/crates/truapi/src/native/platform.rs
#	rust/crates/truapi/src/native/runtime.rs
#	rust/crates/truapi/src/runtime/tests.rs
# Conflicts:
#	rust/crates/truapi-codegen/tests/golden/wire_table.rs
#	rust/crates/truapi/RUNTIME.md
#	rust/crates/truapi/src/host_core.rs
#	rust/crates/truapi/src/lib.rs
#	rust/crates/truapi/src/native.rs
#	rust/crates/truapi/src/native/callbacks.rs
#	rust/crates/truapi/src/native/platform.rs
#	rust/crates/truapi/src/native/runtime.rs
#	rust/crates/truapi/src/platform.rs
#	rust/crates/truapi/src/runtime/services.rs
@github-actions github-actions Bot added documentation Improvements or additions to documentation javascript Pull requests that update javascript code github_actions Pull requests that update GitHub Actions code rust Pull requests that update rust code labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

This pull request touches an app, which is not built by default. Add a label for each build you want:

  • iOS simulator build, ios-simulator-build: builds the iOS app, runs its tests and attaches a build for the iOS Simulator on a Mac.
  • iOS device build, ios-device-build: attaches a signed build that installs on a registered iPhone or iPad.
  • Android build, android-device-build: attaches an APK that installs on an Android phone or an emulator.

Each starts as soon as it is added and follows the branch from then on.

@github-actions github-actions Bot added rfc host-ios Touches the iOS host tree host-android Touches the Android host tree labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Bundle size report

Compared with main at 63a450d.

Raw Gzip Brotli
truapi-host 7.90 MiB (+98.2 KiB, +1.2%) 5.67 MiB (+33.6 KiB, +0.6%) 5.39 MiB (+21.3 KiB, +0.4%)
truapi-provider 4.03 MiB 1.27 MiB 959.8 KiB
truapi 6.07 MiB (+66.2 KiB, +1.1%) 858.0 KiB (+10.0 KiB, +1.2%) 702.7 KiB (+7.7 KiB, +1.1%)
Total 18.00 MiB (+164.4 KiB, +0.9%) 7.78 MiB (+43.7 KiB, +0.6%) 7.01 MiB (+29.0 KiB, +0.4%)

WebAssembly modules

Raw Gzip Brotli
truapi-host/wasm/web/truapi_server_bg.wasm 2.80 MiB (+97.8 KiB, +3.5%) 999.0 KiB (+33.5 KiB, +3.5%) 752.1 KiB (+21.2 KiB, +2.9%)
truapi-host/wasm/web/truapi_verifiable_bg.wasm 4.89 MiB 4.64 MiB 4.61 MiB
truapi-provider/truapi_provider_bg.wasm 3.99 MiB 1.26 MiB 952.1 KiB
Changed files (10)
Raw Gzip Brotli
truapi-host/wasm/web/truapi_server_bg.wasm 2.80 MiB (+97.8 KiB, +3.5%) 999.0 KiB (+33.5 KiB, +3.5%) 752.1 KiB (+21.2 KiB, +2.9%)
truapi/explorer/codegen/types.js 235.9 KiB (+23.6 KiB, +11.1%) 32.7 KiB (+3.3 KiB, +11.3%) 26.2 KiB (+2.5 KiB, +10.8%)
truapi/playground/codegen/truapi-dts.js 304.9 KiB (+23.2 KiB, +8.2%) 52.7 KiB (+4.0 KiB, +8.2%) 42.4 KiB (+3.1 KiB, +7.7%)
truapi/playground/codegen/services.js 103.8 KiB (+6.1 KiB, +6.2%) 15.7 KiB (+882 B, +5.8%) 13.2 KiB (+715 B, +5.6%)
truapi/generated/types.js 67.4 KiB (+5.6 KiB, +9.0%) 8.3 KiB (+820 B, +10.6%) 7.0 KiB (+567 B, +8.6%)
truapi/generated/client.js 74.8 KiB (+5.1 KiB, +7.3%) 11.3 KiB (+820 B, +7.6%) 9.4 KiB (+673 B, +7.5%)
truapi/generated/wire-decode.js 30.1 KiB (+2.1 KiB, +7.4%) 3.1 KiB (+174 B, +5.7%) 2.6 KiB (+151 B, +5.9%)
truapi/generated/wire-table.js 9.4 KiB (+601 B, +6.7%) 1.6 KiB (+72 B, +4.5%) 1.3 KiB (+42 B, +3.3%)
truapi-host/generated/host-callbacks.js 10.5 KiB (+399 B, +3.9%) 3.3 KiB (+122 B, +3.7%) 2.8 KiB (+113 B, +4.0%)
truapi-host/wasm/web/truapi_server.js 58.0 KiB (+3 B) 10.6 KiB (+4 B) 9.1 KiB (+39 B, +0.4%)

Commit: 8c6a37f

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

CI Status: not green, 2 items need attention.

  • ts-host: failure
  • host-wasm: failure
All job results
job result
android-bindings success
bundle-size success
changes success
changeset-guard success
cli-package success
codegen success
e2e skipped
explorer success
funding-battery success
headless-install success
host-android-bindings success
host-android-detekt success
host-wasm failure
ios-bindings success
ios-swift success
licenses success
playground success
provider-android-bindings success
release-guard success
rust success
ts-client success
ts-debugger success
ts-host failure
wasm-provider success
workflow-lint success

Signing credentials: failure as of 2026-10-08, a release may fail

Commit 8c6a37f0 · run log

# Conflicts:
#	rust/crates/truapi-codegen/tests/golden/wire_table.rs
#	rust/crates/truapi/src/lib.rs
# Conflicts:
#	rust/crates/truapi-codegen/tests/golden/wire_table.rs
#	rust/crates/truapi/RUNTIME.md
# Conflicts:
#	rust/crates/truapi-codegen/tests/golden/wire_table.rs
#	rust/crates/truapi/src/lib.rs

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation github_actions Pull requests that update GitHub Actions code host-android Touches the Android host tree host-ios Touches the iOS host tree javascript Pull requests that update javascript code rfc rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serve and hold the selected provider Bridge and test hosts Cancel and expiry Progress and history for the host

1 participant