Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Seanaye/perf/reduce notification fetching (#6841)
Sean Ayed9df3e00286a
diff --git a/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.test.ts b/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.test.tsindex d6b0945e07..ee9d7c4e8b 100644--- a/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.test.ts+++ b/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.test.ts@@ -1,5 +1,6 @@import type { EmailEntity } from '@entity/types/entity';import type { UnifiedNotification } from '@notifications/types';+import type { NotificationState } from '@service-storage/graphql/generated/graphql';import { createRoot, createSignal } from 'solid-js';import { afterEach, describe, expect, it, vi } from 'vitest';import { useSidebarUnread } from './use-sidebar-unread';@@ -8,8 +9,23 @@ const mocks = vi.hoisted(() => ({inbox: vi.fn(),email: vi.fn(),notifications: vi.fn(),+ graphqlFlag: vi.fn(),+ channels: vi.fn(),+ withLocalState: vi.fn(),+ hasUnreadEntity: vi.fn(),+ transformEntities: vi.fn(),}));+vi.mock('@app/lib/analytics/posthog', () => ({+ useFeatureFlag: () => mocks.graphqlFlag,+}));+vi.mock('@queries/channel/unread-presence', () => ({+ createChannelUnreadQuery: mocks.channels,+}));++vi.mock('@app/features/email-view/queries/email-query', () => ({+ buildEmailQuery: () => ({ params: {}, body: {} }),+}));vi.mock('@app/features/inbox-view/queries/use-inbox-query', () => ({useInboxEntitiesQuery: mocks.inbox,}));@@ -17,7 +33,10 @@ vi.mock('@queries/soup/items', () => ({useSoupAstItemsQuery: mocks.email,}));vi.mock('@components/app/GlobalAppState', () => ({- useGlobalNotificationSource: () => ({ notifications: mocks.notifications }),+ useGlobalNotificationSource: () => ({+ notifications: mocks.notifications,+ withLocalState: mocks.withLocalState,+ }),}));// Query builders import the soup barrel, which otherwise opens real sockets.vi.mock('@service-storage/websocket', () => ({@@ -64,10 +83,31 @@ afterEach(() => {vi.clearAllMocks();});-function setup() {+function setup(graphql = false) {return createRoot((cleanup) => {dispose = cleanup;+ const [graphqlEnabled, setGraphqlEnabled] = createSignal(graphql);+ const [done, setDone] = createSignal(false);+ mocks.withLocalState.mockImplementation(({ state }) =>+ done() ? 'done' : state+ );+ const [witnesses, setWitnesses] = createSignal<+ { id: string; state: NotificationState }[]+ >([]);+ mocks.graphqlFlag.mockImplementation(() => ({ enabled: graphqlEnabled() }));const [loading, setLoading] = createSignal(true);+ mocks.channels.mockReturnValue({+ get isEnabled() {+ return graphqlEnabled();+ },+ get isLoading() {+ return loading();+ },+ get data() {+ if (loading()) throw new Error('Read pending unread query');+ return witnesses();+ },+ });const [emails, setEmails] = createSignal<EmailEntity[]>([]);const [notifications, setNotifications] = createSignal<UnifiedNotification[]@@ -81,10 +121,13 @@ function setup() {return { entities: emails() };},};+ mocks.hasUnreadEntity.mockImplementation((items: EmailEntity[]) =>+ items.some((item) => !item.done && !item.isRead)+ );mocks.inbox.mockReturnValue({query,- transformEntities: (items: EmailEntity[]) =>- items.filter((item) => !item.done),+ hasUnreadEntity: mocks.hasUnreadEntity,+ transformEntities: mocks.transformEntities,});mocks.email.mockReturnValue(query);mocks.notifications.mockImplementation(notifications);@@ -93,6 +136,9 @@ function setup() {setLoading,setEmails,setNotifications,+ setWitnesses,+ setGraphqlEnabled,+ setDone,};});}@@ -103,6 +149,8 @@ describe('sidebar unread presence', () => {for (const id of ['inbox', 'mail', 'channels', 'documents', 'agents']) {expect(unread(id)).toBe(false);}+ expect(mocks.hasUnreadEntity).not.toHaveBeenCalled();+ expect(mocks.transformEntities).not.toHaveBeenCalled();expect(mocks.inbox).toHaveBeenCalledWith({tab: 'signal',facets: { read: ['unread'] },@@ -115,6 +163,8 @@ describe('sidebar unread presence', () => {setEmails([unreadEmail]);expect(unread('inbox')).toBe(true);expect(unread('mail')).toBe(true);+ expect(mocks.hasUnreadEntity).toHaveBeenLastCalledWith([unreadEmail]);+ expect(mocks.transformEntities).not.toHaveBeenCalled();setEmails([{ ...unreadEmail, isRead: true }]);expect(unread('inbox')).toBe(false);expect(unread('mail')).toBe(false);@@ -125,6 +175,54 @@ describe('sidebar unread presence', () => {expect(unread('mail')).toBe(false);});+ it('uses bounded GraphQL witnesses without reading the full feed', () => {+ const { unread, setLoading, setWitnesses, setDone } = setup(true);+ expect(unread('channels')).toBe(false);+ expect(mocks.notifications).not.toHaveBeenCalled();+ expect(mocks.channels.mock.calls[0][0]).toMatchObject({+ initial: {+ limit: 500,+ filters: {+ channelFilter: { literal: { notificationState: 'UNSEEN' } },+ },+ },+ });+ setLoading(false);+ setWitnesses([{ id: 'witness', state: 'UNSEEN' }]);+ expect(unread('channels')).toBe(true);+ setDone(true);+ expect(unread('channels')).toBe(false);+ setDone(false);+ expect(unread('channels')).toBe(true);+ setWitnesses([{ id: 'witness', state: 'SEEN' }]);+ expect(unread('channels')).toBe(false);+ setWitnesses([]);+ expect(unread('channels')).toBe(false);+ expect(mocks.notifications).not.toHaveBeenCalled();+ });++ it('follows cold-start transport changes without reading the inactive feed', () => {+ const {+ unread,+ setLoading,+ setGraphqlEnabled,+ setWitnesses,+ setNotifications,+ } = setup();+ setLoading(false);+ setNotifications([message]);+ expect(unread('channels')).toBe(true);+ mocks.notifications.mockClear();+ setGraphqlEnabled(true);+ expect(unread('channels')).toBe(false);+ setWitnesses([{ id: 'bounded', state: 'UNSEEN' }]);+ expect(unread('channels')).toBe(true);+ expect(mocks.notifications).not.toHaveBeenCalled();+ setNotifications([]);+ setGraphqlEnabled(false);+ expect(unread('channels')).toBe(false);+ });+it('uses unread channel messages, ignoring seen, completed, and other entities', () => {const { unread, setNotifications } = setup();setNotifications([message]);diff --git a/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.ts b/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.tsindex b797743249..e11fed2cde 100644--- a/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.ts+++ b/apps/web/src/components/app/sidebar-next/queries/use-sidebar-unread.ts@@ -1,16 +1,41 @@import { buildEmailQuery } from '@app/features/email-view/queries/email-query';import { soupItemMatchesInboxTab } from '@app/features/inbox-view/queries/inbox-item-filter';import { useInboxEntitiesQuery } from '@app/features/inbox-view/queries/use-inbox-query';+import {+ compileToAst,+ defineQueryFilters,+ queryStateFrom,+} from '@app/features/next-soup/filters/filter-store';import { EMPTY_TAG_FACET_CONTEXT } from '@app/features/soup/filters/facets/tag-facet';+import { useFeatureFlag } from '@app/lib/analytics/posthog';import { useGlobalNotificationSource } from '@components/app/GlobalAppState';-import { unreadFilterFn } from '@entity/utils/filter';+import { enableGraphqlSoup } from '@core/constant/featureFlags';import { notificationIsRead } from '@entity/utils/notification';+import { notificationStateFromGraphql } from '@notifications/notification-state';+import { createChannelUnreadQuery } from '@queries/channel/unread-presence';+import { makeGraphqlSoupInput } from '@queries/soup/graphql/ast';import { useSoupAstItemsQuery } from '@queries/soup/items';import { createMemo } from 'solid-js';/** Presence in the loaded unread page, never a total or a pagination loop. */export function useSidebarUnread() {const notificationSource = useGlobalNotificationSource();+ const graphqlFlag = useFeatureFlag(enableGraphqlSoup);+ const channels = createChannelUnreadQuery(+ makeGraphqlSoupInput({+ // Preserve the previous feed's 500-entity candidate bound, but select+ // only channels and one unread witness, never historical message data.+ params: { limit: 500, sort_method: 'updated_at' },+ body: compileToAst(+ queryStateFrom(+ defineQueryFilters({+ include: { channelSeen: false },+ })+ )+ ),+ }),+ () => graphqlFlag().enabled+ );const inbox = useInboxEntitiesQuery({tab: 'signal',facets: { read: ['unread'] },@@ -32,9 +57,7 @@ export function useSidebarUnread() {// Re-check cached rows: optimistic read/done changes can leave them in a page.const inboxUnread = createMemo(() => {if (inbox.query.isLoading) return false;- return inbox- .transformEntities(inbox.query.data?.entities ?? [])- .some(unreadFilterFn);+ return inbox.hasUnreadEntity(inbox.query.data?.entities ?? []);});const emailUnread = createMemo(() => {if (email.isLoading) return false;@@ -42,15 +65,27 @@ export function useSidebarUnread() {(entity) => entity.type === 'email' && !entity.isRead && !entity.done);});- const channelsUnread = createMemo(() =>- notificationSource+ const channelsUnread = createMemo(() => {+ if (graphqlFlag().enabled) {+ if (!channels.isEnabled || channels.isLoading) return false;+ return (channels.data ?? []).some((notification) => {+ const state = notificationStateFromGraphql(notification.state);+ return (+ (notificationSource.withLocalState?.({+ id: notification.id,+ state,+ }) ?? state) === 'unseen'+ );+ });+ }+ return notificationSource.notifications().some((notification) =>notification.entity_type === 'channel' &&!notificationIsRead(notification)- )- );+ );+ });return (id: string): boolean => {if (id === 'inbox') return inboxUnread();diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsxindex a18b31a33d..55f180f637 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx@@ -25,6 +25,7 @@ import { debouncedDependent } from '@core/util/debounce';import { thrownResultErrorHasCode } from '@core/util/result';import { type ChannelEntity, isChannelEntity, type WithSearch } from '@entity';import { notificationIsRead } from '@entity/utils/notification';+import { ensureNotificationSourceLoaded } from '@notifications/notification-helpers';import {useChannelLabelsQuery,useCreateChannelLabelMutation,@@ -925,20 +926,28 @@ export function ChannelsRail(props: ChannelsRailProps) {);};- const markLabelRead = (label: ChannelLabel) => {+ const markLabelRead = async (label: ChannelLabel) => {if (!channelTagsEnabled()) return;const channelIds = new Set(filterChannelLabelMembers(label.channelIds, channelsById()));- const unread = notificationSource- .notifications()- .filter(- (notification) =>- notification.entity_type === 'channel' &&- channelIds.has(notification.entity_id) &&- !notificationIsRead(notification)+ if (channelIds.size === 0) return;+ try {+ await ensureNotificationSourceLoaded(notificationSource);+ const unread = notificationSource+ .notifications()+ .filter(+ (notification) =>+ notification.entity_type === 'channel' &&+ channelIds.has(notification.entity_id) &&+ !notificationIsRead(notification)+ );+ await notificationSource.bulkMarkAsRead(unread);+ } catch (error) {+ toast.failure(+ errorMessage(error, 'Failed to mark channel label as read'));- if (unread.length > 0) void notificationSource.bulkMarkAsRead(unread);+ }};// Drops are resolved here rather than per row so a channel dragged fromdiff --git a/apps/web/src/features/inbox-view/queries/use-inbox-query.test.ts b/apps/web/src/features/inbox-view/queries/use-inbox-query.test.tsindex 51c781dcdb..19a0fa994e 100644--- a/apps/web/src/features/inbox-view/queries/use-inbox-query.test.ts+++ b/apps/web/src/features/inbox-view/queries/use-inbox-query.test.ts@@ -18,6 +18,14 @@ vi.mock('@app/features/soup', async () => ({isSettling: () => false,}),}));+// Keep data-only query tests independent of unrelated UI barrel dependencies.+vi.mock('@entity', async () => ({+ ...(await import('@entity/types/entity')),+ ...(await import('@entity/utils/notification')),+ ...(await import('@entity/utils/task-properties')),+ ...(await import('@entity/utils/company-properties')),+}));+vi.mock('@notifications', async () => await import('@notifications/types'));vi.mock('@app/lib/analytics/posthog', () => ({useFeatureFlag: () => () => ({ enabled: true }),}));diff --git a/apps/web/src/features/inbox-view/queries/use-inbox-query.ts b/apps/web/src/features/inbox-view/queries/use-inbox-query.tsindex 9eb56c0d09..e5534b1b3e 100644--- a/apps/web/src/features/inbox-view/queries/use-inbox-query.ts+++ b/apps/web/src/features/inbox-view/queries/use-inbox-query.ts@@ -28,7 +28,8 @@ import {isSnippetEntity,type WithNotification,} from '@entity';-import type { NotificationSource } from '@notifications';+import { notificationIsRead } from '@entity/utils/notification';+import type { UnifiedNotification } from '@notifications/types';import { useSoupAstItemsQuery } from '@queries/soup/items';import { startOfDay, subWeeks } from 'date-fns';import { createMemo, createSignal, onCleanup, onMount } from 'solid-js';@@ -80,16 +81,14 @@ function matchesCapabilities(}function matchesTab(- entity: WithNotification<EntityData>,+ entity: EntityData,tab: InboxTab,- source: NotificationSource+ notifications: () => UnifiedNotification[]): boolean {const notDone = () =>entity.type === 'email'? !entity.done- : getEntityNotifications(entity, source, {- scopeChannelThreads: true,- }).some((notification) => notification.state !== 'done');+ : notifications().some((notification) => notification.state !== 'done');return match(tab).with('signal', () => {if (!signalFilter(entity) || !notDone()) return false;@@ -159,11 +158,35 @@ export function useInboxEntitiesQuery(};});+ const scopedNotifications = (entity: EntityData) =>+ getEntityNotifications(entity, notificationSource, {+ scopeChannelThreads: true,+ });const filterEntities = (entities: EntityData[]) => {const context = viewContext();return entities.filter((entity) => matchesCapabilities(entity, context.capabilities))- .filter((entity) => matchesTab(entity, context.tab, notificationSource));+ .filter((entity) =>+ matchesTab(entity, context.tab, () => scopedNotifications(entity))+ );+ };++ /** Badge presence: stop at the first match without transforming the page. */+ const hasUnreadEntity = (entities: readonly EntityData[]): boolean => {+ const context = viewContext();+ return entities.some((entity) => {+ if (!matchesCapabilities(entity, context.capabilities)) return false;+ // Cache only within this visit. Membership and unread checks share the+ // same scoped snapshot, but later calls still observe optimistic changes.+ let snapshot: UnifiedNotification[] | undefined;+ const notifications = () => (snapshot ??= scopedNotifications(entity));+ if (!matchesTab(entity, context.tab, notifications)) return false;+ return entity.type === 'email'+ ? !entity.isRead+ : notifications().some(+ (notification) => !notificationIsRead(notification)+ );+ });};const attachNotifications = (entity: EntityData) =>@@ -179,6 +202,7 @@ export function useInboxEntitiesQuery(filterEntities,attachNotifications,transformEntities,+ hasUnreadEntity,notificationSource,};}diff --git a/apps/web/src/features/inbox-view/queries/use-inbox-unread.test.ts b/apps/web/src/features/inbox-view/queries/use-inbox-unread.test.tsnew file mode 100644index 0000000000..f5c2cf7ab4--- /dev/null+++ b/apps/web/src/features/inbox-view/queries/use-inbox-unread.test.ts@@ -0,0 +1,364 @@+import type { EntityWithRawNotifications } from '@app/features/soup/entity-notifications';+import type {+ ChannelEntity,+ ChannelThreadEntity,+ DocumentEntity,+ EmailEntity,+ EntityData,+} from '@entity/types/entity';+import { unreadFilterFn } from '@entity/utils/filter';+import type { UnifiedNotification } from '@notifications/types';+import { createMemo, createRoot, createSignal } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { InboxTab } from '../types';+import { useInboxEntitiesQuery } from './use-inbox-query';++const mocks = vi.hoisted(() => ({+ features: (): boolean => true,+ notificationsByEntity: vi.fn<() => Record<string, UnifiedNotification[]>>(+ () => ({})+ ),+ withLocalOverrides: vi.fn(+ (notification: UnifiedNotification) => notification+ ),+}));+vi.mock('@app/features/soup', async () => ({+ ...(await import('@app/features/soup/filters')),+ ...(await import('@app/features/soup/collection/rows')),+ useSearchContext: () => ({ entityPool: () => [] }),+ createSearchState: vi.fn(),+}));+// Keep data-only query tests independent of unrelated UI barrel dependencies.+vi.mock('@entity', async () => ({+ ...(await import('@entity/types/entity')),+ ...(await import('@entity/utils/notification')),+ ...(await import('@entity/utils/task-properties')),+ ...(await import('@entity/utils/company-properties')),+}));+vi.mock('@notifications', async () => await import('@notifications/types'));+vi.mock('@app/lib/analytics/posthog', () => ({+ useFeatureFlag: () => () => ({ enabled: mocks.features() }),+}));+vi.mock('@core/constant/featureFlags', async (importOriginal) => ({+ ...(await importOriginal<typeof import('@core/constant/featureFlags')>()),+ isFeatureEnabled: () => mocks.features(),+}));+vi.mock('@components/app/GlobalAppState', () => ({+ useGlobalNotificationSource: () => ({+ notificationsByEntity: mocks.notificationsByEntity,+ withLocalOverrides: mocks.withLocalOverrides,+ }),+}));+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'alice' }));+vi.mock('@queries/soup/items', () => ({ useSoupAstItemsQuery: () => ({}) }));+vi.mock('@service-storage/websocket', () => ({+ storageWS: { reconnectIfDisconnected: vi.fn() },+ createWebSocketJob: vi.fn(),+}));+vi.mock('@service-connection/websocket', () => ({+ ws: { addEventListener: vi.fn(), send: vi.fn() },+ state: () => 'closed',+ createConnectionBlockWebsocketEffect: vi.fn(),+ createConnectionWebsocketEffect: vi.fn(),+}));++const NOW = '2026-09-23T12:00:00Z';+const base = { id: 'row', name: 'Row', ownerId: 'alice', updatedAt: NOW };+const documentRow: DocumentEntity = { ...base, type: 'document' };+const emailRow: EmailEntity = {+ ...base,+ type: 'email',+ isRead: false,+ isDraft: false,+ isImportant: true,+ done: false,+};+const channel: ChannelEntity = {+ ...base,+ type: 'channel',+ channelType: 'public',+};+const thread: ChannelThreadEntity = {+ ...base,+ type: 'channel_thread',+ channelId: channel.id,+ messageId: 'root',+ threadId: 'root',+ senderId: 'alice',+ sender: { id: 'alice', type: 'user' },+ content: '',+ attachments: [],+ reactions: [],+ thread: { replyCount: 1, preview: [] },+};+function notification(+ id: string,+ state: UnifiedNotification['state'] = 'unseen',+ metadata: UnifiedNotification['notification_metadata'] = {+ tag: 'channel_message_send',+ content: { messageId: id, channelType: 'public' },+ }+): UnifiedNotification {+ return {+ id,+ entity_id: channel.id,+ entity_type: 'channel',+ state,+ notification_event_type: metadata.tag,+ notification_metadata: metadata,+ created_at: NOW,+ updated_at: NOW,+ sent: true,+ viewed_at: null,+ };+}+function withNotifications<T extends EntityData>(+ entity: T,+ notifications: UnifiedNotification[] | (() => UnifiedNotification[])+): EntityWithRawNotifications<T> {+ return { ...entity, notifications };+}+let dispose: (() => void) | undefined;+function setup(tab: InboxTab = 'signal') {+ return createRoot((cleanup) => {+ dispose = cleanup;+ return useInboxEntitiesQuery({ tab, facets: {} });+ });+}++beforeEach(() => {+ vi.clearAllMocks();+ vi.setSystemTime(new Date(NOW));+ mocks.features = () => true;+ mocks.notificationsByEntity.mockImplementation(() => ({}));+ mocks.withLocalOverrides.mockImplementation((notification) => notification);+});+afterEach(() => {+ dispose?.();+ vi.useRealTimers();+});++describe('Inbox unread presence', () => {+ it('stops at the first qualifying row and scopes its notifications only once', () => {+ const inbox = setup();+ const first = vi.fn(() => [notification('first')]);+ const later = vi.fn(() => [notification('later')]);+ const rows = [+ withNotifications(channel, first),+ ...Array.from({ length: 99 }, (_, index) =>+ withNotifications({ ...channel, id: `later-${index}` }, later)+ ),+ ];+ expect(inbox.hasUnreadEntity(rows)).toBe(true);+ expect(first).toHaveBeenCalledOnce();+ expect(mocks.withLocalOverrides).toHaveBeenCalledOnce();+ expect(later).not.toHaveBeenCalled();+ expect(mocks.notificationsByEntity).not.toHaveBeenCalled();++ first.mockClear();+ later.mockClear();+ mocks.withLocalOverrides.mockClear();+ expect(inbox.transformEntities(rows).some(unreadFilterFn)).toBe(true);+ expect(first).toHaveBeenCalledTimes(2);+ expect(later).toHaveBeenCalledTimes(99);+ expect(mocks.withLocalOverrides).toHaveBeenCalledTimes(101);+ });++ it('does not read email notifications and stops on an unread, non-archived email', () => {+ const inbox = setup();+ const read = vi.fn(() => []);+ expect(+ inbox.hasUnreadEntity([+ withNotifications({ ...emailRow, isRead: true }, read),+ withNotifications({ ...emailRow, done: true }, read),+ withNotifications(emailRow, read),+ withNotifications(channel, read),+ ])+ ).toBe(true);+ expect(read).not.toHaveBeenCalled();+ });++ it('retains the same answers as list transformation across membership and thread cases', () => {+ const inbox = setup();+ const reply = notification('reply', 'unseen', {+ tag: 'channel_message_reply',+ content: {+ messageId: 'reply',+ threadId: 'root',+ channelType: 'public',+ messageContent: '',+ },+ });+ const mention = notification('mention', 'unseen', {+ tag: 'channel_mention',+ content: { messageId: 'root', channelType: 'public', messageContent: '' },+ });+ const cases: [readonly EntityData[], boolean][] = [+ [[], false],+ [[{ ...emailRow, updatedAt: '2026-08-01T00:00:00Z' }], false],+ [[{ ...emailRow, isRead: true }], false],+ [[{ ...emailRow, done: true }], false],+ [[emailRow], true],+ [[withNotifications(documentRow, [notification('seen', 'seen')])], false],+ [[withNotifications(documentRow, [notification('done', 'done')])], false],+ [[withNotifications(documentRow, [])], false],+ [+ [+ withNotifications(+ { ...documentRow, updatedAt: '2026-08-01T00:00:00Z' },+ [notification('old')]+ ),+ ],+ false,+ ],+ [[withNotifications(documentRow, [notification('fresh')])], true],+ [[withNotifications(channel, [reply])], false],+ [[withNotifications(thread, [reply])], true],+ [[withNotifications({ ...thread, messageId: 'other' }, [reply])], false],+ [[withNotifications(channel, [notification('root'), reply])], false],+ [[withNotifications(channel, [mention])], false],+ [[withNotifications(thread, [mention])], true],+ [[withNotifications(channel, [reply, notification('top-level')])], true],+ [+ [+ withNotifications(channel, [+ {+ ...notification('unrelated'),+ notification_metadata: {+ tag: 'channel_invite',+ content: { channelName: 'Channel', invitedBy: 'alice' },+ },+ },+ ]),+ ],+ false,+ ],+ ];+ for (const [rows, expected] of cases) {+ expect(inbox.hasUnreadEntity(rows)).toBe(expected);+ expect(inbox.hasUnreadEntity(rows)).toBe(+ inbox.transformEntities([...rows]).some(unreadFilterFn)+ );+ }+ });++ it('skips feature-hidden rows without reading their notifications', () => {+ mocks.features = () => false;+ const inbox = setup();+ const read = vi.fn(() => [notification('hidden')]);+ const hidden: EntityData[] = [+ { ...documentRow, fileType: 'md', subType: { type: 'snippet' } },+ {+ ...base,+ type: 'calendar_event',+ status: 'confirmed',+ isReadOnly: false,+ },+ {+ ...base,+ type: 'reminder',+ description: 'Reminder',+ scheduleType: 'once',+ nextRunAt: NOW,+ enabled: true,+ },+ {+ ...base,+ type: 'foreign',+ foreignSource: 'unknown',+ rawForeignSource: 'test',+ foreignId: 'test',+ storedForId: 'team',+ storedForAuthEntity: 'team',+ metadata: {},+ },+ ];+ expect(+ inbox.hasUnreadEntity(hidden.map((row) => withNotifications(row, read)))+ ).toBe(false);+ expect(read).not.toHaveBeenCalled();+ });++ it.each(['array', 'accessor', 'global'] as const)(+ 'rechecks reactive read/done overrides without caching across calls (%s)',+ (attachment) => {+ const [states, setStates] = createSignal<UnifiedNotification['state'][]>([+ 'unseen',+ 'unseen',+ ]);+ mocks.withLocalOverrides.mockImplementation((row) => ({+ ...row,+ state: states()[row.id === 'first' ? 0 : 1],+ }));+ const rows = [notification('first'), notification('second')];+ const entities = rows.map((row, index) => {+ const entity = { ...channel, id: String(index) };+ if (attachment === 'global') return entity;+ return withNotifications(+ entity,+ attachment === 'array' ? [row] : () => [row]+ );+ });+ mocks.notificationsByEntity.mockImplementation(() => ({+ 'channel@0': [{ ...rows[0], state: states()[0] }],+ 'channel@1': [{ ...rows[1], state: states()[1] }],+ }));+ createRoot((cleanup) => {+ dispose = cleanup;+ const inbox = useInboxEntitiesQuery({ tab: 'signal', facets: {} });+ const unread = createMemo(() => inbox.hasUnreadEntity(entities));+ expect(unread()).toBe(true);+ setStates(['seen', 'unseen']);+ expect(unread()).toBe(true);+ setStates(['seen', 'done']);+ expect(unread()).toBe(false);+ setStates(['unseen', 'done']);+ expect(unread()).toBe(true);+ });+ }+ );++ it.each(['signal', 'noise', 'reminders'] as const)(+ 'reuses membership for the %s tab',+ (tab) => {+ const inbox = setup(tab);+ const noisyEmail: EmailEntity = {+ ...emailRow,+ id: 'noise',+ labels: [+ {+ id: 'CATEGORY_UPDATES',+ name: 'CATEGORY_UPDATES',+ providerLabelId: 'CATEGORY_UPDATES',+ createdAt: NOW,+ linkId: 'link',+ type: 'system',+ labelListVisibility: 'labelShow',+ messageListVisibility: 'show',+ },+ ],+ };+ const rows = [+ withNotifications(channel, [notification('channel')]),+ emailRow,+ noisyEmail,+ withNotifications(+ {+ ...base,+ type: 'reminder' as const,+ description: 'Reminder',+ scheduleType: 'once' as const,+ nextRunAt: '2026-09-24T12:00:00Z',+ enabled: true,+ },+ [notification('reminder')]+ ),+ ];+ for (const row of rows) {+ expect(inbox.hasUnreadEntity([row])).toBe(+ inbox.transformEntities([row]).some(unreadFilterFn)+ );+ }+ }+ );+});diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.tsindex a50f8f0a33..768f0e1257 100644--- a/apps/web/src/features/next-soup/utils.ts+++ b/apps/web/src/features/next-soup/utils.ts@@ -71,7 +71,7 @@ import {import {compositeEntity,getChannelNotificationParams,- markNotificationsForEntityAsRead,+ markNotificationsForEntityAsReadInBackground,type NotificationSource,notificationIsRead,setDoneOverride,@@ -793,7 +793,7 @@ export function markReminderSeenOnOpen(// Calendar events share the reminder situation: they open the calendar// component split, which has no block to clear the notification either.if (entity.type !== 'reminder' && entity.type !== 'calendar_event') return;- void markNotificationsForEntityAsRead(notificationSource, {+ void markNotificationsForEntityAsReadInBackground(notificationSource, {type: entity.type,id: entity.id,});diff --git a/apps/web/src/features/notifications/components/DebouncedNotificationReadMarker.tsx b/apps/web/src/features/notifications/components/DebouncedNotificationReadMarker.tsxindex b4ab585f99..6bdbc149a1 100644--- a/apps/web/src/features/notifications/components/DebouncedNotificationReadMarker.tsx+++ b/apps/web/src/features/notifications/components/DebouncedNotificationReadMarker.tsx@@ -3,7 +3,7 @@ import { useNonPrimaryEmailLinkIdHeader } from '@queries/email/link';import { useMarkThreadAsSeenMutation } from '@queries/email/thread';import { debounce } from '@solid-primitives/scheduled';import { onMount } from 'solid-js';-import { markNotificationsForEntityAsRead } from '../notification-helpers';+import { markNotificationsForEntityAsReadInBackground } from '../notification-helpers';import type { NotificationSource } from '../notification-source';const DEFAULT_DEBOUNCE_TIME = 2_000;@@ -55,7 +55,7 @@ export function DebouncedNotificationReadMarker(props: {<DebouncedMarkerdebounceTime={props.debounceTime}debouncedFn={() => {- void markNotificationsForEntityAsRead(+ void markNotificationsForEntityAsReadInBackground(props.notificationSource,props.entity);@@ -93,10 +93,13 @@ export const makeDebouncedChannelNotificationReadMarker = (return makeDebouncedMarker({debounceTime: props.debounceTime,debouncedFn() {- markNotificationsForEntityAsRead(props.notificationSource, {- type: 'channel',- id: props.channelId,- });+ void markNotificationsForEntityAsReadInBackground(+ props.notificationSource,+ {+ type: 'channel',+ id: props.channelId,+ }+ );},});};@@ -130,10 +133,13 @@ export function EmailDebouncedReadMarker(props: {<DebouncedMarkerdebounceTime={props.debounceTime}debouncedFn={() => {- markNotificationsForEntityAsRead(props.notificationSource, {- type: 'email_thread',- id: props.threadId,- });+ void markNotificationsForEntityAsReadInBackground(+ props.notificationSource,+ {+ type: 'email_thread',+ id: props.threadId,+ }+ );markSeenMutation.mutate({threadId: props.threadId,linkId: toHeaderLinkId(props.linkId),diff --git a/apps/web/src/features/notifications/index.ts b/apps/web/src/features/notifications/index.tsindex 4cb6ad44c6..6142a44b9c 100644--- a/apps/web/src/features/notifications/index.ts+++ b/apps/web/src/features/notifications/index.ts@@ -24,6 +24,7 @@ export {markNotificationForEntityIdAsRead,markNotificationsForEntityAsDone,markNotificationsForEntityAsRead,+ markNotificationsForEntityAsReadInBackground,notificationIsOfEntity,notificationIsOfEntityType,notificationIsRead,diff --git a/apps/web/src/features/notifications/notification-helpers.ts b/apps/web/src/features/notifications/notification-helpers.tsindex f33be1236e..9431561648 100644--- a/apps/web/src/features/notifications/notification-helpers.ts+++ b/apps/web/src/features/notifications/notification-helpers.ts@@ -171,19 +171,21 @@ export function useUnreadEntityTypeNotifications(* @param entity* @returns Promise<void>*/-export function markNotificationsForEntityAsDone(+export async function markNotificationsForEntityAsDone(notificationSource: NotificationSource,entity: Entity): Promise<void> {+ await ensureNotificationSourceLoaded(notificationSource);return notificationSource.bulkMarkAsDone(notificationSource.notificationsByEntity()[compositeEntity(entity)] ?? []);}-export function markNotificationForEntityIdAsRead(+export async function markNotificationForEntityIdAsRead(notificationSource: NotificationSource,id: string): Promise<void> {+ await ensureNotificationSourceLoaded(notificationSource);return notificationSource.bulkMarkAsRead(notificationSource.notifications()@@ -191,6 +193,16 @@ export function markNotificationForEntityIdAsRead();}+/** Cold imperative actions must load the full feed rather than act on an empty snapshot. */+export async function ensureNotificationSourceLoaded(+ notificationSource: NotificationSource+): Promise<void> {+ const query = notificationSource._notificationsQuery;+ if (!query.isStarted || query.isLoading || query.data === undefined) {+ await query.refetch();+ }+}+/*** Marks all notifications for an entity as read* @param notificationSource@@ -215,6 +227,18 @@ export async function markNotificationsForEntityAsRead();}+/** Best-effort read marker for navigation/timer callers with no awaiting UI. */+export async function markNotificationsForEntityAsReadInBackground(+ notificationSource: NotificationSource,+ entity: Entity+): Promise<void> {+ try {+ await markNotificationsForEntityAsRead(notificationSource, entity);+ } catch (error) {+ console.error('Failed to mark entity notifications as read', error);+ }+}+/*** Returns a boolean indicating whether notifications for an entity are muted* @param notificationSourcediff --git a/apps/web/src/features/notifications/notification-source.ts b/apps/web/src/features/notifications/notification-source.tsindex 55dd7d96b9..8b598f68e5 100644--- a/apps/web/src/features/notifications/notification-source.ts+++ b/apps/web/src/features/notifications/notification-source.ts@@ -21,6 +21,7 @@ import type {} from '@service-notification/generated/schemas';import { mapGraphqlNotification } from '@service-storage/graphql-soup';import { subscribeToGraphqlNotificationPatches } from '@service-storage/graphql-soup-websocket';+import { createLazyMemo } from '@solid-primitives/memo';import type { UseQueryResult } from '@tanstack/solid-query';import {type Accessor,@@ -95,6 +96,11 @@ export type NotificationSource = {notification: UnifiedNotification) => UnifiedNotification;+ /** Apply local intent to an unread witness without fetching full metadata. */+ withLocalState?: (+ notification: Pick<UnifiedNotification, 'id' | 'state'>+ ) => UnifiedNotification['state'];+/** subscribe to new notifications */subscribe: (subscribe: SubscribeFn) => UnsubscribeFn;};@@ -191,6 +197,21 @@ function setSeenOverride(ids: readonly string[], viewedAt: string | undefined) {});}+/** Applies local intent to a bounded state-only witness without loading the feed. */+function notificationStateWithLocalOverrides(+ notification: Pick<UnifiedNotification, 'id' | 'state'>+): UnifiedNotification['state'] {+ const override = doneOverrides().get(notification.id);+ const state = override?.done+ ? 'done'+ : override?.reopened+ ? 'seen'+ : override+ ? nextNotificationState(notification.state, 'MARK_UNDONE')+ : notification.state;+ return state === 'unseen' && seenOverrides[notification.id] ? 'seen' : state;+}+function withNotificationOverrides(notification: UnifiedNotification): UnifiedNotification {@@ -201,16 +222,7 @@ function withNotificationOverrides(return {...notification,get state() {- const state = doneOverride?.done- ? 'done'- : doneOverride?.reopened- ? 'seen'- : doneOverride- ? nextNotificationState(notification.state, 'MARK_UNDONE')- : notification.state;- return state === 'unseen' && seenOverrides[notification.id]- ? 'seen'- : state;+ return notificationStateWithLocalOverrides(notification);},// Only the affected id's seen state is a dependency of this row.get viewed_at() {@@ -246,7 +258,10 @@ export function createNotificationSource(// refetch flips status to error while the cached pages remain, and blanking// every unread surface over a transient refetch is worse than showing the// cached state.- const notifications = createMemo(() => {+ // A shell that only needs mute state, local overrides, or realtime callbacks+ // must not instantiate the full GraphQL notification feed at startup.+ const notifications = createLazyMemo(() => {+ if (notificationsQuery.isLoading) return [];const raw = notificationsQuery.data;if (!raw) return [];return raw.map(withNotificationOverrides);@@ -293,7 +308,7 @@ export function createNotificationSource(if (toPrune.length > 0) setSeenOverride(toPrune, undefined);});- const notificationsByEntity = createMemo(() => {+ const notificationsByEntity = createLazyMemo(() => {const data = notifications();const grouped: NotificationsByEntity = {};@@ -330,15 +345,26 @@ export function createNotificationSource(// TODO(dev-rb/notifications): Verify whether document-mention suppression is// still required, and remove this source-based cleanup when it is not.if (!ENABLE_DOCUMENT_MENTION_NOTIFICATIONS) {+ const discardDocumentMentions = async (notificationIds: string[]) => {+ try {+ await markNotificationsAsDoneMutation.mutateAsync({ notificationIds });+ } catch (error) {+ console.error(+ 'Failed to discard document mention notifications',+ error+ );+ }+ };createEffect(() => {+ // This flag defaults off in production. Cleanup may observe an activated+ // feed, but must not become the reader that wakes it during startup.+ if (!notificationsQuery.isStarted) return;const toDiscard = notifications().filter((n) =>n.notification_event_type === 'document_mention' && n.state !== 'done');if (toDiscard.length === 0) return;- void markNotificationsAsDoneMutation.mutateAsync({- notificationIds: toDiscard.map((n) => n.id),- });+ void discardDocumentMentions(toDiscard.map((n) => n.id));});}@@ -375,6 +401,9 @@ export function createNotificationSource(};const scheduleGraphqlNotificationRefetch = (): void => {+ // Still dispatch new-notification callbacks below. The first actual feed+ // reader will fetch current data; a patch must not wake an unused feed.+ if (!notificationsQuery.isStarted) return;graphqlRefetchPending = true;if (graphqlRefetchScheduled || graphqlRefetchInFlight) return;graphqlRefetchScheduled = true;@@ -517,5 +546,8 @@ export function createNotificationSource(get withLocalOverrides() {return usesGraphql() ? withNotificationOverrides : undefined;},+ get withLocalState() {+ return usesGraphql() ? notificationStateWithLocalOverrides : undefined;+ },};}diff --git a/apps/web/src/features/notifications/tests/debounced-notification-read-marker.test.tsx b/apps/web/src/features/notifications/tests/debounced-notification-read-marker.test.tsxnew file mode 100644index 0000000000..a52ee58b29--- /dev/null+++ b/apps/web/src/features/notifications/tests/debounced-notification-read-marker.test.tsx@@ -0,0 +1,100 @@+import { render } from '@solidjs/testing-library';+import { createRoot } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import {+ DebouncedNotificationReadMarker,+ EmailDebouncedReadMarker,+ makeDebouncedChannelNotificationReadMarker,+} from '../components/DebouncedNotificationReadMarker';+import type { NotificationSource } from '../notification-source';++const mocks = vi.hoisted(() => ({+ markInBackground: vi.fn(async () => {}),+ markThread: vi.fn(),+}));+vi.mock('../notification-helpers', () => ({+ markNotificationsForEntityAsReadInBackground: mocks.markInBackground,+}));+vi.mock('@queries/email/thread', () => ({+ useMarkThreadAsSeenMutation: () => ({ mutate: mocks.markThread }),+}));+vi.mock('@queries/email/link', () => ({+ useNonPrimaryEmailLinkIdHeader: () => (linkId: string | undefined) => linkId,+}));++const source = {} as NotificationSource;+let dispose: (() => void) | undefined;+beforeEach(() => {+ vi.useFakeTimers();+ vi.clearAllMocks();+});+afterEach(() => {+ dispose?.();+ vi.useRealTimers();+});++describe('background notification read markers', () => {+ it('routes automatic entity reads through the rejection-handling helper', async () => {+ const view = render(() => (+ <DebouncedNotificationReadMarker+ notificationSource={source}+ entity={{ type: 'document', id: 'doc' }}+ debounceTime={10}+ />+ ));+ dispose = view.unmount;+ await vi.advanceTimersByTimeAsync(10);+ expect(mocks.markInBackground).toHaveBeenCalledExactlyOnceWith(source, {+ type: 'document',+ id: 'doc',+ });+ });++ it('coalesces imperative channel reads through the rejection-handling helper', async () => {+ const trigger = createRoot((cleanup) => {+ dispose = cleanup;+ return makeDebouncedChannelNotificationReadMarker({+ notificationSource: source,+ channelId: 'channel',+ debounceTime: 10,+ });+ });+ trigger();+ trigger();+ trigger();+ await vi.advanceTimersByTimeAsync(10);+ expect(mocks.markInBackground).toHaveBeenCalledExactlyOnceWith(source, {+ type: 'channel',+ id: 'channel',+ });+ });++ it('keeps email read marking independent of pending notification work', async () => {+ let complete!: () => void;+ mocks.markInBackground.mockImplementationOnce(+ () =>+ new Promise<void>((resolve) => {+ complete = resolve;+ })+ );+ const view = render(() => (+ <EmailDebouncedReadMarker+ notificationSource={source}+ threadId="thread"+ linkId="secondary-inbox"+ debounceTime={10}+ />+ ));+ dispose = view.unmount;+ await vi.advanceTimersByTimeAsync(10);+ expect(mocks.markInBackground).toHaveBeenCalledExactlyOnceWith(source, {+ type: 'email_thread',+ id: 'thread',+ });+ expect(mocks.markThread).toHaveBeenCalledExactlyOnceWith({+ threadId: 'thread',+ linkId: 'secondary-inbox',+ });+ complete();+ });+});diff --git a/apps/web/src/features/notifications/tests/notification-source.test.ts b/apps/web/src/features/notifications/tests/notification-source.test.tsindex 40db991c9a..18634646d5 100644--- a/apps/web/src/features/notifications/tests/notification-source.test.ts+++ b/apps/web/src/features/notifications/tests/notification-source.test.ts@@ -4,6 +4,12 @@ import type { ConnectionGatewayWebsocket } from '@service-connection/websocket';import type { UserUnsubscribe } from '@service-notification/generated/schemas/userUnsubscribe';import { createEffect, createMemo, createRoot, createSignal } from 'solid-js';import { beforeEach, describe, expect, it, vi } from 'vitest';+import {+ markNotificationForEntityIdAsRead,+ markNotificationsForEntityAsDone,+ markNotificationsForEntityAsRead,+ markNotificationsForEntityAsReadInBackground,+} from '../notification-helpers';import {createNotificationSource,setDoneOverride,@@ -13,6 +19,7 @@ import type { UnifiedNotification } from '../types';const mocks = vi.hoisted(() => ({graphqlCacheEnabled: true,graphqlEnabled: false,+ documentMentionsEnabled: true,graphqlPatchCallback: undefined as| ((patch: Record<string, unknown>) => void)| undefined,@@ -33,7 +40,9 @@ const mocks = vi.hoisted(() => ({}));vi.mock('@core/constant/featureFlags', () => ({- ENABLE_DOCUMENT_MENTION_NOTIFICATIONS: true,+ get ENABLE_DOCUMENT_MENTION_NOTIFICATIONS() {+ return mocks.documentMentionsEnabled;+ },enableGraphqlSoup: { key: 'enable-graphql-soup' },isFeatureEnabled: () => mocks.graphqlEnabled,}));@@ -53,7 +62,18 @@ vi.mock('@queries/notification/user-notifications', () => ({optimisticInsertNotification: mocks.optimisticInsertNotification,useMarkNotificationsAsDoneMutation: () => mocks.doneMutation,useMarkNotificationsAsSeenMutation: () => mocks.seenMutation,- useUserNotificationsQuery: () => mocks.notificationsQuery,+ useUserNotificationsQuery: () => {+ if (!('isStarted' in mocks.notificationsQuery)) {+ mocks.notificationsQuery.isStarted = true;+ }+ return mocks.notificationsQuery;+ },+}));++vi.mock('@queries/client', () => ({ queryClient: {} }));+vi.mock('@queries/notification/entity-mutations', () => ({+ toNotificationEntityRef: vi.fn(),+ updateNotificationsForEntities: vi.fn(),}));vi.mock('@queries/notification/unsubscribes', () => ({@@ -104,6 +124,7 @@ describe('createNotificationSource', () => {beforeEach(() => {mocks.graphqlCacheEnabled = true;mocks.graphqlEnabled = false;+ mocks.documentMentionsEnabled = true;mocks.graphqlPatchCallback = undefined;mocks.socketCallback = undefined;mocks.optimisticInsertNotification.mockReset();@@ -116,6 +137,271 @@ describe('createNotificationSource', () => {};});+ it.each([true, false])(+ 'keeps an unused GraphQL feed asleep (document mentions enabled=%s)',+ async (enabled) => {+ mocks.documentMentionsEnabled = enabled;+ const incoming = notification(+ `lazy-notification-${enabled}`,+ 'channel',+ 'channel'+ );+ const dataRead = vi.fn(() => [incoming]);+ const refetch = vi.fn(async () => {});+ let started = false;+ mocks.notificationsQuery = {+ transport: 'graphql',+ get isStarted() {+ return started;+ },+ get isLoading() {+ started = true;+ return false;+ },+ get data() {+ return dataRead();+ },+ refetch,+ };+ const receive = vi.fn();+ const { source, dispose } = createRoot((dispose) => ({+ source: createNotificationSource(+ {} as ConnectionGatewayWebsocket,+ receive+ ),+ dispose,+ }));+ try {+ expect(source.withLocalOverrides).toBeTypeOf('function');+ expect(source.mutedEntities()).toEqual([]);+ mocks.graphqlPatchCallback?.({+ __typename: 'GraphqlNewNotification',+ notification: incoming,+ });+ await Promise.resolve();+ expect(receive).toHaveBeenCalledWith(incoming);+ expect(started).toBe(false);+ expect(dataRead).not.toHaveBeenCalled();+ expect(refetch).not.toHaveBeenCalled();++ await source.markAsRead(incoming);+ expect(+ source.withLocalState?.({ id: incoming.id, state: 'unseen' })+ ).toBe('seen');+ expect(started).toBe(false);+ expect(source.notifications()[0].state).toBe('seen');+ expect(source.notificationsByEntity()['channel@channel']).toHaveLength(+ 1+ );+ expect(started).toBe(true);+ expect(dataRead).toHaveBeenCalledOnce();+ mocks.graphqlPatchCallback?.({+ __typename: 'GraphqlUpdatedNotification',+ notification: incoming,+ });+ await Promise.resolve();+ expect(refetch).toHaveBeenCalledOnce();+ } finally {+ dispose();+ }+ }+ );++ it.each(['rest', 'graphql'] as const)(+ 'cleans up disabled document mentions only once the %s feed is active',+ async (transport) => {+ mocks.documentMentionsEnabled = false;+ const [started, setStarted] = createSignal(transport === 'rest');+ const mention = {+ ...notification(`disabled-mention-${transport}`, 'document', 'doc'),+ notification_event_type: 'document_mention',+ };+ const [rows, setRows] = createSignal([+ mention,+ { ...mention, id: 'already-done', state: 'done' as const },+ notification('ordinary', 'document', 'doc'),+ ]);+ const readData = vi.fn(() => rows());+ mocks.notificationsQuery = {+ transport,+ get isStarted() {+ return started();+ },+ isLoading: false,+ get data() {+ return readData();+ },+ isFetching: false,+ };+ const { source, dispose } = createRoot((dispose) => ({+ source: createNotificationSource({} as ConnectionGatewayWebsocket),+ dispose,+ }));+ try {+ if (transport === 'graphql') {+ expect(readData).not.toHaveBeenCalled();+ expect(mocks.doneMutation.mutateAsync).not.toHaveBeenCalled();+ setStarted(true);+ }+ expect(mocks.doneMutation.mutateAsync).toHaveBeenCalledExactlyOnceWith({+ notificationIds: [mention.id],+ });+ expect(source.notifications()).toHaveLength(3);+ setRows([{ ...mention, id: `later-${transport}` }]);+ expect(mocks.doneMutation.mutateAsync).toHaveBeenLastCalledWith({+ notificationIds: [`later-${transport}`],+ });+ await Promise.resolve();+ } finally {+ dispose();+ }+ }+ );++ it('handles document-mention cleanup failures without an unhandled rejection', async () => {+ mocks.documentMentionsEnabled = false;+ const failure = new Error('offline');+ mocks.doneMutation.mutateAsync.mockRejectedValueOnce(failure);+ mocks.notificationsQuery = {+ transport: 'graphql',+ isStarted: true,+ isLoading: false,+ data: [+ {+ ...notification('cleanup-error', 'document', 'doc'),+ notification_event_type: 'document_mention',+ },+ ],+ };+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});+ const dispose = createRoot((dispose) => {+ createNotificationSource({} as ConnectionGatewayWebsocket);+ return dispose;+ });+ try {+ await Promise.resolve();+ expect(error).toHaveBeenCalledWith(+ 'Failed to discard document mention notifications',+ failure+ );+ } finally {+ dispose();+ error.mockRestore();+ }+ });++ it('catches background read failures while leaving the awaited helper rejecting', async () => {+ const failure = new Error('offline');+ const row = notification('background-failure', 'document', 'doc');+ mocks.seenMutation.mutateAsync.mockRejectedValue(failure);+ mocks.notificationsQuery = {+ transport: 'rest',+ data: [row],+ isLoading: false,+ };+ const { source, dispose } = createRoot((dispose) => ({+ source: createNotificationSource({} as ConnectionGatewayWebsocket),+ dispose,+ }));+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});+ try {+ await expect(+ markNotificationsForEntityAsRead(source, {+ type: 'document',+ id: 'doc',+ })+ ).rejects.toBe(failure);+ await expect(+ markNotificationsForEntityAsReadInBackground(source, {+ type: 'document',+ id: 'doc',+ })+ ).resolves.toBeUndefined();+ expect(error).toHaveBeenCalledExactlyOnceWith(+ 'Failed to mark entity notifications as read',+ failure+ );+ expect(source.notifications()[0].state).toBe('unseen');+ } finally {+ dispose();+ error.mockRestore();+ }+ });++ it.each(['read', 'done'] as const)(+ 'loads a cold full feed before a bulk %s action',+ async (operation) => {+ const row = notification(`lazy-action-${operation}`, 'document', 'doc');+ let release!: () => void;+ let loaded = false;+ const pending = new Promise<void>((resolve) => {+ release = resolve;+ });+ mocks.notificationsQuery = {+ transport: 'graphql',+ isStarted: false,+ get isLoading() {+ return !loaded;+ },+ get data() {+ return loaded ? [row] : undefined;+ },+ refetch: vi.fn(async () => {+ await pending;+ loaded = true;+ }),+ };+ const { source, dispose } = createRoot((dispose) => ({+ source: createNotificationSource({} as ConnectionGatewayWebsocket),+ dispose,+ }));+ try {+ const action =+ operation === 'read'+ ? markNotificationForEntityIdAsRead(source, 'doc')+ : markNotificationsForEntityAsDone(source, {+ type: 'document',+ id: 'doc',+ });+ expect(mocks.notificationsQuery.refetch).toHaveBeenCalledOnce();+ expect(mocks.seenMutation.mutateAsync).not.toHaveBeenCalled();+ expect(mocks.doneMutation.mutateAsync).not.toHaveBeenCalled();+ release();+ await action;+ expect(+ (operation === 'read' ? mocks.seenMutation : mocks.doneMutation)+ .mutateAsync+ ).toHaveBeenCalledWith({ notificationIds: [row.id] });+ } finally {+ setDoneOverride([row.id], undefined);+ dispose();+ }+ }+ );++ it('does not silently perform an empty bulk action when cold loading fails', async () => {+ mocks.notificationsQuery = {+ transport: 'graphql',+ isStarted: false,+ isLoading: false,+ refetch: vi.fn(async () => {+ throw new Error('offline');+ }),+ };+ const { source, dispose } = createRoot((dispose) => ({+ source: createNotificationSource({} as ConnectionGatewayWebsocket),+ dispose,+ }));+ try {+ await expect(+ markNotificationForEntityIdAsRead(source, 'doc')+ ).rejects.toThrow('offline');+ expect(mocks.seenMutation.mutateAsync).not.toHaveBeenCalled();+ } finally {+ dispose();+ }+ });+it.each(['array', 'accessor'] as const)('applies done and undo to GraphQL-attached notifications (%s) before server snapshots change',(attachment) => {diff --git a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.tsindex 5e37d6ea6f..70373f1d4d 100644--- a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts+++ b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts@@ -620,6 +620,30 @@ function controlledQueryHarness(const tick = () => new Promise((resolve) => setTimeout(resolve, 10));+function deferred<T>() {+ let resolve!: (value: T) => void;+ let reject!: (error: Error) => void;+ const promise = new Promise<T>((res, rej) => {+ resolve = res;+ reject = rej;+ });+ return { promise, resolve, reject };+}++function queryResult(+ operation: Operation,+ data: unknown = { from: 'network' }+): OperationResult {+ return {+ operation,+ data,+ error: undefined,+ extensions: undefined,+ stale: false,+ hasNext: false,+ };+}+describe('normalizedCacheExchange', () => {let host: FakeHost;@@ -933,25 +957,457 @@ describe('normalizedCacheExchange', () => {expect(host.writes).toHaveLength(0);});- it('cache-and-network hit emits stale then network result', async () => {- host.scriptRead({ kind: 'hit', data: { from: 'cache' } });- const { ops, results, forwarded } = harness(host);+ it('cache-and-network starts the network before a blocked cache read settles', async () => {+ const read = deferred<ReadResult>();+ const originalRead = host.readQuery;+ host.readQuery = async (args) => {+ await originalRead(args);+ return await read.promise;+ };+ const { ops, network, results, forwarded } = controlledQueryHarness(host);ops.next(makeOp(1, 'cache-and-network'));await tick();+ expect(forwarded.map((op) => op.key)).toEqual([1]);+ expect(results).toHaveLength(0);+ read.resolve({ kind: 'hit', data: { from: 'cache' } });+ await tick();+ expect(results.map((result) => [result.data, result.stale])).toEqual([+ [{ from: 'cache' }, true],+ ]);+ network.next(queryResult(forwarded[0]!));+ await tick();+expect(results.map((r) => [r.data, r.stale])).toEqual([[{ from: 'cache' }, true],[{ from: 'network' }, false],]);expect(results.map(normalizedCacheResultMetadata)).toEqual([{ source: 'normalized-cache-hit' },- { source: 'live-network', revision: INITIAL_CACHE_REVISION },+ { source: 'live-network', persistence: expect.any(Promise) },]);+ const metadata = normalizedCacheResultMetadata(results[1]!);+ expect(metadata?.source).toBe('live-network');+ if (metadata?.source === 'live-network') {+ await expect(metadata.persistence).resolves.toBe(INITIAL_CACHE_REVISION);+ }expect(forwarded.map((op) => op.key)).toEqual([1]);expect(host.writes).toHaveLength(1);expect(host.reads).toHaveLength(1);});+ it('publishes network data before persistence and acknowledges without replaying it', async () => {+ const read = deferred<ReadResult>();+ const write = deferred<WriteResult>();+ host.readQuery = vi.fn(() => read.promise);+ host.writeQuery = vi.fn(() => write.promise);+ const { ops, results, forwarded } = harness(host);+ ops.next(makeOp(1, 'cache-and-network'));+ await tick();+ expect(forwarded).toHaveLength(1);+ expect(host.writeQuery).toHaveBeenCalledOnce();+ expect(results.map((result) => [result.data, result.stale])).toEqual([+ [{ from: 'network' }, false],+ ]);+ const metadata = normalizedCacheResultMetadata(results[0]!);+ expect(metadata).toEqual({+ source: 'live-network',+ persistence: expect.any(Promise),+ });+ read.resolve({ kind: 'hit', data: { from: 'cache' } });+ await tick();+ expect(results).toHaveLength(1);+ write.resolve({+ revision: INITIAL_CACHE_REVISION,+ revisionAdvanced: true,+ changed: [],+ affectedOps: [],+ reset: false,+ });+ await tick();+ if (metadata?.source === 'live-network') {+ await expect(metadata.persistence).resolves.toBe(INITIAL_CACHE_REVISION);+ }+ expect(results).toHaveLength(1);+ });++ it.each([false, true])(+ 'publishes later network data without waiting for an earlier write (streaming=%s)',+ async (streaming) => {+ const firstWrite = deferred<void>();+ const originalWrite = host.writeQuery;+ host.writeQuery = vi+ .fn()+ .mockImplementationOnce(async (args) => {+ await firstWrite.promise;+ return await originalWrite(args);+ })+ .mockImplementation(originalWrite);+ const { ops, network, forwarded, results } = controlledQueryHarness(host);+ ops.next(makeOp(1, 'network-only'));+ network.next({+ ...queryResult(forwarded[0]!, { version: 'A' }),+ hasNext: streaming,+ });+ await tick();+ if (!streaming) ops.next(makeOp(1, 'network-only'));+ network.next(queryResult(forwarded.at(-1)!, { version: 'B' }));+ await tick();++ expect(results.map((result) => result.data)).toEqual([+ { version: 'A' },+ { version: 'B' },+ ]);+ expect(results.map((result) => result.hasNext)).toEqual([+ streaming,+ false,+ ]);+ expect(host.writeQuery).toHaveBeenCalledOnce();+ firstWrite.resolve();+ await tick();+ expect(host.writes.map((write) => write.data)).toEqual([+ { version: 'A' },+ { version: 'B' },+ ]);+ expect(results).toHaveLength(2);+ }+ );++ it('does not let a persistence acknowledgement overwrite a newer optimistic result', async () => {+ const write = deferred<void>();+ const originalWrite = host.writeQuery;+ host.writeQuery = async (args) => {+ await write.promise;+ return await originalWrite(args);+ };+ const { ops, results, forwarded } = harness(host);+ ops.next(makeOp(1, 'network-only'));+ await tick();+ expect(results).toHaveLength(1);+ host.scriptRead({ kind: 'hit', data: { from: 'optimistic layer' } });+ host.pushAffected([1]);+ await tick();+ expect(results.at(-1)?.data).toEqual({ from: 'optimistic layer' });+ expect(results.at(-1)?.stale).toBe(false);+ write.resolve();+ await tick();++ expect(results.map((result) => result.data)).toEqual([+ { from: 'network' },+ { from: 'optimistic layer' },+ ]);+ expect(forwarded).toHaveLength(1);+ });++ it('keeps successful network data when background persistence fails', async () => {+ const write = deferred<WriteResult>();+ host.writeQuery = vi.fn(() => write.promise);+ const onCacheError = vi.fn();+ const { ops, results } = harness(host, undefined, { onCacheError });+ ops.next(makeOp(1, 'network-only'));+ await tick();+ expect(results[0]?.data).toEqual({ from: 'network' });+ const metadata = normalizedCacheResultMetadata(results[0]!);+ write.reject(new Error('disk full'));+ await tick();++ expect(onCacheError).toHaveBeenCalledOnce();+ expect(results).toHaveLength(1);+ expect(results[0]?.error).toBeUndefined();+ expect(metadata?.source).toBe('live-network');+ if (metadata?.source === 'live-network') {+ await expect(metadata.persistence).resolves.toBeUndefined();+ }+ });++ it('settles persistence even when its diagnostic callback throws', async () => {+ host.writeQuery = vi.fn().mockRejectedValue(new Error('disk full'));+ const { ops, results } = harness(host, undefined, {+ onCacheError: () => {+ throw new Error('diagnostic failed');+ },+ });+ ops.next(makeOp(1, 'network-only'));+ await tick();+ const metadata = normalizedCacheResultMetadata(results[0]!);+ expect(metadata?.source).toBe('live-network');+ if (metadata?.source === 'live-network') {+ await expect(metadata.persistence).resolves.toBeUndefined();+ }+ ops.next(makeOp(1, 'network-only'));+ await tick();+ expect(host.writeQuery).toHaveBeenCalledTimes(2);+ expect(results).toHaveLength(2);+ });++ it('publishes a network error while an earlier response is still being persisted', async () => {+ const write = deferred<void>();+ const originalWrite = host.writeQuery;+ host.writeQuery = async (args) => {+ await write.promise;+ return await originalWrite(args);+ };+ const { ops, network, forwarded, results } = controlledQueryHarness(host);+ ops.next(makeOp(1, 'network-only'));+ network.next(queryResult(forwarded[0]!, { version: 'A' }));+ await tick();+ ops.next(makeOp(1, 'network-only'));+ const error = new CombinedError({ networkError: new Error('offline') });+ network.next({ ...queryResult(forwarded[1]!), data: undefined, error });+ await tick();+ expect(results).toHaveLength(2);+ expect(results[1]?.error).toBe(error);+ write.resolve();+ await tick();+ expect(results).toHaveLength(2);+ expect(host.writes).toHaveLength(1);+ });++ it('preserves background write order without registering a torn-down query after remount', async () => {+ const firstWrite = deferred<void>();+ const originalWrite = host.writeQuery;+ host.writeQuery = vi+ .fn()+ .mockImplementationOnce(async (args) => {+ await firstWrite.promise;+ return await originalWrite(args);+ })+ .mockImplementation(originalWrite);+ const { ops, network, forwarded, results, client } =+ controlledQueryHarness(host);+ const first = makeOp(1, 'network-only');+ ops.next(first);+ network.next(queryResult(first, { version: 'A' }));+ await tick();+ ops.next(makeOp(1, 'network-only'));+ network.next(queryResult(forwarded.at(-1)!, { version: 'B' }));+ await tick();+ ops.next(teardownOf(first));+ ops.next(makeOp(1, 'network-only'));+ network.next(queryResult(forwarded.at(-1)!, { version: 'C' }));+ await tick();+ expect(results.map((result) => result.data)).toEqual([+ { version: 'A' },+ { version: 'B' },+ { version: 'C' },+ ]);+ expect(host.writeQuery).toHaveBeenCalledOnce();+ firstWrite.resolve();+ await tick();++ expect(+ host.writes.map((write) => [write.data, write.registerDependencies])+ ).toEqual([+ [{ version: 'A' }, true],+ [{ version: 'B' }, false],+ [{ version: 'C' }, true],+ ]);+ expect(results).toHaveLength(3);+ expect(client.reexecuteOperation).not.toHaveBeenCalled();+ });++ it('still waits for hydrate-only projection instead of exposing cache-only fields', async () => {+ const hydration =+ deferred<Awaited<ReturnType<CacheHost['hydrateQuery']>>>();+ host.hydrateQuery = vi.fn(() => hydration.promise);+ const { ops, results } = harness(host);+ ops.next(makeHydrationOp(1));+ await tick();+ expect(results).toHaveLength(0);+ hydration.resolve({ kind: 'void', revision: INITIAL_CACHE_REVISION });+ await tick();+ expect(results).toHaveLength(1);+ expect(results[0]?.data).toBeUndefined();+ });++ it.each(['hit', 'miss', 'error'] as const)(+ 'ignores a late cache %s after a cache-and-network response',+ async (outcome) => {+ const read = deferred<ReadResult>();+ host.readQuery = vi.fn(() => read.promise);+ const onCacheError = vi.fn();+ const { ops, results, forwarded } = harness(host, undefined, {+ onCacheError,+ });+ ops.next(makeOp(1, 'cache-and-network'));+ await tick();++ expect(forwarded).toHaveLength(1);+ expect(results.map((result) => result.data)).toEqual([+ { from: 'network' },+ ]);+ if (outcome === 'error') read.reject(new Error('late cache failure'));+ else if (outcome === 'miss') read.resolve({ kind: 'miss' });+ else read.resolve({ kind: 'hit', data: { from: 'old cache' } });+ await tick();++ expect(forwarded).toHaveLength(1);+ expect(results).toHaveLength(1);+ expect(host.writes).toHaveLength(1);+ expect(onCacheError).toHaveBeenCalledTimes(outcome === 'error' ? 1 : 0);+ }+ );++ it.each(['miss', 'error'] as const)(+ 'does not forward twice when a concurrent cache read returns %s first',+ async (outcome) => {+ const read = deferred<ReadResult>();+ host.readQuery = vi.fn(() => read.promise);+ const { ops, network, forwarded, results } = controlledQueryHarness(host);+ ops.next(makeOp(1, 'cache-and-network'));+ expect(forwarded).toHaveLength(1);++ if (outcome === 'error') read.reject(new Error('cache unavailable'));+ else read.resolve({ kind: 'miss' });+ await tick();+ expect(forwarded).toHaveLength(1);+ network.next(queryResult(forwarded[0]!));+ await tick();+ expect(results).toHaveLength(1);+ }+ );++ it('still forwards cache-and-network when readQuery throws synchronously', async () => {+ host.readQuery = vi.fn(() => {+ throw new Error('cache unavailable');+ });+ const { ops, forwarded, results } = harness(host);+ ops.next(makeOp(1, 'cache-and-network'));+ await tick();++ expect(forwarded).toHaveLength(1);+ expect(results[0]?.data).toEqual({ from: 'network' });+ });++ it('shows a late offline cache hit without erasing the network error', async () => {+ const read = deferred<ReadResult>();+ host.readQuery = vi.fn(() => read.promise);+ const error = new CombinedError({ networkError: new Error('offline') });+ const { ops, results, forwarded } = harness(host, () => ({+ data: undefined,+ error,+ }));+ ops.next(makeOp(1, 'cache-and-network'));+ await tick();+ read.resolve({ kind: 'hit', data: { from: 'old cache' } });+ await tick();++ expect(results).toHaveLength(2);+ expect(results[0]?.error).toBe(error);+ expect(results[1]?.data).toEqual({ from: 'old cache' });+ expect(results[1]?.error).toBe(error);+ expect(results[1]?.stale).toBe(false);+ expect(forwarded).toHaveLength(1);+ });++ it.each(['hit', 'miss', 'error'] as const)(+ 'fences a pending cache %s across teardown and remount of the same key',+ async (outcome) => {+ const read = deferred<ReadResult>();+ host.readQuery = vi+ .fn()+ .mockImplementationOnce(() => read.promise)+ .mockResolvedValue({ kind: 'hit', data: { from: 'remount' } });+ const { ops, forwarded, results } = controlledQueryHarness(host);+ const first = makeOp(1, 'cache-and-network');+ ops.next(first);+ ops.next(teardownOf(first));+ ops.next(makeOp(1, 'cache-only'));+ await tick();++ if (outcome === 'error') read.reject(new Error('old read failed'));+ else if (outcome === 'miss') read.resolve({ kind: 'miss' });+ else read.resolve({ kind: 'hit', data: { from: 'unmounted query' } });+ await tick();++ expect(results.map((result) => result.data)).toEqual([+ { from: 'remount' },+ ]);+ expect(forwarded.map((op) => op.kind)).toEqual(['query', 'teardown']);+ }+ );++ it('does not let an initial cache read overwrite a newer optimistic reread', async () => {+ const initialRead = deferred<ReadResult>();+ host.readQuery = vi+ .fn()+ .mockImplementationOnce(() => initialRead.promise)+ .mockResolvedValue({ kind: 'hit', data: { status: 'Completed' } });+ const { ops, results, forwarded } = controlledQueryHarness(host);+ ops.next(makeOp(1, 'cache-and-network'));+ host.pushAffected([1]);+ await tick();+ initialRead.resolve({ kind: 'hit', data: { status: 'In Review' } });+ await tick();++ expect(results.map((result) => result.data)).toEqual([+ { status: 'Completed' },+ ]);+ expect(normalizedCacheResultMetadata(results[0]!)).toEqual({+ source: 'affected-cache-reread',+ });+ expect(forwarded).toHaveLength(1);+ });++ it('preserves optimistic rereads that finish after network persistence', async () => {+ const write = deferred<WriteResult>();+ const affectedRead = deferred<ReadResult>();+ const originalWrite = host.writeQuery;+ host.writeQuery = vi.fn(async (args) => {+ await originalWrite(args);+ return await write.promise;+ });+ host.readQuery = vi+ .fn()+ .mockResolvedValueOnce({ kind: 'miss' })+ .mockImplementationOnce(() => affectedRead.promise);+ const { ops, results, forwarded } = harness(host);+ ops.next(makeOp(1, 'cache-and-network'));+ await tick();+ host.pushAffected([1]);+ write.resolve({+ revision: INITIAL_CACHE_REVISION,+ revisionAdvanced: true,+ changed: [],+ affectedOps: [],+ reset: false,+ });+ await tick();+ affectedRead.resolve({ kind: 'hit', data: { from: 'optimistic layer' } });+ await tick();++ expect(results.map((result) => result.data)).toEqual([+ { from: 'network' },+ { from: 'optimistic layer' },+ ]);+ expect(forwarded).toHaveLength(1);+ });++ it('discards an affected reread across teardown and remount', async () => {+ const affectedRead = deferred<ReadResult>();+ host.readQuery = vi+ .fn()+ .mockResolvedValueOnce({ kind: 'miss' })+ .mockImplementationOnce(() => affectedRead.promise)+ .mockResolvedValueOnce({ kind: 'hit', data: { from: 'remount' } });+ const { ops, results, forwarded } = controlledQueryHarness(host);+ const first = makeOp(1, 'cache-and-network');+ ops.next(first);+ await tick();+ host.pushAffected([1]);+ ops.next(teardownOf(first));+ ops.next(makeOp(1, 'cache-only'));+ await tick();+ affectedRead.resolve({+ kind: 'hit',+ data: { from: 'old optimistic layer' },+ });+ await tick();++ expect(results.map((result) => result.data)).toEqual([{ from: 'remount' }]);+ expect(forwarded.map((op) => op.kind)).toEqual(['query', 'teardown']);+ });+it('network-only registers dependencies without reading the cache', async () => {const { ops, results } = harness(host, undefined, ENTITY_RESOLVER_OPTIONS);ops.next(makeOp(1, 'network-only'));@@ -1184,6 +1640,55 @@ describe('normalizedCacheExchange', () => {});});+ it.each(['read', 'write'] as const)(+ 'recovers owner loss reported by a concurrent %s without another API request',+ async (failureSource) => {+ const read = deferred<ReadResult>();+ const write = deferred<WriteResult>();+ host.readQuery = vi.fn(() => read.promise);+ const originalWrite = host.writeQuery;+ host.writeQuery = vi+ .fn()+ .mockImplementationOnce(() => write.promise)+ .mockImplementation(originalWrite);+ const { ops, forwarded, results, client } = harness(host);+ ops.next(makeOp(1, 'cache-and-network'));+ await tick();+ expect(host.writeQuery).toHaveBeenCalledOnce();++ const ownerLost = Object.assign(new Error('old owner lost'), {+ errorCode: 'owner-epoch-lost',+ });+ if (failureSource === 'read') {+ read.reject(ownerLost);+ await tick();+ write.reject(new Error('replacement not ready'));+ } else {+ write.reject(ownerLost);+ }+ await tick();+ host.pushAffected([1]);+ await tick();+ if (failureSource === 'write') {+ read.reject(ownerLost);+ await tick();+ }++ expect(host.writeQuery).toHaveBeenCalledTimes(2);+ expect(host.writeQuery).toHaveBeenLastCalledWith(+ expect.objectContaining({+ opKey: 1,+ data: { from: 'network' },+ registerDependencies: true,+ })+ );+ expect(host.readQuery).toHaveBeenCalledOnce();+ expect(forwarded).toHaveLength(1);+ expect(results).toHaveLength(1);+ expect(client.reexecuteOperation).not.toHaveBeenCalled();+ }+ );+it('registers a slow fallback write without a replacement reread', async () => {let readCount = 0;host.readQuery = async (args) => {diff --git a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.ts b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.tsindex 01eba051d0..b2fac447bb 100644--- a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.ts+++ b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.ts@@ -3,18 +3,21 @@** Differences from `@urql/exchange-graphcache`:* - cache reads are **async** (the cache is disk-backed, possibly in another- * worker/process), so operations needing the network are re-injected into- * the forward pipeline through a queue after the read resolves;+ * worker/process). Cache-first misses enter the network queue after reading;+ * cache-and-network queries start the network without waiting for storage;* - invalidation is push-based: the host emits "these operation keys must* re-execute" (local sibling writes, other tabs/webviews, external* invalidations) and the exchange re-executes them as `cache-first`.** Request policies:* - `cache-first` (default): hit → emit; miss → network.- * - `cache-and-network`: hit → emit with `stale: true`, then network.- * (`toPromise()` ignores stale results, so imperative callers keep- * network-fresh semantics for free.)+ * - `cache-and-network`: read and fetch concurrently; a cache hit may emit with+ * `stale: true` only before newer results supersede that read. (`toPromise()`+ * ignores stale results, so imperative callers keep network-fresh semantics.)* - `network-only`: skip read; response still written to cache.+ * - Foreground network query results publish before persistence. Their private+ * metadata carries a revision acknowledgement for local reconciliation; writes+ * remain ordered, and acknowledgements never replay the response payload.* - `cache-only`: hit → emit; miss → emit `data: undefined`, no network.** Mutations:@@ -105,7 +108,12 @@ const NORMALIZED_CACHE_RESULT_METADATA_KEY = '__macroNormalizedCache';/** Private authority metadata attached by the normalized-cache exchange. */export type NormalizedCacheResultMetadata =- | { source: 'live-network'; revision?: CacheRevision }+ | {+ source: 'live-network';+ revision?: CacheRevision;+ /** Local-only acknowledgement; never rejects or republishes response data. */+ persistence?: Promise<CacheRevision | undefined>;+ }| { source: 'normalized-cache-hit' }| { source: 'affected-cache-reread' };@@ -120,8 +128,17 @@ export function normalizedCacheResultMetadata(return { source };}if (source !== 'live-network') return;- const revision = (metadata as { revision?: unknown }).revision;- return isCacheRevision(revision) ? { source, revision } : { source };+ const { revision, persistence } = metadata as {+ revision?: unknown;+ persistence?: unknown;+ };+ return {+ source,+ ...(isCacheRevision(revision) ? { revision } : {}),+ ...(persistence instanceof Promise+ ? { persistence: persistence as Promise<CacheRevision | undefined> }+ : {}),+ };}function withResultMetadata(@@ -441,60 +458,72 @@ export function normalizedCacheExchange(recoveryPromise?: Promise<void>;};type QueryState = {+ /** Includes background persistence for dependency/replacement ordering. */networkBoundQueries: number;+ networkRequestsInFlight: number;replacementFallback: boolean;deferredAffected: boolean;completedReplacementFallback: boolean;networkRegistrationSatisfied: boolean;retainedReplacementFallback?: RetainedReplacementFallback;networkResultVersion: number;- queryResultTurn?: Promise<void>;+ cacheReadVersion: number;+ networkError?: CombinedError;};+ // Keep write ordering across teardown/remount, including imperative queries+ // that unsubscribe as soon as the early network result reaches toPromise().+ const queryResultTurns = new Map<number, Promise<void>>();const queryStates = new Map<number, QueryState>();const queryState = (key: number): QueryState => {let state = queryStates.get(key);if (!state) {state = {networkBoundQueries: 0,+ networkRequestsInFlight: 0,replacementFallback: false,deferredAffected: false,completedReplacementFallback: false,networkRegistrationSatisfied: false,networkResultVersion: 0,+ cacheReadVersion: 0,};queryStates.set(key, state);}return state;};- const acquireQueryResultTurn = async (key: number): Promise<() => void> => {+ // Async reads must not resurrect a torn-down operation, overwrite a newer+ // network result, or undo a subsequent optimistic/affected cache reread.+ const beginCacheRead = (key: number): (() => boolean) => {const state = queryState(key);- const previous = state.queryResultTurn ?? Promise.resolve();+ const version = ++state.cacheReadVersion;+ return () =>+ activeOps.has(key) &&+ queryStates.get(key) === state &&+ state.cacheReadVersion === version;+ };++ const acquireQueryResultTurn = async (key: number): Promise<() => void> => {+ const previous = queryResultTurns.get(key) ?? Promise.resolve();let release!: () => void;const current = new Promise<void>((resolve) => {release = resolve;});- state.queryResultTurn = current;+ queryResultTurns.set(key, current);await previous;return () => {release();- if (- queryStates.get(key) === state &&- state.queryResultTurn === current- ) {- state.queryResultTurn = undefined;- }+ if (queryResultTurns.get(key) === current) queryResultTurns.delete(key);};};const invalidateOlderRetainedFallback = async (- key: number,+ state: QueryState,version: number): Promise<void> => {while (true) {- const state = queryStates.get(key);- const retained = state?.retainedReplacementFallback;- if (!state || !retained || retained.version >= version) return;+ const retained = state.retainedReplacementFallback;+ if (!retained || retained.version >= version) return;retained.invalidated = true;retained.readyPending = false;if (retained.recoveryPromise) {@@ -606,6 +635,11 @@ export function normalizedCacheExchange(const emitAffectedWhileNetworkBound = (key: number): void => {const operation = activeOps.get(key);if (!operation) return;+ const state = queryState(key);+ // Supersede the initial cache snapshot. An affected reread carries newer+ // local/optimistic state, so let it complete even if network persistence+ // finishes first; only teardown/remount may discard that update.+ state.cacheReadVersion += 1;void host.readQuery({opKey: operation.key,@@ -617,12 +651,18 @@ export function normalizedCacheExchange(}).then((read) => {const active = activeOps.get(key);- if (read.kind !== 'hit' || !active) return;+ if (read.kind !== 'hit' || !active || queryStates.get(key) !== state)+ return;// Preserve the authoritative request while immediately surfacing the// newer local view. Its eventual result still gets the deferred// cache reread below when it could not register fresh dependencies.emitAffectedResult(- cacheResult(active, read.data, true, 'affected-cache-reread')+ cacheResult(+ active,+ read.data,+ state.networkRequestsInFlight > 0,+ 'affected-cache-reread'+ ));}).catch((error) => options.onCacheError?.(error, operation));@@ -678,15 +718,19 @@ export function normalizedCacheExchange(makeSubject<Operation>();const enqueueQueryForward = (op: Operation): void => {- queryState(op.key).networkBoundQueries += 1;+ const state = queryState(op.key);+ state.networkBoundQueries += 1;+ state.networkRequestsInFlight += 1;+ state.networkError = undefined;enqueueForward(op);};const finishNetworkQuery = (key: number,+ state: QueryState,replacementRegistrationSatisfied: boolean): void => {- const state = queryState(key);+ if (queryStates.get(key) !== state) return;const remaining = state.networkBoundQueries - 1;if (remaining > 0) {state.networkBoundQueries = remaining;@@ -902,13 +946,18 @@ export function normalizedCacheExchange(enqueueForward(hydrationTransportOperation(op));return undefined;}+ const readState = queryState(op.key);+ const isCurrentRead = beginCacheRead(op.key);const policy = op.context.requestPolicy;if (policy === 'network-only') {enqueueQueryForward(op);return undefined;}+ const registrationOnly =+ op.context[REPLACEMENT_REGISTRATION_ONLY_CONTEXT_KEY] === true;+ let networkForwarded = false;try {- const read = await host.readQuery({+ const pendingRead = host.readQuery({opKey: op.key,query: queryText(op),operationName: operationName(op),@@ -919,29 +968,44 @@ export function normalizedCacheExchange(? 'user-visible': undefined,});+ // Admit the cache read first, but never wait for the worker's queue+ // before starting a request that needs the network regardless.+ if (policy === 'cache-and-network' && !registrationOnly) {+ networkForwarded = true;+ enqueueQueryForward(op);+ }+ const read = await pendingRead;+ if (!isCurrentRead()) return undefined;if (read.kind === 'hit') {- const stale = policy === 'cache-and-network';- if (stale) enqueueQueryForward(op);- return cacheResult(op, read.data, stale);+ const state = queryState(op.key);+ const stale = networkForwarded && state.networkRequestsInFlight > 0;+ return {+ ...cacheResult(op, read.data, stale),+ // A fast offline failure must not discard a slower usable cache+ // hit, nor may that hit erase the failed revalidation's error.+ error: networkForwarded ? state.networkError : undefined,+ };}if (policy === 'cache-only') {return cacheResult(op, undefined, false);}} catch (error) {options.onCacheError?.(error, op);- if (isOwnerEpochLostError(error)) {- queryState(op.key).replacementFallback = true;+ if (+ isOwnerEpochLostError(error) &&+ queryStates.get(op.key) === readState &&+ (isCurrentRead() || readState.networkBoundQueries > 0)+ ) {+ readState.replacementFallback = true;}+ if (!isCurrentRead()) return undefined;// `cache-only` must never touch the network, even when the cache// itself fails — degrade to an empty result instead.if (policy === 'cache-only') {return cacheResult(op, undefined, false);}}- if (op.context[REPLACEMENT_REGISTRATION_ONLY_CONTEXT_KEY] === true) {- return undefined;- }- enqueueQueryForward(op);+ if (!networkForwarded && !registrationOnly) enqueueQueryForward(op);return undefined;}@@ -1103,11 +1167,97 @@ export function normalizedCacheExchange(}}+ // Persistence is still ordered/durable, but foreground query consumers do+ // not await it. The acknowledgement carries only a revision: replaying the+ // old payload here would overwrite later network or optimistic results.+ async function persistQueryResult(+ result: OperationResult,+ state: QueryState,+ resultVersion: number+ ): Promise<CacheRevision | undefined> {+ const op = result.operation;+ const releaseTurn = await acquireQueryResultTurn(op.key);+ const reportError = (error: unknown): void => {+ try {+ options.onCacheError?.(error, op);+ } catch {+ // A diagnostic callback must not reject an unobserved background+ // acknowledgement or prevent releasing this query's write turn.+ }+ };+ try {+ await invalidateOlderRetainedFallback(state, resultVersion);+ if (result.data == null) return undefined;+ const isActive = () =>+ queryStates.get(op.key) === state && activeOps.has(op.key);+ const writeArgs = {+ opKey: op.key,+ query: queryText(op),+ operationName: operationName(op),+ variables: op.variables as Record<string, unknown> | undefined,+ entityResolvers,+ data: result.data,+ identity: options.extractIdentity?.(result.data),+ registerDependencies: isActive(),+ };+ const retained: RetainedReplacementFallback | undefined =+ result.error === undefined && result.hasNext !== true && isActive()+ ? {+ version: resultVersion,+ writeArgs,+ readyPending: false,+ recovering: false,+ invalidated: false,+ }+ : undefined;+ if (retained && state.replacementFallback) {+ state.retainedReplacementFallback = retained;+ }+ try {+ const write = await host.writeQuery(writeArgs);+ state.networkRegistrationSatisfied = writeArgs.registerDependencies;+ if (state.retainedReplacementFallback === retained) {+ state.retainedReplacementFallback = undefined;+ }+ return write.revision;+ } catch (error) {+ reportError(error);+ // An old-owner failure can arrive after this write started. Retain+ // only the latest successful response for replacement registration.+ if (+ retained &&+ isActive() &&+ state.networkResultVersion === resultVersion &&+ (state.replacementFallback || isOwnerEpochLostError(error))+ ) {+ state.replacementFallback = true;+ state.retainedReplacementFallback = retained;+ }+ return undefined;+ }+ } catch (error) {+ reportError(error);+ return undefined;+ } finally {+ try {+ if (result.hasNext !== true) {+ const registered = state.networkRegistrationSatisfied;+ state.networkRegistrationSatisfied = false;+ finishNetworkQuery(op.key, state, registered);+ }+ } catch (error) {+ reportError(error);+ } finally {+ releaseTurn();+ }+ }+ }+async function writeThrough(result: OperationResult): Promise<OperationResult> {const op = result.operation;- let output =+ const output =op.kind === 'query'? withResultMetadata(result, { source: 'live-network' }): result;@@ -1159,70 +1309,23 @@ export function normalizedCacheExchange(};}} else if (op.kind === 'query') {- const releaseTurn = await acquireQueryResultTurn(op.key);- try {- const state = queryState(op.key);- const resultVersion = state.networkResultVersion + 1;- state.networkResultVersion = resultVersion;- // Every newer result supersedes an older retained payload, even an- // error or intermediate streamed result with no cache write.- await invalidateOlderRetainedFallback(op.key, resultVersion);- if (result.data != null) {- const readArgs = {- opKey: op.key,- query: queryText(op),- operationName: operationName(op),- variables: op.variables as Record<string, unknown> | undefined,- entityResolvers,- };- const writeArgs = {- ...readArgs,- data: result.data,- identity: options.extractIdentity?.(result.data),- registerDependencies: activeOps.has(op.key),- };- const retained: RetainedReplacementFallback | undefined =- result.error === undefined &&- result.hasNext !== true &&- activeOps.has(op.key) &&- state.replacementFallback- ? {- version: resultVersion,- writeArgs,- readyPending: false,- recovering: false,- invalidated: false,- }- : undefined;- if (retained) {- // Install before the first write: replacement-ready pushes can- // arrive synchronously while the cache attempt is settling.- state.retainedReplacementFallback = retained;- }- try {- const write = await host.writeQuery(writeArgs);- output = withResultMetadata(result, {- source: 'live-network',- revision: write.revision,- });- state.networkRegistrationSatisfied =- writeArgs.registerDependencies;- if (state.retainedReplacementFallback === retained) {- state.retainedReplacementFallback = undefined;- }- } catch (error) {- options.onCacheError?.(error, op);- }- }- if (result.hasNext !== true) {- const registrationSatisfied = state.networkRegistrationSatisfied;- state.networkRegistrationSatisfied = false;- finishNetworkQuery(op.key, registrationSatisfied);- }- } finally {- if (!activeOps.has(op.key)) queryStates.delete(op.key);- releaseTurn();+ const state = queryState(op.key);+ const version = ++state.networkResultVersion;+ if (result.hasNext !== true) {+ state.networkRequestsInFlight = Math.max(+ 0,+ state.networkRequestsInFlight - 1+ );}+ state.networkError = result.error;+ // Publication, not persistence, supersedes an older cache snapshot.+ // A failed network request still permits a slower offline cache hit.+ if (result.data != null) state.cacheReadVersion += 1;+ const persistence = persistQueryResult(result, state, version);+ return withResultMetadata(result, {+ source: 'live-network',+ persistence,+ });} else if (op.kind === 'mutation') {const attempt = queueAttemptOf(op);if (attempt) {diff --git a/apps/web/src/lib/queries/channel/unread-presence.test.ts b/apps/web/src/lib/queries/channel/unread-presence.test.tsnew file mode 100644index 0000000000..6ea4bb18a0--- /dev/null+++ b/apps/web/src/lib/queries/channel/unread-presence.test.ts@@ -0,0 +1,116 @@+import { ChannelUnreadPresenceDocument } from '@service-storage/graphql/generated/graphql';+import { createClient, type Operation, type OperationResult } from '@urql/core';+import { createRoot, createSignal } from 'solid-js';+import { describe, expect, it, vi } from 'vitest';+import { makeSubject, pipe, subscribe } from 'wonka';+import {+ getChannelListRevalidations,+ revalidateChannelLists,+} from '../soup/graphql/channel-list-revalidation';+import { createChannelUnreadQuery } from './unread-presence';++const clientMock = vi.hoisted(() => vi.fn());+vi.mock('@service-storage/graphql-soup', () => ({+ getGraphqlSoupClient: clientMock,+}));++function setup() {+ const operations: Operation[] = [];+ const network = makeSubject<OperationResult>();+ const client = createClient({+ url: 'http://test/graphql',+ exchanges: [+ () => (ops) => {+ pipe(+ ops,+ subscribe((op) => operations.push(op))+ );+ return network.source;+ },+ ],+ });+ clientMock.mockReturnValue(client);+ const root = createRoot((dispose) => {+ const [enabled, setEnabled] = createSignal(false);+ const query = createChannelUnreadQuery(+ { initial: { limit: 500 } },+ enabled+ );+ return { dispose, query, setEnabled };+ });+ const respond = (state: 'UNSEEN' | 'SEEN') =>+ network.next({+ operation: operations.filter((op) => op.kind === 'query').at(-1)!,+ stale: false,+ hasNext: false,+ data: {+ user: {+ id: 'viewer',+ soup: {+ items: [+ {+ __typename: 'GraphqlSoupChannel',+ id: 'channel',+ unreadNotifications: [{ id: 'one', state }],+ },+ ],+ },+ },+ },+ });+ return { ...root, operations, respond, client };+}++describe('channel unread presence query', () => {+ it('loads only when enabled and retains reactive witness states', async () => {+ const f = setup();+ try {+ expect(f.operations.filter((op) => op.kind === 'query')).toHaveLength(0);+ expect(getChannelListRevalidations()).toHaveLength(0);+ f.setEnabled(true);+ expect(f.query.isLoading).toBe(true);+ await vi.waitFor(() =>+ expect(f.operations.filter((op) => op.kind === 'query')).toHaveLength(1)+ );+ expect(f.operations[0].query).toEqual(ChannelUnreadPresenceDocument);+ f.respond('UNSEEN');+ expect(f.query.data).toEqual([{ id: 'one', state: 'UNSEEN' }]);+ f.respond('SEEN');+ expect(f.query.data).toEqual([{ id: 'one', state: 'SEEN' }]);+ expect(getChannelListRevalidations()).toEqual([+ {+ document: ChannelUnreadPresenceDocument,+ variables: { input: { initial: { limit: 500 } } },+ },+ ]);+ f.setEnabled(false);+ expect(getChannelListRevalidations()).toHaveLength(0);+ } finally {+ f.dispose();+ }+ });++ it('shares bounded notification revalidation and unregisters on disposal', async () => {+ const f = setup();+ try {+ f.setEnabled(true);+ await vi.waitFor(() =>+ expect(f.operations.filter((op) => op.kind === 'query')).toHaveLength(1)+ );+ f.respond('UNSEEN');+ const query = vi.fn(() => ({ toPromise: async () => ({ data: {} }) }));+ await revalidateChannelLists({ query } as unknown as Pick<+ typeof f.client,+ 'query'+ >);+ expect(query).toHaveBeenCalledWith(+ ChannelUnreadPresenceDocument,+ { input: { initial: { limit: 500 } } },+ { requestPolicy: 'network-only' }+ );+ } finally {+ f.dispose();+ }+ expect(getChannelListRevalidations()).toHaveLength(0);+ });+});diff --git a/apps/web/src/lib/queries/channel/unread-presence.ts b/apps/web/src/lib/queries/channel/unread-presence.tsnew file mode 100644index 0000000000..9f43d28c8e--- /dev/null+++ b/apps/web/src/lib/queries/channel/unread-presence.ts@@ -0,0 +1,51 @@+import { createUrqlQuery } from '@app/lib/urql-solid';+import {+ ChannelUnreadPresenceDocument,+ type ChannelUnreadPresenceQuery,+ type SoupInput,+} from '@service-storage/graphql/generated/graphql';+import { getGraphqlSoupClient } from '@service-storage/graphql-soup';+import { type Accessor, onCleanup } from 'solid-js';+import {+ registerActiveGraphqlSoupQuery,+ registerGraphqlSoupRevalidations,+} from '../soup/graphql/active-queries';++function unreadWitnesses(data: ChannelUnreadPresenceQuery) {+ return data.user.soup.items.flatMap((item) =>+ item.__typename === 'GraphqlSoupChannel' ? item.unreadNotifications : []+ );+}++/** Bounded unread evidence for the sidebar, independent of the full feed. */+export function createChannelUnreadQuery(+ input: SoupInput,+ enabled: Accessor<boolean>+) {+ const variables = { input };+ const query = createUrqlQuery(() => ({+ query: ChannelUnreadPresenceDocument,+ client: getGraphqlSoupClient(),+ variables,+ enabled: enabled(),+ requestPolicy: 'cache-and-network',+ select: unreadWitnesses,+ }));+ onCleanup(+ registerGraphqlSoupRevalidations(() =>+ enabled() ? [{ document: ChannelUnreadPresenceDocument, variables }] : []+ )+ );+ onCleanup(+ registerActiveGraphqlSoupQuery({+ isEnabled: enabled,+ refresh: async () => {+ await query.refetch({+ requestPolicy: 'network-only',+ throwOnError: true,+ });+ },+ })+ );+ return query;+}diff --git a/apps/web/src/lib/queries/notification/tests/user-notifications.test.tsx b/apps/web/src/lib/queries/notification/tests/user-notifications.test.tsxindex 4b00ebb454..c5be727b1d 100644--- a/apps/web/src/lib/queries/notification/tests/user-notifications.test.tsx+++ b/apps/web/src/lib/queries/notification/tests/user-notifications.test.tsx@@ -9,7 +9,13 @@ import type { GetAllUserNotificationsResponse } from '@service-notification/geneimport { QueryClient, QueryClientProvider } from '@tanstack/solid-query';import { createClient, type Operation } from '@urql/core';import { ok } from 'neverthrow';-import { type Accessor, createMemo, createSignal, type JSX } from 'solid-js';+import {+ type Accessor,+ createEffect,+ createMemo,+ createSignal,+ type JSX,+} from 'solid-js';import { render } from 'solid-js/web';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { filter, map, pipe } from 'wonka';@@ -359,6 +365,72 @@ describe('useUserNotificationsQuery transport facade', () => {testQueryClient.clear();});+ it('defers the full GraphQL feed until a data/status reader needs it, preserving pagination', async () => {+ createGraphqlQueryMock.mockClear();+ restUserNotificationsMock.mockClear();+ const fetchNextPage = vi.fn(async () => {});+ const refetch = vi.fn(async () => {});+ createGraphqlQueryMock.mockReturnValue({+ data: [],+ error: null,+ isLoading: false,+ isFetching: false,+ isFetchingNextPage: false,+ hasNextPage: true,+ fetchNextPage,+ refetch,+ });+ let query!: UserNotificationsQuery;+ const dispose = renderWithClient(() => {+ query = useUserNotificationsQuery(() => ({ limit: 500 }));+ return <div />;+ });+ try {+ expect(query.transport).toBe('graphql');+ expect(query.isStarted).toBe(false);+ expect(createGraphqlQueryMock).not.toHaveBeenCalled();+ expect(restUserNotificationsMock).not.toHaveBeenCalled();+ expect(query.isLoading).toBe(false);+ expect(query.isStarted).toBe(true);+ expect(query.data).toEqual([]);+ expect(createGraphqlQueryMock).toHaveBeenCalledOnce();+ expect(query.hasNextPage).toBe(true);+ await query.fetchNextPage();+ await query.refetch();+ expect(fetchNextPage).toHaveBeenCalledOnce();+ expect(refetch).toHaveBeenCalledWith({+ requestPolicy: 'network-only',+ throwOnError: true,+ });+ expect(createGraphqlQueryMock).toHaveBeenCalledOnce();+ } finally {+ dispose();+ }+ });++ it('notifies gated consumers only after the lazy feed has been constructed', () => {+ createGraphqlQueryMock.mockClear();+ const reads = vi.fn();+ let query!: UserNotificationsQuery;+ const dispose = renderWithClient(() => {+ query = useUserNotificationsQuery(() => ({ limit: 500 }));+ createEffect(() => {+ if (query.isStarted) reads(query.data);+ });+ return <div />;+ });+ try {+ expect(query.isStarted).toBe(false);+ expect(reads).not.toHaveBeenCalled();+ expect(createGraphqlQueryMock).not.toHaveBeenCalled();+ expect(query.isLoading).toBe(false);+ expect(reads).toHaveBeenCalledExactlyOnceWith([]);+ expect(createGraphqlQueryMock).toHaveBeenCalledOnce();+ } finally {+ dispose();+ }+ });+it('reads active notifications from the GraphQL query', () => {const graphqlNotification = createMockNotification({ id: 'graphql-1' });createGraphqlQueryMock.mockReturnValue({diff --git a/apps/web/src/lib/queries/notification/user-notifications.ts b/apps/web/src/lib/queries/notification/user-notifications.tsindex 9208acab08..918c159e1d 100644--- a/apps/web/src/lib/queries/notification/user-notifications.ts+++ b/apps/web/src/lib/queries/notification/user-notifications.ts@@ -27,12 +27,13 @@ import type { GetAllUserNotificationsResponse } from '@service-notification/geneimport type { NotificationUpdateOperation } from '@service-storage/graphql/generated/graphql';import { updateNotifications } from '@service-storage/graphql-notifications';import { graphqlCacheEnabled } from '@service-storage/graphql-soup';+import { createLazyMemo } from '@solid-primitives/memo';import {type InfiniteData,useInfiniteQuery,useMutation,} from '@tanstack/solid-query';-import type { Accessor } from 'solid-js';+import { type Accessor, createSignal, untrack } from 'solid-js';import { match, P } from 'ts-pattern';import { z } from 'zod';import { queryClient } from '../client';@@ -186,6 +187,8 @@ export type UserNotificationsQueryOptions = {/** Query state exposed by the transport-neutral notification facade. */export type UserNotificationsQuery = {+ /** Reactively reports data/status activation of the GraphQL feed (REST is eager). */+ readonly isStarted: boolean;readonly data: UnifiedNotification[] | undefined;readonly error: Error | null;readonly isLoading: boolean;@@ -238,9 +241,16 @@ export function useUserNotificationsQuery(// reading a transport must react to the same flag, not an imperative snapshot.const usesGraphql = () => graphqlSoupFlag().enabled && args().done !== true;- const graphqlQuery = createGraphqlNotificationsQuery(args, () => ({- enabled: queryEnabled() && usesGraphql(),- }));+ const [graphqlStarted, setGraphqlStarted] = createSignal(false);+ const graphqlQuery = createLazyMemo(() =>+ untrack(() => {+ const query = createGraphqlNotificationsQuery(args, () => ({+ enabled: queryEnabled() && usesGraphql(),+ }));+ setGraphqlStarted(true);+ return query;+ })+ );const restQuery = useRestUserNotificationsQuery(args, () => ({enabled: queryEnabled() && !usesGraphql(),@@ -248,45 +258,49 @@ export function useUserNotificationsQuery(const refetch = async () => {if (usesGraphql()) {- await graphqlQuery.refetch({+ await graphqlQuery().refetch({requestPolicy: 'network-only',throwOnError: true,});} else {- await restQuery.refetch();+ const result = await restQuery.refetch();+ if (result.error) throw result.error;}};return {+ get isStarted() {+ return !usesGraphql() || graphqlStarted();+ },get data() {- return usesGraphql() ? graphqlQuery.data : restQuery.data;+ return usesGraphql() ? graphqlQuery().data : restQuery.data;},get error() {return usesGraphql()- ? graphqlQuery.error+ ? graphqlQuery().error: ((restQuery.error as Error | null) ?? null);},get isLoading() {- return usesGraphql() ? graphqlQuery.isLoading : restQuery.isLoading;+ return usesGraphql() ? graphqlQuery().isLoading : restQuery.isLoading;},get isFetching() {- return usesGraphql() ? graphqlQuery.isFetching : restQuery.isFetching;+ return usesGraphql() ? graphqlQuery().isFetching : restQuery.isFetching;},get isFetchingNextPage() {return usesGraphql()- ? graphqlQuery.isFetchingNextPage+ ? graphqlQuery().isFetchingNextPage: restQuery.isFetchingNextPage;},get hasNextPage() {return usesGraphql()- ? graphqlQuery.hasNextPage+ ? graphqlQuery().hasNextPage: (restQuery.hasNextPage ?? false);},get transport() {return usesGraphql() ? 'graphql' : 'rest';},async fetchNextPage() {- if (usesGraphql()) await graphqlQuery.fetchNextPage();+ if (usesGraphql()) await graphqlQuery().fetchNextPage();else await restQuery.fetchNextPage();},refetch,diff --git a/apps/web/src/lib/queries/soup/graphql/channel-list-revalidation.ts b/apps/web/src/lib/queries/soup/graphql/channel-list-revalidation.tsindex 3edd4a0426..6ab9303406 100644--- a/apps/web/src/lib/queries/soup/graphql/channel-list-revalidation.ts+++ b/apps/web/src/lib/queries/soup/graphql/channel-list-revalidation.ts@@ -1,11 +1,16 @@-import { ChannelListSoupDocument } from '@service-storage/graphql/generated/graphql';+import {+ ChannelListSoupDocument,+ ChannelUnreadPresenceDocument,+} from '@service-storage/graphql/generated/graphql';import type { Client } from '@urql/core';import { getActiveGraphqlSoupRevalidations } from './active-queries';/** Filtered notification membership must be re-evaluated after status writes. */export function getChannelListRevalidations() {return getActiveGraphqlSoupRevalidations().filter(- (query) => query.document === ChannelListSoupDocument+ (query) =>+ query.document === ChannelListSoupDocument ||+ query.document === ChannelUnreadPresenceDocument);}diff --git a/apps/web/src/lib/queries/soup/graphql/items.test.ts b/apps/web/src/lib/queries/soup/graphql/items.test.tsindex 8e15198968..06b8cb6539 100644--- a/apps/web/src/lib/queries/soup/graphql/items.test.ts+++ b/apps/web/src/lib/queries/soup/graphql/items.test.ts@@ -89,8 +89,9 @@ type FakeExecution = {next(data: unknown,metadata?: {- source: 'live-network' | 'normalized-cache-hit';+ source: 'live-network' | 'normalized-cache-hit' | 'affected-cache-reread';revision?: string;+ persistence?: Promise<string | undefined>;}): void;};@@ -159,6 +160,16 @@ function makeFakeClient(): {};}+function deferred<T>() {+ let resolve!: (value: T) => void;+ let reject!: (error: Error) => void;+ const promise = new Promise<T>((res, rej) => {+ resolve = res;+ reject = rej;+ });+ return { promise, resolve, reject };+}+describe('createGraphqlSoupAstItemsQuery', () => {beforeEach(() => {queryClient.clear();@@ -1177,6 +1188,270 @@ describe('createGraphqlSoupAstItemsQuery', () => {});});+ describe('network publication before persistence', () => {+ function fixture() {+ const fake = makeFakeClient();+ getGraphqlSoupClientMock.mockReturnValue(fake.client);+ let revision = REVISION_0;+ let notify: (revision: string) => void = () => {};+ let notifyGeneration: () => void = () => {};+ getGraphqlSoupCacheHostMock.mockReturnValue({+ currentRevision: async () => revision,+ entityFilter: entityFilterMock,+ onCacheChanged: (callback: typeof notify) => {+ notify = callback;+ return () => {};+ },+ onCacheGenerationChanged: (callback: typeof notifyGeneration) => {+ notifyGeneration = callback;+ return () => {};+ },+ });+ entityFilterMock.mockImplementation(async () => ({+ kind: 'reconciled',+ revision,+ keys: ['GraphqlSoupDocument:item-0'],+ retainedKeys: [],+ optimistic: true,+ }));+ readRecordsByKeysMock.mockImplementation(async () => ({+ revision,+ records: [+ {+ recordKey: 'GraphqlSoupDocument:item-0',+ record: {+ id: 'item-0',+ type: 'document',+ name: `Local ${revision}`,+ },+ },+ ],+ }));+ makeGraphqlSoupInputMock.mockImplementation(({ params, cursor }) =>+ cursor+ ? { continuation: { cursor } }+ : {+ initial: {+ limit: 50,+ sortMethod: 'UPDATED_AT',+ sortDirection: params.sort_direction === 'asc' ? 'ASC' : 'DESC',+ },+ }+ );+ const root = createRoot((dispose) => {+ const [sort, setSort] = createSignal<'asc' | 'desc'>('desc');+ const query = createGraphqlSoupAstItemsQuery(+ () => ({ params: { sort_direction: sort() }, body: {} }),+ () => ({ enabled: true })+ );+ return { dispose, query, setSort };+ });+ return {+ ...root,+ fake,+ names: () => root.query.data()?.entities.map((entity) => entity.name),+ push: (next: string) => {+ revision = next;+ notify(next);+ },+ replace: () => {+ revision = REVISION_0;+ notifyGeneration();+ },+ page: (+ name: string,+ next_cursor: string | null = null,+ id = 'item-0'+ ) =>+ graphqlSoupPage({+ items: [{ id, type: 'document', name }],+ next_cursor,+ }),+ };+ }++ it('shows network rows immediately and resumes local reconciliation after acknowledgement', async () => {+ const f = fixture();+ const write = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('Network'), {+ source: 'live-network',+ persistence: write.promise,+ });+ expect(f.names()).toEqual(['Network']);+ expect(f.query.isLoading()).toBe(false);+ await Promise.resolve();+ expect(entityFilterMock).not.toHaveBeenCalled();+ write.resolve(REVISION_1);+ await Promise.resolve();+ expect(f.names()).toEqual(['Network']);+ expect(entityFilterMock).not.toHaveBeenCalled();+ f.push(REVISION_2);+ await vi.waitFor(() => expect(f.names()).toEqual(['Local 2']));+ } finally {+ f.dispose();+ }+ });++ it('does not rewind an optimistic revision that arrives before acknowledgement', async () => {+ const f = fixture();+ const write = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('Network'), {+ source: 'live-network',+ persistence: write.promise,+ });+ f.push(REVISION_2);+ expect(f.names()).toEqual(['Network']);+ write.resolve(REVISION_1);+ await vi.waitFor(() => expect(f.names()).toEqual(['Local 2']));+ } finally {+ f.dispose();+ }+ });++ it('does not reassert network authority over a newer affected cache result', async () => {+ const f = fixture();+ const write = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('Network'), {+ source: 'live-network',+ persistence: write.promise,+ });+ f.push(REVISION_2);+ f.fake.executions[0].next(f.page('Optimistic'), {+ source: 'affected-cache-reread',+ });+ await vi.waitFor(() => expect(f.names()).toEqual(['Local 2']));+ write.resolve(REVISION_1);+ await Promise.resolve();+ expect(f.names()).toEqual(['Local 2']);+ f.push('3');+ await vi.waitFor(() => expect(f.names()).toEqual(['Local 3']));+ } finally {+ f.dispose();+ }+ });++ it.each(['failed', 'rejected'] as const)(+ 'keeps successful network rows when persistence is %s',+ async (outcome) => {+ const f = fixture();+ const write = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('Network'), {+ source: 'live-network',+ persistence: write.promise,+ });+ if (outcome === 'failed') write.resolve(undefined);+ else write.reject(new Error('cache unavailable'));+ await Promise.resolve();+ f.push(REVISION_1);+ await Promise.resolve();+ expect(f.names()).toEqual(['Network']);+ expect(f.query.isLoading()).toBe(false);+ expect(entityFilterMock).not.toHaveBeenCalled();+ f.fake.executions[0].next(f.page('Recovered cache'), {+ source: 'normalized-cache-hit',+ });+ await vi.waitFor(() => expect(f.names()).toEqual(['Local 1']));+ } finally {+ f.dispose();+ }+ }+ );++ it('ignores an older acknowledgement while a newer network page is pending', async () => {+ const f = fixture();+ const first = deferred<string | undefined>();+ const second = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('First'), {+ source: 'live-network',+ persistence: first.promise,+ });+ f.fake.executions[0].next(f.page('Second'), {+ source: 'live-network',+ persistence: second.promise,+ });+ first.resolve(REVISION_1);+ f.push(REVISION_1);+ await Promise.resolve();+ expect(f.names()).toEqual(['Second']);+ expect(entityFilterMock).not.toHaveBeenCalled();+ second.resolve(REVISION_2);+ f.push(REVISION_2);+ await Promise.resolve();+ expect(f.names()).toEqual(['Second']);+ } finally {+ f.dispose();+ }+ });++ it('tracks continuation-page persistence independently of the first page', async () => {+ const f = fixture();+ const first = deferred<string | undefined>();+ const second = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('First', 'next'), {+ source: 'live-network',+ persistence: first.promise,+ });+ const next = f.query.fetchNextPage();+ await vi.waitFor(() => expect(f.fake.executions).toHaveLength(2));+ f.fake.executions[1].next(f.page('Second', null, 'item-1'), {+ source: 'live-network',+ persistence: second.promise,+ });+ await next;+ expect(f.names()).toEqual(['First', 'Second']);+ first.resolve(REVISION_1);+ f.push(REVISION_1);+ await Promise.resolve();+ expect(entityFilterMock).not.toHaveBeenCalled();+ expect(f.names()).toEqual(['First', 'Second']);+ second.resolve(REVISION_2);+ f.push(REVISION_2);+ await Promise.resolve();+ expect(f.names()).toEqual(['First', 'Second']);+ expect(entityFilterMock).not.toHaveBeenCalled();+ } finally {+ f.dispose();+ }+ });++ it.each(['input', 'generation', 'dispose'] as const)(+ 'fences acknowledgements after a change of %s',+ async (change) => {+ const f = fixture();+ const write = deferred<string | undefined>();+ try {+ f.fake.executions[0].next(f.page('Old input'), {+ source: 'live-network',+ persistence: write.promise,+ });+ if (change === 'dispose') f.dispose();+ else {+ if (change === 'input') f.setSort('asc');+ else f.replace();+ f.fake.executions.at(-1)!.next(f.page('Current cache'), {+ source: 'normalized-cache-hit',+ });+ await vi.waitFor(() => expect(f.names()).toEqual(['Local 0']));+ }+ const calls = entityFilterMock.mock.calls.length;+ write.resolve(REVISION_1);+ await Promise.resolve();+ await Promise.resolve();+ expect(entityFilterMock).toHaveBeenCalledTimes(calls);+ if (change !== 'dispose') expect(f.names()).toEqual(['Local 0']);+ } finally {+ f.dispose();+ }+ }+ );+ });+it('promotes realtime local revisions without a network rerun and fences stale generations', async () => {const fake = makeFakeClient();getGraphqlSoupClientMock.mockReturnValue(fake.client);diff --git a/apps/web/src/lib/queries/soup/graphql/items.ts b/apps/web/src/lib/queries/soup/graphql/items.tsindex 715574ba42..b01229c32c 100644--- a/apps/web/src/lib/queries/soup/graphql/items.ts+++ b/apps/web/src/lib/queries/soup/graphql/items.ts@@ -153,6 +153,14 @@ export function createGraphqlSoupAstItemsQuery(records: GraphqlSoupItem[];};};+ type UnpersistedPage = {+ input: GraphqlSoupInput | undefined;+ generation: number;+ observation: number;+ };+ const [unpersistedPages, setUnpersistedPages] = createSignal<+ ReadonlyMap<number, UnpersistedPage>+ >(new Map());const [currentCacheRevision, setCurrentCacheRevision] = createSignal<CacheRevision | undefined>();@@ -176,6 +184,11 @@ export function createGraphqlSoupAstItemsQuery(let localEvaluationRunning = false;let localEvaluationPending = false;let cacheGeneration = 0;+ let cacheObservation = 0;+ let disposed = false;+ onCleanup(() => {+ disposed = true;+ });const [baselineGeneration, setBaselineGeneration] = createSignal<number>();let previousInitialInput: GraphqlSoupInput | undefined;let networkAuthorityInput: GraphqlSoupInput | undefined;@@ -192,6 +205,51 @@ export function createGraphqlSoupAstItemsQuery(staleFallbackSpan = undefined;};+ const hasUnpersistedPages = (input: GraphqlSoupInput | undefined) =>+ [...unpersistedPages().values()].some(+ (page) => page.input === input && page.generation === cacheGeneration+ );+ const forgetUnpersistedPage = (index: number) => {+ setUnpersistedPages((pages) => {+ if (!pages.has(index)) return pages;+ const next = new Map(pages);+ next.delete(index);+ return next;+ });+ };+ const acknowledgeNetworkPage = async (+ index: number,+ page: UnpersistedPage,+ persistence: Promise<CacheRevision | undefined>+ ): Promise<void> => {+ let revision: CacheRevision | undefined;+ try {+ revision = await persistence;+ } catch {+ // A failed cache write cannot revoke the successful network snapshot.+ return;+ }+ if (+ revision === undefined ||+ disposed ||+ page.generation !== cacheGeneration ||+ page.input !== firstPageInput() ||+ unpersistedPages().get(index) !== page+ )+ return;+ batch(() => {+ // Cache pushes (including optimistic writes) can arrive before this ack.+ // Never rewind their watermark or republish/clear the visible row data.+ if (cacheObservation === page.observation) {+ setCurrentCacheRevision(revision);+ cacheObservation += 1;+ }+ networkAuthorityInput = page.input;+ setNetworkAuthorityRevision(revision);+ forgetUnpersistedPage(index);+ });+ };+createEffect(() => {const host = getGraphqlSoupCacheHost();if (!host) return;@@ -202,6 +260,7 @@ export function createGraphqlSoupAstItemsQuery(setNetworkAuthorityRevision(undefined);setLocalProjection(undefined);setBaselineGeneration(undefined);+ setUnpersistedPages(new Map());};const observeCurrentRevision = () => {const observedGeneration = cacheGeneration;@@ -218,6 +277,7 @@ export function createGraphqlSoupAstItemsQuery(.catch(() => undefined);};const unsubscribeChanges = host.onCacheChanged((revision) => {+ cacheObservation += 1;if (networkAuthorityRevision() !== undefined &&networkAuthorityRevision() !== revision &&@@ -268,6 +328,7 @@ export function createGraphqlSoupAstItemsQuery(return;if (revision === undefined ||+ hasUnpersistedPages(input) ||(networkAuthorityInput === input &&networkAuthorityRevision() === revision &&!offline() &&@@ -536,11 +597,47 @@ export function createGraphqlSoupAstItemsQuery(requestPolicy: 'cache-and-network',keepPreviousData: false,onResult: (result, page) => {- if (result.data) setBaselineGeneration(cacheGeneration);- if (page.pageIndex !== 0) return;+ if (!result.data) return;+ setBaselineGeneration(cacheGeneration);const metadata = normalizedCacheResultMetadata(result);- if (metadata?.source !== 'live-network' || !metadata.revision) return;+ if (metadata?.source !== 'live-network') {+ // An affected/cache result already reflects local state. Its pending+ // network acknowledgement may no longer claim authority over it.+ forgetUnpersistedPage(page.pageIndex);+ return;+ }+ if (metadata.persistence) {+ const pending: UnpersistedPage = {+ input: firstInput,+ generation: cacheGeneration,+ observation: cacheObservation,+ };+ localRequest += 1;+ batch(() => {+ setUnpersistedPages((pages) =>+ new Map(+ [...pages].filter(+ ([, entry]) =>+ entry.input === firstInput &&+ entry.generation === cacheGeneration+ )+ ).set(page.pageIndex, pending)+ );+ setLocalProjection(undefined);+ });+ recordAuthority('network');+ finishStaleFallback('network');+ void acknowledgeNetworkPage(+ page.pageIndex,+ pending,+ metadata.persistence+ );+ return;+ }+ forgetUnpersistedPage(page.pageIndex);+ if (page.pageIndex !== 0 || !metadata.revision) return;networkAuthorityInput = firstInput;+ cacheObservation += 1;batch(() => {setCurrentCacheRevision(metadata.revision);setNetworkAuthorityRevision(metadata.revision);@@ -596,11 +693,12 @@ export function createGraphqlSoupAstItemsQuery(return local;};const networkIsAuthoritative = (): boolean =>- !offline() &&- !query.error?.networkError &&- networkAuthorityInput === firstPageInput() &&- networkAuthorityRevision() !== undefined &&- networkAuthorityRevision() === currentCacheRevision();+ hasUnpersistedPages(firstPageInput()) ||+ (!offline() &&+ !query.error?.networkError &&+ networkAuthorityInput === firstPageInput() &&+ networkAuthorityRevision() !== undefined &&+ networkAuthorityRevision() === currentCacheRevision());// An overlay covers only the server rows that existed when it was evaluated.// New server pages must render immediately, even if the next evaluation stallsdiff --git a/apps/web/src/lib/service-clients/service-storage/graphql/channel-list.test.ts b/apps/web/src/lib/service-clients/service-storage/graphql/channel-list.test.tsindex 0707eeafd0..dedb3635ac 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/channel-list.test.ts+++ b/apps/web/src/lib/service-clients/service-storage/graphql/channel-list.test.ts@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest';import {ChannelListItemFieldsFragmentDoc,ChannelListSoupDocument,+ ChannelUnreadPresenceDocument,SoupDocument,} from './generated/graphql';@@ -40,6 +41,32 @@ describe('bounded channel unread projection', () => {});+ it('uses only IDs and bounded unread states for the sidebar badge', () => {+ const fields: string[] = [];+ visit(ChannelUnreadPresenceDocument, {+ Field(field) {+ fields.push(field.name.value);+ if (field.name.value !== 'notifications') return;+ expect(field.alias?.value).toBe('unreadNotifications');+ expect(print(field)).toContain('limit: 1');+ expect(print(field)).toContain('states: [UNSEEN]');+ expect(print(field)).toContain('channel_message_reply');+ },+ });+ expect(new Set(fields)).toEqual(+ new Set([+ 'user',+ 'soup',+ 'items',+ '__typename',+ 'id',+ 'notifications',+ 'state',+ ])+ );+ expect(fields.filter((field) => field === 'notifications')).toHaveLength(1);+ });+it('leaves full notification reads unbounded and unfiltered', () => {visit(SoupDocument, {Field(field) {diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/channel-unread.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/channel-unread.graphqlnew file mode 100644index 0000000000..99ef1a5352--- /dev/null+++ b/apps/web/src/lib/service-clients/service-storage/graphql/channel-unread.graphql@@ -0,0 +1,24 @@+# Sidebar presence only. Never use this witness as the complete mark-read input.+query ChannelUnreadPresence($input: SoupInput!) {+ user {+ id+ soup(input: $input) {+ items {+ __typename+ id+ ... on GraphqlSoupChannel {+ unreadNotifications: notifications(+ filter: {+ states: [UNSEEN]+ eventTypes: ["channel_mention", "channel_message_send", "channel_message_reply", "document_mention"]+ }+ limit: 1+ ) {+ id+ state+ }+ }+ }+ }+ }+}diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.tsindex 50985b15cb..f9eac182b5 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts@@ -2067,6 +2067,26 @@ export type ChannelListNotificationFieldsFragment = { id: string, eventType: str| { __typename: 'GraphqlTaskAssignedMetadata', taskAssignedTaskId: string, taskAssignedTaskName: string | null, taskAssignedSubType: GraphqlNotificationDocumentSubType | null, taskAssignedAssignedBy: string, taskAssignedSenderProfilePictureUrl: string | null }};+export type ChannelUnreadPresenceQueryVariables = Exact<{+ input: SoupInput;+}>;+++export type ChannelUnreadPresenceQuery = { user: { id: string, soup: { items: Array<+ | { __typename: 'GraphqlSoupAgentSession', id: string }+ | { __typename: 'GraphqlSoupCalendarEvent', id: string }+ | { __typename: 'GraphqlSoupCall', id: string }+ | { __typename: 'GraphqlSoupChannel', id: string, unreadNotifications: Array<{ id: string, state: NotificationState }> }+ | { __typename: 'GraphqlSoupChannelMessage', id: string }+ | { __typename: 'GraphqlSoupChat', id: string }+ | { __typename: 'GraphqlSoupCrmCompany', id: string }+ | { __typename: 'GraphqlSoupDocument', id: string }+ | { __typename: 'GraphqlSoupEmailThread', id: string }+ | { __typename: 'GraphqlSoupForeignEntity', id: string }+ | { __typename: 'GraphqlSoupProject', id: string }+ | { __typename: 'GraphqlSoupReminder', id: string }+ > } } };+export type GraphqlCrmCompanyQuickAccessFieldsFragment = { __typename: 'GraphqlSoupCrmCompany', name: string | null, teamId: string, hidden: boolean, domains: Array<string>, createdAt: string, updatedAt: string, viewedAt: string | null };export type SaveEmailDraftMutationVariables = Exact<{@@ -11946,6 +11966,7 @@ export const RecordChannelActivityDocument = {"kind":"Document","definitions":[{export const UpdateNotificationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateNotifications"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateNotificationsInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateNotifications"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}}]} as unknown as DocumentNode<UpdateNotificationsMutation, UpdateNotificationsMutationVariables>;export const UpdateNotificationsForEntityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateNotificationsForEntity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateNotificationsForEntityInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateNotificationsForEntity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}}]} as unknown as DocumentNode<UpdateNotificationsForEntityMutation, UpdateNotificationsForEntityMutationVariables>;export const ChannelListSoupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ChannelListSoup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ChannelListItemFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"sortTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupReminder"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"scheduleType"}},{"kind":"Field","name":{"kind":"Name","value":"remindAt"}},{"kind":"Field","name":{"kind":"Name","value":"cron"}},{"kind":"Field","name":{"kind":"Name","value":"timezone"}},{"kind":"Field","name":{"kind":"Name","value":"nextRunAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"completedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"referencedEntity"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"subType"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ChannelListItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"unreadNotifications"},"name":{"kind":"Name","value":"notifications"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"states"},"value":{"kind":"ListValue","values":[{"kind":"EnumValue","value":"UNSEEN"}]}},{"kind":"ObjectField","name":{"kind":"Name","value":"eventTypes"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"channel_mention","block":false},{"kind":"StringValue","value":"channel_message_send","block":false},{"kind":"StringValue","value":"channel_message_reply","block":false},{"kind":"StringValue","value":"document_mention","block":false}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"1"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]}}]} as unknown as DocumentNode<ChannelListSoupQuery, ChannelListSoupQueryVariables>;+export const ChannelUnreadPresenceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ChannelUnreadPresence"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"unreadNotifications"},"name":{"kind":"Name","value":"notifications"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"states"},"value":{"kind":"ListValue","values":[{"kind":"EnumValue","value":"UNSEEN"}]}},{"kind":"ObjectField","name":{"kind":"Name","value":"eventTypes"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"channel_mention","block":false},{"kind":"StringValue","value":"channel_message_send","block":false},{"kind":"StringValue","value":"channel_message_reply","block":false},{"kind":"StringValue","value":"document_mention","block":false}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"1"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<ChannelUnreadPresenceQuery, ChannelUnreadPresenceQueryVariables>;export const SaveEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SaveEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SaveEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"saveEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"draft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SaveEmailDraftMutation, SaveEmailDraftMutationVariables>;export const DeleteEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"deleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadDeleted"}}]}}]}}]} as unknown as DocumentNode<DeleteEmailDraftMutation, DeleteEmailDraftMutationVariables>;export const MarkEmailThreadSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkEmailThreadSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkEmailThreadSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markEmailThreadSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailReadStateFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailReadStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}}]}}]} as unknown as DocumentNode<MarkEmailThreadSeenMutation, MarkEmailThreadSeenMutationVariables>;diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex b5c3c2d333..161aee93f5 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -479,6 +479,21 @@ and return to the list: its top-level notifications should be read, includingones older than the global notification feed's loaded page. Notifications forseparate thread stacks remain unread until that thread is opened.+With GraphQL enabled, the app-shell Chat badge uses `ChannelUnreadPresence`: only+channel IDs and at most one unread notification ID/state per channel, with a+500-channel candidate bound and no history, message previews, or metadata. It+shares the channel lists' refreshes after notification patches, mark-read, and+reconnect. Merely rendering that badge, subscribing to realtime notifications,+or applying local read/done overrides must not start the full `SoupNotifications`+feed. Check this with document-mention notifications disabled too (the production+default): mention cleanup must wait until a real data/status reader activates the+feed, then continue cleaning up loaded mentions. Full notification selection and+pagination remain unchanged. Automatic/debounced read markers log failures and+leave failed reads unread; they must not produce unhandled promise rejections or+block the separate email read marker. Cold bulk actions wait for loading+and report failures rather than treating pending data as an empty list. The+Inbox badge still uses its own full Soup query for channel/thread membership.+With GraphQL enabled, channel lists request at most one unread message notificationper channel through an aliased, filtered `notifications` edge. An empty edge meansno unread messages; invites and call notifications do not light the dot. Recent@@ -494,7 +509,17 @@ open the last selected conversation, not a slower earlier request.Check cached Home → Chat navigation, All/Recent/search, and unread state after aread, a new notification, deletion, and reconnect. Cache reads remain asynchronous:a brief spinner can still appear, but cached rows must not wait for a background-network refresh. If more unread notifications+network refresh. Conversely, `cache-and-network` refreshes must start without+waiting for a busy cache worker. Successful foreground query results display+before cache persistence finishes; a delayed acknowledgement must not replay old+rows or overwrite an optimistic update. Check initial and continuation pages with+a slow cache, overlapping refreshes, and leaving/reopening Chat during a write.+A cache write failure must not discard successful network rows. Mutations and+cache-only hydration still wait for their durable/cache-projection work.+A late cache snapshot must not replace newer network rows. Check a cold offline+open too: a cache hit arriving+after the network failure must remain usable without erasing the refresh error.+If more unread notificationsremain, the limited edge must refresh to the next one rather than staying empty.Refreshing unread indicators while composing must preserve the conversation,scroll position, and input focus. The backend must support the new edge argumentsdiff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.mdindex b798d90e30..6a7410e7cd 100644--- a/docs/AGENT_GUIDE/navigation.md+++ b/docs/AGENT_GUIDE/navigation.md@@ -171,6 +171,11 @@ Noise does not light either dot. These are presence indicators, not counts; theydo not fetch additional pages to find every unread item. Opening a view alone doesnot clear its dot — reading or completing the represented items does. The button'saccessible description is `Unread items` while its dot is active.+The Home dot stops checking rows at the first eligible unread item, using the+same Signal membership, channel/thread scoping, and local read/done overrides as+the list. Check that reading that item keeps the dot lit if another loaded row+is unread, and that completing the last one clears it. Query bounds and+pagination are unchanged.The Agents sidebar mixes chat and coding sessions in one newest-first list.New agent sessions use one dot in the left slot for activity and notifications: