Skip to content

fix(api): JWT notifications auth + builtin kill-switch revert - #2807

Merged
riderx merged 6 commits into
mainfrom
fix/notifications-jwt-and-builtin-killswitch
Jul 31, 2026
Merged

fix(api): JWT notifications auth + builtin kill-switch revert#2807
riderx merged 6 commits into
mainfrom
fix/notifications-jwt-and-builtin-killswitch

Conversation

@riderx

@riderx riderx commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary (AI generated)

  • Switch notification manage routes from middlewareKey to middlewareAuth so the dashboard JWT can call /notifications/update-check (and related routes) without Invalid apikey.
  • Fix channel built-in kill-switch: when a device is still on an OTA bundle and the channel points at built-in, /updates now returns success { version: "builtin" } with no error/kind, so the plugin can reset to the store binary.
  • Devices already on built-in still get already_on_builtin + kind: up_to_date.

Motivation (AI generated)

A customer enabling silent push after reverting a channel to built-in hit two bugs:

  1. Dashboard sends JWT, but notification routes only accepted Capgo API keys.
  2. /updates always returned already_on_builtin + kind: up_to_date for built-in channels, so the plugin never entered its version == "builtin" reset path.

Business Impact (AI generated)

Restores the intended emergency rollback / kill-switch (channel → built-in) and silent background update push from the console, which customers rely on for production incident response.

Test Plan (AI generated)

  • Call /notifications/update-check from the dashboard while logged in (JWT) and confirm it queues without Invalid apikey.
  • Call the same endpoint with a Capgo API key and confirm it still works.
  • Point a channel at built-in while a device runs an OTA bundle; confirm /updates returns { "version": "builtin" } without error/kind, and the device resets to the store binary.
  • Device already on built-in still receives already_on_builtin / up_to_date.
  • Existing updates + native-notifications unit tests pass.

Generated with AI

Made with Cursor

Review in cubic

Dashboard silent push used JWT against middlewareKey-only routes.
Channel builtin revert returned already_on_builtin with kind, so the
plugin never reached its reset path for devices still on an OTA bundle.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ba423210-351d-4dcb-a31e-bcd857f79751

📥 Commits

Reviewing files that changed from the base of the PR and between 5bb79e4 and d22c47d.

📒 Files selected for processing (4)
  • supabase/functions/_backend/plugin_runtime/utils/update.ts
  • supabase/functions/_backend/public/notifications/index.ts
  • tests/native-notifications-api.unit.test.ts
  • tests/updates.test.ts

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

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing fix/notifications-jwt-and-builtin-killswitch (d22c47d) with main (5bb79e4)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

The version_name equality path ran before the builtin branch, so
already-on-builtin devices never hit the dedicated error code.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
plugin_parser maps version_name "builtin" to version_build, so compare
version_name === version_build for the up-to-date case and keep the
OTA kill-switch success payload when they differ.

Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx

riderx commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Duplicate of #2805 (same JWT auth + builtin kill-switch fix). Closing to free CI concurrency.

@riderx riderx closed this Jul 31, 2026
@riderx riderx reopened this Jul 31, 2026
@riderx

riderx commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Temporarily closing so push-only CI can finish without PR/push concurrency cancel. Will reopen when green.

@riderx riderx closed this Jul 31, 2026
riderx and others added 2 commits July 31, 2026 05:16
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx riderx reopened this Jul 31, 2026
@riderx
riderx marked this pull request as ready for review July 31, 2026 14:29
@cursor

cursor Bot commented Jul 31, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_f4d6727a-a4e2-47fc-b921-f4a6366375cd)

@riderx
riderx merged commit 4bf1858 into main Jul 31, 2026
66 of 87 checks passed
@riderx
riderx deleted the fix/notifications-jwt-and-builtin-killswitch branch July 31, 2026 14:31
@sonarqubecloud

Copy link
Copy Markdown

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