Skip to content

Queue typed session alerts in the durable FCM relay - #364

Merged
n0rpan merged 5 commits into
mainfrom
mobile/fcm-durable-session-alerts
Dec 3, 2026
Merged

n0rpan merged 5 commits into
mainfrom
mobile/fcm-durable-session-alerts

Conversation

@n0rpan

@n0rpan n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Part of #95. Stacked on #359, which renders the fixed FCM payload.

Accept finished, failed and goal_reached in the host-authenticated notification enqueue endpoint only for FCM. Require the canonical host-issued session reference and an installation ID that can derive a pairing hint. Persist the kind through SQLite and dispatch it using the typed FCM payload. Existing approval requests keep their payload and behavior. Reject an inconsistent typed lease before it can send as an approval.

Migrations from v1 and v2 preserve existing deliveries, leases, retry state, deduplication and registration fences. All 205 relay tests passed, including migration, restart, the typed HTTP contract and the actual FCM adapter payload through dispatch.

This prepares the self-operated relay. Host capability detection, per-device opt-in and pilot deployment follow separately.

Validate explicit finished, failed and goal_reached session requests: a
known kind, a canonical s1_-prefixed 32-byte base64url event reference and
a required canonical pairing hint. Render the stateless APNs worker's
fixed copy with data exactly {kind, session_ref: suffix, pairing_hint}.

The session path reuses the approval delivery path for expiry, size,
fid/token targeting, click_action and proxy: DENY, and carries no
approval field. The legacy approval payload and results stay unchanged;
the dispatcher and HTTP surfaces are untouched.

Tests: node --test mobile-push-relay/test/*.test.js (199 pass). New
fcm-session.test.js covers all three kinds, approval byte parity, the exact
session data, validation before access token or transport, expiry, size,
fid targeting and provider answer classification.
Accept an optional finished, failed or goal_reached kind on the authenticated
POST /v1/notifications. Absence stays the legacy approval. A typed kind is
validated before queueing: the event reference must be the canonical s1_
session reference and the installation id must be the canonical 32-byte value
the dispatcher hashes into the pairing hint.

Store the kind in delivery schema version 3, with an approval default and a
CHECK over the fixed values. A typed kind is refused with kind_unavailable for
an APNs binding, before a delivery or enqueue slot exists. True v1->v2->v3 and
v2->v3 migrations add only the column, leaving retry, lease, dedupe and
ordering state intact.

The dispatcher passes kind only to a typed FCM delivery. Approval requests keep
approvalRef and the byte-identical FCM payload, and APNs never receives a
session field.

Tests: node --test mobile-push-relay/test/*.test.js (205 pass).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T14:20:00.997640Z 4571e79 Draft marked ready
🔒 Security Review ✅ Completed 2026-12-03T14:21:51.182876Z 4571e79 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from mobile/fcm-session-alert-payload to main December 3, 2026 13:53
@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue 4571e79

@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

In line to merge. Commit 4571e79 is reviewed with nothing blocking; it has entered the merge queue.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

Asked for by the maintainer’s queue request, for commit 4571e79.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 4571e79b40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@n0rpan
n0rpan marked this pull request as draft December 3, 2026 14:18
@n0rpan
n0rpan marked this pull request as ready for review December 3, 2026 14:18
@n0rpan
n0rpan added this pull request to the merge queue Dec 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 3, 2026
@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue 4571e79

@n0rpan
n0rpan added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 210d082 Dec 3, 2026
23 checks passed
@n0rpan
n0rpan deleted the mobile/fcm-durable-session-alerts branch December 3, 2026 18:10
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