镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[FIX] Send Firebase Installation IDs to FCM in the fid field - #2

Open
semion11 wants to merge 1 commit into
rails-7.2from
fcm-fid-support
Open

semion11 wants to merge 1 commit into
rails-7.2from
fcm-fid-support

Conversation

@semion11

@semion11 semion11 commented Oct 15, 2026 •

Copy link
Copy Markdown

FCM HTTP v1 deprecated Message.token and added Message.fid for
Firebase Installation IDs. New Android SDKs give apps an FID instead
of a registration token, but Rpush could only send token.

An FID has 22 characters and a registration token is much longer, so
the device_token length tells them apart. Google's SDK does this exact
check: return token.length() <= 22; (firebase-messaging Store.java,
firebase/firebase-android-sdk#8087).

@semion11 semion11 changed the title Send Firebase Installation IDs to FCM in the fid field [FIX] Rebase the fork on upstream rpush and send FCM FIDs Oct 15, 2026
@semion11
semion11 changed the base branch from master to sapi-main October 15, 2026 15:12
@semion11 semion11 changed the title [FIX] Rebase the fork on upstream rpush and send FCM FIDs [FIX] Send Firebase Installation IDs to FCM in the fid field Oct 15, 2026
@semion11
semion11 requested a balanced review from Copilot October 15, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open findings
What changed in this PR

Adds support for sending Firebase Installation IDs (FIDs) to FCM HTTP v1 by introducing an explicit flag that switches the outbound message field from token to fid.

Changes:

  • Add device_token_is_fid attribute (persisted in AR + supported in Redis client) to distinguish FID vs registration token.
  • Update FCM notification JSON generation to send fid when the flag is set, otherwise token.
  • Add unit/functional specs and README docs covering FID behavior and validation.
File Description
spec/​unit/​client/​shared/​fcm/​notification.rb Adds unit tests for device_token_is_fid serialization, validation, and as_json field selection.
spec/​functional/​fcm_spec.rb Adds functional test ensuring outbound HTTP uses fid (and not token) when configured.
lib/​rpush/​client/​active_model/​fcm/​notification.rb Implements fid vs token switching and adds validation when marked as FID.
lib/​rpush/​client/​redis/​notification.rb Adds Redis-backed attribute device_token_is_fid with default false.
lib/​generators/​templates/​rpush_9_3_0_updates.rb Introduces migration to persist device_token_is_fid on notifications table.
lib/​generators/​rpush_migration_generator.rb Ensures the new migration template is included in generator output.
spec/​support/​active_record_setup.rb Updates spec DB migration setup to include the new migration.
README.md Documents how to send FIDs via device_token_is_fid.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

FCM HTTP v1 deprecated Message.token and added Message.fid for
Firebase Installation IDs. New Android SDKs give apps an FID instead
of a registration token, but Rpush could only send token.

An FID has 22 characters and a registration token is much longer, so
the device_token length tells them apart. Google's SDK does this exact
check: return token.length() <= 22; (firebase-messaging Store.java,
firebase/firebase-android-sdk#8087).
@semion11
semion11 changed the base branch from sapi-main to rails-7.2 October 15, 2026 16:21
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.

2 participants