Skip to content

fix(identity): keep Home's data on screen when returning to the hub - #1090

Merged
lklimek merged 52 commits into
v1.0-devfrom
fix/identity-hub-keep-data-on-return
Oct 14, 2026
Merged

lklimek merged 52 commits into
v1.0-devfrom
fix/identity-hub-keep-data-on-return

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR

Coming back to an identity's Home no longer blanks it for a second or two. The profile, contacts and profile photo it already showed stay on screen and are refreshed in the background; fresh data replaces them as it arrives.

User story

As an everyday user, I want an identity's Home to show what I saw a moment ago when I come back to it, so that the screen does not flash empty or jump while it reloads.

Scenario

Actual behavior

  1. Open an identity's Home; the profile, contacts and photo load.
  2. Go to another screen (for example Wallets) and come back.
  3. Home is empty again: no contacts, no profile, a placeholder instead of the photo, until the network answers 1–2 seconds later.

Expected behavior

  • Coming back to the same identity shows the previous profile, contacts and photo on the first frame, and a reload starts in the background.
  • When the reload answers, its data replaces what was kept. If it fails, the kept data stays.
  • Choosing another identity, switching network, or an explicit refresh still clear everything, as before.

Detailed discussion

  • hub_screen.rs: refresh() and refresh_on_arrival() share reload(keep_shown). On arrival (keep_shown = true) it calls contacts_state.invalidate() (keeps the lists, re-arms the load), profile_cache.reload_kept() and avatar_cache.reload_kept(); an explicit refresh() clears everything. reset_for_context_change (network switch) is unchanged. Another identity's contacts are dropped by the existing reconcile_owner; profiles are cached per identity.
  • profile_cache.rs: stale set; reload_kept() marks loaded profiles for reload (skipping one already in flight), get_or_request returns the kept profile and queues its reload once.
  • avatar_cache.rs / components/avatar.rs: reload_kept() keeps Ready/Fetched images and marks them for renewal (failed/loading entries re-arm as with invalidate); a successful renewal replaces the image, a failed one keeps it. Avatar asks the cache for a renewal fetch even while it shows an image; for images not marked for renewal this is still None, so other screens behave as before. is_waiting_for_avatar uses awaits_result() so a renewal's result is accepted.
  • Home's setup checklist (from feat(identity): align Home and reuse identity-bound send flows #1074) keeps working: kept data stays known during the reload.

Known limitation: for 1–2 seconds after coming back, a change made elsewhere (a contact removed on another device, a new profile photo under the same URL) is not visible yet.

Stacked atop #1082 (which is stacked atop #1074): merge after both; retarget to v1.0-dev then. Overlaps the hub files of the planned result-routing PR; whichever lands second merges the other.

Testing

  • identity_hub::loads::returning_to_the_same_identity_keeps_its_home_and_reloads_it (kittest): first frame after refresh_on_arrival still shows the contact, the checklist and the photo; LoadContacts, LoadProfile and FetchAvatar are dispatched. Failed before the change.
  • returning_to_another_identity_drops_the_previous_home, the_reload_after_returning_replaces_the_kept_contacts.
  • Unit: avatar_cache::tests::reload_kept_renews_shown_images_and_rearms_failed_ones, extended hub_screen::tests::hub_avatar_completions_only_retain_requested_urls.
  • Each of 8 deliberate breakages of the change (clearing on arrival, no reload, no re-arm, no renewal fetch, renewal not awaited or not applied) made a test fail.
  • Whole kittest binary: 478 passed; clippy (--lib --test kittest) clean; cargo fmt --all.

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

PR Hygiene · 18e016d

  • Bots — coderabbitai ✓ · thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — not asked of a bot author
  • Build running
  • Approvals
    • files with no dedicated owner (src/ui/components/avatar.rs, src/ui/identity/hub_screen.rs, src/ui/identity/profile_cache.rs and 2 more) — lklimek

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • Bug Fixes
    • Identity Hub content now remains visible while profile, contact, and avatar data refreshes. Updated photos replace the displayed image when available, while failed refreshes keep the existing image.
    • Returning to an identity restores its existing content while new data loads; switching identities clears the previous identity’s content.
    • Failed profile loads can be retried when returning to an identity, without repeated retries during normal screen updates.

lklimek and others added 30 commits October 12, 2026 12:26
Show published avatars, compact username controls, responsive Home cards, and Profile navigation. Reuse the wallet send form with fixed identity parties and owned-wallet withdrawal destinations.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
Keep contacts at the top of the right column beside quick actions. Place
left-aligned username cards with setup and payment history, using A05
column proportions and stacked cards in narrow windows.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
Preserve the development-branch update alongside the Home layout fix.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
SDK responses include recipient addresses. Only update balances for
Platform addresses registered to the selected wallet, preventing unrelated
wallets from offering foreign funds for identity top-ups or transfers.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
…idle

The offline profile-cache test intentionally leaves the avatar request
pending. Render bounded frames while checking the pending fetch and
preserving assertions for cached, saved, and absent profile data.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
Conflict in src/ui/identity/settings.rs: both sides added methods to
SettingsTab at the same place. Kept both (focus_section from this branch,
usernames_card_mut and accepts_legacy_recovery_result from #1076) and this
branch's doc comment on render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
IDH-004 still described a `Set up your social profile` checklist entry
with its own skip affordance. Home renders an optional `Set a display
name` step, and the only dismiss control, `Hide this for now`, hides the
whole checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…owns

The only Move to wallet test ran against a context without wallets and
asserted that an external address is refused, so it would also pass if the
ownership check refused every address.

Register a wallet, take one of its receiving addresses, and drive the
production validation and confirmation: the dispatched withdrawal must carry
the bound identity, that address and the entered amount. An external address
is still refused, and the owned address is refused once its wallet is removed.
Nothing is broadcast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Every frame of an identity-bound send form restored the binding, which
allocated a new box and cloned the identity twice for Send and Move to
wallet, and looked up the username again for Top up, even when nothing had
changed.

The check `validated_send_route` already made is now a shared predicate, and
the per-frame call restores only when that predicate fails. Construction,
reset and refresh still restore unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Home tracked which request its payment preview answered, but not which
identity the rows belonged to. The selected identity can change without the
hub hearing of it, for example when another screen's identity selector is
used and that screen is closed without a refresh. Home then showed the new
identity above the previous identity's payments, and the load guard kept the
new identity's history from being requested.

Home state now records its owner and reconciles it before rendering: content
of another identity is dropped and its pending request forgotten, so a late
answer is discarded and the new history loads. A refresh for the same
identity keeps the preview on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…llet

Move to wallet opens the shared send form, whose Max for an identity sender
always kept back the fee of a transfer between identities. A withdrawal to a
Core address costs far more, so Max offered an amount the network refused,
and the form only compared the amount with the balance.

The reserve now follows the destination: a Core address keeps back the
withdrawal estimate, every other destination keeps what it kept before. Max
and send validation read the same value, and a withdrawal that would leave
too little for the fee is refused before the confirmation, naming the highest
amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…s app

Send from Identity Home dispatched its transfers without a signing key. The
backend passed that on, and the SDK then takes the identity's first TRANSFER
key, including a disabled one, without asking whether the local signer holds
it. An identity with an earlier disabled key, or one imported with only a
later key, could not send.

Transfers to an identity and to Platform addresses now resolve the key before
any network call: an active TRANSFER key the signer can use, lowest id first.
An explicitly requested key that is unusable is refused rather than replaced,
and a missing key is reported as its own error. The send form resolves the
same key, passes it along, and refuses before the confirmation when there is
none. This also covers the MCP transfer tools, which dispatch without a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…registration

The fixture wired the wallet backend before registering its wallet, which
starts a background registration next to the awaited one, and then polled
for the addresses. Registering the wallet first leaves the awaited calls as
the only registration, so the owned address is available as soon as they
return and the wait is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Home and the Contacts tab share one ContactsState, and the hub reset it only
for identity changes it made itself. Selecting another identity on a screen
opened from the hub (Add contact, then Cancel) left the previous identity's
contacts and requests on screen under the new identity, with the load slot
still claimed, so the new identity's lists never loaded and Accept paired the
new identity with the old identity's request.

ContactsState now records the identity its lists belong to. Home and the
Contacts tab bind it before reading or loading: on a change the lists are
dropped and the load re-armed. Paid-action guards are keyed by request and
survive the change, so a request both identities can see stays guarded while
its action is still running.

The Home payments test no longer depends on which frame its load goes out
in: the contact load now takes the first frame after such a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…latform address

The shared send form reserved the identity-to-identity transfer fee for a
Platform address destination, while the task it dispatches estimates the
larger transfer-to-addresses fee, and it accepted any amount up to the full
balance. The transfer screen it replaced used the transfer-to-addresses
estimate for Max, the fee shown and an amount-plus-fee check.

Max, the fee preview and the confirmation text now read one reserve that
uses the existing transfer-to-addresses estimate for this route, and an
amount that leaves less than that fee in the identity is refused before the
confirmation, with the highest amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… took

The hub replaces the tab's action with the header's when both produce one
in the same frame. A tab that returned its contact or payment-history load
on that frame had already claimed the load's one dispatch slot, so the load
never ran, and cancelling the screen the header opened returns to the hub
without refreshing it.

Home and the Contacts tab now take a `may_load` flag. The hub clears it on a
frame where the header returned an action, so the slot stays free and the
load goes out on the next frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er screen

Home asks for its payment history once per arrival and accepts only the
answer to that request. An answer that arrived while Send or Top up covered
the hub went to the covering screen, which ignores it; Cancel returns
without refreshing, so the preview stayed empty or stale until an explicit
refresh.

The app now forwards a payment history result to the hidden hub as it does
for profile results. The hub still records only the answer to its own
request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The existing tests call the key resolver directly, so they would still pass
if a transfer task stopped calling it. This one dispatches both transfer
tasks through `run_identity_task` against a mock SDK, with no usable key and
with an explicitly requested unusable one, and expects the dedicated error:
a task that got past the resolver would fail on the mock instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the list

The preview took six entries from a vector of every matching contact, built
again on each frame. `ContactsState` now offers the matches as an iterator,
which the preview bounds before reading; the Contacts tab keeps the
collected list where it needs the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hub asks for its contacts and contact requests once per arrival, and
Home now shows them. Answers that arrived while Send or Top up covered the
hub went to the covering screen, which ignores them; Cancel returns without
refreshing, so Home's contact preview stayed empty until an explicit
refresh.

The app now forwards both results to the hidden hub, next to the payment
history. The hub keeps dropping lists loaded for an identity other than the
one it shows, which the new test covers with a result for another identity.
The payment history test shares the new helper that covers the hub with the
Send screen and cancels back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #1077, #1078 and #1079. No conflicts: docs/user-stories.md and
src/ui/identity/settings.rs merged automatically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Home's Top up now opens the shared send form, which numbered a wallet-funded
top-up by the count of stored top-ups. A stored history can have gaps, so
with entries 0 and 2 the form chose 2 and the finished top-up replaced that
entry in the identity's stored history; every later one did the same. The
screen it replaced used the highest stored index plus one.

`QualifiedIdentity::next_top_up_index` is now the one place that chooses the
index: one past the highest stored, or the lowest free one when the highest
possible index is taken, so it can neither overflow nor reuse an entry. The
shared send form and the older top-up screen both use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The identity top-up tool numbered a top-up by the count of stored top-ups,
so a history with a gap had an entry replaced, as in the shared send form.
It now uses `QualifiedIdentity::next_top_up_index`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…decided

A hub frame merges actions from the top bar, the sidebar, the header, the
tab, the breadcrumb and a confirmation dialog, and the last non-empty one
wins. The tabs returned their data loads from rendering, claiming the load's
one dispatch slot on the spot. A load could then replace a sidebar or top
bar click made on the same frame, and a breadcrumb entry applied after the
tab could replace a load whose slot was already claimed, so it never ran.
The earlier header-only flag covered one of those sources.

Home and the Contacts tab no longer load while rendering. The hub asks the
rendered tab for its due load at the end of the frame, only when nothing
produced an action, and nothing after that point replaces an action. So a
click anywhere keeps its frame and a claimed load is always the action
returned. The load binds the lists to the selected identity first, so an
identity chosen in the breadcrumb is loaded once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on this device

The transfer key resolver took any stored key entry for a usable key. An
entry that only refers to a wallet needs that wallet on this device: without
it an earlier such key was chosen over a later key whose material is here,
and an identity with only such a key reached the confirmation, to fail when
the transfer was signed.

The resolver now asks whether the private half can be obtained. The rule is
the one username registration already uses; it moves to `QualifiedIdentity`
so both read it from one place. A locked wallet still counts, as the app asks
for its password when it signs. `can_sign_with` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app hands every failure to the visible screen as a message without a
task context, and Wallet Send took any of them for the failure of its own
send: it left the waiting state and showed the filled form again while the
payment was still running, so the user could confirm it a second time. Home
starts loads of its own right before Send or Top up opens, which makes such
a failure likely.

A confirmed send now goes out under a dispatch context of its own and the
screen remembers it. While it waits, only a failure carrying that context
ends the wait; other failures are still reported by the banner. The send no
longer joins a task batch, which cannot carry a context: an asset-lock
maximum lookup due in the same frame is asked for on the next one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… form runs

Home's Top up opens the shared send form, which remembered a running top-up
only on the screen. Leaving the waiting form by its breadcrumb destroyed that
record, so a reopened form offered the same identity another top-up while the
first still ran: funds would leave twice, and both could be recorded under
one index.

The form now records its top-ups in the registry Add Funds keeps outside any
screen, and refuses a top-up of an identity that has one in flight. The app
releases the entry on that top-up's own result, as it does for Add Funds, and
hands the result to the form that waits on it. Either screen holds back while
the other's top-up runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Wallet Send tests entered the waiting state through a hook that took a
hand-made context, which no dispatch ever produced. They now go through
`dispatch_send`, the path a confirmed send takes, so the screen waits on a
dispatch of its own and the tests keep holding when the screen relies on it.
The unused hook is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acy encrypted format

Early versions kept a private key in a per-key encrypted format. This version
stores such an entry but cannot open it, with or without a password, yet the
transfer key resolver counted it as usable: an earlier such key was chosen
over a later key that can sign, and an identity with only such a key reached
the confirmation, to fail when the transfer was signed.

The shared rule now says such a key cannot be obtained. A key in the vault and
a key also held in a readable way stay eligible. Username registration keeps
reporting such a key as ready, as before: it needs a status and guidance of
its own first, and the note saying so moves to where that decision is made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Returning to the hub dropped every fetched avatar, so Home showed a spinner
in place of the profile photo until it was downloaded again.

On arrival the avatar cache now keeps fetched images and marks them for a
renewal: the image stays on screen, the Avatar component asks for the
renewal on its next render, and the hub accepts that result, which replaces
the kept image. A failed renewal keeps it; failed and unfinished fetches are
re-armed as before. An explicit refresh and an identity or network switch
still clear the cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/dash-evo-tool/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7393c88-21f0-42ce-937b-505489bfa99f
📥 Commits

Reviewing files that changed from the base of the PR and between 4870e5d and 18e016d.

📒 Files selected for processing: 5
  • src/ui/components/avatar.rs
  • src/ui/identity/hub_screen.rs
  • src/ui/identity/profile_cache.rs
  • src/ui/state/avatar_cache.rs
  • tests/kittest/identity_hub.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Arrival refreshes now retain displayed profile and avatar content while requesting updates. Cache changes track stale profiles and avatar renewals. Identity Hub tests cover retained content, retries, identity changes, and refreshed results.

Changes: Identity Hub refresh

Layer / File(s) Summary
Cache retention and renewal
src/ui/identity/profile_cache.rs, src/ui/state/avatar_cache.rs
ProfileCache marks retained profiles stale and requests their reload. AvatarCache retains ready images or fetched bytes during renewal, suppresses duplicate renewal requests, and preserves cached data when a renewal fails.
Arrival refresh and avatar requests
src/ui/identity/hub_screen.rs, src/ui/components/avatar.rs
refresh_on_arrival uses the keep-shown reload path. Avatar rendering can request renewal while displaying the cached image.
Identity Hub refresh behavior
src/ui/identity/hub_screen.rs, src/ui/state/avatar_cache.rs, tests/kittest/identity_hub.rs
Tests check avatar replacement, retained profile and contact content, profile retry behavior, identity changes, and replacement contact results.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant IdentityHubScreen
  participant ProfileCache
  participant AvatarCache
  participant Avatar
  IdentityHubScreen->>ProfileCache: reload_kept marks retained profiles stale
  IdentityHubScreen->>AvatarCache: reload_kept retains images for renewal
  Avatar->>AvatarCache: ensure_requested requests a retained image renewal
  AvatarCache-->>Avatar: returns renewal task while cached image remains available
Loading

Suggested reviewers: lklimek, thepastaclaw

Merge Risk: ⚪ Minimal · up to 18e01

The change keeps Home content visible while it refreshes in the background. No concrete merge-blocking risk is evident from the supplied evidence. The stated 1-2 second staleness window is an intentional tradeoff.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 36 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: retaining Home data when returning to the identity hub while refreshed data loads.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

⏹️ Not reviewed — PR is closed (merged) (commit 18e016d)

lklimek and others added 3 commits October 14, 2026 12:08
… send

Send opened from an identity's Home searched recipients among the selected
wallet's identities only. With no wallet on the device the list was empty,
and with one, identities imported without it could not be found by name, so
the other identity could not be picked as the identity transfer screen
allowed.

An identity-bound send now searches every identity stored on this device
for the current network, without the sender. A send from a wallet keeps to
that wallet's identities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
The Home header and the Home content each resolved the selected identity,
and every resolution reads and decodes the whole local roster and hydrates
its top-up history. The hub now resolves it once per frame and passes it to
both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…tity-send-form-followups

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

@thepastaclaw thepastaclaw 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.

Final validation — Phase 2 only (no Phase 1 for this repository)

The arrival refresh preserves previously loaded Home data, but it no longer retries an initially failed profile load when the user returns to the hub. Both supplied reviewer findings describe this same confirmed recovery regression and are combined below. Verification was static at the exact supplied head; the supplied CI snapshot shows Clippy, Test Suite, Platform pin guard, and policy reconciliation queued.

🔴 1 blocking

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The change coordinates retained data, asynchronous reloads, and avatar renewal across several UI caches with regression tests, but does not alter a critical surface.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/ui/identity/profile_cache.rs`:
- [BLOCKING] src/ui/identity/profile_cache.rs:173-180: Rearm failed initial profile loads when returning to the hub
  When an identity has no locally cached profile, dispatch_pending() inserts its ID into requested. If that initial LoadProfile fails, record_error() clears in_flight but leaves requested populated and loaded empty. The new refresh_on_arrival() calls reload_kept(), which marks only loaded IDs stale, so subsequent get_or_request() calls still consider the failed identity known and never queue another load. Previously, arrival called reset(), clearing this debounce state and allowing recovery. A transient initial failure therefore leaves the profile unavailable, hides the setup checklist, and keeps the Contacts tab behind its profile gate across subsequent visits until an explicit refresh or another cache reset. During reload_kept(), rearm requested-but-unloaded identities that have no live request while preserving loaded entries and genuine in-flight work. Add a regression test covering an uncached initial load failure followed by arrival and a new dispatch, while confirming that ordinary intervening frames do not retry continuously.

Comment thread src/ui/identity/profile_cache.rs Resolved
…e hub

A profile whose first load failed stayed marked as requested with nothing
loaded. Returning to the hub only renewed loaded profiles, so that one was
never asked for again until an explicit refresh: the setup checklist stayed
hidden and Contacts stayed behind its profile gate.

Returning now also re-arms a requested profile that has neither loaded nor
a load in flight. Ordinary frames still do not retry a failed load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

@thepastaclaw thepastaclaw 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.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

Reviewed the complete diff at head 2de50e6 and verified that the failed-initial-profile retry defect is fixed. No blocking issues were identified; one non-blocking coverage gap remains for renewal completion after an avatar has become an uploaded texture. Validation was static only; the supplied CI snapshot shows Test Suite, Clippy, and Platform pin guard queued.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The change coordinates retained UI data and asynchronous reload state across profile, contact, and avatar caches, but does not modify any critical surface.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/ui/state/avatar_cache.rs`:
- [SUGGESTION] src/ui/state/avatar_cache.rs:290-294: Exercise renewal completion from the Ready texture state
  This test seeds bytes but never calls set_ready(), so its failed and successful renewal completions exercise FetchState::Fetched rather than the distinct FetchState::Ready branch in store(). The hub unit test also completes renewal from Fetched, and the new kittest confirms that a rendered photo survives arrival and requests renewal without delivering that renewal's completion. The normal return-to-Home state therefore lacks coverage for preserving an uploaded texture on failure and replacing it on success. Add a Ready-state regression using egui::Context::default().load_texture(): assert that a failed renewal retains the original texture ID, then that a subsequent successful renewal removes the old Ready entry, exposes replacement bytes, and produces a new texture when rendered. This guards the newly changed Ready-state behavior; the current implementation is not itself defective.

Comment thread src/ui/state/avatar_cache.rs Resolved
lklimek and others added 3 commits October 14, 2026 12:52
The Contacts and Profile tabs each resolved the selected identity again on
every frame, on top of the lookup the hub already made for the shared
header, so each repaint decoded the whole roster and hydrated its top-ups
twice. The hub now passes the identity it resolved to both tabs. Profile
keeps reconciling its editor against it as before; the Contacts load, which
runs only when due, still looks the identity up itself.

A test-only, per-thread roster read counter (feature "testing") lets a hub
test check that Contacts and Profile read the roster as often per frame as
Home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…tity-send-form-followups

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
The renewal tests started from fetched bytes, never from an uploaded
texture, which is the usual state when returning to Home. The new test
renders the Avatar component: a failed renewal keeps the uploaded texture,
and a successful one drops it, exposes the fresh bytes and is drawn as a
new texture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

@thepastaclaw thepastaclaw 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.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

Independently reviewed the complete PR diff and surrounding cache, rendering, and result-routing code at f7f3031. Both prior findings are fixed, and no additional actionable in-scope issues were identified. This was a static review; no builds or tests were run, and the supplied CI snapshot still showed Test Suite, Clippy, Platform pin guard, and policy reconciliation pending.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The change coordinates background refresh and retained state across Rust profile and avatar caches, hub lifecycle handling, and UI tests without changing a critical surface.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

lklimek and others added 2 commits October 14, 2026 14:04
…-followups

The squash carries #1074's final head, which this branch already contains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Base automatically changed from fix/identity-send-form-followups to v1.0-dev October 14, 2026 14:06
lklimek and others added 3 commits October 14, 2026 14:06
…tity-hub-keep-data-on-return

Conflict in tests/kittest/identity_hub.rs: both sides added tests at the
same place in the `loads` module. Kept all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…data-on-return

The squash commit's tree equals 54052b0, which is already merged here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@lklimek
lklimek enabled auto-merge (squash) October 14, 2026 14:57
@lklimek

lklimek commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

/skip-bots

@lklimek
lklimek disabled auto-merge October 14, 2026 15:02
@lklimek
lklimek merged commit 6634ef8 into v1.0-dev Oct 14, 2026
10 of 11 checks passed
@lklimek
lklimek deleted the fix/identity-hub-keep-data-on-return branch October 14, 2026 15:03
lklimek added a commit that referenced this pull request Oct 21, 2026
)

* feat(identity): align Home and reuse identity-bound send flows

Show published avatars, compact username controls, responsive Home cards, and Profile navigation. Reuse the wallet send form with fixed identity parties and owned-wallet withdrawal destinations.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* fix(identity): align Home columns and username notices

Keep contacts at the top of the right column beside quick actions. Place
left-aligned username cards with setup and payment history, using A05
column proportions and stacked cards in narrow windows.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* fix(wallet): scope SDK address balances to their owning wallet

SDK responses include recipient addresses. Only update balances for
Platform addresses registered to the selected wallet, preventing unrelated
wallets from offering foreign funds for identity top-ups or transfers.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* test(identity): advance pending avatar rendering without waiting for idle

The offline profile-cache test intentionally leaves the avatar request
pending. Render bounded frames while checking the pending fetch and
preserving assertions for cached, saved, and absent profile data.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* docs(identity): describe the Home setup checklist as it ships

IDH-004 still described a `Set up your social profile` checklist entry
with its own skip affordance. Home renders an optional `Set a display
name` step, and the only dismiss control, `Hide this for now`, hides the
whole checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(identity): cover Move to wallet with an address a loaded wallet owns

The only Move to wallet test ran against a context without wallets and
asserted that an external address is refused, so it would also pass if the
ownership check refused every address.

Register a wallet, take one of its receiving addresses, and drive the
production validation and confirmation: the dispatched withdrawal must carry
the bound identity, that address and the entered amount. An external address
is still refused, and the owned address is refused once its wallet is removed.
Nothing is broadcast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* perf(identity): rebind the send form's identity only when it changed

Every frame of an identity-bound send form restored the binding, which
allocated a new box and cloned the identity twice for Send and Move to
wallet, and looked up the username again for Top up, even when nothing had
changed.

The check `validated_send_route` already made is now a shared predicate, and
the per-frame call restores only when that predicate fails. Construction,
reset and refresh still restore unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): keep Home payments with the identity they belong to

