fix(api): delete only the targeted session - #832
Merged
swolfand merged 1 commit intoJul 30, 2026
Merged
Conversation
Route Session.delete through the per-session removal endpoint so deleting one session does not remove every session attached to the client. Add a regression test covering the endpoint and session ID.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesSession deletion correction
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
swolfand
marked this pull request as ready for review
July 30, 2026 02:49
swolfand
deleted the
codex/linear-mention-mobile-603-spike-session.delete-removes-al
branch
July 30, 2026 04:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Session.delete()was documented to delete the receiver session but previously called the client-wideDELETE /client/sessionsendpoint and never used the sessionid, risking removal of all client sessions.Description
Session.delete()through the per-session endpoint by callingClerkApi.session.removeSession(id)and change its return type toClerkResult<Session, ClerkErrorResponse>.Clientimport fromSession.ktthat was associated with the bulk delete return type.SessionDeleteTestwhich verifies thatremoveSession(id)is invoked for the target session ID and thatdeleteSessions()is not called.Testing
git diff --checkto validate changes and code hygiene which reported no issues.com.clerk.api.session.SessionDeleteTestto cover the regression scenario and verify the correct API call../gradlew spotlessApply :source:api:testDebugUnitTest --tests 'com.clerk.api.session.SessionDeleteTest'but execution was blocked by the environment missing an Android SDK (ANDROID_HOME/sdk.dir), so the test could not be executed in this environment.Codex Task
Note
Fix
Session.deleteto delete only the targeted session instead of all sessionsSession.deletewas callingdeleteSessions()(DELETE /client/sessions), removing all sessions instead of just the current one. It now callsremoveSession(id)with the session's ownidand returns aClerkResult<Session>instead ofClerkResult<Client>. A new test classSessionDeleteTestverifies the correct endpoint is called anddeleteSessions()is not invoked.🖇️ Linked Issues
Resolves MOBILE-603, which identified that
Session.delete()was documented to delete the current session but instead called the bulk-delete endpoint.Macroscope summarized 7c9446f.
Summary by CodeRabbit