Skip to content

fix(relay): delete devices atomically#1665

Merged
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/fix-relay-device-deletion
Jul 21, 2026
Merged

fix(relay): delete devices atomically#1665
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/fix-relay-device-deletion

Conversation

@bobleer

@bobleer bobleer commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • scope device deletion to the authenticated account so a guessed device ID cannot affect another user
  • revoke device auth tokens before deleting the device row and keep both writes in one transaction
  • return 404 Not Found for devices outside the account and add route-level regression tests

Why

auth_tokens.device_id references devices.device_id, so deleting the device first can fail while active tokens exist. The previous deletion was also not scoped by user_id. The transactional helper preserves referential integrity and prevents partial or cross-account deletion.

Test plan

  • cargo test -p bitfun-relay-service
  • node scripts/check-core-boundaries.mjs
  • cargo check --workspace
  • git diff --check

AI-assisted: yes. Testing level: fully tested with automated Rust checks.

@bobleer
bobleer merged commit a8a56fe into GCWing:main Jul 21, 2026
5 checks passed
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