Skip to content

feat: add reset() and deprecate removeUserId() - #30

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

gunoooo merged 3 commits into
mainfrom
CLIX-121

Conversation

@gunoooo

@gunoooo gunoooo commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

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 reset() to ClixInitCoordinator
  • 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

  • New Features

    • Added reset() to clear all local SDK state (including device identifier); SDK must be re-initialized to use afterward.
  • Deprecated

    • removeUserId() is deprecated — use reset() instead.
  • Chores

    • Package version updated to 1.5.0.

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

coderabbitai Bot commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a new Clix.reset() method that clears local SDK state and requires re-initialization, deprecates removeUserId() in favor of reset(), bumps package version to 1.5.0, and adds a 1.5.0 section to CHANGELOG.md documenting the changes.

Changes

Cohort / File(s) Summary
Changelog & Version
CHANGELOG.md, package.json
Adds a 1.5.0 changelog section and updates version from 1.4.1 to 1.5.0.
Core reset API
src/core/Clix.ts
Adds static reset(): Promise<void>, marks removeUserId() as deprecated (JSDoc), and implements state/storage/notification cleanup with error logging.
Init coordinator
src/core/ClixInitCoordinator.ts
Adds reset(): void to reinitialize internal promise/state so the coordinator can be reused after completion or failure.

Possibly related PRs

Suggested reviewers

  • pitzcarraldo
  • nyanxyz
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the two main changes: adding a reset() method and deprecating removeUserId().
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 pitzcarraldo February 19, 2026 08:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/core/Clix.ts (1)

116-127: ⚠️ Potential issue | 🟡 Minor

CHANGELOG claims setUserId() accepts null, but the implementation doesn't support it.

The CHANGELOG (line 15) states "setUserId() now accepts null to remove the user ID", but the method signature at line 107 only accepts string:

static async setUserId(userId: string): Promise<void>

Either update the signature to userId: string | null with logic to call removeProjectUserId() when null, or correct the CHANGELOG to remove this claim.

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

In `@src/core/Clix.ts` around lines 116 - 127, The CHANGELOG states setUserId()
accepts null but the implementation only accepts string; update the API to match
the changelog by changing the Clix.setUserId signature to accept userId: string
| null and implement the null-handling branch to call
this.shared?.deviceService?.removeProjectUserId() (or delegate to the existing
Clix.removeUserId() helper) after awaiting
Clix.initCoordinator.waitForInitialization(), otherwise keep current behavior
and ensure non-null values call the existing deviceService.setProjectUserId();
alternatively, if you prefer not to support null, update the CHANGELOG to remove
the claim.
🤖 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 17-19: Update the implementation and docs to be consistent: change
the setUserId signature in Clix (method setUserId) to accept string|null (or
optional) and implement treating null as clearing the user id (equivalent to
previous removeUserId behavior), update the `@deprecated` JSDoc on removeUserId /
in src/core/Clix.ts to match the CHANGELOG message, and ensure removeUserId is
marked deprecated in favor of setUserId(null) (or keep reset() as an alias if
intended) so CHANGELOG, JSDoc and runtime behavior all align.

---

Outside diff comments:
In `@src/core/Clix.ts`:
- Around line 116-127: The CHANGELOG states setUserId() accepts null but the
implementation only accepts string; update the API to match the changelog by
changing the Clix.setUserId signature to accept userId: string | null and
implement the null-handling branch to call
this.shared?.deviceService?.removeProjectUserId() (or delegate to the existing
Clix.removeUserId() helper) after awaiting
Clix.initCoordinator.waitForInitialization(), otherwise keep current behavior
and ensure non-null values call the existing deviceService.setProjectUserId();
alternatively, if you prefer not to support null, update the CHANGELOG to remove
the claim.

Comment thread CHANGELOG.md Outdated

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

Copy link
Copy Markdown

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: 32d818ffd4

ℹ️ 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".

Comment thread src/core/Clix.ts
@coderabbitai
coderabbitai Bot requested a review from nyanxyz February 19, 2026 08:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@src/core/Clix.ts`:
- Around line 129-148: The reset() implementation should be best‑effort: call
Clix.initCoordinator.waitForInitialization() in a try block but move all
cleanup/removal and this.initCoordinator.reset() into a finally block so they
run even if waitForInitialization() throws; ensure you still guard nulls
(this.shared?.sessionService?.cleanup(), liveActivityService,
notificationService, storageService.remove(...)) and log the wait error via
ClixLogger.error before proceeding, so cleanup always executes and the
coordinator is reset regardless of initialization failures.
- Around line 129-148: Clix.reset() currently only removes 'clix_device_id' and
'clix_session_last_activity' leaving persisted keys like 'clix_config' and
'clix_current_push_token' behind; update the reset() implementation (in the
Clix.reset method) to also remove 'clix_config' and 'clix_current_push_token'
from this.shared?.storageService before clearing this.shared and calling
this.initCoordinator.reset(); ensure the removals occur after waiting for
initCoordinator.waitForInitialization() and before setting shared to undefined
so all persisted SDK state is cleared as documented.

Comment thread src/core/Clix.ts
@gunoooo
gunoooo merged commit 4549e08 into main Feb 19, 2026
3 checks passed
@gunoooo
gunoooo deleted the CLIX-121 branch February 19, 2026 10:02
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