Skip to content

consolidating storage keys#142

Draft
djanhjo wants to merge 3 commits intodevelopfrom
inapp-14355_2
Draft

consolidating storage keys#142
djanhjo wants to merge 3 commits intodevelopfrom
inapp-14355_2

Conversation

@djanhjo
Copy link
Copy Markdown
Contributor

@djanhjo djanhjo commented Apr 8, 2026

Consolidating storage key definitions into central location and typing helper functions to maintain consistency.


Note

Medium Risk
Broad refactor across queue/user/message managers to use centralized STORAGE_KEYS; a wrong key mapping would break persisted state (tokens, queue polling, SSE flags), though key strings themselves remain unchanged.

Overview
Consolidates browser storage key usage by introducing a shared STORAGE_KEYS map in local-storage.ts and updating managers/services to reference it instead of duplicating string constants.

local-storage helpers are now typed to accept StorageKey | string, and expiry cleanup uses a small isGistKey helper. Tests were updated to mock STORAGE_KEYS accordingly, and queue-service no longer exports storage-key constants (callers now use STORAGE_KEYS directly).

Reviewed by Cursor Bugbot for commit 2401653. Bugbot is set up for automated code reviews on this repo. Configure here.

@djanhjo djanhjo requested a review from a team as a code owner April 8, 2026 18:34
Comment thread src/utilities/local-storage.ts Outdated
Comment thread src/utilities/local-storage.ts Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8898245. Configure here.

getKeyFromLocalStore,
setKeyToLocalStore,
shouldPersistSession,
STORAGE_KEYS,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test mock missing sessionId key breaks getSessionId path

Low Severity

The STORAGE_KEYS mock in queue-service.test.ts only includes userQueueNextPullCheck, but queue-service.ts's getSessionId() also accesses STORAGE_KEYS.sessionId. Before this PR, sessionIdLocalStoreName was a constant defined directly in queue-service.ts and always available. Now it comes from the mocked module and resolves to undefined, causing getKeyFromLocalStore(undefined) and setKeyToLocalStore(undefined, ...) calls during tests that invoke getUserQueue().

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8898245. Configure here.

@djanhjo djanhjo marked this pull request as draft May 5, 2026 15:01
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