Skip to content

feat: turn payments on for existing profiles - #1339

Closed
jvsena42 wants to merge 2 commits into
masterfrom
feat/paykit-payments-migration
Closed

jvsena42 wants to merge 2 commits into
masterfrom
feat/paykit-payments-migration

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Superseded by #1338. That PR removes both payment toggles and turns private and public payments on at every launch for any profile that has them off, which covers existing profiles. This PR will be closed once it merges.

This PR turns private and public payments on once for Pubky profiles that existed before payments were on by default.

Context: https://synonymworkspace.slack.com/archives/C07BJ7DNPCG/p1794640038822989. John does not want users to opt in to private or public payments. The new-profile defaults and the Pay Contacts removal are a separate PR; this one covers profiles that already exist and does not depend on it.

Do not merge before the public payments Terms update (synonymdev/synonym-website#265, #1342) is approved. This turns on public payment endpoints for users who never chose them. JC confirmed the current Terms already cover private payments on by default (Slack).

Description

  • Adds app data migration 5, which queues the change at upgrade for wallets with a stored Pubky identity. Wallets without a profile queue nothing.
  • Runs the queued change in the background after the foreground public endpoint refresh, only while the wallet exists, the node is running, the Pubky session is current, Paykit UI is on, no wipe is in progress and the profile is not being deleted. It goes through the same enable paths as the Settings toggles, so the private access check, app record sync, contact preparation and rollback all apply.
  • Drops a step from the queue when it succeeds, when its payments are already on, or when the user chose the setting. A profile without private payment access drops the private step and still gets public payments. Any other failure keeps the step queued for the next launch; the change is attempted at most once per launch.
  • Keeps explicit private opt-outs: turning private payments off stores a confirmed preference with sharing off, and the migration skips that state.
  • Records a public choice from now on: the Settings public toggle stores that the user chose, and the migration skips it. The migration's own enable does not record a choice.
  • Clears the queue and the public choice on sign-out, profile deletion and wallet reset, so a later new profile is not treated as migrated.

Enabling private payments here runs the v0.1 per-contact private endpoint setup for every saved contact of every existing user on update. That is the slow path Paykit v0.2 replaces, and it runs for everyone after the update ships.

Out of Scope

  • New-profile defaults and removing the Pay Contacts step: separate PR.
  • Bitkit/Utilities/AppDataMigrations.swift: public opt-outs made before this update. Migration 4 turned public payments off for every wallet, and the toggle stored no choice until this PR, so a user who turned public payments off after migration 4 cannot be told apart from one who never touched it. Both get public payments on.
  • Throttling or spreading the per-contact private endpoint setup for users with many contacts.
  • Paykit v0.2 migration.

Twin: synonymdev/bitkit-android#1931

Design

N/A — no UI changes.

Preview

N/A — no user-visible UI change; settings toggles flip on in the background.

QA Notes

Setup

  • Install a build from master, create or restore a Pubky profile, add contacts, leave private payments unconfirmed (do not open Pay Contacts or General Settings) and public payments off, then update to this branch's build.
  • For opt-out cases, before updating, turn private payments off in General Settings.
  • Local bitkit-docker regtest stack with a homeserver, as in journeys/payment-requests/README.md.

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

  • 1. Update with a profile, private unconfirmed and public off, then open the app with the node running → General Settings shows private and public payments on; contacts receive private endpoints — app upgrade over an existing install is not in Capabilities
  • 2. Update with private payments turned off in Settings → private stays off, public turns on — app upgrade not in Capabilities
  • 3. Update with the homeserver unreachable → both stay off; after relaunch with the homeserver back, both turn on — app upgrade not in Capabilities
  • 4. Update, then sign out before the node starts; create a new profile → the migration does not run for the new profile — app upgrade not in Capabilities

Automated Checks

  • added PaykitPaymentsMigrationTests.swift — queues only for wallets with a profile and only once; skips payments already on, private opt-outs and public choices; enables both and clears the queue; drops private without access and still enables public; keeps transient failures and superseded steps queued; attempts once per launch; does not start or count while not current; stops before public when the session ends; keeps a public choice made during the private step
  • added ContactPaymentsServiceTests.swift — the public toggle records a choice; the migration's enable does not
  • updated AppDataMigrationsTests.swift — schema version 5

Evidence

  • On 4673e64: PaykitPaymentsMigrationTests (16), ContactPaymentsServiceTests (37) and AppDataMigrationsTests (10) pass.
  • On 4673e64: the unit tests in the CI selection pass on a dedicated iPhone 17 (iOS 26.5) simulator: 3963 tests, 3959 passed, 4 skipped, 0 failed. An earlier run on a simulator shared with another test run crashed the test host several times; the clean rerun on its own simulator passed.
  • swiftformat --lint passes on the changed files.

Gaps

  • Manual tests 1–4 not run; no device testing done.
  • Public opt-outs made before this update are not preserved (see Out of Scope).

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: Not exposed)
  • Implementation: claude-opus-5-5 (reasoning: Not exposed)
  • Review: Not performed

Metadata note: the session reports the model ID; the reasoning setting is not exposed in the session metadata.

🤖 Generated with Claude Code

Queue a one-time change at upgrade for wallets with a stored Pubky
identity, and run it in the background once the wallet, node and session
are ready. It goes through the Settings enable paths for private and
public payments, skips settings the user already chose, drops the private
step for profiles without private access, and keeps transient failures
queued for the next launch. The public toggle now records the user's
choice. Sign-out, profile deletion and wallet reset clear the queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42 jvsena42 self-assigned this Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42

Copy link
Copy Markdown
Member Author

Closing as superseded by #1338. Contact payments are now always on while a Pubky profile exists, and ContactPaymentsService.ensureEnabled there turns them on for existing profiles on every foreground, which covers what this migration did.

@jvsena42 jvsena42 closed this Nov 16, 2026
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.

1 participant