Skip to content

fix(cost): remove deprecated device.heartbeat tRPC route#4490

Merged
saddlepaddle merged 1 commit into
mainfrom
saddlepaddle/remove-device-heartbeat-route
May 13, 2026
Merged

fix(cost): remove deprecated device.heartbeat tRPC route#4490
saddlepaddle merged 1 commit into
mainfrom
saddlepaddle/remove-device-heartbeat-route

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented May 13, 2026

Summary

Removes device.heartbeat, accounting for ~10% of /api log volume on Vercel.

The renderer caller was removed in #2904 (2026-03-28). MINIMUM_DESKTOP_VERSION = "1.5.0" (released 2026-04-11) blocks every client that predates the caller removal from using the app — those clients hit the UpdateRequiredPage gate. The endpoint was kept "for backwards compat with shipped clients", but the only clients still polling are stuck behind that gate, and their heartbeat traffic has no downstream consumer.

heartbeat only updates device_presence.last_seen_at, which is purely cosmetic (used for ORDER BY in the MCP list-devices tool). After this change, stale-build calls return a silent tRPC NOT_FOUND — no UI affordance, no breakage.

registerDevice stays untouched — MCP's executeOnDevice still uses the device_presence row for ownership verification.

Test plan

  • CI green
  • Spot-check Vercel /api log volume drops by ~10% within an hour of deploy
  • Confirm no spike in tRPC NOT_FOUND errors in app code (only stale binaries should hit it)

Summary by cubic

Removed deprecated device.heartbeat tRPC route to eliminate unused polling and cut cost, keeping registerDevice for MCP ownership checks. Expect ~10% drop in Vercel /api log volume; stale clients are already blocked and now get tRPC NOT_FOUND.

Written for commit f216c1e. Summary will update on new commits.

Summary by CodeRabbit

  • Chores
    • Removed deprecated device synchronization procedure that was previously maintained for compatibility with older application versions. Core device registration functionality remains fully available and operational. Applications currently using this removed procedure will require code updates to maintain full compatibility and proper connectivity with the system.

Review Change Stack

The renderer caller was removed in #2904 (2026-03-28) and the
MINIMUM_DESKTOP_VERSION floor (1.5.0, 2026-04-11) blocks any client
that predates the caller removal from using the app. The endpoint
was kept "for backwards compat with shipped clients", but the only
clients still polling are stuck behind the UpdateRequiredPage gate
and their heartbeat traffic has no downstream consumer — heartbeat
only updates devicePresence.lastSeenAt, which is purely cosmetic
(MCP list-devices ORDER BY).

Removing the route turns those stale-build calls into a silent tRPC
NOT_FOUND. registerDevice stays — MCP's executeOnDevice still uses
the row for ownership verification.

Trims ~10% of /api log volume on Vercel.
@capy-ai
Copy link
Copy Markdown

capy-ai Bot commented May 13, 2026

Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e8a41c91-c326-44e0-9f4b-2e23daf41b86

📥 Commits

Reviewing files that changed from the base of the PR and between 274a808 and f216c1e.

📒 Files selected for processing (1)
  • packages/trpc/src/router/device/device.ts

📝 Walkthrough

Walkthrough

Removes the deprecated heartbeat mutation from deviceRouter to eliminate backwards-compatibility code for older desktop and mobile clients. The registerDevice procedure continues unchanged.

Changes

Device Router Cleanup

Layer / File(s) Summary
Remove deprecated heartbeat mutation
packages/trpc/src/router/device/device.ts
The heartbeat mutation procedure is removed from deviceRouter, which previously maintained backwards compatibility with older clients. Only registerDevice remains as an active router procedure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A heartbeat once kept old friends near,
But time marches on, year after year,
Now deprecated code finds its rest,
Clean routers are simply the best!
One less procedure to maintain, hooray!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch saddlepaddle/remove-device-heartbeat-route

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.

@saddlepaddle saddlepaddle merged commit d1aee09 into main May 13, 2026
10 of 11 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 13, 2026

Greptile Summary

Removes the device.heartbeat tRPC procedure that accounted for ~10% of /api log volume. The endpoint updated only the cosmetic last_seen_at field in device_presence, its renderer caller was already deleted in #2904, and all clients that predate that removal are gated behind UpdateRequiredPage via MINIMUM_DESKTOP_VERSION.

  • The removal is complete: a grep for device.heartbeat across the repo returns zero results, confirming no active callers remain.
  • registerDevice is untouched; MCP's executeOnDevice ownership verification is unaffected. Stale binaries that still poll will receive a silent tRPC NOT_FOUND, which the PR description notes has no UI affordance.

Confidence Score: 5/5

Safe to merge — removes a fully orphaned endpoint with no remaining callers.

The deleted procedure had no callers in the codebase, its only side effect was updating a cosmetic last_seen_at column, and all clients old enough to still call it are blocked at the version gate before they reach the API. registerDevice and the rest of the device router are untouched.

No files require special attention.

Important Files Changed

Filename Overview
packages/trpc/src/router/device/device.ts Removes the deprecated heartbeat mutation from the device router; registerDevice is unchanged and no callers of device.heartbeat remain in the repo.

Sequence Diagram

sequenceDiagram
    participant SC as Stale Client (< 1.5.0)
    participant GW as UpdateRequiredPage Gate
    participant API as tRPC /api
    participant NC as New Client (≥ 1.5.0)

    SC->>GW: Any request
    GW-->>SC: Blocked (UpdateRequiredPage)
    Note over SC,GW: Heartbeat polls never reach API

    NC->>API: device.registerDevice (startup)
    API-->>NC: "{ device, timestamp }"
    Note over NC,API: heartbeat route no longer exists
    NC->>API: (no heartbeat polling)
Loading

Reviews (1): Last reviewed commit: "fix(cost): remove deprecated device.hear..." | Re-trigger Greptile

saddlepaddle pushed a commit that referenced this pull request May 14, 2026
* fix(trpc): suppress NOT_FOUND errors in onError handler

Old desktop clients (pre-1.5.0) still poll device.heartbeat which was
removed in #4490. Those clients are gated behind UpdateRequiredPage and
their calls have no downstream consumer, but the unconditional
console.error was generating ~84k ERROR log entries since the route
was deleted (2026-05-13).

Suppress NOT_FOUND codes entirely — any removed or mistyped procedure
hit by old clients should not pollute the error dashboard.

* fix(trpc): scope NOT_FOUND suppression to device.heartbeat path only

---------

Co-authored-by: sazabi[bot] <1815759+sazabi[bot]@users.noreply.github.com>
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