Skip to content

refactor: split LoadedApp context & migrate to jotai - #1280

Draft
dorianvp wants to merge 28 commits into
devfrom
chore/refactor-state-machine
Draft

refactor: split LoadedApp context & migrate to jotai#1280
dorianvp wants to merge 28 commits into
devfrom
chore/refactor-state-machine

Conversation

@dorianvp

Copy link
Copy Markdown
Member

On top of #1279.

This is a huge PR that essentially splits the LoadedApp context into chunks, and makes the state machine explicit through jotai. This gives us a bunch of benefits straight away, such as:

  • sync re-renders fixed: sync ticks no longer rebuild the context object.
  • fixed: the old module-level priceFetcherStore singleton became a per-instance PriceLane torn down on unmount, with epoch-dropped writes.
  • enables further testing: sync, price, and view logic moved into pure functions with seven isolated test files. We could also fake the entire backend with the current code, meaning that we could stress-test the UI under various conditions/inputs.

Limitations: the monolithic context still exists, with 41 setState calls on data fields (which still fan out to all 48 consumers.

dorianvp and others added 28 commits August 10, 2026 16:56
The project-local uniffi-bindgen for the Nym proxy shim moves here from
zingolib's zingo-netutils workspace, pinned to the shim's uniffi 0.28.
consume-android-shim now regenerates the Kotlin bindings itself from a
staged .so (uniffi library mode reads the metadata statically, so a
cross-compiled Android library works on the host) instead of copying a
pre-generated kotlin/ tree out of the bundle; such a tree, if present,
is ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The UniFFI proxy shim zingo-nym-proxy-ffi moves here from zingolib's
zingo-netutils workspace, where zingolib#2666 removed it. It lands at
rust/nym-proxy-ffi under its original crate name, which UniFFI turns
into the binding namespace the Kotlin and Swift hosts import.

The shim's former path dependency on zingo-netutils becomes a git
dependency on zingolib dev with the nym feature. The crate sits outside
the main workspace, with its own committed lockfile, because nym-sdk's
transitive graph needs crypto-common ^0.2 and cannot resolve against
the workspace's pins.

This supersedes the whole-workspace nym-host vendoring of PR #1251:
only the shim moves, and every other crate remains in zingolib,
referenced on its dev branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replayed from 5aa621e on migrate-nym-bindgen, minus the vendored
rust/nym-host workspace: the shim now lives at rust/nym-proxy-ffi (the
previous commit), so every nym-host path retargets there, the Kotlin
bindings generate through the main workspace's zingo-uniffi-bindgen,
and the iOS artifact is named ZingoNymProxyFFI.xcframework after the
crate instead of the vendored directory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The shim at rust/nym-proxy-ffi resolves in its own lockfile, so the
workspace-wide jobs never touch it. This job runs fmt, check, clippy,
and nextest inside the shim's workspace on every PR, joining the
fail-all bucket like the other verdict jobs. Cross-compilation per ABI
stays out of PR CI (issue #1275 tracks collapsing the bundle tooling;
the release path builds the shipped libraries).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The replayed screens were written against the pre-token theme
(colors.text, colors.background, colors.placeholder, colors.warning,
and the bottom-sheet colors). Dev landed the token system after the
branch diverged. This maps every stale token to its dev equivalent and
moves MixnetDoctor onto the app theme hook instead of the navigation
theme cast. tsc and eslint pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The root manifest carried a crates-io `zingo-netutils = "5.0.1"`
dependency beside the git-sourced copy arriving through zingolib, so one
build graph compiled two diverging crates under the same version. The
wallet crate's two `GrpcIndexer` call sites now import through the
`zingolib::netutils` facade, ADR 0024's convergence surface, and the
registry dependency, its feature request, and its lockfile subtree are
gone. `cargo check --workspace` passes; the only netutils in the graph
is the git `dev` copy the shim also consumes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The relocated shim resolved the real rustls-platform-verifier without the
JVM initialization Android requires, because zingolib's webpki patch never
crosses a workspace root; every mixnet enable would have died at the first
TLS handshake exactly as zingolib#2531 recorded. ADR 0004 decides the fix:
this app owns platform verification. The new tls-init crate is the one
hand-written JNI seam and hands the app Context to the verifier; the shim
links it into libzingo_nym_proxy_ffi.so on Android; NymTlsInit invokes it
before every proxy start; gradle consumes the verifier's Kotlin component
from the cargo checkout so both halves share the lockfile-pinned version.
Checked green on host and aarch64-linux-android.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The maintainer ratified the documentation rule for this repository on
2026-08-10: every item doc-comment is exactly one sentence, while module
headers and ratified test conventions keep their shape. This change
rewrites the multi-sentence doc-comments this branch introduces — in the
shim, the golden-wire suite, the workbench binaries, the wallet crate's
two touched blocks, and NymTlsInit's KDoc — and records the rule in
.agents/claude.md. The consume-android-shim ABI note also stops naming
zingolib as the bundler's home, since the bundler now lives beside it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The host lanes now run check, clippy, and nextest with --workspace so the
tls-init member is proven in shape, while its Android-gated JNI body is
proven by the release cross-build; the member's imports are also
rustfmt-normalized.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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