Refactor: eliminate duplicated stale-eviction logic and storage error handling#201
Merged
Refactor: eliminate duplicated stale-eviction logic and storage error handling#201
Conversation
Merged
…ract getStorageErrorMessage helper Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com> Agent-Logs-Url: https://github.com/ormidales/truepath/sessions/3be07f1c-7595-47e0-874c-7d833091e877
Copilot
AI
changed the title
[WIP] Release v1.0.11
Refactor: eliminate duplicated stale-eviction logic and storage error handling
Mar 26, 2026
ormidales
approved these changes
Mar 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the extension to remove duplicated logic in two places: request-tracking eviction in the background script and storage/quota error message selection in the popup UI.
Changes:
background.js: Centralize TTL stale-entry eviction by delegatingtrackInitialHostcapacity handling tocleanupStaleTrackedRequests.popup.js: Extract agetStorageErrorMessage(error)helper and reuse it in both domain-add and clear-list storage write paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| background.js | Refactors request tracking to reuse cleanupStaleTrackedRequests for TTL-based eviction before applying oldest-inserted fallback. |
| popup.js | Introduces getStorageErrorMessage to dedupe quota-vs-generic storage error messaging across UI actions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Two instances of duplicated logic identified in review: stale-entry eviction in
trackInitialHostreinvented whatcleanupStaleTrackedRequestsalready does, and the quota/storage error message selection was copy-pasted betweenaddCurrentDomainandclearDomains.background.js— delegate eviction tocleanupStaleTrackedRequestsMoved
cleanupStaleTrackedRequestsbeforetrackInitialHostand replaced the inline TTL-check loop with a direct call. Oldest-inserted fallback only runs if the map remains at capacity after cleanup.popup.js— extractgetStorageErrorMessagehelperEncapsulates the quota-vs-generic error message selection. Both
addCurrentDomainandclearDomainsnow callsetStatus(getStorageErrorMessage(error), true).⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.