fix(cloud): expiry watch dedupe id must not contain a colon

Merged
SA
2d ago
+3-2

Links

  • Issue: SUPER-3018 · follows #9800

Summary

QStash rejects every publish whose deduplicationId contains : with HTTP 400 DeduplicationId cannot contain ':'. The expiry watch's id was <workspaceId>:<expiresAtMs>, so since #9800 deployed, no expiry watch was ever queued in production. queueWatch logs the failure and carries on, so nothing else broke: boxes still went to sleep through the 30-minute reconcile or a client's access call, which is the pre-#9800 latency.

Found during the production idle-expiry check of a throwaway box: the API log shows [cloud-workspace] could not queue the expiry watch … DeduplicationId cannot contain ':' on every sandbox.keepalive and cloudWorkspace.access.

Change

  • deduplicationId is now <workspaceId>-<expiresAtMs>.
  • The existing watch test asserts the new id and that it contains no colon.

Testing

  • Unit test updated; CI runs the trpc suite.
  • After deploy: wake a box, let it idle, and confirm the row flips to asleep about 5 s after sandbox_expires_at with no "could not queue" errors in the API log.

Summary by cubic

Fixes the sandbox expiry watch never being queued in production: QStash rejects deduplication IDs containing a colon, so boxes only went to sleep via the 30-minute reconcile or a client access call instead of shortly after sandbox_expires_at.

  • Changes the expiry watch deduplication ID from <workspaceId>:<expiresAtMs> to <workspaceId>-<expiresAtMs>.
  • Updates the unit test to assert the new ID and confirm it contains no colon.

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency in how scheduled cloud workspace expiration checks are identified. This helps ensure checks for different expiration times are handled separately.