Skip to content

Fixes stale cached data on account switch#5035

Merged
sergeibbb merged 3 commits intomainfrom
4943-invalidate-cached-account
Mar 16, 2026
Merged

Fixes stale cached data on account switch#5035
sergeibbb merged 3 commits intomainfrom
4943-invalidate-cached-account

Conversation

@sergeibbb
Copy link
Copy Markdown
Member

Fixes: #4943

Prevents cached data from a previous account from displaying after an account switch by incorporating a fingerprint of the active authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are re-fetched when the underlying account's access token changes, invalidating data specific to the old account. A 64-bit FNV-1a hash is introduced to generate robust session fingerprints.

Also adds a peek method to the cache to safely retrieve resolved cached values without triggering a fetch.

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

sergeibbb added a commit that referenced this pull request Mar 10, 2026
Prevents cached data from a previous account from displaying after an
account switch by incorporating a fingerprint of the active
authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are
re-fetched when the underlying account's access token changes,
invalidating data specific to the old account. A 64-bit FNV-1a hash is
introduced to generate robust session fingerprints.

Also adds a `peek` method to the cache to safely retrieve resolved
cached values without triggering a fetch.

(#4943, #5035)
@sergeibbb sergeibbb force-pushed the 4943-invalidate-cached-account branch from 53e0386 to d23d3eb Compare March 10, 2026 18:17
@sergeibbb sergeibbb requested a review from Copilot March 10, 2026 18:24
@sergeibbb sergeibbb marked this pull request as ready for review March 10, 2026 18:25
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Mar 10, 2026

🤖 Augment PR Summary

Summary: Prevents stale integration/resource cache entries from leaking across account switches by tying cache ETags to the active authentication session.

Changes:

  • Extends integration and resource cache ETags to incorporate a per-session fingerprint
  • Adds a safe cache peek helper to read resolved values without triggering fetches
  • Introduces a 64-bit FNV-1a hash helper to generate robust session fingerprints
  • Updates the changelog to document the account-switch cache fix (4942: Cached values from the previous account #4943)

Technical Notes: The session fingerprint is derived from the current auth session access token, ensuring cache invalidation when the active session changes.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/cache.ts
Comment thread src/plus/integrations/models/integration.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses stale integration/resource cache entries surfacing after switching accounts by incorporating an authentication-session fingerprint into cache ETags, forcing re-fetches when the active session changes.

Changes:

  • Add a 64-bit FNV-1a hash helper (fnv1aHash64) to generate stable session fingerprints.
  • Add IntegrationBase.sessionFingerprint derived from the current session access token.
  • Update cache ETag construction for integration/resource caches, plus add a peek helper used for resource ETags.
  • Document the fix in CHANGELOG.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/system/hash.ts Adds 64-bit FNV-1a hash to support session fingerprinting.
src/plus/integrations/models/integration.ts Introduces sessionFingerprint based on the current auth session’s token.
src/cache.ts Uses session fingerprint in cache ETags and adds peek to read resolved cached values.
CHANGELOG.md Adds a “Fixed” entry for stale cached data after account switching.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cache.ts
Comment thread src/system/hash.ts Outdated
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Prevents cached data from a previous account from displaying after an
account switch by incorporating a fingerprint of the active
authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are
re-fetched when the underlying account's access token changes,
invalidating data specific to the old account. A 64-bit FNV-1a hash is
introduced to generate robust session fingerprints.

Also adds a `peek` method to the cache to safely retrieve resolved
cached values without triggering a fetch.

(#4943, #5035)
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Updates the FNV1a hash function to use Math.imul for 32-bit integer multiplication.
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Introduces comprehensive tests for the 32-bit and 64-bit FNV-1a hash implementations.

Validates both `fnv1aHash` and `fnv1aHash64` against official test vectors from RFC 9923, ensuring correctness and adherence to the standard. The tests also verify output format and collision resistance for varied inputs.

This ensures the reliability and precision of the hash functions, particularly highlighting how the 64-bit implementation accurately matches RFC vectors by mitigating JavaScript's number precision limitations.
@sergeibbb sergeibbb force-pushed the 4943-invalidate-cached-account branch from f4290f4 to bd976be Compare March 16, 2026 17:59
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Prevents cached data from a previous account from displaying after an
account switch by incorporating a fingerprint of the active
authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are
re-fetched when the underlying account's access token changes,
invalidating data specific to the old account. A 64-bit FNV-1a hash is
introduced to generate robust session fingerprints.

Also adds a `peek` method to the cache to safely retrieve resolved
cached values without triggering a fetch.

(#4943, #5035)
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Updates the FNV1a hash function to use Math.imul for 32-bit integer multiplication.
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Introduces comprehensive tests for the 32-bit and 64-bit FNV-1a hash implementations.

Validates both `fnv1aHash` and `fnv1aHash64` against official test vectors from RFC 9923, ensuring correctness and adherence to the standard. The tests also verify output format and collision resistance for varied inputs.

This ensures the reliability and precision of the hash functions, particularly highlighting how the 64-bit implementation accurately matches RFC vectors by mitigating JavaScript's number precision limitations.
@sergeibbb sergeibbb force-pushed the 4943-invalidate-cached-account branch from bd976be to 0845f51 Compare March 16, 2026 18:35
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Prevents cached data from a previous account from displaying after an
account switch by incorporating a fingerprint of the active
authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are
re-fetched when the underlying account's access token changes,
invalidating data specific to the old account. A 64-bit FNV-1a hash is
introduced to generate robust session fingerprints.

Also adds a `peek` method to the cache to safely retrieve resolved
cached values without triggering a fetch.

(#4943, #5035)
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Updates the FNV1a hash function to use Math.imul for 32-bit integer multiplication.
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Introduces comprehensive tests for the 32-bit and 64-bit FNV-1a hash implementations.

Validates both `fnv1aHash` and `fnv1aHash64` against official test vectors from RFC 9923, ensuring correctness and adherence to the standard. The tests also verify output format and collision resistance for varied inputs.

This ensures the reliability and precision of the hash functions, particularly highlighting how the 64-bit implementation accurately matches RFC vectors by mitigating JavaScript's number precision limitations.
@sergeibbb sergeibbb force-pushed the 4943-invalidate-cached-account branch from 0845f51 to 463f058 Compare March 16, 2026 18:36
Prevents cached data from a previous account from displaying after an
account switch by incorporating a fingerprint of the active
authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are
re-fetched when the underlying account's access token changes,
invalidating data specific to the old account. A 64-bit FNV-1a hash is
introduced to generate robust session fingerprints.

Also adds a `peek` method to the cache to safely retrieve resolved
cached values without triggering a fetch.

(#4943, #5035)
Updates the FNV1a hash function to use Math.imul for 32-bit integer multiplication.
Introduces comprehensive tests for the 32-bit and 64-bit FNV-1a hash implementations.

Validates both `fnv1aHash` and `fnv1aHash64` against official test vectors from RFC 9923, ensuring correctness and adherence to the standard. The tests also verify output format and collision resistance for varied inputs.

This ensures the reliability and precision of the hash functions, particularly highlighting how the 64-bit implementation accurately matches RFC vectors by mitigating JavaScript's number precision limitations.
@sergeibbb sergeibbb force-pushed the 4943-invalidate-cached-account branch from 463f058 to d502571 Compare March 16, 2026 18:49
@sergeibbb sergeibbb merged commit aca3a72 into main Mar 16, 2026
6 checks passed
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Prevents cached data from a previous account from displaying after an
account switch by incorporating a fingerprint of the active
authentication session into cache ETags.

This ensures that cached items tied to an integration or resource are
re-fetched when the underlying account's access token changes,
invalidating data specific to the old account. A 64-bit FNV-1a hash is
introduced to generate robust session fingerprints.

Also adds a `peek` method to the cache to safely retrieve resolved
cached values without triggering a fetch.

(#4943, #5035)
sergeibbb added a commit that referenced this pull request Mar 16, 2026
Updates the FNV1a hash function to use Math.imul for 32-bit integer multiplication.
@sergeibbb sergeibbb deleted the 4943-invalidate-cached-account branch March 16, 2026 18:53
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.

4942: Cached values from the previous account

3 participants