Home tracked which request its payment preview answered, but not which
identity the rows belonged to. The selected identity can change without the
hub hearing of it, for example when another screen's identity selector is
used and that screen is closed without a refresh. Home then showed the new
identity above the previous identity's payments, and the load guard kept the
new identity's history from being requested.

Home state now records its owner and reconciles it before rendering: content
of another identity is dropped and its pending request forgotten, so a late
answer is discarded and the new history loads. A refresh for the same
identity keeps the preview on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): reserve the withdrawal fee when moving credits to a wallet

Move to wallet opens the shared send form, whose Max for an identity sender
always kept back the fee of a transfer between identities. A withdrawal to a
Core address costs far more, so Max offered an amount the network refused,
and the form only compared the amount with the balance.

The reserve now follows the destination: a Core address keeps back the
withdrawal estimate, every other destination keeps what it kept before. Max
and send validation read the same value, and a withdrawal that would leave
too little for the fee is refused before the confirmation, naming the highest
amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): sign identity transfers with an active key held in this app

Send from Identity Home dispatched its transfers without a signing key. The
backend passed that on, and the SDK then takes the identity's first TRANSFER
key, including a disabled one, without asking whether the local signer holds
it. An identity with an earlier disabled key, or one imported with only a
later key, could not send.

Transfers to an identity and to Platform addresses now resolve the key before
any network call: an active TRANSFER key the signer can use, lowest id first.
An explicitly requested key that is unusable is refused rather than replaced,
and a missing key is reported as its own error. The send form resolves the
same key, passes it along, and refuses before the confirmation when there is
none. This also covers the MCP transfer tools, which dispatch without a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(identity): load the Move to wallet fixture without a background registration

The fixture wired the wallet backend before registering its wallet, which
starts a background registration next to the awaited one, and then polled
for the addresses. Registering the wallet first leaves the awaited calls as
the only registration, so the owned address is available as soon as they
return and the wait is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): keep contact lists with the identity they were loaded for

Home and the Contacts tab share one ContactsState, and the hub reset it only
for identity changes it made itself. Selecting another identity on a screen
opened from the hub (Add contact, then Cancel) left the previous identity's
contacts and requests on screen under the new identity, with the load slot
still claimed, so the new identity's lists never loaded and Accept paired the
new identity with the old identity's request.

ContactsState now records the identity its lists belong to. Home and the
Contacts tab bind it before reading or loading: on a change the lists are
dropped and the load re-armed. Paid-action guards are keyed by request and
survive the change, so a request both identities can see stays guarded while
its action is still running.

The Home payments test no longer depends on which frame its load goes out
in: the contact load now takes the first frame after such a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(send): reserve the address-transfer fee when an identity pays a Platform address

The shared send form reserved the identity-to-identity transfer fee for a
Platform address destination, while the task it dispatches estimates the
larger transfer-to-addresses fee, and it accepted any amount up to the full
balance. The transfer screen it replaced used the transfer-to-addresses
estimate for Max, the fee shown and an amount-plus-fee check.

Max, the fee preview and the confirmation text now read one reserve that
uses the existing transfer-to-addresses estimate for this route, and an
amount that leaves less than that fee in the identity is refused before the
confirmation, with the highest amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): keep a hub load from being spent on a frame the header took

The hub replaces the tab's action with the header's when both produce one
in the same frame. A tab that returned its contact or payment-history load
on that frame had already claimed the load's one dispatch slot, so the load
never ran, and cancelling the screen the header opened returns to the hub
without refreshing it.

Home and the Contacts tab now take a `may_load` flag. The hub clears it on a
frame where the header returned an action, so the slot stays free and the
load goes out on the next frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): deliver Home's payment history to the hub behind another screen

Home asks for its payment history once per arrival and accepts only the
answer to that request. An answer that arrived while Send or Top up covered
the hub went to the covering screen, which ignores it; Cancel returns
without refreshing, so the preview stayed empty or stale until an explicit
refresh.

The app now forwards a payment history result to the hidden hub as it does
for profile results. The hub still records only the answer to its own
request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(identity): run both transfer tasks without a usable key

The existing tests call the key resolver directly, so they would still pass
if a transfer task stopped calling it. This one dispatches both transfer
tasks through `run_identity_task` against a mock SDK, with no usable key and
with an explicitly requested unusable one, and expects the dedicated error:
a task that got past the resolver would fail on the mock instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(identity): stop Home's contact preview at six without collecting the list

The preview took six entries from a vector of every matching contact, built
again on each frame. `ContactsState` now offers the matches as an iterator,
which the preview bounds before reading; the Contacts tab keeps the
collected list where it needs the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): deliver contact lists to the hub behind another screen

The hub asks for its contacts and contact requests once per arrival, and
Home now shows them. Answers that arrived while Send or Top up covered the
hub went to the covering screen, which ignores them; Cancel returns without
refreshing, so Home's contact preview stayed empty until an explicit
refresh.

The app now forwards both results to the hidden hub, next to the payment
history. The hub keeps dropping lists loaded for an identity other than the
one it shows, which the new test covers with a result for another identity.
The payment history test shares the new helper that covers the hub with the
Send screen and cancels back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): record a top-up under an index no earlier top-up holds

Home's Top up now opens the shared send form, which numbered a wallet-funded
top-up by the count of stored top-ups. A stored history can have gaps, so
with entries 0 and 2 the form chose 2 and the finished top-up replaced that
entry in the identity's stored history; every later one did the same. The
screen it replaced used the highest stored index plus one.

`QualifiedIdentity::next_top_up_index` is now the one place that chooses the
index: one past the highest stored, or the lowest free one when the highest
possible index is taken, so it can neither overflow nor reuse an entry. The
shared send form and the older top-up screen both use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): number an identity top-up the same way as the app

The identity top-up tool numbered a top-up by the count of stored top-ups,
so a history with a gap had an entry replaced, as in the shared send form.
It now uses `QualifiedIdentity::next_top_up_index`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): settle the hub's data loads where its frame action is decided

A hub frame merges actions from the top bar, the sidebar, the header, the
tab, the breadcrumb and a confirmation dialog, and the last non-empty one
wins. The tabs returned their data loads from rendering, claiming the load's
one dispatch slot on the spot. A load could then replace a sidebar or top
bar click made on the same frame, and a breadcrumb entry applied after the
tab could replace a load whose slot was already claimed, so it never ran.
The earlier header-only flag covered one of those sources.

Home and the Contacts tab no longer load while rendering. The hub asks the
rendered tab for its due load at the end of the frame, only when nothing
produced an action, and nothing after that point replaces an action. So a
click anywhere keeps its frame and a claimed load is always the action
returned. The load binds the lists to the selected identity first, so an
identity chosen in the breadcrumb is loaded once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): do not sign a transfer with a key whose wallet is not on this device

The transfer key resolver took any stored key entry for a usable key. An
entry that only refers to a wallet needs that wallet on this device: without
it an earlier such key was chosen over a later key whose material is here,
and an identity with only such a key reached the confirmation, to fail when
the transfer was signed.

The resolver now asks whether the private half can be obtained. The rule is
the one username registration already uses; it moves to `QualifiedIdentity`
so both read it from one place. A locked wallet still counts, as the app asks
for its password when it signs. `can_sign_with` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): keep a send waiting when another task fails

The app hands every failure to the visible screen as a message without a
task context, and Wallet Send took any of them for the failure of its own
send: it left the waiting state and showed the filled form again while the
payment was still running, so the user could confirm it a second time. Home
starts loads of its own right before Send or Top up opens, which makes such
a failure likely.

A confirmed send now goes out under a dispatch context of its own and the
screen remembers it. While it waits, only a failure carrying that context
ends the wait; other failures are still reported by the banner. The send no
longer joins a task batch, which cannot carry a context: an asset-lock
maximum lookup due in the same frame is asked for on the next one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): hold back a second top-up while one sent from the send form runs

Home's Top up opens the shared send form, which remembered a running top-up
only on the screen. Leaving the waiting form by its breadcrumb destroyed that
record, so a reopened form offered the same identity another top-up while the
first still ran: funds would leave twice, and both could be recorded under
one index.

The form now records its top-ups in the registry Add Funds keeps outside any
screen, and refuses a top-up of an identity that has one in flight. The app
releases the entry on that top-up's own result, as it does for Add Funds, and
hands the result to the form that waits on it. Either screen holds back while
the other's top-up runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(wallet): reach the waiting state through the production dispatch

The Wallet Send tests entered the waiting state through a hook that took a
hand-made context, which no dispatch ever produced. They now go through
`dispatch_send`, the path a confirmed send takes, so the screen waits on a
dispatch of its own and the tests keep holding when the screen relies on it.
The unused hook is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): do not sign a transfer with a key kept only in the legacy encrypted format

Early versions kept a private key in a per-key encrypted format. This version
stores such an entry but cannot open it, with or without a password, yet the
transfer key resolver counted it as usable: an earlier such key was chosen
over a later key that can sign, and an identity with only such a key reached
the confirmation, to fail when the transfer was signed.

The shared rule now says such a key cannot be obtained. A key in the vault and
a key also held in a readable way stay eligible. Username registration keeps
reporting such a key as ready, as before: it needs a status and guidance of
its own first, and the note saying so moves to where that decision is made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): refuse a transfer between identities that leaves nothing for the fee

A transfer to another identity pays its fee on top, from the same balance.
The form checked the amount against the balance alone, so an amount above
what Max offers reached the confirmation and failed afterwards. It is now
refused like a transfer to a Platform address or a withdrawal, naming the
highest amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): choose a withdrawal key whose private half this device can obtain

The withdrawal key resolver took any stored key entry for a usable key, as
the transfer resolver once did. A key that only refers to a wallet this
device does not hold, or that is kept only in the legacy encrypted format,
was chosen over a key that can sign, and the withdrawal failed when it was
signed. The resolver now applies the rule transfers use.

The send form asks the same resolver before it opens the confirmation, so a
withdrawal no key here can sign is refused there instead of after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): confirm a top-up that ends unseen and free the form that sent it

A top-up sent from the send form keeps running when the form is closed or
covered by another screen. Its success was then reported nowhere, and a
covered form went on showing "Sending..." for a result that had already come.

The app now tells the top-up registry whether the screen that sent the top-up
is in view when it ends; a success nobody watched is confirmed by the banner
Add Funds uses for a top-up continued in the background. The form checks the
registry as Add Funds does and, once its top-up is no longer in flight, comes
back empty, since the top-up may have succeeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): complete a waiting send only on its own result

Wallet Send took a result for the outcome of its send by its kind alone. A
result of the same kind from another task, such as a credit transfer started
elsewhere, marked the waiting send as complete and cleared its progress
banner while the payment was still running.

While the screen waits on a send it dispatched, a result under another
context may still refresh what the form offers, but it no longer completes
the send or ends its progress banner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): take the send progress banner along when the form is closed

Confirming a send raises "Sending transaction..." with a running clock and
no automatic dismissal, and only the form held its handle. Closing the form
while the send ran left that banner up until the user dismissed it, whatever
the send's outcome.

The form now clears its progress banner when it is destroyed, which covers
every way the app removes a screen. A top-up still in flight is handed to the
background banner Add Funds uses, so it stays followed and its guard against
a second top-up stays in place.

Tests confirm a send the way the confirmation dialog does, so they see the
banner the dialog raises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): keep the Receive code in step with the value it shares

Receive works out the value it shows and copies on every frame, but drew its
QR code once. An identity that gained a username while the dialog was open
was then offered by name while the code still encoded the identity ID.

The code is kept with the value it encodes and is drawn again when that
value changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): show the setup checklist only once its inputs are read

Home showed "Finish setting up your identity" for a moment on every visit
and then hid it. The checklist decides what is left from the profile and
the contact list, which load in the background; until they landed, an
unread profile counted as "no display name" and an unloaded list as "no
contacts", so an identity with both looked unfinished.

The checklist now waits until both are read. The contacts state records
whether its list has been loaded, and Home keeps the profile as unknown
until the profile cache has it. Once both are known it shows exactly as
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* refactor(ui): track a screen's outstanding request with PendingRequest

Fifteen screens kept the same hand-rolled slot for the one task they wait
on: store the dispatch context, compare each result's context against it,
clear it when it settles. `ui::state::PendingRequest` owns that pattern
(dispatch, owns, settle, clear), with an optional subject for slots that
also remember who the request is about.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* refactor(ui): deliver a dispatched task's result to the screen that sent it

Task results went to whichever screen was visible. A screen that waited on
its own task therefore missed the result when it was covered or hidden.
AppState also grew per-domain routers for hidden screens, and screens had
to defend themselves against results that were not theirs.

AppState now records the screen behind every BackendTaskContext::Dispatched
task (app/request_routing.rs) and delivers that task's result or error to
the same screen, wherever it is:
- Stacked screens get ids that are never reused (ScreenStack); root screens
  are keyed by RootScreenType.
- The visible screen gets undispatched tasks, results of a closed screen,
  and results that arrive after a network switch.
- A hidden screen still raises the global error banner, so a failure is
  never handled out of sight.
- Errors handled outside the general path (Core wallet auto-detected,
  migration, network context) also reach the screen that dispatched them.

Retired:
- the hidden-screen username refresh router;
- the top-up "watched" heuristic (screen_awaits_top_up);
- the top-up/send "resume after unseen end" polling of the registry;
- the hub router's payment-history and profile-load kinds;
- the send form's take-and-restore of its banner and status after another
  task's result, which becomes an explicit split.
The hub and voting-panel routers stay for results their screen does not
receive itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): offer every local identity as recipient of an identity send

Send opened from an identity's Home searched recipients among the selected
wallet's identities only. With no wallet on the device the list was empty,
and with one, identities imported without it could not be found by name, so
the other identity could not be picked as the identity transfer screen
allowed.

An identity-bound send now searches every identity stored on this device
for the current network, without the sender. A send from a wallet keeps to
that wallet's identities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(ui): keep a closed screen's task result away from the screen in view

A dispatched task whose screen was closed before it finished went to the
screen in view, as if it were that screen's own. A new Send form opened
after closing a sending one then flipped to "Sent ..." for a payment it
never sent, or to an error for a failure that was not its own.

Such results now reach no screen (ResultRoute::ClosedOwner):
- an error raises the global banner, as before;
- a send's success raises a banner with the text the closed form would have
  shown (closed_send_form_message, shared with the form);
- a top-up keeps its own confirmation banner;
- the screen in view is refreshed, as data may have changed.

Review follow-ups in the same routing code:
- A testing-only capture switch lets a kittest click a real control and
  check that the frame loop records the dispatching screen itself.
- Kittests cover the hidden-owner banner rule and the owner notification
  in the error arms outside the general path.
- The owner notification is no longer sent twice for legacy-recovery
  errors.
- The owner notification is dropped from the CoreWalletAutoDetected arm,
  which reports a success notice and is never constructed.
- The voting-panel route collapses to one pure check.
- ScreenStack keeps ids paired: it no longer hands out a mutable slice,
  only last_mut and iter_mut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* docs(ui): describe where task results are delivered

The ScreenLike docs now state:
- dispatched results reach their screen even while it is hidden;
- display_task_error suppresses the banner only while the screen is in
  view;
- display_message and should_suppress_backend_task_error are routed the
  same way.

Comments that said every result goes to the visible screen now say this
applies to undispatched tasks. PendingRequest is imported the same way in
every file that uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): read the selected identity once per Home frame

The Home header and the Home content each resolved the selected identity,
and every resolution reads and decodes the whole local roster and hydrates
its top-up history. The hub now resolves it once per frame and passes it to
both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): let Contacts and Profile use the hub's selected identity

The Contacts and Profile tabs each resolved the selected identity again on
every frame, on top of the lookup the hub already made for the shared
header, so each repaint decoded the whole roster and hydrated its top-ups
twice. The hub now passes the identity it resolved to both tabs. Profile
keeps reconciling its editor against it as before; the Contacts load, which
runs only when due, still looks the identity up itself.

A test-only, per-thread roster read counter (feature "testing") lets a hub
test check that Contacts and Profile read the roster as often per frame as
Home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(ui): leave the screen in view alone when a closed screen's task ends

A dispatched task whose screen was closed called refresh() on the screen
in view. Some screens reset themselves on refresh(): the Documents screen
cleared a running query, then rejected that query's own answer. Before
owner routing that screen received the result and ignored it.

Such a result now changes nothing on the screen in view. A send's outcome
is still reported by its banner. A top-up nobody open sent still refreshes
the screen in view, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* docs: say where a closed screen's task result goes

AGENTS.md and the request_routing module docs said a closed screen's
results go to the visible screen. They reach no screen: banners report
them. Only undispatched results, and results that arrive after a network
switch, go to the visible screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): read the profile load in flight from its PendingRequest

ProfileCache::reload_kept (#1090) leaves alone the profile whose load is
still running. On this branch that load is tracked in a PendingRequest, so
read its subject instead of unpacking an Option tuple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Codex GPT-6 <noreply@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
lklimek added a commit that referenced this pull request Oct 28, 2026
…onsibilities (#1100)

* feat(identity): align Home and reuse identity-bound send flows

Show published avatars, compact username controls, responsive Home cards, and Profile navigation. Reuse the wallet send form with fixed identity parties and owned-wallet withdrawal destinations.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* fix(identity): align Home columns and username notices

Keep contacts at the top of the right column beside quick actions. Place
left-aligned username cards with setup and payment history, using A05
column proportions and stacked cards in narrow windows.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* fix(wallet): scope SDK address balances to their owning wallet

SDK responses include recipient addresses. Only update balances for
Platform addresses registered to the selected wallet, preventing unrelated
wallets from offering foreign funds for identity top-ups or transfers.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* test(identity): advance pending avatar rendering without waiting for idle

The offline profile-cache test intentionally leaves the avatar request
pending. Render bounded frames while checking the pending fetch and
preserving assertions for cached, saved, and absent profile data.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

* docs(identity): describe the Home setup checklist as it ships

IDH-004 still described a `Set up your social profile` checklist entry
with its own skip affordance. Home renders an optional `Set a display
name` step, and the only dismiss control, `Hide this for now`, hides the
whole checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(identity): cover Move to wallet with an address a loaded wallet owns

The only Move to wallet test ran against a context without wallets and
asserted that an external address is refused, so it would also pass if the
ownership check refused every address.

Register a wallet, take one of its receiving addresses, and drive the
production validation and confirmation: the dispatched withdrawal must carry
the bound identity, that address and the entered amount. An external address
is still refused, and the owned address is refused once its wallet is removed.
Nothing is broadcast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* perf(identity): rebind the send form's identity only when it changed

Every frame of an identity-bound send form restored the binding, which
allocated a new box and cloned the identity twice for Send and Move to
wallet, and looked up the username again for Top up, even when nothing had
changed.

The check `validated_send_route` already made is now a shared predicate, and
the per-frame call restores only when that predicate fails. Construction,
reset and refresh still restore unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): keep Home payments with the identity they belong to

Home tracked which request its payment preview answered, but not which
identity the rows belonged to. The selected identity can change without the
hub hearing of it, for example when another screen's identity selector is
used and that screen is closed without a refresh. Home then showed the new
identity above the previous identity's payments, and the load guard kept the
new identity's history from being requested.

Home state now records its owner and reconciles it before rendering: content
of another identity is dropped and its pending request forgotten, so a late
answer is discarded and the new history loads. A refresh for the same
identity keeps the preview on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): reserve the withdrawal fee when moving credits to a wallet

Move to wallet opens the shared send form, whose Max for an identity sender
always kept back the fee of a transfer between identities. A withdrawal to a
Core address costs far more, so Max offered an amount the network refused,
and the form only compared the amount with the balance.

The reserve now follows the destination: a Core address keeps back the
withdrawal estimate, every other destination keeps what it kept before. Max
and send validation read the same value, and a withdrawal that would leave
too little for the fee is refused before the confirmation, naming the highest
amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): sign identity transfers with an active key held in this app

Send from Identity Home dispatched its transfers without a signing key. The
backend passed that on, and the SDK then takes the identity's first TRANSFER
key, including a disabled one, without asking whether the local signer holds
it. An identity with an earlier disabled key, or one imported with only a
later key, could not send.

Transfers to an identity and to Platform addresses now resolve the key before
any network call: an active TRANSFER key the signer can use, lowest id first.
An explicitly requested key that is unusable is refused rather than replaced,
and a missing key is reported as its own error. The send form resolves the
same key, passes it along, and refuses before the confirmation when there is
none. This also covers the MCP transfer tools, which dispatch without a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(identity): load the Move to wallet fixture without a background registration

The fixture wired the wallet backend before registering its wallet, which
starts a background registration next to the awaited one, and then polled
for the addresses. Registering the wallet first leaves the awaited calls as
the only registration, so the owned address is available as soon as they
return and the wait is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): keep contact lists with the identity they were loaded for

Home and the Contacts tab share one ContactsState, and the hub reset it only
for identity changes it made itself. Selecting another identity on a screen
opened from the hub (Add contact, then Cancel) left the previous identity's
contacts and requests on screen under the new identity, with the load slot
still claimed, so the new identity's lists never loaded and Accept paired the
new identity with the old identity's request.

ContactsState now records the identity its lists belong to. Home and the
Contacts tab bind it before reading or loading: on a change the lists are
dropped and the load re-armed. Paid-action guards are keyed by request and
survive the change, so a request both identities can see stays guarded while
its action is still running.

The Home payments test no longer depends on which frame its load goes out
in: the contact load now takes the first frame after such a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(send): reserve the address-transfer fee when an identity pays a Platform address

The shared send form reserved the identity-to-identity transfer fee for a
Platform address destination, while the task it dispatches estimates the
larger transfer-to-addresses fee, and it accepted any amount up to the full
balance. The transfer screen it replaced used the transfer-to-addresses
estimate for Max, the fee shown and an amount-plus-fee check.

Max, the fee preview and the confirmation text now read one reserve that
uses the existing transfer-to-addresses estimate for this route, and an
amount that leaves less than that fee in the identity is refused before the
confirmation, with the highest amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): keep a hub load from being spent on a frame the header took

The hub replaces the tab's action with the header's when both produce one
in the same frame. A tab that returned its contact or payment-history load
on that frame had already claimed the load's one dispatch slot, so the load
never ran, and cancelling the screen the header opened returns to the hub
without refreshing it.

Home and the Contacts tab now take a `may_load` flag. The hub clears it on a
frame where the header returned an action, so the slot stays free and the
load goes out on the next frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): deliver Home's payment history to the hub behind another screen

Home asks for its payment history once per arrival and accepts only the
answer to that request. An answer that arrived while Send or Top up covered
the hub went to the covering screen, which ignores it; Cancel returns
without refreshing, so the preview stayed empty or stale until an explicit
refresh.

The app now forwards a payment history result to the hidden hub as it does
for profile results. The hub still records only the answer to its own
request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(identity): run both transfer tasks without a usable key

The existing tests call the key resolver directly, so they would still pass
if a transfer task stopped calling it. This one dispatches both transfer
tasks through `run_identity_task` against a mock SDK, with no usable key and
with an explicitly requested unusable one, and expects the dedicated error:
a task that got past the resolver would fail on the mock instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(identity): stop Home's contact preview at six without collecting the list

The preview took six entries from a vector of every matching contact, built
again on each frame. `ContactsState` now offers the matches as an iterator,
which the preview bounds before reading; the Contacts tab keeps the
collected list where it needs the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): deliver contact lists to the hub behind another screen

The hub asks for its contacts and contact requests once per arrival, and
Home now shows them. Answers that arrived while Send or Top up covered the
hub went to the covering screen, which ignores them; Cancel returns without
refreshing, so Home's contact preview stayed empty until an explicit
refresh.

The app now forwards both results to the hidden hub, next to the payment
history. The hub keeps dropping lists loaded for an identity other than the
one it shows, which the new test covers with a result for another identity.
The payment history test shares the new helper that covers the hub with the
Send screen and cancels back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): record a top-up under an index no earlier top-up holds

Home's Top up now opens the shared send form, which numbered a wallet-funded
top-up by the count of stored top-ups. A stored history can have gaps, so
with entries 0 and 2 the form chose 2 and the finished top-up replaced that
entry in the identity's stored history; every later one did the same. The
screen it replaced used the highest stored index plus one.

`QualifiedIdentity::next_top_up_index` is now the one place that chooses the
index: one past the highest stored, or the lowest free one when the highest
possible index is taken, so it can neither overflow nor reuse an entry. The
shared send form and the older top-up screen both use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): number an identity top-up the same way as the app

The identity top-up tool numbered a top-up by the count of stored top-ups,
so a history with a gap had an entry replaced, as in the shared send form.
It now uses `QualifiedIdentity::next_top_up_index`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): settle the hub's data loads where its frame action is decided

A hub frame merges actions from the top bar, the sidebar, the header, the
tab, the breadcrumb and a confirmation dialog, and the last non-empty one
wins. The tabs returned their data loads from rendering, claiming the load's
one dispatch slot on the spot. A load could then replace a sidebar or top
bar click made on the same frame, and a breadcrumb entry applied after the
tab could replace a load whose slot was already claimed, so it never ran.
The earlier header-only flag covered one of those sources.

Home and the Contacts tab no longer load while rendering. The hub asks the
rendered tab for its due load at the end of the frame, only when nothing
produced an action, and nothing after that point replaces an action. So a
click anywhere keeps its frame and a claimed load is always the action
returned. The load binds the lists to the selected identity first, so an
identity chosen in the breadcrumb is loaded once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): do not sign a transfer with a key whose wallet is not on this device

The transfer key resolver took any stored key entry for a usable key. An
entry that only refers to a wallet needs that wallet on this device: without
it an earlier such key was chosen over a later key whose material is here,
and an identity with only such a key reached the confirmation, to fail when
the transfer was signed.

The resolver now asks whether the private half can be obtained. The rule is
the one username registration already uses; it moves to `QualifiedIdentity`
so both read it from one place. A locked wallet still counts, as the app asks
for its password when it signs. `can_sign_with` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): keep a send waiting when another task fails

The app hands every failure to the visible screen as a message without a
task context, and Wallet Send took any of them for the failure of its own
send: it left the waiting state and showed the filled form again while the
payment was still running, so the user could confirm it a second time. Home
starts loads of its own right before Send or Top up opens, which makes such
a failure likely.

A confirmed send now goes out under a dispatch context of its own and the
screen remembers it. While it waits, only a failure carrying that context
ends the wait; other failures are still reported by the banner. The send no
longer joins a task batch, which cannot carry a context: an asset-lock
maximum lookup due in the same frame is asked for on the next one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): hold back a second top-up while one sent from the send form runs

Home's Top up opens the shared send form, which remembered a running top-up
only on the screen. Leaving the waiting form by its breadcrumb destroyed that
record, so a reopened form offered the same identity another top-up while the
first still ran: funds would leave twice, and both could be recorded under
one index.

The form now records its top-ups in the registry Add Funds keeps outside any
screen, and refuses a top-up of an identity that has one in flight. The app
releases the entry on that top-up's own result, as it does for Add Funds, and
hands the result to the form that waits on it. Either screen holds back while
the other's top-up runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(wallet): reach the waiting state through the production dispatch

The Wallet Send tests entered the waiting state through a hook that took a
hand-made context, which no dispatch ever produced. They now go through
`dispatch_send`, the path a confirmed send takes, so the screen waits on a
dispatch of its own and the tests keep holding when the screen relies on it.
The unused hook is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): do not sign a transfer with a key kept only in the legacy encrypted format

Early versions kept a private key in a per-key encrypted format. This version
stores such an entry but cannot open it, with or without a password, yet the
transfer key resolver counted it as usable: an earlier such key was chosen
over a later key that can sign, and an identity with only such a key reached
the confirmation, to fail when the transfer was signed.

The shared rule now says such a key cannot be obtained. A key in the vault and
a key also held in a readable way stay eligible. Username registration keeps
reporting such a key as ready, as before: it needs a status and guidance of
its own first, and the note saying so moves to where that decision is made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): refuse a transfer between identities that leaves nothing for the fee

A transfer to another identity pays its fee on top, from the same balance.
The form checked the amount against the balance alone, so an amount above
what Max offers reached the confirmation and failed afterwards. It is now
refused like a transfer to a Platform address or a withdrawal, naming the
highest amount that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): choose a withdrawal key whose private half this device can obtain

The withdrawal key resolver took any stored key entry for a usable key, as
the transfer resolver once did. A key that only refers to a wallet this
device does not hold, or that is kept only in the legacy encrypted format,
was chosen over a key that can sign, and the withdrawal failed when it was
signed. The resolver now applies the rule transfers use.

The send form asks the same resolver before it opens the confirmation, so a
withdrawal no key here can sign is refused there instead of after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): confirm a top-up that ends unseen and free the form that sent it

A top-up sent from the send form keeps running when the form is closed or
covered by another screen. Its success was then reported nowhere, and a
covered form went on showing "Sending..." for a result that had already come.

The app now tells the top-up registry whether the screen that sent the top-up
is in view when it ends; a success nobody watched is confirmed by the banner
Add Funds uses for a top-up continued in the background. The form checks the
registry as Add Funds does and, once its top-up is no longer in flight, comes
back empty, since the top-up may have succeeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): complete a waiting send only on its own result

Wallet Send took a result for the outcome of its send by its kind alone. A
result of the same kind from another task, such as a credit transfer started
elsewhere, marked the waiting send as complete and cleared its progress
banner while the payment was still running.

While the screen waits on a send it dispatched, a result under another
context may still refresh what the form offers, but it no longer completes
the send or ends its progress banner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(wallet): take the send progress banner along when the form is closed

Confirming a send raises "Sending transaction..." with a running clock and
no automatic dismissal, and only the form held its handle. Closing the form
while the send ran left that banner up until the user dismissed it, whatever
the send's outcome.

The form now clears its progress banner when it is destroyed, which covers
every way the app removes a screen. A top-up still in flight is handed to the
background banner Add Funds uses, so it stays followed and its guard against
a second top-up stays in place.

Tests confirm a send the way the confirmation dialog does, so they see the
banner the dialog raises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): keep the Receive code in step with the value it shares

Receive works out the value it shows and copies on every frame, but drew its
QR code once. An identity that gained a username while the dialog was open
was then offered by name while the code still encoded the identity ID.

The code is kept with the value it encodes and is drawn again when that
value changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(identity): show the setup checklist only once its inputs are read

Home showed "Finish setting up your identity" for a moment on every visit
and then hid it. The checklist decides what is left from the profile and
the contact list, which load in the background; until they landed, an
unread profile counted as "no display name" and an unloaded list as "no
contacts", so an identity with both looked unfinished.

The checklist now waits until both are read. The contacts state records
whether its list has been loaded, and Home keeps the profile as unknown
until the profile cache has it. Once both are known it shows exactly as
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* refactor(ui): track a screen's outstanding request with PendingRequest

Fifteen screens kept the same hand-rolled slot for the one task they wait
on: store the dispatch context, compare each result's context against it,
clear it when it settles. `ui::state::PendingRequest` owns that pattern
(dispatch, owns, settle, clear), with an optional subject for slots that
also remember who the request is about.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* refactor(ui): deliver a dispatched task's result to the screen that sent it

Task results went to whichever screen was visible. A screen that waited on
its own task therefore missed the result when it was covered or hidden.
AppState also grew per-domain routers for hidden screens, and screens had
to defend themselves against results that were not theirs.

AppState now records the screen behind every BackendTaskContext::Dispatched
task (app/request_routing.rs) and delivers that task's result or error to
the same screen, wherever it is:
- Stacked screens get ids that are never reused (ScreenStack); root screens
  are keyed by RootScreenType.
- The visible screen gets undispatched tasks, results of a closed screen,
  and results that arrive after a network switch.
- A hidden screen still raises the global error banner, so a failure is
  never handled out of sight.
- Errors handled outside the general path (Core wallet auto-detected,
  migration, network context) also reach the screen that dispatched them.

Retired:
- the hidden-screen username refresh router;
- the top-up "watched" heuristic (screen_awaits_top_up);
- the top-up/send "resume after unseen end" polling of the registry;
- the hub router's payment-history and profile-load kinds;
- the send form's take-and-restore of its banner and status after another
  task's result, which becomes an explicit split.
The hub and voting-panel routers stay for results their screen does not
receive itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): offer every local identity as recipient of an identity send

Send opened from an identity's Home searched recipients among the selected
wallet's identities only. With no wallet on the device the list was empty,
and with one, identities imported without it could not be found by name, so
the other identity could not be picked as the identity transfer screen
allowed.

An identity-bound send now searches every identity stored on this device
for the current network, without the sender. A send from a wallet keeps to
that wallet's identities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(ui): keep a closed screen's task result away from the screen in view

A dispatched task whose screen was closed before it finished went to the
screen in view, as if it were that screen's own. A new Send form opened
after closing a sending one then flipped to "Sent ..." for a payment it
never sent, or to an error for a failure that was not its own.

Such results now reach no screen (ResultRoute::ClosedOwner):
- an error raises the global banner, as before;
- a send's success raises a banner with the text the closed form would have
  shown (closed_send_form_message, shared with the form);
- a top-up keeps its own confirmation banner;
- the screen in view is refreshed, as data may have changed.

Review follow-ups in the same routing code:
- A testing-only capture switch lets a kittest click a real control and
  check that the frame loop records the dispatching screen itself.
- Kittests cover the hidden-owner banner rule and the owner notification
  in the error arms outside the general path.
- The owner notification is no longer sent twice for legacy-recovery
  errors.
- The owner notification is dropped from the CoreWalletAutoDetected arm,
  which reports a success notice and is never constructed.
- The voting-panel route collapses to one pure check.
- ScreenStack keeps ids paired: it no longer hands out a mutable slice,
  only last_mut and iter_mut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* docs(ui): describe where task results are delivered

The ScreenLike docs now state:
- dispatched results reach their screen even while it is hidden;
- display_task_error suppresses the banner only while the screen is in
  view;
- display_message and should_suppress_backend_task_error are routed the
  same way.

Comments that said every result goes to the visible screen now say this
applies to undispatched tasks. PendingRequest is imported the same way in
every file that uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): read the selected identity once per Home frame

The Home header and the Home content each resolved the selected identity,
and every resolution reads and decodes the whole local roster and hydrates
its top-up history. The hub now resolves it once per frame and passes it to
both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): let Contacts and Profile use the hub's selected identity

The Contacts and Profile tabs each resolved the selected identity again on
every frame, on top of the lookup the hub already made for the shared
header, so each repaint decoded the whole roster and hydrated its top-ups
twice. The hub now passes the identity it resolved to both tabs. Profile
keeps reconciling its editor against it as before; the Contacts load, which
runs only when due, still looks the identity up itself.

A test-only, per-thread roster read counter (feature "testing") lets a hub
test check that Contacts and Profile read the roster as often per frame as
Home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(ui): leave the screen in view alone when a closed screen's task ends

A dispatched task whose screen was closed called refresh() on the screen
in view. Some screens reset themselves on refresh(): the Documents screen
cleared a running query, then rejected that query's own answer. Before
owner routing that screen received the result and ignored it.

Such a result now changes nothing on the screen in view. A send's outcome
is still reported by its banner. A top-up nobody open sent still refreshes
the screen in view, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* docs: say where a closed screen's task result goes

AGENTS.md and the request_routing module docs said a closed screen's
results go to the visible screen. They reach no screen: banners report
them. Only undispatched results, and results that arrive after a network
switch, go to the visible screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(identity): read the profile load in flight from its PendingRequest

ProfileCache::reload_kept (#1090) leaves alone the profile whose load is
still running. On this branch that load is tracked in a PendingRequest, so
read its subject instead of unpacking an Option tuple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* refactor(app): separate request delivery and cache notifications

Correlate single and batch screen requests through one execution boundary,
including panic and admission failures. Deliver domain cache changes without
resetting unrelated forms, and keep persistent observers separate from request
ownership. Move backend events and domain feedback to their owning modules.

Cover closed purchase forms, pending document queries, network-scoped cache
updates, sequential and concurrent panics, and full-channel admission failure.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* refactor(app): extract shared shutdown lifecycle session

Keep viewport close handling in AppState while sharing shutdown setup, result drainage, and wallet teardown across both exit adapters.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

* refactor(app): encapsulate voting scheduling and reconciler policy

Keep voting maintenance timers, migration recovery cutoffs and terminal
transitions in one coordinator. AppState supplies readiness and dispatches
work while preserving attention-before-refresh ordering.

Co-locate reconciliation policy, copy and tests with their owners, keeping
existing public test seams through app reexports.

Co-Authored-By: Codex <codex@openai.com>

* test(app): import task error in shutdown coverage

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* test(app): exercise production routing and task dispatch

Replace orphan routing and join-adapter test copies with the production route, observer-interest and executor APIs. Cover closed-owner isolation and admission rejection correlation.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* test(ui): capture platform info requests without rejecting dispatch

Use the dispatch-capture seam and captured request context to keep the
refresh-burst fixture pending without network execution. Shutting down
the task manager now correctly settles the request as an admission failure.

Co-Authored-By: Codex <codex@openai.com>

* fix(ui): settle token and settings tasks under their dispatch context

Every plain task a screen returns now runs under a Dispatched context.
Two screens still compared the bare operation, so their tasks never
settled:

- My Tokens kept waiting on a balance refresh or a reward estimate. Its
  banner stayed up, and each later Refresh was dropped as a duplicate.
- Settings left Clear Database, Restore from Previous Version and the
  backup-retention form disabled after a failure.

My Tokens now sends these operations under a dispatch context it keeps,
so only its own result settles them. Settings and the app's
chooser-ownership check match on the operation inside the context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(app): keep results of a previous network off the new network's screens

A network switch forgot every request owner, so a result that arrived
after the switch went to the screen in view on the new network. For
example, a document page queried on the old network landed in the new
network's Documents screen.

Each owner now records the network its task was dispatched on. A result
for another network than the active one takes the PreviousNetwork route:
- It reaches no screen and no observer.
- Banners report it as they do for a closed sender.
- The root screen that sent it has its wait ended with
  NetworkSwitchedBeforeResult instead of being left pending for good.
A switch back before the result arrives delivers it as usual.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(identity): expect a top-up's sender to outlive a network switch

Request owners now keep the network their task was dispatched on and
are no longer cleared by a switch. Assert that the top-up's sender stays
on record instead of asserting that the switch forgot it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(app): a registration result from the previous network leaves the Token Creator alone

The Token Creator sends a registration on one network. The user switches
networks and starts another registration there. The first one's late
outcome must not touch the new one:
- a success does not mark it Complete and raises no banner;
- a failure does not end its progress, and is reported only by the
  closed-sender banner.
ResultRoute::PreviousNetwork is what keeps both cases off the screen.
Routing such a result to the screen in view, as before, fails both.

The creator's start of a registration moves into
mark_token_registration_started so the test seam starts it the same way
the confirmation does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(identity): a hidden hub hears of another screen's contact details write

On v1.0-dev, AppState forwarded every DashPayContactInfoUpdated to a
hidden hub, which then retired the note it had confirmed and reloaded
its lists. With owner routing, only the hub's own writes reached it.
The hub's observer now takes another screen's write as well, so a
note saved elsewhere while the hub is hidden is not covered by the
hub's older one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(identity): route the hub's contact-request load back to the hub

The Contacts tab loads its contact list and its request lists as one
batch with their own contexts. Only the contact-list load had a
dispatch, so the request-list result went to the screen in view as
well as the hub. Both loads are now the hub's own dispatches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(app): cover every stop path of an interrupted contact details write

The test checks that each path reports the write's owner and contact:
- a panic, and a sequential item skipped after one;
- a worker that panicked or was cancelled;
- a task manager that refuses the batch at shutdown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(app): keep a previous network's scheduled-vote sweep off the new network's screens

The app starts scheduled-vote sweeps itself, undispatched, so no sender is
on record and their outcome fell through to the screen in view. After a
network switch, an old sweep's failure therefore reached the new network's
visible screen through display_backend_task_error, display_task_error and
display_message, and display_message(Error) clears progress banners such as
a running token registration's.

The sweep context names its network. When that network is not the active
one, take_result_route now returns ResultRoute::PreviousNetwork(None), which
gives no screen and no observer. PreviousNetwork now holds
Option<ScreenOwner>, with None for a task the app started itself. The sweep
error arm delivers through result_screen_mut(route) instead of the visible
screen. The scheduler guard is still released for the sweep's own network,
and the banner still reports the failure. The completion arm already
delivered through the route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs(error): say where a caught task panic's payload still goes

BackendTaskPanicked keeps the payload out of the error, whose Debug reaches
the banner's details panel. The process-wide panic hook in logging.rs still
logs it, as it does for every panic. The doc now says so, and asks that
panic messages never contain secrets, instead of implying that the payload
is never retained anywhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(dpns): end the voting panel's refresh only on its own dispatch

After a network switch, end_previous_network_request ends the previous
network's contest refresh with NetworkSwitchedBeforeResult. The voting
panel's display_backend_task_error matched any contest-refresh context,
so that ending also stopped the panel's own refresh on the new network:
the progress banner was dismissed and Refresh came back while the new
refresh was still running.

The panel now sends its refresh through a PendingRequest, and a failure
ends the panel's refresh only when the panel owns that context. Switching
networks, or the refresh's own "contests refreshed" result, clears the
slot. The refresh start moves into start_contest_refresh, which the
Refresh path and a testing seam share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(dpns): pin the voting panel's progress banner through a previous network's refresh

The regression test for a previous network's contest refresh ending
checked only the panel's refresh status. The bug it guards against also
dismissed the progress banner, and a regression that kept the status but
dropped the banner would have passed. The test now asserts that the banner
survives the old refresh's end and goes away with the new refresh's own
failure. A mutation that clears the banner on any contest-refresh failure
fails the new assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

---------

Co-authored-by: Codex GPT-6 <noreply@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants