Compare commits

..
Author SHA1 Message Date
Shivam Mishra 94cc3228c8 perf: extend cache key expiry to 7 days 2026-06-10 13:03:07 +05:30
Shivam Mishra 3e65534e68 refactor: fold cache revalidation into the event dispatcher 2026-06-10 12:59:26 +05:30
Shivam Mishra 343b25842a refactor: replace teams merge mutation with full replace 2026-06-10 12:54:42 +05:30
Shivam Mishra 880c5e8bf4 refactor: configure cache api clients via constructor options 2026-06-10 12:46:10 +05:30
Shivam Mishra ac5b3a38c5 refactor: remove cold-path cache key preflight 2026-06-10 12:45:48 +05:30
Shivam Mishra 0b4d1c801c refactor: remove client-side cache key pulls 2026-06-10 12:37:11 +05:30
Shivam Mishra f452b88e8d refactor: simplify boot cache hydration to a paint-only step 2026-06-10 12:37:11 +05:30
Shivam Mishra 9fb75656d2 feat: transmit cache keys on room channel subscribe 2026-06-10 12:37:11 +05:30
Sivin VargheseandGitHub 1ccb0352d3 Merge branch 'develop' into feat/expand-idb-coverage 2026-06-09 20:55:11 +05:30
Shivam Mishra c13d59bb7f chore: update relevant columns for user 2026-06-09 15:18:16 +05:30
Shivam MishraandGitHub 08cb8e8638 Merge branch 'develop' into feat/expand-idb-coverage 2026-06-09 14:29:58 +05:30
Shivam Mishra b8629e5aa8 feat: remove http caching from cache keys 2026-06-08 19:01:24 +05:30
Shivam Mishra 91f2df8834 refactor: share cache revalidation dispatch 2026-06-08 18:47:42 +05:30
Shivam Mishra 625302ac3c refactor: deduplicate cache revalidation actions 2026-06-08 18:39:40 +05:30
Shivam Mishra 0deb026f9d fix: bump inbox cache when portal changes
The cached inbox payload embeds the portal name and slug as help_center,
but portal updates and deletes never bumped the inbox cache key, so warm
IDB caches kept showing stale help-center details. Bump the account inbox
cache key from the portal lifecycle; destroy is covered because nullify
detaches inboxes via update_all and skips their callbacks.
2026-06-08 18:28:09 +05:30
Shivam Mishra fe8c228715 fix: bump team cache when membership changes
The cached team payload embeds a per-user is_member flag, but TeamMember
create/destroy never bumped the team cache key, so warm IDB caches kept
showing a stale membership flag after a user was added to or removed from
a team. Bump the team cache key from the TeamMember lifecycle.
2026-06-08 18:27:58 +05:30
Shivam Mishra 68bd8290e5 fix: bump agent cache when custom role changes
Editing or deleting a custom role left warm IDB caches showing stale
embedded role details and permissions in the agent list, since the
account_user cache key only tracked custom_role_id on the account user.
Bump the account_user cache key from the custom role lifecycle so clients
refetch the agent list. The destroy bump is needed because dependent:
nullify updates account_users via update_all and skips their callbacks.
2026-06-08 18:17:14 +05:30
Shivam Mishra 304d5b85ef fix: revalidate cache after cable subscription 2026-06-08 18:05:14 +05:30
Shivam MishraandGitHub 81c01e7ff1 Merge branch 'develop' into feat/expand-idb-coverage 2026-06-08 17:58:14 +05:30
Shivam Mishra b8bca46ba8 fix: address cache revalidation feedback 2026-05-29 16:28:19 +05:30
Shivam MishraandGitHub 264987624d Merge branch 'develop' into feat/expand-idb-coverage 2026-05-27 16:50:30 +05:30
Shivam Mishra cf7056e379 test: update attributes 2026-05-27 15:25:36 +05:30
Shivam Mishra 60d6f7f104 feat: invalidate cache on avatar update 2026-05-27 13:13:33 +05:30
Shivam Mishra 24c1ef7807 test: update cacheable models 2026-05-27 12:52:23 +05:30
Shivam Mishra c929319045 feat: cache custom attributes in IDB 2026-05-27 12:45:30 +05:30
Shivam Mishra 5cb517612f feat: flush IndexedDB cache on DATA_VERSION bump
The idempotent upgrade only created missing object stores, so bumping
DATA_VERSION no longer reset bad or stale data — it just added stores. This
restores a bump as a true global cache flush: the upgrade now clears every
existing store before recreating any missing ones, so shipping a version
bump forces all clients to refetch fresh on next boot.

Gated on oldVersion > 0 so fresh installs skip the flush, and clearing
before creating means only pre-existing stores are touched. This is the
break-glass lever for the one non-self-healing failure mode (non-empty
store holding wrong-shaped data paired with a matching cache key), e.g.
after a serializer shape change shipped without a version bump.
2026-05-27 12:31:51 +05:30
Shivam MishraandGitHub f4c5f45327 Merge branch 'develop' into feat/expand-idb-coverage 2026-05-27 12:10:39 +05:30
Shivam MishraandGitHub be541db44f Merge branch 'develop' into feat/expand-idb-coverage 2026-05-25 15:23:53 +05:30
Shivam Mishra 4633b49c39 feat: hydrate Vuex stores from IndexedDB on boot
Cached fetches no longer issue a /cache_keys preflight per call. The client
trusts whatever it has in IDB and keeps it fresh through ActionCable
broadcasts and the existing reconnect-time batch revalidate.

On warm boots a new hydrateStoresFromCache helper seeds Vuex from IDB
before ActionCable connects, so inboxes, labels, teams, canned responses,
and agents render immediately from cache. The helper snapshots local cache
keys before fetching server keys — without that ordering the comparison
would always see "fresh" against the just-written key and stale data would
be served forever. Stale entries are revalidated in the background; cold
devices stay on the network-fetch path with no regression.

Also awaits replace inside refetchAndCommit so the data write completes
before the cache key is persisted, closing a window where a concurrent
reader could see a fresh key paired with stale data.
2026-05-21 17:22:04 +05:30
Shivam Mishra fe5c353106 feat: cache canned responses and agents in IndexedDB
Converts the canned-response and agent API clients to CacheEnabledApiClient
subclasses and wires revalidate actions into the corresponding Vuex modules,
so settings pages and pickers stop fetching the same lists on every visit.
The canned-response search box continues to bypass the cache and hit the
network directly, so server-side ordering stays authoritative.

Also fixes a pre-existing gap in teams/revalidate: SET_TEAMS merges into a
record dict by id and never removes missing entries, so a team deleted
server-side would survive a reconnect-driven revalidate. Now matches the
get action by emitting CLEAR_TEAMS first.

Each affected spec clears its IDB store before every case, since the
preflight-throws-on-axios-reject pattern they relied on is going away in the
next commit.
2026-05-21 17:21:53 +05:30
Shivam Mishra 1a61e8102e refactor: generalize ActionCable cache invalidation over the model registry
Replaces the three hardcoded dispatches in actionCable.onCacheInvalidate and
ReconnectService.revalidateCaches with a loop over cacheableModels. Adding a
new cached model no longer requires editing these two handlers — they pick
it up automatically from the registry.

Also guards against partial server payloads: dispatches are skipped for
models whose key is undefined, so a client running ahead of a server
deploy keeps working without spurious dispatches.
2026-05-21 17:21:42 +05:30
Shivam Mishra 0ae3a82339 feat: drive IndexedDB cache layer from a single registry
Introduces cacheableModels.js as the source of truth for which models the
client caches in IDB and how to dispatch their revalidate actions. DataManager
derives modelsToSync from the registry and creates object stores
idempotently, so adding new cached models needs only one place to change
plus a one-time DATA_VERSION bump.

Also fixes two latent bugs that the upcoming boot-hydration relies on:
setCacheKeys now awaits all per-key writes (was async-forEach with no await),
and replace awaits clear before push (avoids ConstraintError on rapid
refetches).
2026-05-21 17:21:33 +05:30
Shivam Mishra 991bc5a265 feat: expand workspace cache_keys to canned responses and agents
Adds CannedResponse and AccountUser to the per-account cacheable_models so
their cache keys are exposed via /cache_keys and broadcast over ActionCable
on mutation. The endpoint now delegates to Account#cache_keys instead of
listing the three models inline, so future additions only need to touch the
concern.

AccountUser uses bespoke field-gated callbacks rather than the blanket
AccountCacheRevalidator: active_at is bumped on every page navigation and
would otherwise invalidate the agent cache constantly. User adds a
cross-account callback so name/email/display_name/confirmed_at changes
propagate, since those fields appear in the agent serializer but live on
the User model.
2026-05-21 17:21:17 +05:30

Diff Content Not Available