refactor(storage): remove the unused legacy Usage session scanner - #4060
Open
heeoneie wants to merge 5 commits into
Open
refactor(storage): remove the unused legacy Usage session scanner#4060heeoneie wants to merge 5 commits into
heeoneie wants to merge 5 commits into
Conversation
SettingsStore.usageStats and packages/storage/src/usage-stats-store.ts have no production consumer. Desktop reads Usage through the Runtime Host client in runtime-host-usage-ipc-main.ts; the only .usageStats( call site in the repository is window.maka.settings.usageStats(range, host), which resolves through that same Host path. Refs apache#4059 Generated-by: Claude Opus 5
Its only importer was SettingsStore.usageStats, removed in this branch. Refs apache#4059 Generated-by: Claude Opus 5
These cover SettingsStore.usageStats and the legacy scanner only; both are gone. Refs apache#4059 Generated-by: Claude Opus 5
usage-stats-store.ts held the only import that pulled node:sqlite into ./settings-store's module graph. With the legacy scanner gone that entrypoint is SQLite-free, so it leaves SQLITE_BACKED_ENTRYPOINTS -- updated in the same change with the reason, as the list's own comment asks. Refs apache#4059 Generated-by: Claude Opus 5
…ne line Dropping UsageRange and UsageStats leaves three specifiers, which biome format prints inline. Caught by `npx biome format packages/storage`. Refs apache#4059 Generated-by: Claude Opus 5
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.
Summary
SettingsStore.usageStatsandpackages/storage/src/usage-stats-store.tshave no production consumer. Desktop reads Usage through the Runtime Host: thesettings:usageStatshandler inruntime-host-usage-ipc-main.tsresolves vialoadUsageStats(deps.client, ...), and the only.usageStats(call site in the repository iswindow.maka.settings.usageStats(range, host)atsettings-surface.tsx:636, which goes through that same Host path.@maka/core/usage-stats/*is a separate module and is untouched, as areSettingsStoreitself andprojectDesktopUsageStats.Removing the scanner also removes the only import that pulled
node:sqliteinto./settings-store's module graph —usage-stats-store.tsimportedcreateSqliteSessionMetadataStore.public-entrypoints.test.tsfails ononly the declared entrypoints load node:sqliteuntil'./settings-store'leavesSQLITE_BACKED_ENTRYPOINTS, so that list is updated in the same change with the reason, as its own comment asks. A consumer importing@maka/storage/settings-storeno longer pays the SQLite load.usage-stats-storeis not inpackages/storage'sexportsmap, so this is not a public-API change.Refs #4059
Verification
Ran:
tsc -p packages/core/tsconfig.jsonandtsc -p packages/storage/tsconfig.json— clean.biome lint packages/storageandbiome format packages/storage— clean. The format run is what caught the collapsed type import infd35428.@maka/storagesuite (node --test "dist/**/*.test.js"): 991 tests, 969 pass, 3 fail, 19 skipped.mainin the same container: 995 tests, 973 pass, and the same 3 failures —rejects a second authority for the same storage root in another process,does not classify a SQLite write failure as a migration blocker, andan unmarked read-only workspace fails without leaving marker state. Two of them assert that a permission denial rejects, and my test process runs as root, sochmoddoes not deny it. Unrelated to this change.readUsageStats,usage-stats-store, andSettingsStore.usageStats: no remaining reference.Not run: the Desktop build, Desktop tests, and e2e. The Electron postinstall and one registry dependency are blocked in my environment, so the Desktop side is verified by reference inspection only, not by execution. Worth a reviewer confirming
npm --workspace @maka/desktop test.AI use
Select exactly one:
Tool(s) and scope: Claude Opus 5 — call-site verification, the edits themselves, and running the checks above. Each commit carries a
Generated-by: Claude Opus 5trailer.Checklist
Does this PR entail a change in behavior?