Skip to content

fix(contacts): preserve preferences during pending opt-in - #471

Draft
vladbisceanu wants to merge 1 commit into
useplunk:nextfrom
vladbisceanu:upstream/16-pending-opt-in-preserves-state
Draft

fix(contacts): preserve preferences during pending opt-in#471
vladbisceanu wants to merge 1 commit into
useplunk:nextfrom
vladbisceanu:upstream/16-pending-opt-in-preserves-state

Conversation

@vladbisceanu

Copy link
Copy Markdown

Problem

The documented double-opt-in flow currently needs two secret-key calls. A public one-call track payload with subscribed: false would unsubscribe an existing active contact, while omitting it creates a new contact subscribed.

Solution

  • add preserveExistingSubscription to the public track schema
  • apply subscribed only on first creation when that option is true
  • preserve the elected contact state if another request wins the concurrent create
  • update the contact concepts, recipe, and OpenAPI contract

The race path intentionally returns the elected row without replaying the losing request metadata. This matches #469: stale concurrent payloads must not overwrite winner-owned contact data. The fork version composes this behavior with that broader race hardening.

Proof

  • ContactService suite: 62/62 passed
  • yarn workspace api build: passed
  • yarn lint: passed (existing warnings only)
  • final-diff review completed; its metadata-replay suggestion was dismissed for the winner-ownership reason above

Fork tracking: vladbisceanu#16
Fork implementation: vladbisceanu#17
Related concurrency hardening: #469

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