Skip to content

feat: add reset() and deprecate removeUserId()#23

Merged
gunoooo merged 3 commits intomainfrom
CLIX-121
Feb 19, 2026
Merged

feat: add reset() and deprecate removeUserId()#23
gunoooo merged 3 commits intomainfrom
CLIX-121

Conversation

@gunoooo
Copy link
Contributor

@gunoooo gunoooo commented Feb 19, 2026

Summary

Add reset() method for logout support and deprecate removeUserId().

Changes

  • Add reset() method that clears all local SDK state (device ID, session) without server calls
  • Deprecate removeUserId() — use reset() instead
  • Add unit test for reset()
  • Bump version to 1.5.0

Spec

https://docs.google.com/document/d/1ET-KqAFQlODNEm08YDXehzfWuqKZsOhnr4NJG-f0P9k/edit?tab=t.0#bookmark=id.9awmqjhnpii6

Summary by CodeRabbit

  • Release

    • v1.5.0 released.
  • New Features

    • Added reset() to clear all local SDK state, including device ID and session-related state.
    • Added stop action to halt session observation.
  • Deprecations

    • removeUserId() deprecated — use reset() instead.
  • Tests

    • Added tests verifying reset triggers notification reset, session stop, and storage cleanup.

- Add reset() to clear all local SDK state including device ID
- Deprecate removeUserId() in favor of reset()
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

Walkthrough

Release 1.5.0: adds a public reset() to clear local SDK state and device ID, deprecates removeUserId() in favor of reset(), adds SessionService.stop(), updates tests to cover reset behavior, and bumps the clix version to 1.5.0.

Changes

Cohort / File(s) Summary
Core API
clix/src/main/kotlin/so/clix/core/Clix.kt
Adds public reset() that clears notification state, device ID, last activity, and initialization flag; marks removeUserId() as @Deprecated with ReplaceWith("reset()").
Session handling
clix/src/main/kotlin/so/clix/services/SessionService.kt
Adds stop() to unregister the lifecycle observer (ProcessLifecycleOwner.get().lifecycle.removeObserver(this)).
Tests
clix/src/test/kotlin/so/clix/core/ClixTest.kt
Adds SessionService and StorageService mocks; new test verifies Clix.reset() calls notificationService.reset(), sessionService.stop(), and storageService.remove() for clix_device_id and clix_session_last_activity.
Release & versioning
CHANGELOG.md, gradle/libs.versions.toml
Adds changelog entry for 1.5.0 and updates version catalog entry clix from 1.4.1 to 1.5.0.

Possibly related PRs

Suggested reviewers

  • nyanxyz
  • JeongwooYoo
  • pitzcarraldo
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: adding a new reset() method and deprecating removeUserId().

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CLIX-121

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

@coderabbitai coderabbitai bot requested a review from nyanxyz February 19, 2026 08:32
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3320ae49f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Around line 15-19: The CHANGELOG and API are out of sync: update the
implementation in Clix.kt so setUserId accepts a nullable type (change
setUserId(userId: String) to setUserId(userId: String?) and handle null by
clearing the stored user id), mark removeUserId() as deprecated with `@Deprecated`
and make it delegate to setUserId(null) (or remove its body in favor of
delegation), and update any KDoc/comments for setUserId/removeUserId to reflect
the new behavior.

In `@clix/src/main/kotlin/so/clix/core/Clix.kt`:
- Around line 155-171: reset() currently removes local storage keys but fails to
clear backend user properties and the in-memory device state; update reset() to
call deviceService.removeProjectUserId() (await/handle errors) to remove the
project-level user ID on the backend and also clear the in-memory
Clix.environment.device (remove device id and token) so no residual device
identity remains; alternatively, if backend removal must be explicit, add a
clear of Clix.environment.device and update docs/comments to state that
deviceService.removeProjectUserId() must be invoked separately for backend
cleanup (reference: reset(), deviceService.removeProjectUserId(),
Clix.environment.device, and removeUserId()).

@gunoooo gunoooo requested a review from pitzcarraldo February 19, 2026 08:38
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@clix/src/main/kotlin/so/clix/core/Clix.kt`:
- Around line 155-172: The KDoc for Clix.reset() is ambiguous about backend user
identity removal and may mislead callers given the deprecated removeUserId() had
server-side effects; update the KDoc on the `@JvmStatic` fun reset() in Clix.kt to
explicitly state that reset() only clears local SDK state (device ID, local
session) and does NOT make any server calls or clear backend user properties,
and add guidance that callers who need backend cleanup should call
removeUserId() (or the corresponding server-clearing API) before removing that
deprecated method or changing its ReplaceWith hint so callers are not silently
left with backend identity data.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
clix/src/test/kotlin/so/clix/core/ClixTest.kt (1)

132-145: Consider verifying that SDK requires re-initialization after reset().

The reset() implementation correctly sets the private isInitialized flag to false, and the test covers the service resets. However, the initialization state reset itself is not verified. Since isInitialized is private, either expose a public isInitialized() getter or add a behavioral test that verifies the SDK requires re-initialization (e.g., attempt to use a method requiring initialization and confirm it fails or re-initializes).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clix/src/test/kotlin/so/clix/core/ClixTest.kt` around lines 132 - 145, After
calling Clix.reset() the test should assert the SDK is no longer initialized;
either add a public isInitialized() accessor on Clix and assert it returns false
after Clix.reset(), or add a behavioral check by invoking a method that requires
initialization (e.g., a method like Clix.initialize() or any public API that
should fail when uninitialized such as calling session-related API) and assert
it either throws an IllegalStateException or forces re-initialization; update
the test to call Clix.reset() then use the chosen approach to verify the private
isInitialized flag was effectively cleared.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@clix/src/test/kotlin/so/clix/core/ClixTest.kt`:
- Around line 132-145: After calling Clix.reset() the test should assert the SDK
is no longer initialized; either add a public isInitialized() accessor on Clix
and assert it returns false after Clix.reset(), or add a behavioral check by
invoking a method that requires initialization (e.g., a method like
Clix.initialize() or any public API that should fail when uninitialized such as
calling session-related API) and assert it either throws an
IllegalStateException or forces re-initialization; update the test to call
Clix.reset() then use the chosen approach to verify the private isInitialized
flag was effectively cleared.

@gunoooo gunoooo merged commit 46845ed into main Feb 19, 2026
3 checks passed
@gunoooo gunoooo deleted the CLIX-121 branch February 19, 2026 09:57
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