Repository navigation
Conversation
Signed-off-by: jm <jm@squareup.com> Co-authored-by: Codex <noreply@openai.com> Signed-off-by: jm <jm@squareup.com>
* blox/push-client-revocation-review-fix: test(push): satisfy regression test lint checks fix(push): journal gateway and relay cleanup independently Signed-off-by: jm <jm@squareup.com> # Conflicts: # mobile/test/shared/push/push_bootstrap_test.dart
* blox/push-client-revocation-review-fix: fix(push): keep gateway cleanup independent of relay credentials Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com> Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com>
* blox/push-ci-lint-pr5-20261029: test(push): brace gateway failure callback in PR5 Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com>
…renewal Signed-off-by: jm <jm@squareup.com>
…renewal Signed-off-by: jm <jm@squareup.com>
* commit '4cd6bcc05a3e28d10fdb83397500a6e5d37b0201': test(desktop): bind duplicate voice players to message IDs Signed-off-by: jm <jm@squareup.com>
joahg
left a comment
There was a problem hiding this comment.
🤖 Read the renewal batch and the lifecycle gating (completed-handoff cache keyed on inputs and deadline, publicationBusy guard, retry after shared-authority change); failures don't suppress the next recovery attempt and healthy origins aren't republished every tick. Physical-device App Attest/APNs verification is still pending per the description.
Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com>
Signed-off-by: jm <jm@squareup.com> Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: jm <jm@squareup.com>
joahg
left a comment
There was a problem hiding this comment.
🤖 Re-approving. The renewal logic is unchanged. The new diff passes hosted-relay assertion headers with background: true on the lease publish, and the fixture now rejects upgrades without the expected identity. That matches the revocation outbox's pattern, and the new test covers all four renewal publishes.
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord: changes needed at b346729; five persistence, rotation-recovery and renewal findings are inline. Source review only, with incomplete product-flow coverage and physical-device App Attest/APNs validation still pending.
| /// Lowercase SHA-256 digest of the binary APNs device token. | ||
| public let endpointHash: String | ||
| /// Endpoint epoch being enrolled, rotated or restored. | ||
| public let endpointEpoch: Int64 |
There was a problem hiding this comment.
🤖 Star Lord: [P1] Preserve decoding of existing pending journals. Builds using the same pending-buzz-push-v1 Keychain account already persist records without endpointEpoch. Synthesized Codable requires this new key; the initializer's default does not apply during decoding. One such journal makes the whole array unreadable, blocking enrollment, revocation and the endpoint-grants bridge indefinitely; save/remove also decode first. This affects upgrades of builds where push was enabled. Decode a missing epoch as 1 and cover a pre-change journal fixture. The documented separate-record cutover does not help here because this account name is unchanged.
| if let pending = pendingEnrollment, let handle = pending.gatewayInstallationHandle, | ||
| storedRecords.contains(where: { | ||
| $0.gatewayOrigin == gatewayOrigin && $0.gatewayInstallationHandle == handle | ||
| && $0.endpointEpoch > (pending.endpointEpoch) |
There was a problem hiding this comment.
🤖 Star Lord: [P2] Retire a conflicting rotation journal at the same epoch. If A journals 1→2/token B but its rotation never commits, a later token C can let a sibling commit 1→2/C and rewrite the shared records to epoch 2/hash C. This strict > check leaves A's epoch-2/B journal intact. A then replays B, which the gateway rejects with 404 because neither the old-epoch CAS nor exact-target retry matches. resumeEnrollment only replaces v1/installations errors without a handle, so this community cannot recover until journal expiry, potentially 30 days. Also supersede an equal-epoch rotation journal with a different endpoint hash, in both this check and settlePendingEnrollments, and cover that sequence.
| final allOriginsKey = | ||
| '$nativeCleanupKey|${[for (final value in communities) '${value.id}|${value.pushNotificationsEnabled}|' | ||
| '${buzzPushSubscriptionsFingerprint(value.pushSubscriptionState.desired)}'].join(';')}'; | ||
| '$token|$nativeCleanupKey|${activeSelection.hasValue}|${activeSelection.value?.id}|${[for (final value in communities) '${value.id}|${value.relayUrl}|${value.nsec}|${value.pubkey}|${value.pushNotificationsEnabled}|' | ||
| '${buzzPushSubscriptionStateFingerprint(value.pushSubscriptionState)}'].join(';')}'; |
There was a problem hiding this comment.
🤖 Star Lord: [P2] Keep failure backoff stable across generation reservations. This full-state fingerprint includes generationCursor, which _publish increments and persists before relay submission. If native enrollment succeeds but WebSocket/auth/event submission repeatedly fails, each retry changes allOriginsKey; BuzzPushAttemptGate.failed therefore resets its failure count every time. The worker repeats storage and network work every 2.5–5 seconds indefinitely instead of backing off toward 15 minutes. Separate failure identity from its own generation bookkeeping and extend the existing journey with repeated post-reservation failures.
| firstStack ??= stack; | ||
| } | ||
| } | ||
| if (firstError != null) Error.throwWithStackTrace(firstError, firstStack!); |
There was a problem hiding this comment.
🤖 Star Lord: [P2] Preserve healthy renewal deadlines when another origin fails. Throwing here discards the earliest healthy deadline, so the caller schedules only failure backoff. With a sibling repeatedly failing metadata discovery, the key remains stable and backoff reaches 7.5–15 minutes, longer than the five-minute renewal cushion. A healthy origin checked just before its renewal window can then expire before the next batch, losing notifications despite being available. Return successful deadlines alongside failures and bound the next wake by the earliest healthy renewal deadline.
| if (value.relayOrigin != grant.relayOrigin) value, | ||
| grant, | ||
| ]), | ||
| expiresAt: grant.expiresAt, |
There was a problem hiding this comment.
🤖 Star Lord: [P3] Cache the accepted lease's expiration. publishBuzzDevPushLease expires the relay lease at min(grant.expiresAt, now + descriptor.maxLeaseTtlSeconds), but this cache and the batch timer use only the native grant deadline. A supported relay advertising a shorter TTL can therefore lose its lease while this cache suppresses republication for the rest of the grant lifetime. The current first-party 30-day TTL does not expose this. Return the publication's actual expiration and use it for cached handoffs and renewal scheduling.
brow
left a comment
There was a problem hiding this comment.
🤖 Pre-review recommends rework before this lands. Four things regress what works today:
BuzzPushPendingEnrollmentRecordgains a requiredendpointEpoch, while released builds and main already save pending journals without it under the samepending-buzz-push-v1account. After an update the whole pending array fails to decode, so enrollment, renewal and cleanup fail for every community, and no path clears it. Decoding a missing epoch as 1 resolves it.completedOtherOriginslives in memory and drops the active community, so every launch and every community switch republishes each inactive enabled community (two NIP-11 fetches, a native enroll and a new authenticated socket each) with no token change. Skipping a community whose accepted lease already matches the current grant authority resolves it; that needs the accepted authority persisted.allOriginsKeyincludesgenerationCursor, which_publishbumps before it submits, so a failure after the reservation changes the key andBuzzPushAttemptGaterestarts at 2.5 to 5 s on every retry instead of backing off. Keeping the failure streak's identity independent of the generation bookkeeping resolves it.- A pending rotation journal is superseded only by a greater epoch (
BuzzDevPushEnrollmentDriver.swift:580and:439). When a sibling commits the same epoch with a newer token, the stale journal keeps replaying a rotation the gateway rejects until it expires, and that community gets no push; before this change it re-enrolled. Treating a same-epoch record with a different endpoint hash as superseding, in both places, resolves it.
Rotate APNs endpoints through an authenticated request, then restore relay grants across enabled communities. Keep successful handoffs until their own renewal deadline or inputs change, so a failing relay does not make healthy communities republish every five seconds. Republish shared grants after either owner renews and avoid concurrent renewals.
Validation: 73 focused Flutter tests and clean mobile analysis, covering failed relays, input changes, renewal deadlines, and accepted handoffs whose local save fails. Physical-device App Attest/APNs verification remains pending.
Stack (merge in order): #8673 → #8703 → #8704 → #8705 → #8706 → #8707 → #8708.