Skip to content

refactor(storage): remove the unused legacy Usage session scanner #4059

Closed

Description

@me2seeks

Context

Desktop Usage now reads canonical data through the selected Runtime Host. The legacy Storage path remains in SettingsStore, but repository-wide production-call-site inspection finds no consumer outside its own definition and dedicated tests.

Scope

  • Remove SettingsStore.usageStats and its readUsageStats import.
  • Remove packages/storage/src/usage-stats-store.ts.
  • Remove dedicated legacy-reader tests and stale public-entrypoint expectations.
  • Verify repository-wide references, package entrypoints, Storage tests, Desktop tests, typecheck, and dependency analysis.

Non-goals

  • Removing SettingsStore itself.
  • Removing projectDesktopUsageStats; it still projects Host Session IDs into Desktop namespaces.
  • Changing Runtime Host Usage, provenance, pricing, or UI behavior.
  • Changing the Runtime Host wire contract or compatibility epoch.

Acceptance

  • No production or test reference remains to the legacy scanner.
  • Desktop Usage continues to use the selected Runtime Host.
  • Storage and Desktop focused validation remains green.

Related

Activity

  1. heeoneie commented on Aug 28, 2026

    @heeoneie
    Contributor

    I'd like to take this one.

    I verified the premise before starting:

    • The only importer of usage-stats-store.js is settings-store.ts:32.
    • Desktop's settings:usageStats IPC handler resolves through loadUsageStats(deps.client, ...) in runtime-host-usage-ipc-main.ts — the Runtime Host client, not SettingsStore. The single .usageStats( call site in the repository is window.maka.settings.usageStats(range, host) at settings-surface.tsx:636, which goes through that same Host path.
    • @maka/core/usage-stats/* is a separate module and stays untouched.
    • usage-stats-store is not in packages/storage's exports map, so removing it is not a public-API change.

    One thing worth flagging up front, since it is the "stale public-entrypoint expectations" part of the scope: usage-stats-store.ts imports createSqliteSessionMetadataStore, and that import is the only reason ./settings-store reaches node:sqlite. With the scanner gone, public-entrypoints.test.ts fails on only the declared entrypoints load node:sqlite until './settings-store' is dropped from SQLITE_BACKED_ENTRYPOINTS. So this change also takes @maka/storage/settings-store off the package's SQLite boundary — the direction #1257 argued for. I'll update that list in the same change and say why, as its comment asks.

    Local result so far: -696/+0 across four files. @maka/core and @maka/storage typecheck and build clean, and the Storage suite is 969 pass / 3 fail — unmodified main in the same container gives the same 3 failures (read-only and permission assertions that don't hold when the test process runs as root).

    I can't build Desktop in my environment (Electron postinstall and one registry dependency are blocked), so the Desktop side is verified by reference inspection only. I'll state that explicitly in the PR rather than imply I ran it.

  2. added
    help wanted
    on Aug 29, 2026
  3. added theissue type on Aug 29, 2026
  4. Phoenix500526 commented on Aug 29, 2026

    @Phoenix500526
    Contributor

    take

  5. me2seeks commented on Aug 29, 2026

    @me2seeks
    ContributorAuthor

    take

    Hey, thx for your interest! Someone had already asked to work on this earlier, so I’ve reassigned it to them to avoid duplicate work. Thx for understanding!

  6. Lxr-max commented on Sep 15, 2026

    @Lxr-max

    take

  7. github-actions commented on Sep 15, 2026

    @github-actions

    Issue #4059 is already assigned to heeoneie, so it was not reassigned.

  8. Lxr-max commented on Sep 15, 2026

    @Lxr-max

    Noting for triage: the code for this issue already landed in #4060 (refactor(storage): remove the unused legacy Usage session scanner, merged 2026-08-29) with Refs #4059 rather than Fixes #4059, so the issue stayed open. Current main no longer contains usage-stats-store / SettingsStore.usageStats / readUsageStats.

    This issue can be closed as completed by #4060 unless maintainers want a separate checklist item kept open.

  9. Lxr-max commented on Sep 15, 2026

    @Lxr-max

    untake

  10. Astro-Han commented on Sep 17, 2026

    @Astro-Han
    Contributor

    The code for this landed in #4060 (8237a9a0d, merged 2026-08-29), which used Refs rather than Fixes, so the issue stayed open. Current main no longer contains packages/storage/src/usage-stats-store.ts, SettingsStore.usageStats, or readUsageStats, and Desktop Usage reads through the selected Runtime Host. Closing as completed by #4060.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issuehelp wanted

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions