feat: long-poll on the storage nodes; one-time background prompt; no startup "Device ready" flash - #1108
Merged
Conversation
…yncs the moment it does Storage node: POST /api/v2/b0x/wait (B0xWaitRequest) answers as soon as any listed spool holds an entry at or after the device's mark, or with none after at most 25 s. Woken in-process by every submit; served outside the node's request timeout and concurrency limit, bounded by its own cap on waits held, and holding no database connection while it waits. App (dsm_sdk): an inbox waiter beside the poller holds a wait on every member over this device's inbox routes and wakes a sync the moment one answers. Waits mark each spool where the last sync read it to its end. While the waits cover the fleet (N - K + 1 members), the poller slows to a safety net: 5 s while settling, 30 s on screen. Work in progress: the waiter's real-node test is written but not yet run; code-map pins not yet moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
…onnection survives Doze The first time the app starts with a wallet and is still battery-optimised, it opens the system's 'let this app run in the background' dialog (REQUEST_IGNORE_BATTERY_OPTIMIZATIONS), or the optimisation list where the dialog does not exist. Asked once per install; a refusal is kept. No push service is involved: the wallet keeps its own connection to the nodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
The chip-trace 'Device ready' scene played on every transition from the publishing screen to the wallet. An ordinary launch of a device set up long ago can report the publishing phase for a moment before the core confirms the identity is published, so the scene flashed at startup with nothing new to celebrate. It now plays only when the securing screen was shown in this run: the device was set up here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
… of its own Storage nodes read no clock and run no timer (storage spec §1 rule 4, tests/no_clock_reads.rs). The wait handler's own deadline is gone: the wait route carries a TimeoutLayer that answers 204 once AppLimits.wait_bound passes (25 s deployed), as the request timeout already bounds every other route. B0xWaitRequest loses wait_ms; the device reads 204 as a quiet round. The wait tests move to tests/b0x_wait.rs, beside the other timing tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
ci/no_clock_and_no_json.sh refuses wall-clock reads outside the BLE transport. A member's rest is now a timer that puts it back after 30 s, a round answered before a 1 s timer fires counts as quick, and the wait for a sync is bounded by a sleep. No Instant::now() remains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
Code-only moves (the shared proto gained the wait messages, which regenerates the types every crate reads). Map built at 5995fe2; the evidence each pin names ran at that tree: 254 dsm, 47 dsm_sdk, 22 dsm_storage_node tests, all passing. make requirement-map-intent INTENT_BUILT=android,node: 635 PINNED, 0 failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Transfers settle as soon as the other side's step lands, instead of at the next poll.
Storage node:
POST /api/v2/b0x/wait(B0xWaitRequest)200with the spools that hold an entry at or after the device's mark for them. It answers at once if one already does; otherwise it holds the request until one lands.204. The bound isAppLimits.wait_bound(25 s deployed), enforced by aTimeoutLayeron the wait route. The node reads no clock, keeping to storage spec §1 rule 4 (tests/no_clock_reads.rs).503. A held wait holds no database connection.App:
dsm_sdk::sdk::inbox_waiter404before the redeploy), is rested for 30 s. Repeated instant answers back off from 1 s up to 30 s.Android: one-time background prompt
BatteryExemptionopens the system's "let this app run in the background" dialog once per install, the first time the app starts with a wallet while still battery-optimised.Frontend: no "Device ready" flash at startup
Related Issues
Follows #1107 (2 s / 5 s polling stopgap).
Testing
cargo fmt --all -- --check, and clippy-D warningsondsm_sdkanddsm_storage_nodescripts/real_code_guard.pycleancargo testgreen, including the newtests/b0x_wait.rsand the wait case intests/resource_limits.rs, run against Postgresinbox_waiter/inbox_pollertests, including a wait held at in-process nodes over TLS (test_support::nodes) and answered when a delivery landsFxProvidertests, including a new case for a launch through the publishing screen, which fails on the old cue;tscand eslint cleanmake android: not built locally (no Android SDK in this environment); CI builds itChecklist
TODO|FIXME|HACK|XXXaddedNotes
404, rests each member, and polls exactly as it does today.REQUEST_IGNORE_BATTERY_OPTIMIZATIONSis fine for side-loaded beta builds. A Play Store release needs Google's approval for it, or a switch to opening the battery settings list instead.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y4wDTToHmJfkYYJvMKXt3u
Generated by Claude Code