Repository navigation
feat: register with the deployed wake gateways - #1349
coreyphillips wants to merge 6 commits into
Conversation
[Medium impact] The gateway changes appear safe to merge. SummaryEnables the deployed wake gateways:
No actionable issues found. Acknowledged scope: coreyphillips explicitly deferred Reviews (1) · Last reviewed commit: "feat: register with the deployed wake ga..." · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Points Env.wakeGatewayUrl at https://wake.bitkit.to on mainnet and https://wake.staging.bitkit.to on regtest, keeps testnet and signet off, keeps the debug WAKE_GATEWAY_URL override first, and returns nil under unit tests. Twin of synonymdev/bitkit-android#1944, and the two map networks identically. Reviewed 5710a2c, light tier. Not built: iOS does not build on this reviewer's Linux host; reasoned from the code and CI.
What I checked, and 3 candidates I ruled out
Read in full: Env.swift (network and wake sections), WakeManager.swift (policy and registration), WakeReceiver.swift gateway handling, WakeDevSettingsSection.swift
Tests: WakeRegistrationTests.swift covers the per-network mapping and nil under unit tests; the author's manual unit-tests run on 5710a2c concluded success
CI: build-local failed at "Verify current PR merge checkout" (the checked-out merge did not match the PR's base and head, a check on the runner's checkout, before any build), and e2e-status failed only because the shards it gates were skipped after that; Run Tests and Integration Tests were still running
Ruled out
- Unit tests on regtest hit the staging gateway:
Env.networkis.regtestunderisUnitTest, andwakeGatewayUrlreturns nil onisUnitTestbefore the mapping;WakeGatewayLiveTestsreads its URL from its own environment variables. - E2E builds register on staging:
WakeRegistrationPolicy.allowsRegistrationreturns false whenEnv.isE2E. - A changed gateway strands an existing registration:
WakeReceiveracks through the storedregisteredGatewayUrl, not the currentEnvvalue.
Merge confidence: 4/5, no findings, but no device run against the prod gateway yet (the PR's own Gaps) and build-local must rerun green.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the run metadata available to the reviewer does not carry it)
|
Triage: this PR goes in the 3.2.0 milestone under #1354, so 3.2.0 receives wakes through the deployed gateways. Twin: synonymdev/bitkit-android#1944. |
|
@jvsena42 ready for review. Since your review of the Android twin, |
|
Changed
|
A renewal sends the registration the gateway already holds, so the cached device was kept before the send. When that send failed, the advanced timestamp made the next try read as fresh and unchanged, and the renewal waited another 30 days. The cached device is now cleared before every send and set again once the gateway answers.
65d3560 to
8af8e0e
Compare
|
Changed
|
The scene registers again only when its inputs change, so a process that stayed in memory past the max age never sent the renewal. A return to the foreground now runs a non-forced registration, which stays local unless the registration is due or something changed. Presence refreshes after a registration restart only the presence loop, so they start no further check.
| /// stayed in memory is sent from here. | ||
| private func renewRegistrationIfDue() { | ||
| guard gatewayUrl != nil, latestInputs != nil else { return } | ||
| Task { await serialized { await self.register(force: false) } } |
There was a problem hiding this comment.
A due renewal gets one attempt here. If it fails while the phone is offline and the connection comes back with Bitkit still open, the device can stay unregistered until the next foreground return or registration input change. Could we use the existing retry policy while the app is active and registration is still allowed?
There was a problem hiding this comment.
A failed renewal leaves the device registered. The renewal is due at 30 days, so the gateway still holds the install for about 240 more days. sentToGatewayUrl is kept, so wakes and presence keep working (WakeStorage.swift:72). Because the device is cleared before sending (WakeManager.swift:256-258), every later register call sends again, and the next foreground return does that long before the gateway would retire the device. A retry loop here would only help an app that stays in the foreground the whole time, and it would run alongside the scene's own WakeRetry loop. Leaving this open for you.
|
Not changing
|
120b87d to
0a0deb6
Compare
|
@jvsena42 friendly nudge on this one. Since my last ping, ben-kaufman's review led to two fixes: a failed renewal is sent again on the next try ( |
Closes #1354
Part of #1238
Twin: synonymdev/bitkit-android#1944
Points builds at the deployed wake gateways (synonymdev/wake#2). Draft until a device test against staging and prod passes.
Description
Env.wakeGatewayUrl: mainnet useshttps://wake.bitkit.to, regtesthttps://wake.staging.bitkit.to, and testnet and signet stay off. The debugWAKE_GATEWAY_URLoverride still wins.WakeRegistrarsends an unchanged registration again once it is 30 days old (WakeTimestamp.registrationMaxAgeSecs). The gateway retires a device with no accepted push or registration for 270 days and presence does not count, so a wallet that got no wake for about nine months would stop receiving wakes until its token changed. Same fix as fix: register wakes again before the gateway retires the device bitkit-android#1958, from jvsena42's review of #1944. The cached device is dropped before every send, so a renewal whose send fails goes again on the next try, and a return to the foreground checks whether the renewal is due, since the scene registers again only when its inputs change (both from ben-kaufman's review).Out of Scope
swap.claimableandpaykit.synchandlers (Phase 2 and 3): until then those wakes acknoHandler.Design
N/A: no UI changes.
Preview
N/A
QA Notes
Setup
A debug build (regtest) on a device, without
WAKE_GATEWAY_URL, with notifications on.Journeys
N/A: not drivable; see Manual Tests.
Manual Tests
https://wake.staging.bitkit.to, and Device shows the registrationAutomated Checks
WakeRegistrationTests.swift: each network maps to its gatewayWakeRegistrationTests.swift: unit tests have no gatewayWakeRegistrationTests.swift: a registration 271 days old is sent againWakeRegistrationTests.swift: an unchanged registration stays unchanged until 30 days, then registers once and starts a new ageWakeRegistrationTests.swift:isRegistrationDueat its boundaries, with no recorded time and with a clock stepped backWakeRegistrationTests.swift: a renewal whose send fails is sent again on the next tryEvidence
a5470b7(master merged): unit, integration and E2E tests passed.6e58db5,e8201e0(re-registration): SwiftFormat lint passes locally; tests run in CI.e8201e0moves the max age intoWakeStorage.swift, which the notification extension also compiles.8af8e0e(failed renewal),0a0deb6(foreground check): SwiftFormat lint passes locally; tests run in CI.Gaps
WakeManager.sceneBecameActive); it reuses the non-forced registration the tests cover.