GRI-2149: stop resetting the reconnect backoff on a pending hello #286

Merged
vivy merged 1 commit from fix/GRI-2149-backoff-reset-on-pending into dev 2026-11-16 14:06:20 +00:00
Member

Closes #285.

Cause

Sync::connect_once hard-coded admitted: true on every ordinary close
(None frame, Message::Close), regardless of whether the server actually
accepted the device during that connection. A pending hello answers the
handshake too, so a device waiting for admin approval reset its backoff to
BACKOFF_BASE (1 s) on every reconnect and never backed off.

Fix

Session now tracks admitted itself: true once HelloOutcome::Accepted is
seen, or once an EnrolmentUpdate::Approved arrives mid-connection (an
approval that lands while the device is still on a pending connection).
Sync::connect_once reads session.is_admitted() instead of hard-coding
true, so a still-pending device's backoff keeps growing between
reconnects.

Tests

Added to crates/client/src/session.rs:

  • a_pending_hello_does_not_admit_the_device
  • an_accepted_hello_admits_the_device
  • an_approval_during_a_pending_connection_admits_the_device

Ran: cargo test -p client (98 unit tests + 3 integration tests, all pass),
cargo clippy -p client --all-targets (clean), scripts/local-gates.sh --rust-only
(every gate passed).

Closes #285. ## Cause `Sync::connect_once` hard-coded `admitted: true` on every ordinary close (`None` frame, `Message::Close`), regardless of whether the server actually accepted the device during that connection. A **pending** hello answers the handshake too, so a device waiting for admin approval reset its backoff to `BACKOFF_BASE` (1 s) on every reconnect and never backed off. ## Fix `Session` now tracks `admitted` itself: true once `HelloOutcome::Accepted` is seen, or once an `EnrolmentUpdate::Approved` arrives mid-connection (an approval that lands while the device is still on a pending connection). `Sync::connect_once` reads `session.is_admitted()` instead of hard-coding `true`, so a still-pending device's backoff keeps growing between reconnects. ## Tests Added to `crates/client/src/session.rs`: - `a_pending_hello_does_not_admit_the_device` - `an_accepted_hello_admits_the_device` - `an_approval_during_a_pending_connection_admits_the_device` Ran: `cargo test -p client` (98 unit tests + 3 integration tests, all pass), `cargo clippy -p client --all-targets` (clean), `scripts/local-gates.sh --rust-only` (every gate passed).
GRI-2149: stop resetting the reconnect backoff on a pending hello
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo deny (pull_request) Successful in 12s
CI / cargo deny advisories (pull_request) Successful in 22s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo clippy (pull_request) Successful in 1m9s
CI / frontend-web (pull_request) Successful in 1m2s
CI / cargo test (pull_request) Successful in 3m40s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 2s
89e66a67c2
Session now tracks admitted (accepted) separately from merely getting
past the hello handshake. Sync::connect_once reads it instead of
hard-coding admitted: true, so a device waiting for approval keeps
backing off between reconnects instead of resetting to ~1s every time.
vivy approved these changes 2026-11-16 14:06:18 +00:00
vivy left a comment

Reviewed: cause and fix match the issue, tests cover it, CI green, up to date with dev.

Reviewed: cause and fix match the issue, tests cover it, CI green, up to date with dev.
vivy merged commit 538f477e1e into dev 2026-11-16 14:06:20 +00:00
vivy deleted branch fix/GRI-2149-backoff-reset-on-pending 2026-11-16 14:06:21 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!286
No description provided.