Skip to content

feat: register with the deployed wake gateways - #1944

Merged
coreyphillips merged 1 commit into
masterfrom
feat/wake-gateway-urls
Nov 17, 2026
Merged

coreyphillips merged 1 commit into
masterfrom
feat/wake-gateway-urls

Conversation

@coreyphillips

@coreyphillips coreyphillips commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1956
Part of #1804
Twin: synonymdev/bitkit-ios#1349

Points builds at the deployed wake gateways (synonymdev/wake#2). Draft until a device test against staging and prod passes.

Description

  • Env.wakeGatewayUrl: mainnet uses https://wake.bitkit.to, regtest https://wake.staging.bitkit.to, and testnet and signet stay off. The debug WAKE_GATEWAY_URL override still wins.

Out of Scope

  • swap.claimable and paykit.sync handlers (Phase 2 and 3): until then those wakes ack no_handler.

Design

N/A: no UI changes.

Preview

N/A

QA Notes

Setup

A debug build (regtest) on a device, without WAKE_GATEWAY_URL, with the bitkit-stag google-services.json and Background Payments on.

Journeys

N/A: not drivable; see Manual Tests.

Manual Tests

  • 1. Open Dev Settings → the wake gateway shows https://wake.staging.bitkit.to
  • 2. Tap Send Test Wake → the alert shows: needs a device and real FCM

Automated Checks

  • added WakeGatewayUrlTest.kt: each network maps to its gateway

Evidence

  • Staging: Send Test Wake showed the alert on an Android phone.
  • CI on ebd143e: build, unit tests, lint, detekt and UI tests passed. Its regtest APK uses Firebase project bitkit-stag.

Gaps

  • No device run yet against prod. That needs a mainnet build with the bitkit-prod Firebase config.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from ebd143e (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@coreyphillips
coreyphillips marked this pull request as ready for review November 17, 2026 12:23
@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

Sets default wake gateways by network:

  • The app selects a wake gateway based on its network.

No actionable issues found. coreyphillips explicitly deferred the swap and Paykit handlers and disclosed that the production device test remains pending.

Reviews (1) · Last reviewed commit: "feat: register with the deployed wake ga..." · Reviewed by Greptile

@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. Points Env.wakeGatewayUrl at https://wake.bitkit.to on mainnet and https://wake.staging.bitkit.to on regtest, keeps testnet and signet off, and keeps the debug WAKE_GATEWAY_URL override first. Reviewed ebd143e, light tier. Not built: on bitkit-android a review never runs the branch's Gradle build; reasoned from the code and CI.

What I checked, and 3 candidates I ruled out

Read in full: Env.kt (wake section), WakeConfig.kt, FcmService.kt; traced gatewayUrl through WakeRepo, WakeInbox, WakeHandlers, DevSettingsViewModel
Tests: WakeGatewayUrlTest.kt covers the per-network mapping
CI: build-and-test, compose-ui and the e2e shards on this head were still running when I read them; lint, detekt and Greptile green

Ruled out

  • E2E builds on regtest now leave dead tokens on the staging gateway: WakeConfig.isRegistrationEnabled is !Env.isE2eTest, and WakeRepo returns WakeSync.Off on it before any register or opt-out call.
  • JVM unit tests now get a live gateway URL from Env: WakeRepoTest and WakeInboxTest stub wakeConfig.gatewayUrl; WakeConfigTest does not read it; nothing in app/src/test calls the gateway through Env.
  • Upgraded mainnet installs register without consent: registration still goes through isWakeOptedIn (Background Payments on and notification permission granted).

Merge confidence: 4/5, no findings, but the mainnet path has no device run against the prod gateway yet (the PR's own Gaps) and CI was still running.

Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the run metadata available to the reviewer does not carry it)

@jvsena42 jvsena42 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR is a URL change, but it turns the whole wake registration path on by default: every mainnet and regtest install that WakeConfig counts as opted in now registers with the gateway. I reviewed it as the launch of that feature. One LOW is inline; it anchors on the URL line because the code it points at is unchanged here.

Not a finding: the opt-in gate counts notifications being on as consent, and below API 33 they are on by default. Registering that way links nothing new. Since #1932, public payments are always on while a profile exists, so the published invoices already tie the node id to the Pubky key. A wallet without a profile registers ln: only.

Checked and clean:

  • Push payloads. FcmService enqueues WakeWorker for every data message. Without credentials it ignores them. Otherwise the payload must decrypt to the install's key, and only wake.test has a handler, which posts a notification with no intent extras. No payload field reaches a payment, a node start or persisted state beyond the 200-entry dedupe list.
  • Registration signatures. They are domain-separated (wake-register-v1), so a gateway-chosen audience can't produce a reusable signature. The device secret goes out only as SHA-256.
  • Wipe. It unregisters before the keychain wipe, and getNodeId() is null once the node stops, so nothing re-registers mid-wipe.
  • E2E builds never register (WakeConfig.kt:28).
  • Startup. Nothing blocks it; all wake work runs in appScope with 10 s / 15 s timeouts.
  • iOS twin. synonymdev/bitkit-ios#1349 uses the same URLs. Its WakeManager.swift:230 has the same skip as the LOW; I haven't reproduced it there.

The PR body still says "Draft until a device test against staging and prod passes", and its Gaps list prod as unverified.

perf: relevant, because it adds default background work: one presence PUT per foreground minute (a new TLS connection each time), one DELETE per backgrounding, and registration once per fingerprint change.

Device gate (partial): ebd143e — not run yet; pending: presence and registration request rate against wake.staging.bitkit.to over 10 foreground minutes and one backgrounding, and cold start → Home, on this PR and master.
Skipped — covered by CI at ebd143e: unit tests, compose UI tests, detekt, lint, e2e (all green).

Comment thread app/src/main/java/to/bitkit/env/Env.kt Resolved
@ovitrif

ovitrif commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Triage: this PR goes in the 3.2.0 milestone under #1956, so 3.2.0 receives wakes through the deployed gateways. Twin: synonymdev/bitkit-ios#1349.

@jvsena42
jvsena42 dismissed their stale review November 17, 2026 13:58

No HIGH/MEDIUM left at ebd143e; the remaining LOW does not block. Device gate pending.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving: nothing above LOW from the code scan or the device gate. The approval stands with 1 LOW open: re-registering before the gateway retires an idle device. Fix it here or in a follow-up issue, whichever you prefer, and reply on the thread saying which.

On the device the PR build behaves as described.

  • Registration. It registered once after the first node start (Registered(deviceId=…, unknownTopics=[])), and six later cold starts logged UpToDate.
  • Presence. Foreground presence renewed every ~61 s, 10 PUTs in 10 minutes with no failures or retries. In the background it renewed nothing.
  • Manual test 1. Dev Settings shows https://wake.staging.bitkit.to, and the gateway's Device view lists the ln: identity with topics paykit.*, swap.*.
  • Manual test 2. Send Test Wake works over real FCM. The push arrived in ~4 s, the "Wake test" notification was posted, and the push was acked HANDLED.
  • Master. It shows the gateway off and refuses Test Wake.

I couldn't count the DELETE on backgrounding: clearPresence logs nothing on success, and the emulator packet capture saw no gateway traffic. No Failed to clear wake presence was logged.

Device gate: ebd143e — Pixel_9 emulator (API 37), CI APKs (PR ebd143e, master f9a473aae), staging wake gateway with real FCM. Manual tests 1 and 2 pass. perf: cold start median 2.1 s to activity, 6.0 s to Home with balance (master 1.9 s / 5.7 s; the slow outliers on both builds came from emulator-wide stalls); 1.0 presence req/min in the foreground (master 0), 0 in the background, 1 registration per fingerprint; no ANR or OOM. Figma: n/a. l10n: no UI text changed.
⚠️ Not verified: the background DELETE /v1/presence count (no success log, no packet capture), and prod (wake.bitkit.to), which needs a mainnet build with the bitkit-prod Firebase config.
Skipped — covered by CI at ebd143e: unit tests, compose UI tests, detekt, lint, e2e (all green).

@coreyphillips
coreyphillips merged commit e0ecaa4 into master Nov 17, 2026
39 checks passed
@coreyphillips
coreyphillips deleted the feat/wake-gateway-urls branch November 17, 2026 17:19
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.

feat: wakes through the deployed gateways

4 participants