Skip to content

fix(web): scope daily brief cache by account#1274

Open
GautamSharma99 wants to merge 1 commit into
supermemoryai:mainfrom
GautamSharma99:fix/scope-daily-brief-cache
Open

fix(web): scope daily brief cache by account#1274
GautamSharma99 wants to merge 1 commit into
supermemoryai:mainfrom
GautamSharma99:fix/scope-daily-brief-cache

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

Summary

Daily space highlights were cached only by project ID. Since default project tags
can repeat across accounts, another user signing in through the same browser
could receive the previous user’s cached highlights and suggested questions.

This PR:

  • includes user and organization IDs in the React Query key
  • includes user, organization, and project IDs in the persistent Cache API key
  • disables the highlights query until the user and organization are available
  • retires the account-agnostic space-highlights-v1 cache namespace
  • removes stale in-memory entries when the user or organization changes
  • clears persistent highlights on logout, account changes, organization changes,
    and organization reset
  • preserves the current account’s active query during cleanup

Privacy impact

Cached daily briefs can no longer be reused across accounts that share project
tags such as sm_project_default.

Previously cached entries are isolated by moving to the space-highlights-v2
namespace and deleting the legacy cache after authentication resolves.

Tests

Added regression coverage for:

  • account-scoped cache keys
  • different accounts using the same default project tag
  • safe encoding of cache-key identifiers
  • retirement of the legacy account-agnostic cache

Validation completed:

  • focused tests: 4 passing
  • Biome checks: passing

The repository-wide suite currently reports unrelated existing failures in MCP
OAuth tests, Tools tests, and memory-graph rendering tests. Repository-wide type
checking also reports existing errors outside the changed files.

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