Skip to content

feat(zero-rust): wait JS's 5 minutes before a hidden client disconnects - #214

Open
tmm wants to merge 1 commit into
mainfrom
feat/zero-rust-hidden-delay
Open

tmm wants to merge 1 commit into
mainfrom
feat/zero-rust-hidden-delay

Conversation

@tmm

@tmm tmm commented Nov 14, 2026

Copy link
Copy Markdown
Member

tmm's defaults decision, made as he asked:

  • ZeroOptions::hidden_disconnect_delay_ms defaults to 300,000 ms (5 minutes), as JS's hiddenTabDisconnectDelay does (DEFAULT_DISCONNECT_HIDDEN_DELAY_MS in zero.ts). Before, it was 0, which disconnected as soon as set_visible(false) was called. The field's doc comment tells mobile apps to set 0 to keep that behaviour, as Swift does.
  • Memory stays the default storage. PARITY.md now calls this the one deliberate difference from JS's defaults: SQLite is the opt-in sqlite feature, so the default build has no third-party dependencies, and the app chooses where its replica lives.

Changeset: zero-rust minor. A changed default is a behaviour change, and before 1.0 a breaking change bumps the minor version, as 0.2.0 did. The next release is 0.3.0.

Test: tests/visibility.rs uses default options. A hidden client is still connected after 299 s, with pings answered, and disconnected at 300 s. With the old 0 default it fails at the first assertion; I checked by reverting the default. The conformance vectors set the delay themselves, so nothing else tests Rust's own default.

Nothing else depends on the default: no app calls set_visible, and the conformance runner already passes JS's 300,000.

Checked locally:

  • cargo fmt --check and cargo clippy --workspace --all-targets --all-features -D warnings
  • cargo test --workspace --all-features and cargo doc -D warnings
  • conformance: 66,384 cases, 0 failures, 2,254 under the documented exceptions
  • oxfmt --check

ZeroOptions::hidden_disconnect_delay_ms now defaults to 300,000 ms, as
JS's hiddenTabDisconnectDelay does, instead of 0. Memory stays the
default storage, documented in PARITY.md as deliberate.

Amp-Thread-ID: https://ampcode.com/threads/T-db04f816-97ed-4bc9-b19e-9ee68611a0ab
Co-authored-by: tmm <tmm@tmm.dev>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants