Skip to content

fix(wake): close the client gaps from the gateway review - #195

Merged
coreyphillips merged 1 commit into
masterfrom
fix/wake-client-gaps
Nov 9, 2026
Merged

coreyphillips merged 1 commit into
masterfrom
fix/wake-client-gaps

Conversation

@coreyphillips

Copy link
Copy Markdown
Collaborator

Closes the client gaps found in the wake gateway's pre-prod review.

  • A default registration ts is one past the last in this process, so two quick registrations (launch plus token callback) no longer get 409 stale_registration.
  • GatewayRejected gains server_time (401 stale_timestamp) and retry_after_secs (429).
  • Add wake_get_device and wake_send_test. wake_set_topics returns WakeSubscription with unknown_topics.

Breaking for the wake API, which no app uses yet. iOS bindings regenerated.

Tests: cargo test --lib modules::wake passes, and both live tests pass against the wake docker stack.

- A default registration ts is one past the last in this process, so two quick registrations no longer get 409 stale_registration.
- GatewayRejected carries server_time and retry_after_secs.
- Add wake_get_device and wake_send_test. wake_set_topics returns unknown_topics.

@talosmachina talosmachina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings. Closes the wake client gaps: monotonic default registration ts, server_time and retry_after_secs on GatewayRejected, wake_get_device, wake_send_test, and WakeSubscription with unknown_topics from wake_set_topics. Reviewed 78f2d64, full tier.

What I checked, and 5 candidates I ruled out

Read in full: the diff of src/lib.rs, src/modules/wake/{client,errors,registration,types}.rs, the new tests in tests.rs, the README section
Call sites traced: wake_prepare_registration (default and explicit timestamp), rejection for every parser, send for the Retry-After header, parse_wake_id for the test wake id
CI: wake-tests, paykit-route-tests, SwiftPM and manifest checks green; iOS and Android bindgen still running at review time
Not built here: my sandboxed runner could not confirm the author's permission and refused to run the branch, so the tests count is CI's, not mine

Ruled out

  • Explicit timestamp skips LAST_TIMESTAMP: a caller retrying with server_time after stale_timestamp has a clock more than 600 s off, so a later default from that clock is refused as stale anyway; it cannot collide into a 409.
  • Default ts running ahead of the clock: it moves one second per registration in the same second, so it needs hundreds of registrations in a burst to leave the 600 s window.
  • unknown_topics required in SetTopicsResponse: RegisterResponse already requires it, and the module is documented as experimental until the apps adopt it.
  • Strict platform / environment decode in parse_get_device: matches the two values WakePlatform and WakeEnvironment serialise to, the same way the rest of the module rejects what it cannot place.
  • HTTP-date Retry-After: deliberately mapped to None, and the executor test covers both forms.

Merge confidence: 4/5, the bindgen jobs had not finished and the tests were not run here.

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ✅ Approve

Findings: None.

QA for 78f2d64:

The videos record terminal output from automated assertions against the library built at this head.

Wake validation and HTTP responses ✅ The wake unit tests pass, including timestamp ordering, new device routes and retry metadata.

Checked with cargo test --locked --lib modules::wake; the recording shows the same test executable running the non-live cases.

wake-unit.2x.mp4

Register and update a device through the gateway ✅ The live device round trip passes immediate re-registration, device lookup, test-wake queueing and topic updates.

live_gateway_round_trip also checks unknown-topic reporting, presence and secret revocation on unregister.

gateway-device.2x.mp4

Deliver and revoke a peer wake grant ✅ The live grant round trip receives, decrypts and acknowledges a fake-provider push, then rejects the revoked grant.

Checked with live_gateway_grant_round_trip, including grant restrictions and usage counters.

gateway-grant.2x.mp4

Call the wake API through Swift bindings ✅ The checked-in Swift bindings compile and pass live calls through the exported Rust API.

A standalone Swift async caller checks re-registration, WakeDevice, WakeSubscription, optional presence, serverTime on a stale registration and retryAfterSecs after exhausting the test-wake allowance.

swift-bindings.2x.mp4

No device run: this experimental wake API has no app caller yet. Real APNs/FCM delivery and Android-side invocation remain untested.

Full review of the diff, 10 files. Also read the existing code review; the QA above was run independently.


Reviewed by gpt-6.1-sol-high

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

utAck

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.

4 participants