Skip to content

fix: skip push registration in e2e #739

Description

@ovitrif

Summary

The app registers every install for push notifications with the Bitkit notification server, including E2E builds whose simulator is wiped minutes later. Each wiped install leaves a dead APNs token that the LSP keeps pushing to.

Scope

  • Cross-platform: same behavior on Android and iOS, one issue per repo (counterpart linked below).
  • Requested change: E2E builds skip the network registration with the notification server and log one line, keyed on the existing E2E build flag. Every other build keeps today's behavior.
  • Out of scope: how the notification server handles dead tokens (synonymdev/bitkit-notification-server#19), and Blocktank's retry loop.

Observed on staging

On 2026-09-10 the Blocktank staging ln2 watcher logged 210 Failed to notify peer … Notification reject by Apple/Google errors for 5 node ids, all E2E wallets. WakeToTimeoutWatcher retries an offline peer with a pending HTLC every 5 minutes for up to 14 days, and a provider reject does not stop it. No E2E spec exercises push notifications, so registration from those builds serves nothing.

Why E2E builds can skip it

No E2E test uses push notifications: grep -ri notification bitkit-e2e-tests/test/specs finds nothing. The suite drives the app in the foreground, and receiving a payment while backgrounded is never asserted, so a registration from an E2E build is never consumed. The only effect of registering is the dead token the wiped device leaves behind, which Blocktank then retries against every 5 minutes for up to 14 days.

Mechanism

  • PushNotificationManager.registerWithBackend calls CoreService.shared.blocktank.registerDeviceForNotifications unconditionally on node start and on token refresh.
  • Env.isE2E already exists: true under the E2E_BUILD compilation condition, which .github/workflows/e2e-tests.yml and e2e_migration.yml set via SWIFT_ACTIVE_COMPILATION_CONDITIONS, or when the E2E environment variable is true. Release and TestFlight builds never set it.

Fix

  • PushNotificationManager.registerWithBackend returns early with a single log line when Env.isE2E is true, mirroring Android. Token retrieval, the keychain cache, and receive-side handling are not reached and stay untouched.
  • iOS has no manual dev registration action, and both registerWithBackend callers in MainNavView toast only on failure, so a skipped registration shows no success toast.
  • No new flag, no build-setting or workflow change.

Verification

  • E2E_BUILD build → create wallet → node start logs the skip line and no registration call.
  • Default build → node start proceeds to registration as before.
  • Existing lint and unit tests pass.
  • Staging: after the E2E build carries the change, no new node ids appear in the WakeToTimeout reject lines.

Counterpart: synonymdev/bitkit-android#1244, fixed by synonymdev/bitkit-android#1245.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions