Skip to content

feat(push): persist FCM messages#582

Merged
wolf31o2 merged 1 commit intomainfrom
feat/fcm-persistence
Jan 18, 2026
Merged

feat(push): persist FCM messages#582
wolf31o2 merged 1 commit intomainfrom
feat/fcm-persistence

Conversation

@wolf31o2
Copy link
Copy Markdown
Member

@wolf31o2 wolf31o2 commented Jan 18, 2026

Closes #335


Summary by cubic

Adds persistence for FCM tokens to a local file and hardens error handling in the push output, so notifications survive restarts and failures. Addresses Linear #335.

  • New Features

    • Persist FCM tokens to a JSON file; load on startup and save on create/delete.
    • Added SetPersistenceFile to configure the persistence path.
    • Thread-safe TokenStore with read/write locks and safe copies from GetFcmTokens.
  • Refactors

    • NewMessage returns an error on empty token; added unit tests.
    • Push.New and credential helpers return errors; plugin init handles failures.
    • Replaced panics/os.Exit with structured logging (slog) and graceful continuation in event handlers.

Written for commit 4eea9b7. Summary will update on new commits.

@wolf31o2 wolf31o2 requested a review from a team as a code owner January 18, 2026 00:29
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 18, 2026

Warning

Rate limit exceeded

@wolf31o2 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 87842cc and 4eea9b7.

📒 Files selected for processing (5)
  • output/push/fcm/message.go
  • output/push/fcm/message_test.go
  • output/push/fcm_repository.go
  • output/push/plugin.go
  • output/push/push.go

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 5 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="output/push/fcm_repository.go">

<violation number="1" location="output/push/fcm_repository.go:92">
P2: `saveTokens()` releases `persistMutex` before the file write, so concurrent requests can write the persistence file at the same time and corrupt it. Hold the mutex for the entire save operation to serialize writes.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
@wolf31o2 wolf31o2 force-pushed the feat/fcm-persistence branch from c23277c to 4eea9b7 Compare January 18, 2026 04:55
@wolf31o2
Copy link
Copy Markdown
Member Author

@cubic-dev-ai review this PR

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai bot commented Jan 18, 2026

@cubic-dev-ai review this PR

@wolf31o2 I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@wolf31o2 wolf31o2 merged commit 2161f87 into main Jan 18, 2026
11 checks passed
@wolf31o2 wolf31o2 deleted the feat/fcm-persistence branch January 18, 2026 19:46
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.

Add persistence to push output token store

3 participants