Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): preserve inbox rows while cache metadata loads (#9096)

gbirman57bf539b50bf
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index b8f98c7032..1a1f767416 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -5,6 +5,7 @@
- `bun run lint`: lint with biome
- `bun run format`: format changes with biome
- `bun run knip`: to check for dead code
+- Run Linux native cache-plugin tests from the repository root with `nix develop .#tauri-linux --command cargo test --manifest-path apps/web/tauri/Cargo.toml -p graphql_cache_plugin`; the [Tauri platform shell](../../docs/development/running-locally.md) supplies the required desktop libraries.
- `bun run lint:oxlint` (repository root): type-aware oxlint. `typescript/no-floating-promises` is an error with no suppressions and `ignoreVoid: false` (FE-13), enforced in `just check` and CI; start detached work with `fireAndForget` from `@core/util/fireAndForget`, not `void`. Plain `oxlint` without `--type-aware` skips that rule silently. The ast-grep rule `ts-no-expression-void` covers `() => void p()`, which the lint can't see.
- Email rendering is isolated in `packages/email-renderer` at the repository root. Run `just test-email-rendering` for its Node and Chromium suites. Add fixtures under `packages/email-renderer/tests/fixtures`, run `just test-email-rendering-update`, and review changed images. These are renderer tests, not inbox e2e.
- The app does not register a service worker. Keep `public/sw.js` as a retirement
@@ -471,10 +472,17 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription to
`bunx playwright test --config src/lib/queries/soup/graphql/browser-test/playwright.config.ts`:
it uses the real Soup source and exchange, holds local/network completion,
and asserts every observed row-ID state on revisits and an OPFS reload.
+ It also verifies that cold empty Mail tabs stay loading until HTTP settles.
It also runs in `just test-cache-wasm-browser`.
- Reactive GraphQL reads use `createLiveQuery` for a document and
`useSoupAstItemsQuery` (backed by `createSoupLiveQuery`) for Soup lists; see
[choosing a reactive read](docs/graphql-normalized-cache-plan.md#choosing-a-reactive-read).
+- Reconcile cached Mail pages with same-query server membership; missing local
+ previews are unknown, not proof that a fetched email left the inbox. Keep
+ local pagination cursors independent of retained server rows. Preserve live
+ flags alongside fallback previews; retained rows and legacy hosts still need
+ mutation revalidation. Merge continuation pages through the indexed cursor.
+ Never restore explicitly invalidated membership from an older view's snapshot.
- Render user-visible text in new UI, and every menu and navigation label,
with `t()` from `@app/lib/i18n`, adding only the English to
`src/lib/i18n/locales/en/`. The periodic `update-translations` skill fills
diff --git a/apps/web/docs/graphql-normalized-cache-plan.md b/apps/web/docs/graphql-normalized-cache-plan.md
index e166d3d1a4..32a282b681 100644
--- a/apps/web/docs/graphql-normalized-cache-plan.md
+++ b/apps/web/docs/graphql-normalized-cache-plan.md
@@ -867,6 +867,22 @@ use `createSoupLiveQuery`: it adds Soup's local membership, ordering, pagination
and Mail policy through its predicate adapter. That policy remains outside
generic cache-core.
+Mail list pages carry same-query server membership in the existing `baseline`
+field. The Mail adapter reconciles only baseline rows outside the indexed window,
+retaining unknown rows and rejecting confirmed nonmembers. Known read, archive,
+and signal flags can disprove an incomplete row's membership through the compiled
+predicate; missing facts never prove a new match. Optimistic and committed flags
+are read from the same engine revision as the page.
+
+Fallbacks preserve the server's query-dependent preview fields while selecting
+live flags independently of canonical preview hydration. Lists with retained rows,
+or older native hosts without `retainedKeys`, remain eligible for mutation-driven
+server revalidation. Indexed cursors do not move to retained rows; continuation
+publishes an ordered through-read of the union instead of appending across them.
+New server membership triggers evaluation even when the local list is already
+longer. A baseline beyond the 5,000-row cap discards the local projection and uses
+the live server list; indexed rows do not count against that baseline cap.
+
Grouped Soup uses `graphql/create-grouped-soup-live-query.ts` to own the initial
request and every loaded per-bin continuation. With maintained cache queries and
a supported filter plus created/updated sort, their combined server membership
@@ -962,7 +978,11 @@ transaction as their normalized write. It compares up to 500 local matches
against returned IDs, bounded by the last canonical view timestamp and ID when
`nextCursor` exists. Exhausted/empty first pages cover the whole matching slice.
Missing matches become durable incomplete projections, not deleted records or
-invented archive/signal facts. Full canonical snapshots restore their proof;
+invented archive/signal facts. Mail retention excludes explicitly invalidated
+(`Dirty`) baseline rows in the same projection scope unless an optimistic shadow
+takes precedence; an older open view cannot restore the revoked evidence.
+This differs from missing metadata, which still retains same-query membership.
+Full canonical snapshots restore their proof;
partial patches cannot. Backfills, cursor pages, incomplete responses,
unsupported predicates, identity switches, and pending optimistic rows do not
supply this negative evidence. The existing authoritative-write telemetry covers
diff --git a/apps/web/src/lib/graphql-cache/protocol.ts b/apps/web/src/lib/graphql-cache/protocol.ts
index 95d6f6b26f..bd37eef170 100644
--- a/apps/web/src/lib/graphql-cache/protocol.ts
+++ b/apps/web/src/lib/graphql-cache/protocol.ts
@@ -142,6 +142,8 @@ export type EntityFilterCacheResult =
kind: 'mail-page';
revision: CacheRevision;
keys: string[];
+ /** Server members with incomplete local metadata; absent on older native hosts. */
+ retainedKeys?: string[];
/** View-correct timestamps aligned with keys, independent of cached previews. */
sortTimestamps: string[];
nextCursor: string | null;
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection.browser.e2e.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection.browser.e2e.ts
index 98a7395adc..9ae7cb498d 100644
--- a/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection.browser.e2e.ts
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection.browser.e2e.ts
@@ -1,6 +1,113 @@
import { fileURLToPath } from 'node:url';
import { expect, test } from '@playwright/test';
+test('server-confirmed invitations survive missing cache metadata and confirmed archives still leave Inbox', async ({
+ page,
+}) => {
+ const scope = `mail-membership-${crypto.randomUUID()}`;
+ await page.goto(`/mail-projection.html?scope=${scope}`);
+ await expect(page.locator('#result')).toHaveAttribute(
+ 'data-status',
+ 'ready',
+ { timeout: 60_000 }
+ );
+ const result = await page.evaluate(
+ async ({ scope, modulePath }) => {
+ const { createWorkerCacheHost } = (await import(
+ modulePath
+ )) as typeof import('../../host/worker-host');
+ const host = createWorkerCacheHost({ scope });
+ const id = (n: number) =>
+ `00000000-0000-0000-0000-${String(n).padStart(12, '0')}`;
+ const key = (n: number) => `GraphqlSoupEmailThread:${id(n)}`;
+ const query = `query MailUpdate { user { id soup(input:{initial:{limit:100,emailView:INBOX}}) { items { __typename id ... on GraphqlSoupEmailThread { inboxVisible isRead } } } } }`;
+ const write = (n: number, inboxVisible: boolean) =>
+ host.writeQuery({
+ query,
+ identity: 'offline-mail-viewer',
+ data: {
+ user: {
+ id: 'offline-mail-viewer',
+ soup: {
+ items: [
+ {
+ __typename: 'GraphqlSoupEmailThread',
+ id: id(n),
+ inboxVisible,
+ isRead: false,
+ },
+ ],
+ },
+ },
+ },
+ });
+ const filters = Object.fromEntries(
+ [
+ ['documentFilter', 'id'],
+ ['projectFilter', 'projectIdSelf'],
+ ['chatFilter', 'chatId'],
+ ['calendarEventFilter', 'id'],
+ ['channelFilter', 'channelId'],
+ ['channelThreadFilter', 'threadId'],
+ ['callFilter', 'callId'],
+ ['crmCompanyFilter', 'id'],
+ ['foreignEntityFilter', 'id'],
+ ].map(([field, literal]) => [field, { literal: { [literal]: id(0) } }])
+ );
+ try {
+ await write(76, true);
+ const baseline = [76, 60].map((n) => ({
+ key: key(n),
+ sortTimestamp: '2026-01-01T00:00:00Z',
+ }));
+ const read = () =>
+ host.entityFilter({
+ filters,
+ sortMethod: 'UPDATED_AT',
+ sortDirection: 'DESC',
+ limit: 10,
+ baseline,
+ mail: { view: 'INBOX' },
+ });
+ const before = await read();
+ // Unrelated cache revisions used to replace the server list with a partial local page.
+ await write(50, true);
+ const refreshed = await read();
+ await write(60, false);
+ const archived = await read();
+ if (
+ before.kind !== 'mail-page' ||
+ refreshed.kind !== 'mail-page' ||
+ archived.kind !== 'mail-page'
+ )
+ throw new Error('expected cached Mail pages');
+ return {
+ retained: before.retainedKeys,
+ visibleBefore: before.keys.includes(key(76)),
+ visibleAfterRefresh: refreshed.keys.includes(key(76)),
+ visibleAfterArchive: archived.keys.includes(key(76)),
+ archivedRemoved: !archived.keys.includes(key(60)),
+ inviteKey: key(76),
+ };
+ } finally {
+ host.dispose();
+ }
+ },
+ {
+ scope,
+ modulePath: `/@fs${fileURLToPath(new URL('../../host/worker-host.ts', import.meta.url))}`,
+ }
+ );
+ expect(result).toEqual({
+ retained: [result.inviteKey],
+ visibleBefore: true,
+ visibleAfterRefresh: true,
+ visibleAfterArchive: true,
+ archivedRemoved: true,
+ inviteKey: result.inviteKey,
+ });
+});
+
test('delivered reminders immediately lead cached Signal, including sent-only threads', async ({
page,
}) => {
@@ -270,3 +377,223 @@ test('new Mail filter combinations and pagination work offline without bodies or
await context.setOffline(false);
}
});
+
+test('retained mail applies optimistic flags, rollback and committed actions without hydration', async ({
+ page,
+}) => {
+ const scope = `retained-actions-${crypto.randomUUID()}`;
+ await page.goto(`/mail-projection.html?scope=${scope}`);
+ await expect(page.locator('#result')).toHaveAttribute(
+ 'data-status',
+ 'ready',
+ { timeout: 60_000 }
+ );
+ const result = await page.evaluate(
+ async ({ scope, hostPath, readerPath, selectionPath, documentsPath }) => {
+ const { createWorkerCacheHost } = (await import(
+ hostPath
+ )) as typeof import('../../host/worker-host');
+ const { readSoupPage } = (await import(
+ readerPath
+ )) as typeof import('../../../queries/soup/graphql/read-soup-page');
+ const { selectRecords } = (await import(
+ selectionPath
+ )) as typeof import('../../exchange/record-selection');
+ const { MailItemFieldsFragmentDoc } = (await import(
+ documentsPath
+ )) as typeof import('../../../service-clients/service-storage/graphql/generated/graphql');
+ const host = createWorkerCacheHost({ scope });
+ const id = '00000000-0000-0000-0000-000000000076';
+ const key = `GraphqlSoupEmailThread:${id}`;
+ const snapshot: Extract<
+ import('../../../service-clients/service-storage/graphql-soup').GraphqlSoupItem,
+ { __typename: 'GraphqlSoupEmailThread' }
+ > = {
+ __typename: 'GraphqlSoupEmailThread',
+ id,
+ entityType: 'EMAIL_THREAD',
+ displayName: 'Invitation',
+ emailName: 'Invitation',
+ providerId: null,
+ ownerId: 'offline-mail-viewer',
+ linkId: '00000000-0000-0000-0000-000000001000',
+ inboxVisible: true,
+ isRead: false,
+ isSignal: false,
+ isImportant: false,
+ isDraft: false,
+ isFavorited: false,
+ createdAt: '2026-01-01T00:00:00Z',
+ updatedAt: '2026-01-01T00:00:00Z',
+ viewedAt: null,
+ latestInboundMessageTs: '2026-01-01T00:00:00Z',
+ latestOutboundMessageTs: null,
+ latestNonSpamMessageTs: null,
+ reminderReturnedAt: null,
+ projectId: null,
+ cacheProjection: null,
+ frecencyScore: null,
+ snippet: 'Fetched preview',
+ senderEmail: null,
+ senderName: null,
+ senderPhotoUrl: null,
+ notifications: [],
+ participants: [],
+ attachments: [],
+ labels: [],
+ properties: [],
+ mailDraftState: null,
+ mailAllPreview: null,
+ mailDraftPreview: null,
+ mailSentPreview: null,
+ };
+ const filters = Object.fromEntries(
+ [
+ ['documentFilter', 'id'],
+ ['projectFilter', 'projectIdSelf'],
+ ['chatFilter', 'chatId'],
+ ['calendarEventFilter', 'id'],
+ ['channelFilter', 'channelId'],
+ ['channelThreadFilter', 'threadId'],
+ ['callFilter', 'callId'],
+ ['crmCompanyFilter', 'id'],
+ ['foreignEntityFilter', 'id'],
+ ].map(([field, literal]) => [
+ field,
+ { literal: { [literal]: '00000000-0000-0000-0000-000000000000' } },
+ ])
+ );
+ const read = async (unread = false) => {
+ const page = await host.entityFilter({
+ filters: {
+ ...filters,
+ ...(unread
+ ? { emailFilter: { tree: { literal: { read: false } } } }
+ : {}),
+ },
+ sortMethod: 'UPDATED_AT',
+ sortDirection: 'DESC',
+ limit: 10,
+ mail: { view: 'INBOX' },
+ baseline: [{ key, sortTimestamp: snapshot.createdAt }],
+ });
+ if (page.kind !== 'mail-page') throw new Error('expected Mail page');
+ const selected = await readSoupPage(host, {
+ page,
+ select: selectRecords(MailItemFieldsFragmentDoc),
+ baseline: [snapshot],
+ mailView: 'INBOX',
+ });
+ if (selected.kind !== 'ready')
+ throw new Error('expected coherent row selection');
+ const row = selected.records.find((row) => row.id === id);
+ return {
+ present: page.keys.includes(key),
+ isRead:
+ row?.__typename === 'GraphqlSoupEmailThread' ? row.isRead : null,
+ preview:
+ row?.__typename === 'GraphqlSoupEmailThread' ? row.emailName : null,
+ };
+ };
+ const update = async (
+ field: 'inboxVisible' | 'isRead',
+ value: boolean,
+ rollback = false
+ ) => {
+ const mutation =
+ field === 'inboxVisible'
+ ? 'setEmailThreadArchived'
+ : 'markEmailThreadSeen';
+ const query = `mutation Change { ${mutation} { __typename id ${field} } }`;
+ const data = {
+ [mutation]: {
+ __typename: 'GraphqlSoupEmailThread',
+ id,
+ [field]: value,
+ },
+ };
+ const nowMs = Date.now();
+ const queued = await host.enqueueOptimisticMutation(
+ { uuid: crypto.randomUUID(), query, data },
+ { owner: 'test', nowMs, leaseExpiresAtMs: nowMs + 60_000 }
+ );
+ if (queued.initialClaim.kind !== 'claimed')
+ throw new Error('expected mutation claim');
+ const optimistic = await read();
+ const token = {
+ owner: 'test',
+ generation: queued.initialClaim.mutation.leaseGeneration,
+ };
+ if (rollback)
+ await host.rollbackOptimisticWrite(
+ queued.transactionId,
+ token,
+ 'rejected'
+ );
+ else
+ await host.commitOptimisticWrite(queued.transactionId, token, {
+ query,
+ data,
+ });
+ return { optimistic, settled: await read() };
+ };
+ try {
+ await host.writeQuery({
+ query:
+ 'query Partial { user { id soup(input:{initial:{limit:1,emailView:INBOX}}) { items { __typename id ... on GraphqlSoupEmailThread { inboxVisible isRead } } } } }',
+ identity: 'offline-mail-viewer',
+ data: {
+ user: {
+ id: 'offline-mail-viewer',
+ soup: {
+ items: [
+ {
+ __typename: 'GraphqlSoupEmailThread',
+ id,
+ inboxVisible: true,
+ isRead: false,
+ },
+ ],
+ },
+ },
+ },
+ });
+ return {
+ initial: await read(),
+ read: await update('isRead', true),
+ unread: await read(true),
+ rollback: await update('inboxVisible', false, true),
+ archive: await update('inboxVisible', false),
+ undo: await update('inboxVisible', true),
+ };
+ } finally {
+ host.dispose();
+ }
+ },
+ {
+ scope,
+ hostPath: `/@fs${fileURLToPath(new URL('../../host/worker-host.ts', import.meta.url))}`,
+ readerPath: `/@fs${fileURLToPath(new URL('../../../queries/soup/graphql/read-soup-page.ts', import.meta.url))}`,
+ selectionPath: `/@fs${fileURLToPath(new URL('../../exchange/record-selection.ts', import.meta.url))}`,
+ documentsPath: `/@fs${fileURLToPath(new URL('../../../service-clients/service-storage/graphql/generated/graphql.ts', import.meta.url))}`,
+ }
+ );
+ expect(result.initial).toEqual({
+ present: true,
+ isRead: false,
+ preview: 'Invitation',
+ });
+ expect(result.read.optimistic).toEqual({
+ present: true,
+ isRead: true,
+ preview: 'Invitation',
+ });
+ expect(result.read.settled).toEqual(result.read.optimistic);
+ expect(result.unread.present).toBe(false);
+ expect(result.rollback.optimistic.present).toBe(false);
+ expect(result.rollback.settled).toEqual(result.read.settled);
+ expect(result.archive.optimistic.present).toBe(false);
+ expect(result.archive.settled.present).toBe(false);
+ expect(result.undo.optimistic).toEqual(result.read.settled);
+ expect(result.undo.settled).toEqual(result.read.settled);
+});
diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.test.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.test.ts
index cb95aef47f..51782a128a 100644
--- a/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.test.ts
+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.test.ts
@@ -313,6 +313,26 @@ describe('coordinator runtime protocol', () => {
expect(mail({ cursor: 'row', through: 'row' })).toBe(false);
expect(mail({ through: 'x'.repeat(4097) })).toBe(false);
expect(mail({ unexpected: true })).toBe(false);
+ const baseline = [
+ {
+ key: 'GraphqlSoupEmailThread:one',
+ sortTimestamp: '2026-01-01T00:00:00Z',
+ },
+ ];
+ expect(valid({ ...request, mail: { view: 'INBOX' }, baseline })).toBe(true);
+ expect(
+ valid({ ...request, mail: { view: 'INBOX', through: 'row' }, baseline })
+ ).toBe(true);
+ expect(
+ valid({ ...request, mail: { view: 'INBOX', cursor: 'row' }, baseline })
+ ).toBe(false);
+ expect(
+ valid({
+ ...request,
+ mail: { view: 'INBOX' },
+ baseline: Array(5001).fill(baseline[0]),
+ })
+ ).toBe(false);
});
it('validates calendar range, commit, and uncertain-event requests', () => {
diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.ts
index 24837d76f5..9f04d68966 100644
--- a/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.ts
+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-protocol.ts
@@ -791,7 +791,8 @@ export function isCacheRequest(value: unknown): value is CacheRequest {
: request.mail.cursor === undefined &&
typeof through === 'string' &&
through.length <= 4096) &&
- request.baseline === undefined &&
+ (request.baseline === undefined ||
+ request.mail.cursor === undefined) &&
(request.mail.cursor === undefined ||
(typeof request.mail.cursor === 'string' &&
request.mail.cursor.length <= 4096)))) &&
diff --git a/apps/web/src/lib/queries/soup/graphql/browser-test/harness.tsx b/apps/web/src/lib/queries/soup/graphql/browser-test/harness.tsx
index 17aadb3098..df8bca72d6 100644
--- a/apps/web/src/lib/queries/soup/graphql/browser-test/harness.tsx
+++ b/apps/web/src/lib/queries/soup/graphql/browser-test/harness.tsx
@@ -74,7 +74,12 @@ function MailList(props: { tab: MailTab }) {
return 'pending';
};
return (
- <section id="mail-list" data-tab={props.tab} data-source={phase()}>
+ <section
+ id="mail-list"
+ data-tab={props.tab}
+ data-source={phase()}
+ aria-busy={source.isLoading()}
+ >
<p role="status">{source.error()?.message ?? phase()}</p>
<ol>
<For each={source.data()}>
@@ -86,7 +91,11 @@ function MailList(props: { tab: MailTab }) {
}
function App() {
- const [tab, setTab] = createSignal<MailTab>('noise');
+ const [tab, setTab] = createSignal<MailTab>(
+ new URLSearchParams(location.search).get('tab') === 'signal'
+ ? 'signal'
+ : 'noise'
+ );
const navigate = (next: MailTab) => {
if (next === 'noise') holdLocalReads();
else releaseLocalReads();
diff --git a/apps/web/src/lib/queries/soup/graphql/browser-test/mail-flicker.browser.e2e.ts b/apps/web/src/lib/queries/soup/graphql/browser-test/mail-flicker.browser.e2e.ts
index 621f520aa0..e99a932039 100644
--- a/apps/web/src/lib/queries/soup/graphql/browser-test/mail-flicker.browser.e2e.ts
+++ b/apps/web/src/lib/queries/soup/graphql/browser-test/mail-flicker.browser.e2e.ts
@@ -10,6 +10,54 @@ function heldResponse() {
};
}
+for (const result of ['emails', 'empty'] as const) {
+ test(`a cold Noise tab stays loading until its first server result: ${result}`, async ({
+ page,
+ }) => {
+ const network = heldResponse();
+ await page.route('**/__mail-flicker/graphql', async (route) => {
+ const request: { variables: SoupQueryVariables } = route
+ .request()
+ .postDataJSON();
+ const initial = request.variables.input.initial;
+ const noise =
+ initial?.filters?.emailFilter?.tree?.literal?.importance === false;
+ if (!noise) {
+ await route.fulfill({ json: { data: response([]) } });
+ return;
+ }
+ network.requested.resolve();
+ await network.release.promise;
+ await route.fulfill({
+ json: { data: response(result === 'emails' ? SERVER_IDS : []) },
+ });
+ });
+ await page.goto(
+ `/?scope=cold-noise-${crypto.randomUUID()}&seed=false&tab=signal`
+ );
+ await page.evaluate(() => window.mailFlicker.releaseLocalReads());
+ const list = page.locator('#mail-list');
+ const rows = page.locator('[data-thread-id]');
+ await expect(list).toHaveAttribute('data-source', 'network');
+ await expect(list).toHaveAttribute('aria-busy', 'false');
+ await page.getByRole('button', { name: 'Noise', exact: true }).click();
+ await network.requested.promise;
+ await page.evaluate(() => window.mailFlicker.releaseLocalReads());
+ // The real worker has finished its empty local query, while HTTP is still
+ // held. That is incomplete mailbox coverage, not a confirmed empty tab.
+ await expect(list).toHaveAttribute('data-source', 'local');
+ await expect(rows).toHaveCount(0);
+ await expect(list).toHaveAttribute('aria-busy', 'true');
+ network.release.resolve();
+ await expect(list).toHaveAttribute('data-source', 'network');
+ await expect(list).toHaveAttribute('aria-busy', 'false');
+ await expect(rows).toHaveCount(result === 'emails' ? SERVER_IDS.length : 0);
+ expect(
+ await page.evaluate(() => window.mailFlicker.stopRecording().cacheErrors)
+ ).toEqual([]);
+ });
+}
+
test('Noise never reintroduces repaired stale threads between cached and network renders', async ({
page,
}, testInfo) => {
@@ -46,6 +94,7 @@ test('Noise never reintroduces repaired stale threads between cached and network
await page.evaluate(() => window.mailFlicker.startRecording());
await page.evaluate(() => window.mailFlicker.releaseLocalReads());
await expect(list).toHaveAttribute('data-source', 'local');
+ await expect(list).toHaveAttribute('aria-busy', 'false');
network.release.resolve();
await expect(list).toHaveAttribute('data-source', 'network');
await expect(rows).toHaveCount(SERVER_IDS.length);
diff --git a/apps/web/src/lib/queries/soup/graphql/create-soup-live-query.ts b/apps/web/src/lib/queries/soup/graphql/create-soup-live-query.ts
index 776d9dd0e6..9ff27db1ba 100644
--- a/apps/web/src/lib/queries/soup/graphql/create-soup-live-query.ts
+++ b/apps/web/src/lib/queries/soup/graphql/create-soup-live-query.ts
@@ -23,6 +23,7 @@ import {
type CacheRevision,
MAX_MAIL_THROUGH_ROWS,
} from '../../../graphql-cache/protocol';
+import { emailThreadSortTs } from '../../../service-clients/service-storage/email-thread-sort';
import {
ChannelListItemFieldsFragmentDoc,
ChannelListSoupDocument,
@@ -539,8 +540,16 @@ export function createSoupLiveQuery(
(record) => record.__typename !== 'GraphqlSoupEmailThread'
)
: serverRecords();
- const baseline = soupReconciliationBaseline(records, initial.sortMethod);
- if (!baseline && !mailView) return;
+ const baseline = soupReconciliationBaseline(
+ records.map((record) => {
+ if (!mailView || record.__typename !== 'GraphqlSoupEmailThread')
+ return record;
+ const timestamp = emailThreadSortTs(record, mailView);
+ return { ...record, createdAt: timestamp, updatedAt: timestamp };
+ }),
+ initial.sortMethod
+ );
+ if (!baseline) return;
return {
input,
records,
@@ -590,7 +599,8 @@ export function createSoupLiveQuery(
// (unsupported filters, a cold cache) still read the server after writes.
const cacheMaintained = (): boolean => {
if (!hasGraphqlCacheHost()) return false;
- if (localSource()?.mailView) return localMailCurrent();
+ if (localSource()?.mailView)
+ return localMailCurrent() && displayLocalProjection() !== undefined;
// A folder list keeps its email rows from the server, and a maintained
// query still loading leaves the server page on screen.
return (
@@ -658,6 +668,12 @@ export function createSoupLiveQuery(
existing.generation === cacheGeneration &&
existing.mail.revision === revision &&
existing.mail.edge === edge &&
+ [...existing.baselineKeys].every((key) => serverRecordKeys().has(key)) &&
+ definition?.records.every(
+ (record) =>
+ existing.baselineKeys.has(soupItemKey(record)) ||
+ existing.displayedKeys.has(soupItemKey(record))
+ ) &&
(existing.displayedKeys.size >= loaded ||
existing.mail.nextCursor == null)
)
@@ -675,6 +691,10 @@ export function createSoupLiveQuery(
!query.error?.networkError)))
) {
localEvaluationPending = false;
+ if (!definition && !hasUnpersistedPages(input)) {
+ setLocalProjection(undefined);
+ setLocalMailCurrent(false);
+ }
return;
}
const {
@@ -707,8 +727,9 @@ export function createSoupLiveQuery(
filters,
sortMethod,
sortDirection,
+ baseline,
...(!mailView
- ? { limit, baseline }
+ ? { limit }
: through
? {
// At least as deep as the server pages already shown.
@@ -749,13 +770,25 @@ export function createSoupLiveQuery(
discarded = true;
return;
}
+ // Older native hosts accept but ignore the baseline on Mail reads.
+ // Their omission cannot prove non-membership; retain the server list.
+ if (
+ result.kind === 'mail-page' &&
+ result.retainedKeys === undefined &&
+ records.some(
+ (record) => !result.keys.includes(soupItemKey(record))
+ )
+ ) {
+ setLocalProjection(undefined);
+ return;
+ }
const selected = await readSoupPage(host, {
page: result,
select:
result.kind === 'mail-page'
? mailItemSelection
: definition.select,
- baseline: result.kind === 'mail-page' ? [] : records,
+ baseline: records,
mailView,
});
if (requestId !== localRequest) {
@@ -773,9 +806,7 @@ export function createSoupLiveQuery(
setLocalProjection({
input: definition.input,
generation: requestGeneration,
- baselineKeys: new Set(
- result.kind === 'mail-page' ? [] : records.map(soupItemKey)
- ),
+ baselineKeys: new Set(records.map(soupItemKey)),
displayedKeys: new Set(reconciledRecords.map(soupItemKey)),
withoutEmail,
...(result.kind === 'mail-page'
@@ -795,7 +826,11 @@ export function createSoupLiveQuery(
setLocalMailEdge(result.endCursor ?? null);
// Set here: a new edge reruns the effect, which supersedes
// this request before its `finally`.
- if (mailView) setLocalMailCurrent(true);
+ if (mailView)
+ setLocalMailCurrent(
+ result.kind === 'mail-page' &&
+ result.retainedKeys?.length === 0
+ );
// The filter, fragments, and final revision agree. A newer coherent
// page is valid even if hydration advanced past the initial read.
// Publish both result kinds' watermarks: the Mail guard avoids a
@@ -807,14 +842,14 @@ export function createSoupLiveQuery(
finishStaleFallback('local');
span.setAttr(
'evaluation.retained_count',
- result.kind === 'reconciled' ? result.retainedKeys.length : 0
+ result.retainedKeys?.length ?? 0
);
return;
}
} catch {
outcome = 'error';
- // Unsupported, incomplete, validation, and storage failures retain
- // the stale network/normalized-cache fallback already on screen.
+ // Transient evaluation failures retain the last coherent projection,
+ // including offline rows absent from the server fallback.
} finally {
// Only the latest request decides, after any stale-revision retries.
if (mailView && requestId === localRequest && outcome !== 'success')
@@ -883,6 +918,8 @@ export function createSoupLiveQuery(
if (networkIsAuthoritative()) return query.data?.records();
const local = displayLocalProjection();
if (!local) return query.data?.records();
+ // Mail merges new server evidence in its ordered through-read. Appending
+ // it here would bypass membership decisions and the local cursor order.
if (local.mail) return local.records;
const additions = unreconciledServerRecords(
serverRecords(),
@@ -976,7 +1013,19 @@ export function createSoupLiveQuery(
error,
isSupported,
isEnabled: () => query.isEnabled,
- isLoading: () => query.isLoading && displayLocalProjection() === undefined,
+ isLoading: () => {
+ if (!query.isLoading) return false;
+ const local = displayLocalProjection();
+ if (!local) return true;
+ // An empty local Mail page does not establish complete mailbox coverage.
+ // Wait for the first query response before showing an online empty state.
+ return (
+ local.mail !== undefined &&
+ local.records.length === 0 &&
+ !offline() &&
+ !options().networkPaused
+ );
+ },
isFetching: () => query.isFetching,
isFetchingNextPage: () =>
fetchingMailPage() || (!cachedMail() && query.isFetchingNextPage),
@@ -1012,7 +1061,7 @@ export function createSoupLiveQuery(
const mailView = initial.emailView;
setFetchingMailPage(true);
try {
- const result = await host.entityFilter({
+ let result = await host.entityFilter({
filters: initial.filters ?? {},
sortMethod: initial.sortMethod ?? 'UPDATED_AT',
sortDirection: initial.sortDirection ?? 'DESC',
@@ -1026,11 +1075,33 @@ export function createSoupLiveQuery(
return;
}
if (result.kind !== 'mail-page') return;
- const keys = [...local.displayedKeys, ...result.keys];
+ const definition = localSource();
+ const reconcile =
+ result.retainedKeys !== undefined &&
+ result.endCursor &&
+ definition?.source.baseline?.length;
+ if (reconcile) {
+ // A retained row may sit below the indexed cursor. Re-read the whole
+ // window through the next page before publishing; append cannot keep
+ // that union ordered and deduplication alone can produce no-op pages.
+ result = await host.entityFilter({
+ ...definition.source,
+ limit: Math.min(
+ local.displayedKeys.size + result.keys.length,
+ MAX_MAIL_THROUGH_ROWS
+ ),
+ mail: { view: mailView, through: result.endCursor ?? undefined },
+ });
+ if (displayLocalProjection() !== local || result.kind !== 'mail-page')
+ return;
+ }
+ const keys = reconcile
+ ? result.keys
+ : [...local.displayedKeys, ...result.keys];
const selected = await readSoupPage(host, {
page: result,
select: mailItemSelection,
- baseline: local.records,
+ baseline: reconcile ? definition.records : local.records,
keys,
mailView,
});
@@ -1053,8 +1124,12 @@ export function createSoupLiveQuery(
// Together, so the evaluation sees the new edge already displayed.
batch(() => {
setLocalMailEdge(edge);
+ setLocalMailCurrent(result.retainedKeys?.length === 0);
setLocalProjection({
...local,
+ baselineKeys: reconcile
+ ? new Set(definition.records.map(soupItemKey))
+ : local.baselineKeys,
displayedKeys: new Set(keys),
mail: {
nextCursor: result.nextCursor,
@@ -1072,15 +1147,19 @@ export function createSoupLiveQuery(
}
},
resetToInitialPage: () => {
+ // Resetting server pages can invalidate the displayed projection's
+ // baseline. Capture ownership before that happens, then clear its edge.
+ const mail = localProjection()?.mail;
pagingGeneration += 1;
- query.resetToInitialPage();
- if (displayLocalProjection()?.mail) {
- batch(() => {
+ batch(() => {
+ query.resetToInitialPage();
+ setLocalMailEdge(null);
+ setLocalMailCurrent(false);
+ if (mail) {
setLocalProjection(undefined);
- setLocalMailEdge(null);
setLocalEvaluationTrigger((value) => value + 1);
- });
- }
+ }
+ });
},
refresh: async () => {
if (firstPageInput() === undefined) return;
diff --git a/apps/web/src/lib/queries/soup/graphql/items.test.ts b/apps/web/src/lib/queries/soup/graphql/items.test.ts
index 3efdc0fffa..67772332d5 100644
--- a/apps/web/src/lib/queries/soup/graphql/items.test.ts
+++ b/apps/web/src/lib/queries/soup/graphql/items.test.ts
@@ -44,6 +44,10 @@ vi.mock('../../../graphql-cache/exchange/normalized-cache-exchange', () => ({
}));
vi.mock('@service-storage/graphql-soup', () => ({
+ emailThreadSortTs: (record: {
+ latestInboundMessageTs?: string;
+ updatedAt: string;
+ }) => record.latestInboundMessageTs ?? record.updatedAt,
getGraphqlSoupClient: getGraphqlSoupClientMock,
getGraphqlSoupCacheHost: getGraphqlSoupCacheHostMock,
hasGraphqlCacheHost: () => getGraphqlSoupCacheHostMock() !== undefined,
@@ -203,6 +207,609 @@ describe('createGraphqlSoupAstItemsQuery', () => {
});
});
+ it.each([
+ { name: 'current host', supported: true, includesInvite: true },
+ { name: 'older host omits row', supported: false, includesInvite: false },
+ {
+ name: 'older host omits preview',
+ supported: false,
+ includesInvite: true,
+ },
+ ])(
+ 'keeps server mail during incomplete cache refreshes ($name)',
+ async ({ supported, includesInvite }) => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ makeGraphqlSoupInputMock.mockReturnValue({
+ initial: { emailView: 'INBOX', sortMethod: 'UPDATED_AT', limit: 20 },
+ });
+ let revision = REVISION_1;
+ let archived = false;
+ let hydrated = false;
+ let changed: (revision: string) => void = () => {};
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
+ onCacheGenerationChanged: () => () => {},
+ });
+ const normalKey = 'GraphqlSoupEmailThread:normal';
+ const inviteKey = 'GraphqlSoupEmailThread:invite';
+ entityFilterMock.mockImplementation(async () => ({
+ kind: 'mail-page',
+ revision,
+ keys:
+ includesInvite && !archived ? [inviteKey, normalKey] : [normalKey],
+ ...(supported ? { retainedKeys: archived ? [] : [inviteKey] } : {}),
+ sortTimestamps: ['2026-01-02T00:00:00Z', '2026-01-01T00:00:00Z'],
+ nextCursor: null,
+ optimistic: false,
+ }));
+ readRecordsByKeysMock.mockImplementation(async () => ({
+ revision,
+ records: mailThreadRecords([normalKey, inviteKey]).map((row) => ({
+ ...row,
+ record: {
+ ...row.record,
+ emailName: 'Preview from another tab',
+ ...(!hydrated && row.recordKey === inviteKey
+ ? { mailAllPreview: null }
+ : {}),
+ },
+ })),
+ }));
+ const { query, dispose } = createRoot((dispose) => ({
+ dispose,
+ query: createGraphqlSoupAstItemsQuery(
+ () => ({ params: {}, body: {} }),
+ () => ({ enabled: true })
+ ),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: ['invite', 'normal'].map((id) => ({
+ __typename: 'GraphqlSoupEmailThread',
+ id,
+ emailName:
+ id === 'invite' ? 'Calendar invitation' : 'Ordinary email',
+ latestInboundMessageTs: '2026-01-02T00:00:00Z',
+ })),
+ next_cursor: null,
+ })
+ );
+ await vi.waitFor(() => expect(query.data()?.entities).toHaveLength(2));
+ revision = REVISION_2;
+ changed(revision);
+ await vi.waitFor(() =>
+ expect(entityFilterMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ baseline: expect.arrayContaining([
+ { key: inviteKey, sortTimestamp: '2026-01-02T00:00:00Z' },
+ ]),
+ })
+ )
+ );
+ if (includesInvite)
+ await vi.waitFor(() => expect(query.data()?.cachedMail).toBe(true));
+ else
+ await vi.waitFor(() =>
+ expect(query.cacheMaintained?.()).not.toBe(true)
+ );
+ expect(query.data()?.entities.map((row) => row.id)).toEqual([
+ 'invite',
+ 'normal',
+ ]);
+ expect(query.data()?.entities[0]).toMatchObject({
+ emailName: 'Calendar invitation',
+ });
+ expect(query.cacheMaintained?.()).toBe(false);
+ expect(
+ getActiveGraphqlSoupRevalidations(undefined, {
+ unmaintainedOnly: true,
+ })
+ ).not.toHaveLength(0);
+ if (supported) {
+ archived = true;
+ revision = '3';
+ changed(revision);
+ await vi.waitFor(() =>
+ expect(query.data()?.entities.map((row) => row.id)).toEqual([
+ 'normal',
+ ])
+ );
+ } else if (includesInvite) {
+ hydrated = true;
+ revision = '3';
+ changed(revision);
+ await vi.waitFor(() =>
+ expect(query.data()?.entities[0]).toMatchObject({
+ emailName: inviteKey,
+ })
+ );
+ }
+ if (!supported) {
+ expect(query.cacheMaintained?.()).toBe(false);
+ archived = true;
+ revision = '4';
+ changed(revision);
+ const refresh = query.refresh();
+ fake.executions.at(-1)!.next(
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id: 'normal' }],
+ next_cursor: null,
+ }),
+ { source: 'live-network', revision }
+ );
+ await refresh;
+ expect(query.data()?.entities.map((row) => row.id)).toEqual([
+ 'normal',
+ ]);
+ }
+ } finally {
+ dispose();
+ }
+ }
+ );
+
+ it('keeps retained previews while read state changes before and after settlement', async () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ let revision = '1';
+ let changed: (revision: string) => void = () => {};
+ let isRead = false;
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
+ onCacheGenerationChanged: () => () => {},
+ });
+ const key = 'GraphqlSoupEmailThread:invite';
+ entityFilterMock.mockImplementation(async () => ({
+ kind: 'mail-page',
+ revision,
+ keys: [key],
+ retainedKeys: [key],
+ sortTimestamps: ['2026-01-01T00:00:00Z'],
+ nextCursor: null,
+ optimistic: revision === '2',
+ }));
+ readRecordsByKeysMock.mockImplementation(async () => ({
+ revision,
+ records: [
+ {
+ recordKey: key,
+ record: {
+ __typename: 'GraphqlSoupEmailThread',
+ id: 'invite',
+ isRead,
+ inboxVisible: true,
+ isSignal: false,
+ emailName: 'Another view',
+ mailAllPreview: null,
+ },
+ },
+ ],
+ }));
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(() => ({
+ emailView: 'INBOX',
+ sortMethod: 'UPDATED_AT',
+ limit: 20,
+ })),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [
+ {
+ __typename: 'GraphqlSoupEmailThread',
+ id: 'invite',
+ isRead: false,
+ inboxVisible: true,
+ emailName: 'Invitation',
+ },
+ ],
+ next_cursor: null,
+ })
+ );
+ revision = '2';
+ isRead = true;
+ changed(revision);
+ await vi.waitFor(() =>
+ expect(source.data()?.[0]).toMatchObject({
+ isRead: true,
+ emailName: 'Invitation',
+ })
+ );
+ expect(source.cacheMaintained()).toBe(false);
+ revision = '3';
+ changed(revision);
+ await vi.waitFor(() => expect(source.localRevision()).toBe('3'));
+ expect(source.data()?.[0]).toMatchObject({
+ isRead: true,
+ emailName: 'Invitation',
+ });
+ isRead = false;
+ revision = '4';
+ changed(revision);
+ await vi.waitFor(() =>
+ expect(source.data()?.[0]).toMatchObject({
+ isRead: false,
+ emailName: 'Invitation',
+ })
+ );
+ } finally {
+ dispose();
+ }
+ });
+
+ it('merges retained rows across a Mail cursor before publishing the next page', async () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ let revision = '1';
+ let changed: (revision: string) => void = () => {};
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
+ onCacheGenerationChanged: () => () => {},
+ });
+ const key = (id: string) => `GraphqlSoupEmailThread:${id}`;
+ entityFilterMock.mockImplementation(async ({ mail }) => ({
+ kind: 'mail-page',
+ revision,
+ keys: (mail.through === 'end'
+ ? ['first', 'second', 'retained']
+ : mail.cursor
+ ? ['second']
+ : ['first', 'retained']
+ ).map(key),
+ retainedKeys: mail.cursor ? [] : [key('retained')],
+ sortTimestamps:
+ mail.through === 'end'
+ ? [
+ '2026-01-03T00:00:00Z',
+ '2026-01-02T00:00:00Z',
+ '2026-01-01T00:00:00Z',
+ ]
+ : mail.cursor
+ ? ['2026-01-02T00:00:00Z']
+ : ['2026-01-03T00:00:00Z', '2026-01-01T00:00:00Z'],
+ endCursor: mail.cursor || mail.through === 'end' ? 'end' : 'first',
+ nextCursor: mail.cursor || mail.through === 'end' ? null : 'next',
+ optimistic: false,
+ }));
+ readRecordsByKeysMock.mockImplementation(
+ async (_host, _selection, keys) => ({
+ revision,
+ records: mailThreadRecords(keys),
+ })
+ );
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(() => ({
+ emailView: 'INBOX',
+ sortMethod: 'UPDATED_AT',
+ limit: 1,
+ })),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [
+ {
+ __typename: 'GraphqlSoupEmailThread',
+ id: 'retained',
+ emailName: 'Invitation',
+ },
+ ],
+ next_cursor: null,
+ })
+ );
+ revision = '2';
+ changed(revision);
+ await vi.waitFor(() => expect(source.cachedMail()).toBe(true));
+ expect(source.data()?.map((row) => row.id)).toEqual([
+ 'first',
+ 'retained',
+ ]);
+ await source.fetchNextPage();
+ expect(source.data()?.map((row) => row.id)).toEqual([
+ 'first',
+ 'second',
+ 'retained',
+ ]);
+ } finally {
+ dispose();
+ }
+ });
+
+ it('discards a local Mail projection when the server baseline exceeds its bound', async () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ let revision = '1';
+ let changed: (revision: string) => void = () => {};
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
+ onCacheGenerationChanged: () => () => {},
+ });
+ const key = 'GraphqlSoupEmailThread:one';
+ entityFilterMock.mockImplementation(async () => ({
+ kind: 'mail-page',
+ revision,
+ keys: [key],
+ retainedKeys: [],
+ sortTimestamps: ['2026-01-01T00:00:00Z'],
+ nextCursor: null,
+ endCursor: 'previous-depth',
+ optimistic: false,
+ }));
+ readRecordsByKeysMock.mockImplementation(async () => ({
+ revision,
+ records: mailThreadRecords([key]),
+ }));
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(() => ({
+ emailView: 'INBOX',
+ sortMethod: 'UPDATED_AT',
+ limit: 20,
+ })),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id: 'one' }],
+ next_cursor: null,
+ })
+ );
+ revision = '2';
+ changed(revision);
+ await vi.waitFor(() => expect(source.cachedMail()).toBe(true));
+ const refresh = source.refresh();
+ const items = Array.from({ length: 5001 }, (_, i) => ({
+ __typename: 'GraphqlSoupEmailThread',
+ id: i === 0 ? 'one' : String(i),
+ emailName: 'Fresh server row',
+ }));
+ fake.executions
+ .at(-1)!
+ .next(graphqlSoupPage({ items, next_cursor: null }), {
+ source: 'live-network',
+ revision: '3',
+ });
+ await refresh;
+ revision = '4';
+ changed(revision);
+ await vi.waitFor(() => expect(source.cachedMail()).toBe(false));
+ expect(source.cacheMaintained()).toBe(false);
+ expect(source.data()?.[0]).toMatchObject({
+ emailName: 'Fresh server row',
+ });
+ entityFilterMock.mockClear();
+ source.resetToInitialPage();
+ fake.executions.at(-1)!.next(
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id: 'one' }],
+ next_cursor: null,
+ }),
+ { source: 'normalized-cache-hit', revision }
+ );
+ await vi.waitFor(() => expect(entityFilterMock).toHaveBeenCalled());
+ expect(entityFilterMock.mock.calls[0][0].mail.through).toBeUndefined();
+ } finally {
+ dispose();
+ }
+ });
+
+ it('reconciles late server rows even when the local list is already longer', async () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ let revision = '1';
+ let changed: (revision: string) => void = () => {};
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
+ onCacheGenerationChanged: () => () => {},
+ });
+ const key = (id: string) => `GraphqlSoupEmailThread:${id}`;
+ entityFilterMock.mockImplementation(async ({ baseline }) => {
+ const ids = baseline?.some(
+ (entry: { key: string }) => entry.key === key('late')
+ )
+ ? ['late', 'one', 'two']
+ : ['one', 'two'];
+ return {
+ kind: 'mail-page',
+ revision,
+ keys: ids.map(key),
+ retainedKeys: [],
+ sortTimestamps: ids.map(() => '2026-01-01T00:00:00Z'),
+ nextCursor: null,
+ optimistic: false,
+ };
+ });
+ readRecordsByKeysMock.mockImplementation(
+ async (_host, _selection, keys) => ({
+ revision,
+ records: mailThreadRecords(keys),
+ })
+ );
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(() => ({
+ emailView: 'INBOX',
+ sortMethod: 'UPDATED_AT',
+ limit: 20,
+ })),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id: 'one' }],
+ next_cursor: null,
+ })
+ );
+ revision = '2';
+ changed(revision);
+ await vi.waitFor(() => expect(source.cachedMail()).toBe(true));
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id: 'late' }],
+ next_cursor: null,
+ }),
+ { source: 'normalized-cache-hit', revision }
+ );
+ await vi.waitFor(() =>
+ expect(source.data()?.map((row) => row.id)).toEqual([
+ 'late',
+ 'one',
+ 'two',
+ ])
+ );
+ fake.executions[0].next(
+ graphqlSoupPage({ items: [], next_cursor: null }),
+ { source: 'normalized-cache-hit', revision }
+ );
+ await vi.waitFor(() =>
+ expect(source.data()?.map((row) => row.id)).toEqual(['one', 'two'])
+ );
+ expect(source.cacheMaintained()).toBe(true);
+ } finally {
+ dispose();
+ }
+ });
+
+ it('keeps recovery refreshes enabled when server evidence arrives during pagination', async () => {
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ let revision = '1';
+ let changed: (revision: string) => void = () => {};
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
+ onCacheGenerationChanged: () => () => {},
+ });
+ const key = (id: string) => `GraphqlSoupEmailThread:${id}`;
+ const merged = {
+ kind: 'mail-page' as const,
+ revision: '2',
+ keys: ['first', 'second', 'retained'].map(key),
+ retainedKeys: [key('retained')],
+ sortTimestamps: [
+ '2026-01-03T00:00:00Z',
+ '2026-01-02T00:00:00Z',
+ '2026-01-01T00:00:00Z',
+ ],
+ nextCursor: null,
+ endCursor: 'end',
+ optimistic: false,
+ };
+ const evaluation = deferred<typeof merged>();
+ let paging = false;
+ entityFilterMock.mockImplementation(async ({ mail, baseline }) => {
+ if (mail.cursor) {
+ paging = true;
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: ['first', 'retained'].map((id) => ({
+ __typename: 'GraphqlSoupEmailThread',
+ id,
+ })),
+ next_cursor: null,
+ }),
+ { source: 'normalized-cache-hit', revision }
+ );
+ return {
+ ...merged,
+ keys: [key('second')],
+ retainedKeys: [],
+ sortTimestamps: [merged.sortTimestamps[1]],
+ };
+ }
+ if (mail.through === 'end') return merged;
+ if (
+ paging &&
+ baseline.some((entry: { key: string }) => entry.key === key('retained'))
+ ) {
+ return evaluation.promise;
+ }
+ return {
+ ...merged,
+ revision,
+ keys: [key('first')],
+ retainedKeys: [],
+ sortTimestamps: [merged.sortTimestamps[0]],
+ endCursor: 'first',
+ nextCursor: 'next',
+ };
+ });
+ readRecordsByKeysMock.mockImplementation(
+ async (_host, _selection, keys: string[]) => ({
+ revision,
+ records: mailThreadRecords(
+ keys.filter((key) => !key.endsWith(':retained'))
+ ),
+ })
+ );
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(() => ({
+ emailView: 'INBOX',
+ sortMethod: 'UPDATED_AT',
+ limit: 1,
+ })),
+ }));
+ try {
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id: 'first' }],
+ next_cursor: null,
+ })
+ );
+ revision = '2';
+ changed(revision);
+ await vi.waitFor(() => expect(source.cacheMaintained()).toBe(true));
+ await source.fetchNextPage();
+ expect(source.data()?.map((row) => row.id)).toEqual([
+ 'first',
+ 'second',
+ 'retained',
+ ]);
+ expect(source.cacheMaintained()).toBe(false);
+ expect(
+ getActiveGraphqlSoupRevalidations(undefined, { unmaintainedOnly: true })
+ ).not.toHaveLength(0);
+ } finally {
+ evaluation.resolve(merged);
+ dispose();
+ }
+ });
+
it("hands the query's email view to the item mapper", async () => {
const fake = makeFakeClient();
getGraphqlSoupClientMock.mockReturnValue(fake.client);
@@ -1691,6 +2298,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
});
entityFilterMock.mockResolvedValue({
kind: 'mail-page',
+ retainedKeys: [],
revision: REVISION_2,
keys: [],
sortTimestamps: [],
@@ -1821,6 +2429,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
const index = args.filters.emailFilter ? 2 : args.mail.cursor ? 1 : 0;
return {
kind: 'mail-page',
+ retainedKeys: [],
revision: REVISION_0,
keys: [keys[index]],
sortTimestamps: [ts],
@@ -1927,6 +2536,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
});
entityFilterMock.mockImplementation(async (args) => ({
kind: 'mail-page',
+ retainedKeys: [],
revision: REVISION_0,
keys: [`GraphqlSoupEmailThread:${args.mail.cursor ? 'two' : 'one'}`],
sortTimestamps: ['2025-01-01T00:00:00.000001Z'],
@@ -2022,6 +2632,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
const keys = all.slice(start, end);
return {
kind: 'mail-page',
+ retainedKeys: [],
revision: REVISION_0,
keys,
sortTimestamps: keys.map(() => '2025-01-01T00:00:00.000001Z'),
@@ -2050,7 +2661,10 @@ describe('createGraphqlSoupAstItemsQuery', () => {
);
});
const serverPage = (id: string, next: string | null) =>
- graphqlSoupPage({ items: [{ id }], next_cursor: next });
+ graphqlSoupPage({
+ items: [{ __typename: 'GraphqlSoupEmailThread', id }],
+ next_cursor: next,
+ });
const ids = () => query.data()?.entities.map((entity) => entity.id);
const tick = () => new Promise((resolve) => setTimeout(resolve, 0));
try {
@@ -2116,6 +2730,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
});
entityFilterMock.mockImplementation(async () => ({
kind: 'mail-page',
+ retainedKeys: [],
revision,
keys: ['GraphqlSoupEmailThread:a'],
sortTimestamps: ['2025-01-01T00:00:00.000001Z'],
@@ -2224,6 +2839,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
const last = keys.length ? `${generation}|${keys.at(-1)}` : null;
return {
kind: 'mail-page',
+ retainedKeys: [],
revision,
keys,
sortTimestamps: keys.map(() => '2025-01-01T00:00:00.000001Z'),
@@ -2480,6 +3096,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
);
entityFilterMock.mockResolvedValue({
kind: 'mail-page',
+ retainedKeys: [],
revision: REVISION_0,
keys: [],
sortTimestamps: [],
@@ -2556,10 +3173,14 @@ describe('createGraphqlSoupAstItemsQuery', () => {
const fake = makeFakeClient();
getGraphqlSoupClientMock.mockReturnValue(fake.client);
let revision = REVISION_0;
+ let changed: (revision: string) => void = () => {};
getGraphqlSoupCacheHostMock.mockReturnValue({
currentRevision: async () => revision,
entityFilter: entityFilterMock,
- onCacheChanged: () => () => {},
+ onCacheChanged: (callback: typeof changed) => {
+ changed = callback;
+ return () => {};
+ },
onCacheGenerationChanged: () => () => {},
});
makeGraphqlSoupInputMock.mockReturnValue({
@@ -2576,6 +3197,7 @@ describe('createGraphqlSoupAstItemsQuery', () => {
};
entityFilterMock.mockImplementation(async () => ({
kind: 'mail-page',
+ retainedKeys: [],
revision,
keys: ['GraphqlSoupEmailThread:local-draft'],
sortTimestamps: ['2026-09-28T12:00:00Z'],
@@ -2639,6 +3261,16 @@ describe('createGraphqlSoupAstItemsQuery', () => {
);
expect(query.data()?.cachedMail).toBe(true);
+ entityFilterMock.mockRejectedValueOnce(
+ new Error('temporary cache read failure')
+ );
+ revision = REVISION_2;
+ changed(revision);
+ await vi.waitFor(() => expect(query.cacheMaintained?.()).toBe(false));
+ expect(query.data()?.entities.map((row) => row.id)).toEqual([
+ 'local-draft',
+ ]);
+
// Once the write settles, the fresh server page takes over even if
// an old local row remains. Pending preservation must not retain ghosts.
revision = REVISION_2;
@@ -2684,6 +3316,148 @@ describe('createGraphqlSoupAstItemsQuery', () => {
});
});
+ it.each([
+ { result: 'emails', optimistic: false },
+ { result: 'empty', optimistic: false },
+ { result: 'network error', optimistic: false },
+ { result: 'emails', optimistic: true },
+ ] as const)(
+ 'keeps a cold empty Mail result loading until $result (optimistic: $optimistic)',
+ async ({ result, optimistic }) => {
+ const online = vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(true);
+ const fake = makeFakeClient();
+ let revision = REVISION_0;
+ let keys: string[] = [];
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => revision,
+ entityFilter: entityFilterMock,
+ onCacheChanged: () => () => {},
+ onCacheGenerationChanged: () => () => {},
+ });
+ entityFilterMock.mockImplementation(async () => ({
+ kind: 'mail-page',
+ revision,
+ keys,
+ retainedKeys: [],
+ sortTimestamps: keys.map(() => '2026-01-01T00:00:00Z'),
+ nextCursor: null,
+ endCursor: null,
+ optimistic,
+ }));
+ readRecordsByKeysMock.mockImplementation(async () => ({
+ revision,
+ records: mailThreadRecords(keys),
+ }));
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(() => ({
+ emailView: 'INBOX',
+ sortMethod: 'UPDATED_AT',
+ filters: {
+ emailFilter: { tree: { literal: { importance: false } } },
+ },
+ limit: 20,
+ })),
+ }));
+ try {
+ await vi.waitFor(() => expect(source.cachedMail()).toBe(true));
+ expect(source.data()).toEqual([]);
+ expect(source.isFetching()).toBe(true);
+ expect(source.isLoading()).toBe(true);
+ if (result === 'network error') {
+ fake.executions[0].fail(
+ new CombinedError({ networkError: new Error('API disconnected') })
+ );
+ expect(source.isLoading()).toBe(false);
+ expect(source.data()).toEqual([]);
+ expect(source.error()).toBeUndefined();
+ return;
+ }
+ revision = REVISION_1;
+ keys = result === 'emails' ? ['GraphqlSoupEmailThread:noise'] : [];
+ fake.executions[0].next(
+ graphqlSoupPage({
+ items:
+ result === 'emails'
+ ? [{ __typename: 'GraphqlSoupEmailThread', id: 'noise' }]
+ : [],
+ next_cursor: null,
+ })
+ );
+ expect(source.isLoading()).toBe(false);
+ await vi.waitFor(() =>
+ expect(source.data()?.map((record) => record.id)).toEqual(
+ result === 'emails' ? ['noise'] : []
+ )
+ );
+ if (result === 'empty') {
+ const refresh = source.refresh();
+ expect(source.isFetching()).toBe(true);
+ expect(source.isLoading()).toBe(false);
+ fake.executions
+ .at(-1)!
+ .next(graphqlSoupPage({ items: [], next_cursor: null }));
+ await refresh;
+ expect(source.isLoading()).toBe(false);
+ }
+ } finally {
+ dispose();
+ online.mockRestore();
+ }
+ }
+ );
+
+ it.each(['offline', 'cache-only', 'local-only'] as const)(
+ 'does not wait for HTTP when an empty Mail result is %s',
+ async (mode) => {
+ const online = vi
+ .spyOn(navigator, 'onLine', 'get')
+ .mockReturnValue(mode !== 'offline');
+ const fake = makeFakeClient();
+ getGraphqlSoupClientMock.mockReturnValue(fake.client);
+ getGraphqlSoupCacheHostMock.mockReturnValue({
+ currentRevision: async () => REVISION_0,
+ entityFilter: entityFilterMock,
+ onCacheChanged: () => () => {},
+ onCacheGenerationChanged: () => () => {},
+ });
+ entityFilterMock.mockResolvedValue({
+ kind: 'mail-page',
+ revision: REVISION_0,
+ keys: [],
+ retainedKeys: [],
+ sortTimestamps: [],
+ nextCursor: null,
+ endCursor: null,
+ optimistic: false,
+ });
+ readRecordsByKeysMock.mockResolvedValue({
+ revision: REVISION_0,
+ records: [],
+ });
+ const { source, dispose } = createRoot((dispose) => ({
+ dispose,
+ source: createSoupLiveQuery(
+ () => ({ emailView: 'INBOX', sortMethod: 'UPDATED_AT', limit: 20 }),
+ () => ({
+ networkPaused: mode === 'cache-only',
+ localOnly: mode === 'local-only',
+ })
+ ),
+ }));
+ try {
+ await vi.waitFor(() => expect(source.cachedMail()).toBe(true));
+ expect(source.data()).toEqual([]);
+ expect(source.isLoading()).toBe(false);
+ if (mode === 'local-only') expect(fake.executions).toHaveLength(0);
+ } finally {
+ dispose();
+ online.mockRestore();
+ }
+ }
+ );
+
it('shows current-query local data without a tab placeholder while the network continues', async () => {
const fake = makeFakeClient();
getGraphqlSoupClientMock.mockReturnValue(fake.client);
diff --git a/apps/web/src/lib/queries/soup/graphql/mail-state.ts b/apps/web/src/lib/queries/soup/graphql/mail-state.ts
new file mode 100644
index 0000000000..d389976ca0
--- /dev/null
+++ b/apps/web/src/lib/queries/soup/graphql/mail-state.ts
@@ -0,0 +1,50 @@
+import {
+ readRecordsByKeys,
+ selectRecords,
+} from '../../../graphql-cache/exchange/record-selection';
+import type { CacheHost } from '../../../graphql-cache/host/types';
+import type { CacheRevision } from '../../../graphql-cache/protocol';
+import {
+ MailInboxStateFieldsFragmentDoc,
+ MailReadStateFieldsFragmentDoc,
+ MailSignalStateFieldsFragmentDoc,
+} from '../../../service-clients/service-storage/graphql/generated/graphql';
+
+const selections = [
+ selectRecords(MailInboxStateFieldsFragmentDoc),
+ selectRecords(MailReadStateFieldsFragmentDoc),
+ selectRecords(MailSignalStateFieldsFragmentDoc),
+];
+
+/** Select flags independently: a missing preview or another flag cannot hide a
+ * known optimistic/committed update. Callers validate every returned revision. */
+export async function readMailState(
+ host: Pick<CacheHost, 'readRecordsByKeys'>,
+ keys: string[]
+) {
+ const revisions: CacheRevision[] = [];
+ const records = new Map<
+ string,
+ { inboxVisible?: boolean; isRead?: boolean; isSignal?: boolean }
+ >();
+ for (const selection of selections) {
+ for (let offset = 0; offset < keys.length; offset += 500) {
+ const result = await readRecordsByKeys<{
+ inboxVisible?: boolean;
+ isRead?: boolean;
+ isSignal?: boolean;
+ }>(host, selection, keys.slice(offset, offset + 500));
+ revisions.push(result.revision);
+ for (const { recordKey, record } of result.records) {
+ const flags = records.get(recordKey) ?? {};
+ if (typeof record.inboxVisible === 'boolean')
+ flags.inboxVisible = record.inboxVisible;
+ if (typeof record.isRead === 'boolean') flags.isRead = record.isRead;
+ if (typeof record.isSignal === 'boolean')
+ flags.isSignal = record.isSignal;
+ records.set(recordKey, flags);
+ }
+ }
+ }
+ return { revisions, records };
+}
diff --git a/apps/web/src/lib/queries/soup/graphql/read-soup-page.ts b/apps/web/src/lib/queries/soup/graphql/read-soup-page.ts
index a00ca69bfc..7b3c1ff145 100644
--- a/apps/web/src/lib/queries/soup/graphql/read-soup-page.ts
+++ b/apps/web/src/lib/queries/soup/graphql/read-soup-page.ts
@@ -4,6 +4,7 @@ import type { CacheHost } from '../../../graphql-cache/host/types';
import type { EntityFilterCacheResult } from '../../../graphql-cache/protocol';
import type { MailItemFieldsFragment } from '../../../service-clients/service-storage/graphql/generated/graphql';
import type { GraphqlSoupItem } from '../../../service-clients/service-storage/graphql-soup';
+import { readMailState } from './mail-state';
import { type CachedMailView, materializeMailView } from './mail-view';
import { materializeReconciledSoup, soupItemKey } from './reconciliation';
@@ -34,10 +35,31 @@ export async function readSoupPage(
)
);
}
+ const selected = chunks.flatMap((chunk) => chunk.records);
+ const selectedByKey = new Map(
+ selected.map((row) => [row.recordKey, row.record])
+ );
+ const snapshots = new Map(
+ baseline.map((record) => [soupItemKey(record), record])
+ );
+ const fallbackKeys =
+ page.kind === 'mail-page'
+ ? page.keys.filter((key) => {
+ if (!snapshots.has(key)) return false;
+ const record = selectedByKey.get(key);
+ return (
+ !record ||
+ !mailView ||
+ !materializeMailView(record as MailItemFieldsFragment, mailView, '')
+ );
+ })
+ : [];
+ const state = await readMailState(host, fallbackKeys);
const revision = await host.currentRevision();
if (
page.revision !== revision ||
- chunks.some((chunk) => chunk.revision !== revision)
+ chunks.some((chunk) => chunk.revision !== revision) ||
+ state.revisions.some((value) => value !== revision)
)
return { kind: 'stale' as const, revision };
@@ -45,19 +67,41 @@ export async function readSoupPage(
page.kind === 'mail-page'
? new Map(page.keys.map((key, i) => [key, page.sortTimestamps[i]]))
: undefined;
- const records = materializeReconciledSoup(
- keys,
- chunks.flatMap((chunk) => chunk.records),
- baseline
- ).flatMap((record) => {
- const timestamp = timestamps?.get(soupItemKey(record));
- if (!timestamp || !mailView) return [record];
- const selected = materializeMailView(
- record as MailItemFieldsFragment,
- mailView,
- timestamp
- );
- return selected ? [selected] : [];
- });
+ const records = materializeReconciledSoup(keys, selected, baseline).flatMap(
+ (record) => {
+ const key = soupItemKey(record);
+ const timestamp = timestamps?.get(key);
+ if (!timestamp || !mailView) return [record];
+ // Older hosts can confirm membership before the canonical preview is
+ // readable. Prefer canonical fields as soon as they become available.
+ const current = selectedByKey.get(key);
+ const canonical =
+ current &&
+ materializeMailView(
+ current as MailItemFieldsFragment,
+ mailView,
+ timestamp
+ );
+ if (canonical) return [canonical];
+ const snapshot = snapshots.get(key);
+ if (snapshot?.__typename !== 'GraphqlSoupEmailThread') return [];
+ // Only preview fields are query-dependent. Shared fields remain live,
+ // including flags readable without the canonical-preview fragment.
+ return [
+ {
+ ...snapshot,
+ ...(current?.__typename === 'GraphqlSoupEmailThread' ? current : {}),
+ ...state.records.get(key),
+ createdAt: timestamp,
+ emailName: snapshot.emailName,
+ snippet: snapshot.snippet,
+ isDraft: snapshot.isDraft,
+ senderEmail: snapshot.senderEmail,
+ senderName: snapshot.senderName,
+ senderPhotoUrl: snapshot.senderPhotoUrl,
+ },
+ ];
+ }
+ );
return { kind: 'ready' as const, revision, records };
}
diff --git a/apps/web/src/lib/service-clients/service-storage/email-thread-sort.ts b/apps/web/src/lib/service-clients/service-storage/email-thread-sort.ts
new file mode 100644
index 0000000000..6b9ed2404f
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/email-thread-sort.ts
@@ -0,0 +1,38 @@
+import { match, P } from 'ts-pattern';
+import type { GraphqlEmailView } from './graphql/generated/graphql';
+
+function latestTimestamp(
+ ...timestamps: (string | null | undefined)[]
+): string | undefined {
+ return timestamps.reduce<string | undefined>(
+ (latest, timestamp) =>
+ typeof timestamp === 'string' &&
+ (latest === undefined || Date.parse(timestamp) > Date.parse(latest))
+ ? timestamp
+ : latest,
+ undefined
+ );
+}
+
+/** The server's per-view sort key, recomputed from the thread's own facts so a
+ * cache re-read never dates a row by the view that fetched the thread last.
+ * Mirrors `get_sort_timestamp_field` in crates/email; INBOX is the server's
+ * default view. */
+export function emailThreadSortTs(
+ thread: {
+ latestInboundMessageTs?: string | null;
+ reminderReturnedAt?: string | null;
+ latestOutboundMessageTs?: string | null;
+ latestNonSpamMessageTs?: string | null;
+ updatedAt: string;
+ },
+ emailView: GraphqlEmailView | null | undefined
+): string {
+ const key = match(emailView)
+ .with('SENT', () => thread.latestOutboundMessageTs)
+ .with('INBOX', P.nullish, () =>
+ latestTimestamp(thread.latestInboundMessageTs, thread.reminderReturnedAt)
+ )
+ .otherwise(() => thread.latestNonSpamMessageTs);
+ return key ?? thread.updatedAt;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts b/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts
index 25f120264d..5fc041fc39 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts
+++ b/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts
@@ -78,11 +78,12 @@ import {
type Client as GraphqlWsClient,
} from 'graphql-ws';
import { batch, createSignal, untrack } from 'solid-js';
-import { match, P } from 'ts-pattern';
+import { match } from 'ts-pattern';
import { delegateChannelNotificationRefresh } from '../../queries/channel/notification-refresh';
import { soupOptimisticResolvers } from '../../queries/optimistic-resolvers';
import { createCacheRecovery } from './cache-recovery';
import { emailCacheDeletionKeys } from './email-cache-deletions';
+import { emailThreadSortTs } from './email-thread-sort';
import type { SoupApiItem } from './generated/schemas/soupApiItem';
import type { SoupCalendarEventSoupPropertiesField } from './generated/schemas/soupCalendarEventSoupPropertiesField';
import type { SoupCalendarEventTime } from './generated/schemas/soupCalendarEventTime';
@@ -116,6 +117,8 @@ import {
waitToRetryGraphqlSoupWebSocket,
} from './graphql-soup-websocket';
+export { emailThreadSortTs } from './email-thread-sort';
+
const dssHost = SERVER_HOSTS['document-storage-service'];
const QUEUE_CLEAR_INSPECTION_TIMEOUT_MS = 1000;
@@ -1723,42 +1726,6 @@ function mapGraphqlNotifications(
return notifications?.map(mapGraphqlNotification);
}
-function latestTimestamp(
- ...timestamps: (string | null | undefined)[]
-): string | undefined {
- return timestamps.reduce<string | undefined>(
- (latest, timestamp) =>
- typeof timestamp === 'string' &&
- (latest === undefined || Date.parse(timestamp) > Date.parse(latest))
- ? timestamp
- : latest,
- undefined
- );
-}
-
-/** The server's per-view sort key, recomputed from the thread's own facts so a
- * cache re-read never dates a row by the view that fetched the thread last.
- * Mirrors `get_sort_timestamp_field` in crates/email; INBOX is the server's
- * default view. */
-export function emailThreadSortTs(
- thread: {
- latestInboundMessageTs?: string | null;
- reminderReturnedAt?: string | null;
- latestOutboundMessageTs?: string | null;
- latestNonSpamMessageTs?: string | null;
- updatedAt: string;
- },
- emailView: GraphqlEmailView | null | undefined
-): string {
- const key = match(emailView)
- .with('SENT', () => thread.latestOutboundMessageTs)
- .with('INBOX', P.nullish, () =>
- latestTimestamp(thread.latestInboundMessageTs, thread.reminderReturnedAt)
- )
- .otherwise(() => thread.latestNonSpamMessageTs);
- return key ?? thread.updatedAt;
-}
-
/** An agent session's own row fields in the REST shape, without the
* notifications a list selects alongside them. */
export function mapGraphqlAgentSessionRow(
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.ts
index 26728e94a6..b73e3dc10a 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
@@ -16869,6 +16869,12 @@ export type MailAccountsQuery = { user: { id: string, emailLinks: Array<{ id: st
export type MailPreviewFieldsFragment = { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null };
+export type MailReadStateFieldsFragment = { __typename: 'GraphqlSoupEmailThread', id: string, isRead: boolean };
+
+export type MailInboxStateFieldsFragment = { __typename: 'GraphqlSoupEmailThread', id: string, inboxVisible: boolean };
+
+export type MailSignalStateFieldsFragment = { __typename: 'GraphqlSoupEmailThread', id: string, isSignal: boolean };
+
type MailItemFields_GraphqlSoupAgentSession_Fragment = { __typename: 'GraphqlSoupAgentSession', cacheProjection: string | null, frecencyScore: number | null, id: string, entityType: GraphqlSoupEntityType, displayName: string | null, isFavorited: boolean, isArchived: boolean, ownerId: string, botId: string, harness: string, repoUrl: string | null, repoBranch: string | null, pullRequestUrl: string | null, workingBranch: string | null, pullRequestState: GraphqlAgentPullRequestState | null, pullRequestId: string | null, turnState: string | null, threadId: string | null, source: GraphqlAgentSessionSource, visibility: GraphqlAgentSessionVisibility, status: string, createdAt: string, updatedAt: string, viewedAt: string | null, sessionName: string, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, targetEntityType: GraphqlEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:
| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }
| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }
@@ -21197,6 +21203,9 @@ export const ItemPreviewFieldsFragmentDoc = {"kind":"Document","definitions":[{"
export const ItemPreviewDetailsFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ItemPreviewDetailsFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ItemPreviewFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"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":"GraphqlDateRangePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"rangeStart"},"name":{"kind":"Name","value":"start"}},{"kind":"Field","alias":{"kind":"Name","value":"rangeEnd"},"name":{"kind":"Name","value":"end"}}]}},{"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":"ItemPreviewFields"},"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":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"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":"fileType"}},{"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":"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":"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":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelDisplayName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"companyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}}]}}]}},{"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":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}}]} as unknown as DocumentNode<ItemPreviewDetailsFieldsFragment, unknown>;
export const PropertyAssignmentParentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PropertyAssignmentParent"},"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":"id"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}}]}}]}}]} as unknown as DocumentNode<PropertyAssignmentParentFragment, unknown>;
export const SavedViewFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SavedViewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSavedView"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"config"}},{"kind":"Field","name":{"kind":"Name","value":"sharedTeamId"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SavedViewFieldsFragment, unknown>;
+export const MailReadStateFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailReadStateFields"},"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<MailReadStateFieldsFragment, unknown>;
+export const MailInboxStateFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailInboxStateFields"},"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":"inboxVisible"}}]}}]} as unknown as DocumentNode<MailInboxStateFieldsFragment, unknown>;
+export const MailSignalStateFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailSignalStateFields"},"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":"isSignal"}}]}}]} as unknown as DocumentNode<MailSignalStateFieldsFragment, unknown>;
export const MailItemFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}}]}},{"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":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"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":"GraphqlDateRangePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"rangeStart"},"name":{"kind":"Name","value":"start"}},{"kind":"Field","alias":{"kind":"Name","value":"rangeEnd"},"name":{"kind":"Name","value":"end"}}]}},{"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":"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":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupAgentSessionFields"},"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":"isArchived"}},{"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":"source"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"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":"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":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"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":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"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":"FragmentSpread","name":{"kind":"Name","value":"SoupAgentSessionFields"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"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":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"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":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"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":"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":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"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":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"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","alias":{"kind":"Name","value":"callChannelId"},"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":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"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":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"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":"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":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"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":"targetEntityType"}},{"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":"GraphqlExternalChatMessageMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"externalChatProvider"},"name":{"kind":"Name","value":"provider"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatName"},"name":{"kind":"Name","value":"chatName"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"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":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"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":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"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":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"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":"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":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"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":"GraphqlCalendarEventJoinRequestMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestTitle"},"name":{"kind":"Name","value":"title"}}]}},{"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"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}}]} as unknown as DocumentNode<MailItemFieldsFragment, unknown>;
export const SoupEntityCoreFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityCoreFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"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":"__typename"}},{"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":"targetEntityType"}},{"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":"GraphqlExternalChatMessageMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"externalChatProvider"},"name":{"kind":"Name","value":"provider"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatName"},"name":{"kind":"Name","value":"chatName"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"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":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"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":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"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":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"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":"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":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"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":"GraphqlCalendarEventJoinRequestMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestTitle"},"name":{"kind":"Name","value":"title"}}]}},{"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":"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":"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<SoupEntityCoreFieldsFragment, unknown>;
export const MailAccountFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}}]} as unknown as DocumentNode<MailAccountFieldsFragment, unknown>;
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/soup.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/soup.graphql
index e167993348..1b81e09ea8 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/soup.graphql
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/soup.graphql
@@ -78,6 +78,25 @@ fragment MailPreviewFields on GraphqlMailPreviewMessage {
senderPhotoUrl
}
+# Independent selections keep known flags live even on a partial thread.
+fragment MailReadStateFields on GraphqlSoupEmailThread {
+ __typename
+ id
+ isRead
+}
+
+fragment MailInboxStateFields on GraphqlSoupEmailThread {
+ __typename
+ id
+ inboxVisible
+}
+
+fragment MailSignalStateFields on GraphqlSoupEmailThread {
+ __typename
+ id
+ isSignal
+}
+
# Local-only selection: materialize canonical preview references instead of the
# query-dependent preview fields last written by a different tab/filter.
fragment MailItemFields on GraphqlSoupEntity {
diff --git a/apps/web/tauri/graphql_cache_plugin/src/engine/soup.rs b/apps/web/tauri/graphql_cache_plugin/src/engine/soup.rs
index 9f218ef525..90e8996019 100644
--- a/apps/web/tauri/graphql_cache_plugin/src/engine/soup.rs
+++ b/apps/web/tauri/graphql_cache_plugin/src/engine/soup.rs
@@ -126,6 +126,18 @@ pub(super) async fn filter(
}
}
if let Some(mail_request) = request.mail {
+ let baseline = request
+ .baseline
+ .unwrap_or_default()
+ .into_iter()
+ .map(|entry| {
+ soup_filter_cache_adapter::reconciliation_baseline_entry(
+ entry.key,
+ &entry.sort_timestamp,
+ )
+ })
+ .collect::<Result<Vec<_>, _>>()
+ .map_err(|error| error.to_string())?;
return mail::page_current(
engine,
generation,
@@ -134,6 +146,7 @@ pub(super) async fn filter(
&request.sort_direction,
request.limit,
mail_request,
+ &baseline,
)
.await
.map(EntityFilterResult::Mail)
diff --git a/crates/client/cache-wasm/AGENTS.md b/crates/client/cache-wasm/AGENTS.md
index 74e50d43b5..fb7e8ad288 100644
--- a/crates/client/cache-wasm/AGENTS.md
+++ b/crates/client/cache-wasm/AGENTS.md
@@ -46,6 +46,9 @@ wasm-bindgen shell exposing `cache-core` + `cache-turso` + `turso-opfs` as a
## Gotchas
+- Pass the existing entity-filter `baseline` to Mail pagination too; `retainedKeys`
+ tells the frontend which server rows still lack canonical local metadata.
+
- Email send persistence and cancellation belong to the frontend email journal, not the normalized cache or its mutation queue.
- The engine is guarded by an async mutex so overlapping JS calls serialize
diff --git a/crates/client/cache-wasm/src/shell.rs b/crates/client/cache-wasm/src/shell.rs
index 948f6e8bc5..a9cf59c015 100644
--- a/crates/client/cache-wasm/src/shell.rs
+++ b/crates/client/cache-wasm/src/shell.rs
@@ -1473,6 +1473,18 @@ impl CacheEngine {
}
}
if let Some(mail) = request.mail {
+ let baseline = request
+ .baseline
+ .unwrap_or_default()
+ .into_iter()
+ .map(|entry| {
+ soup_filter_cache_adapter::reconciliation_baseline_entry(
+ entry.key,
+ &entry.sort_timestamp,
+ )
+ })
+ .collect::<Result<Vec<_>, _>>()
+ .map_err(err_js)?;
let generation = state.mail_generation.clone();
let result = soup_filter_cache_adapter::mail::page_current(
state.engine_mut()?,
@@ -1482,6 +1494,7 @@ impl CacheEngine {
&request.sort_direction,
request.limit,
mail,
+ &baseline,
)
.await
.map_err(|error| match error {
diff --git a/crates/soup_filter_cache_adapter/AGENTS.md b/crates/soup_filter_cache_adapter/AGENTS.md
index 0ef70aacdc..005ad42771 100644
--- a/crates/soup_filter_cache_adapter/AGENTS.md
+++ b/crates/soup_filter_cache_adapter/AGENTS.md
@@ -24,6 +24,8 @@ understand. Runs both natively (Tauri) and compiled to wasm (web).
backfills, partial/cursor pages, identity switches, and pending optimistic
rows. At most 500 local matches are checked per write; later full snapshots
restore completeness.
+- `src/mail/retention.rs`: retain same-query server rows while local facts are
+ incomplete, reject proven nonmembers, and preserve the indexed cursor.
## Scope
@@ -52,6 +54,15 @@ understand. Runs both natively (Tauri) and compiled to wasm (web).
## Gotchas
+- Mail pages reconcile server membership through the generic predicate engine;
+ retain unknown projections with their supplied sort values, exclude confirmed
+ nonmembers, and keep continuation cursors on the original indexed window.
+ Reconcile only baseline rows outside that window; known live flags may reject
+ incomplete rows through predicate simplification, never establish new membership.
+ Exclude explicitly invalidated (`Dirty`) baseline rows in the queried scope
+ unless an optimistic shadow takes precedence; an older reader must not undo
+ authoritative first-page repair. Missing facts still retain server membership.
+
- This crate must stay wasm-compatible — no `sqlx`, no native-only crates in
default features; native-only test fixtures live under
`[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]`.
diff --git a/crates/soup_filter_cache_adapter/src/mail.rs b/crates/soup_filter_cache_adapter/src/mail.rs
index 7d828a6340..90993f226e 100644
--- a/crates/soup_filter_cache_adapter/src/mail.rs
+++ b/crates/soup_filter_cache_adapter/src/mail.rs
@@ -3,6 +3,7 @@ use super::*;
use cache_core::{
engine::{Engine, EngineError},
normalize::normalize,
+ predicate::reconciliation::PredicateBaselineEntry,
predicate::{PredicateIndexStorage, ProjectionState},
store::Storage,
value::{CacheValue, EntityKey, Record},
@@ -18,6 +19,7 @@ use soup_filter_projection::{
use std::borrow::Cow;
pub(crate) mod reconciliation;
+mod retention;
#[cfg(all(test, not(target_arch = "wasm32")))]
mod test;
@@ -672,6 +674,8 @@ pub enum PageResult {
revision: String,
/// Normalized matching email keys.
keys: Vec<String>,
+ /// Server-confirmed rows retained while their local projection is unknown.
+ retained_keys: Vec<String>,
/// View-correct display timestamps, aligned with keys.
sort_timestamps: Vec<String>,
/// Query-bound local continuation.
@@ -725,11 +729,13 @@ pub async fn page<S: PredicateIndexStorage>(
limit,
request,
false,
+ &[],
)
.await
}
/// Evaluate Mail using complete property-aware projections.
+#[expect(clippy::too_many_arguments, reason = "shared host page boundary")]
pub async fn page_current<S: PredicateIndexStorage>(
engine: &mut Engine<S>,
generation: &str,
@@ -738,6 +744,7 @@ pub async fn page_current<S: PredicateIndexStorage>(
direction: &str,
limit: u16,
request: PageRequest,
+ baseline: &[PredicateBaselineEntry],
) -> Result<PageResult, PageError<S::Error>> {
page_impl(
engine,
@@ -748,6 +755,7 @@ pub async fn page_current<S: PredicateIndexStorage>(
limit,
request,
true,
+ baseline,
)
.await
}
@@ -765,6 +773,7 @@ async fn page_impl<S: PredicateIndexStorage>(
limit: u16,
request: PageRequest,
current: bool,
+ baseline: &[PredicateBaselineEntry],
) -> Result<PageResult, PageError<S::Error>> {
let revision = engine.current_revision().to_string();
// A read through a position takes `limit` as its fewest rows and pages
@@ -781,6 +790,12 @@ async fn page_impl<S: PredicateIndexStorage>(
))
.into());
}
+ if baseline.len() > cache_core::predicate::reconciliation::MAX_RECONCILIATION_BASELINE {
+ return Err(error("Mail reconciliation baseline is too large").into());
+ }
+ if !baseline.is_empty() && request.cursor.is_some() {
+ return Err(error("Mail continuation pages do not accept a server baseline").into());
+ }
let Some(viewer) = engine.current_identity().await? else {
return Ok(PageResult::Incomplete { revision });
};
@@ -877,15 +892,6 @@ async fn page_impl<S: PredicateIndexStorage>(
}
(None, None) => read_page(engine, &query, limit).await?,
};
- let sort_timestamps = window
- .values
- .iter()
- .map(|value| {
- chrono::DateTime::from_timestamp_micros(*value)
- .map(|ts| ts.to_rfc3339())
- .ok_or_else(|| error("invalid page timestamp"))
- })
- .collect::<Result<Vec<_>, _>>()?;
let end_cursor = window
.keys
.last()
@@ -900,6 +906,19 @@ async fn page_impl<S: PredicateIndexStorage>(
.map_err(error)
})
.transpose()?;
+ // Keep local cursors tied to the indexed window. A retained server row can
+ // be outside it and must not cause continuation pages to skip cached mail.
+ let (window, retained_keys) =
+ retention::reconcile_window(engine, &query, window, baseline).await?;
+ let sort_timestamps = window
+ .values
+ .iter()
+ .map(|value| {
+ chrono::DateTime::from_timestamp_micros(*value)
+ .map(|ts| ts.to_rfc3339())
+ .ok_or_else(|| error("invalid page timestamp"))
+ })
+ .collect::<Result<Vec<_>, _>>()?;
Ok(PageResult::MailPage {
revision,
keys: window
@@ -907,6 +926,7 @@ async fn page_impl<S: PredicateIndexStorage>(
.into_iter()
.map(|key| key.as_str().to_owned())
.collect(),
+ retained_keys,
sort_timestamps,
next_cursor: end_cursor.clone().filter(|_| window.more),
end_cursor,
diff --git a/crates/soup_filter_cache_adapter/src/mail/retention.rs b/crates/soup_filter_cache_adapter/src/mail/retention.rs
new file mode 100644
index 0000000000..f080a182d8
--- /dev/null
+++ b/crates/soup_filter_cache_adapter/src/mail/retention.rs
@@ -0,0 +1,213 @@
+//! Preserve server membership until the Mail index can confirm or reject it.
+use super::*;
+use cache_core::predicate::reconciliation::{
+ PredicateMembership, predicate_membership, reconcile_predicate_baseline,
+};
+use cache_core::record_selection::RecordSelection;
+use predicate_index::{PredicateExpr, ReferenceHit};
+use std::collections::HashMap;
+
+pub(super) async fn reconcile_window<S: PredicateIndexStorage>(
+ engine: &mut Engine<S>,
+ query: &ValidatedIndexQuery,
+ window: Window,
+ baseline: &[PredicateBaselineEntry],
+) -> Result<(Window, Vec<String>), PageError<S::Error>> {
+ if baseline.is_empty() {
+ return Ok((window, Vec::new()));
+ }
+ let mut values: HashMap<_, _> = window
+ .keys
+ .iter()
+ .cloned()
+ .zip(window.values.iter().copied())
+ .collect();
+ // The window already proves membership. Only classify server rows outside
+ // it; combining both sets into a new baseline incorrectly consumed its cap.
+ let baseline = baseline
+ .iter()
+ .filter(|entry| !values.contains_key(&entry.record_key))
+ .cloned()
+ .collect::<Vec<_>>();
+ let keys = baseline
+ .iter()
+ .map(|entry| entry.record_key.clone())
+ .collect::<Vec<_>>();
+ let bases = engine
+ .storage()
+ .load_projection_states(&keys)
+ .await
+ .map_err(EngineError::Storage)?;
+ let shadows = engine
+ .storage()
+ .load_optimistic_projections(&keys)
+ .await
+ .map_err(EngineError::Storage)?;
+ let records = engine
+ .storage()
+ .get_batch(
+ &keys
+ .iter()
+ .map(|key| EntityKey(key.as_str().to_owned().into()))
+ .collect::<Vec<_>>(),
+ )
+ .await
+ .map_err(EngineError::Storage)?;
+ let membership = baseline
+ .iter()
+ .zip(&bases)
+ .zip(&shadows)
+ .zip(&records)
+ .map(|(((entry, base), shadow), record)| {
+ // An explicit invalidation revokes older positive evidence. A
+ // different reader's stale baseline must not undo an authoritative
+ // first-page repair. Missing facts still retain their baseline,
+ // and pending local edits keep their normal optimistic precedence.
+ let invalidated = shadow.is_none()
+ && matches!(
+ base,
+ Some(ProjectionState::Incomplete {
+ profile,
+ partition,
+ kind: ProjectionIncompleteKind::Dirty,
+ ..
+ }) if query.includes_scope(profile, partition)
+ );
+ let membership = if invalidated {
+ PredicateMembership::NonMatch
+ } else {
+ predicate_membership(query, base.as_ref(), shadow.as_ref(), record.is_some())
+ };
+ let value = match membership {
+ PredicateMembership::Match(value) => value,
+ _ => entry.sort_value,
+ };
+ values.insert(entry.record_key.clone(), value);
+ membership
+ })
+ .collect::<Vec<_>>();
+ let mut result = reconcile_predicate_baseline(
+ query,
+ &baseline,
+ membership,
+ window
+ .keys
+ .into_iter()
+ .zip(window.values)
+ .map(|(record_key, sort_value)| ReferenceHit {
+ record_key,
+ sort_value,
+ })
+ .collect(),
+ window.optimistic || shadows.iter().any(Option::is_some),
+ );
+ let rejected = known_nonmembers(engine, query, &result.retained_keys).await?;
+ result.keys.retain(|key| !rejected.contains(key));
+ result.retained_keys.retain(|key| !rejected.contains(key));
+ Ok((
+ Window {
+ values: result.keys.iter().map(|key| values[key]).collect(),
+ keys: result.keys,
+ more: window.more,
+ optimistic: result.optimistic,
+ },
+ result
+ .retained_keys
+ .into_iter()
+ .map(|key| key.as_str().to_owned())
+ .collect(),
+ ))
+}
+
+/// Missing previews/capsules cannot undo a known read/archive/signal change.
+/// Substitute only present booleans into the compiled predicate, then use its
+/// normal simplifier to prove non-membership. Other facts stay unknown: this
+/// can reject a retained row, never admit a new one or invent projection facts.
+async fn known_nonmembers<S: PredicateIndexStorage>(
+ engine: &mut Engine<S>,
+ query: &ValidatedIndexQuery,
+ keys: &[RecordKey],
+) -> Result<HashSet<RecordKey>, PageError<S::Error>> {
+ if keys.is_empty() {
+ return Ok(HashSet::new());
+ }
+ let Some(partition) = query
+ .as_query()
+ .partitions
+ .iter()
+ .find(|p| p.partition == vocabulary::partition())
+ else {
+ return Ok(keys.iter().cloned().collect());
+ };
+ let mut facts: HashMap<String, HashMap<&str, ExactValue>> = HashMap::new();
+ for (field, attribute) in [
+ ("inboxVisible", "mail-inbox"),
+ ("isRead", "mail-read"),
+ ("isSignal", "mail-signal"),
+ ] {
+ let selection = RecordSelection::parse(
+ cache_core::meta::bundled_schema_ref(),
+ &format!("fragment MailState on GraphqlSoupEmailThread {{ {field} }}"),
+ "MailState",
+ )
+ .map_err(error)?;
+ for chunk in keys.chunks(cache_core::record_selection::MAX_RECORD_SELECTION_KEYS) {
+ let selected = engine
+ .read_records_by_keys(
+ &selection,
+ &chunk
+ .iter()
+ .map(|key| EntityKey(key.as_str().to_owned().into()))
+ .collect::<Vec<_>>(),
+ )
+ .await?;
+ for row in selected.value {
+ if let Some(value) = row.record.get(field).and_then(Value::as_bool) {
+ let fact = boolean_fact(value, attribute)
+ .ok_or_else(|| error("invalid boolean fact"))?;
+ facts
+ .entry(row.record_key.to_string())
+ .or_default()
+ .insert(attribute, fact.value);
+ }
+ }
+ }
+ }
+ let mut rejected = HashSet::new();
+ for key in keys {
+ if let Some(facts) = facts.get(key.as_str()) {
+ let predicate = substitute_flags(&partition.predicate, facts)
+ .validate_and_simplify()
+ .map_err(error)?;
+ if matches!(predicate, PredicateExpr::None) {
+ rejected.insert(key.clone());
+ }
+ }
+ }
+ Ok(rejected)
+}
+
+fn substitute_flags(expr: &PredicateExpr, facts: &HashMap<&str, ExactValue>) -> PredicateExpr {
+ match expr {
+ PredicateExpr::And(a, b) => PredicateExpr::And(
+ Box::new(substitute_flags(a, facts)),
+ Box::new(substitute_flags(b, facts)),
+ ),
+ PredicateExpr::Or(a, b) => PredicateExpr::Or(
+ Box::new(substitute_flags(a, facts)),
+ Box::new(substitute_flags(b, facts)),
+ ),
+ PredicateExpr::Not(a) => PredicateExpr::Not(Box::new(substitute_flags(a, facts))),
+ PredicateExpr::Exact { attribute, value } if facts.contains_key(attribute.as_str()) => {
+ if facts.get(attribute.as_str()) == Some(value) {
+ PredicateExpr::All
+ } else {
+ PredicateExpr::None
+ }
+ }
+ PredicateExpr::ExactExists { attribute } if facts.contains_key(attribute.as_str()) => {
+ PredicateExpr::All
+ }
+ _ => expr.clone(),
+ }
+}
diff --git a/crates/soup_filter_cache_adapter/src/mail/test.rs b/crates/soup_filter_cache_adapter/src/mail/test.rs
index d3095ca1a7..014c58eadc 100644
--- a/crates/soup_filter_cache_adapter/src/mail/test.rs
+++ b/crates/soup_filter_cache_adapter/src/mail/test.rs
@@ -13,6 +13,7 @@ mod drafts;
mod optimistic;
mod reconciliation;
mod reminders;
+mod retention;
mod through;
const VIEWER: &str = "macro|[email protected]";
diff --git a/crates/soup_filter_cache_adapter/src/mail/test/drafts.rs b/crates/soup_filter_cache_adapter/src/mail/test/drafts.rs
index e5f9aed252..b6e772842c 100644
--- a/crates/soup_filter_cache_adapter/src/mail/test/drafts.rs
+++ b/crates/soup_filter_cache_adapter/src/mail/test/drafts.rs
@@ -29,6 +29,7 @@ async fn cached_keys<S: PredicateIndexStorage>(
cursor: None,
through: None,
},
+ &[],
)
.await
.unwrap()
diff --git a/crates/soup_filter_cache_adapter/src/mail/test/reconciliation.rs b/crates/soup_filter_cache_adapter/src/mail/test/reconciliation.rs
index 77fbf0e8f9..d8acd88ae7 100644
--- a/crates/soup_filter_cache_adapter/src/mail/test/reconciliation.rs
+++ b/crates/soup_filter_cache_adapter/src/mail/test/reconciliation.rs
@@ -91,6 +91,7 @@ async fn current_keys<S: PredicateIndexStorage>(
cursor: None,
through: None,
},
+ &[],
)
.await
.unwrap() else {
@@ -252,6 +253,7 @@ fn other_mail_views_use_their_own_timestamp_and_membership() {
cursor: None,
through: None,
},
+ &[],
)
.await
.unwrap() else {
diff --git a/crates/soup_filter_cache_adapter/src/mail/test/retention.rs b/crates/soup_filter_cache_adapter/src/mail/test/retention.rs
new file mode 100644
index 0000000000..a1fab17de5
--- /dev/null
+++ b/crates/soup_filter_cache_adapter/src/mail/test/retention.rs
@@ -0,0 +1,710 @@
+use super::*;
+
+async fn server_membership<S: PredicateIndexStorage>(storage: S) {
+ let mut engine = Engine::new(storage);
+ write(&mut engine, QUERY, &seed()).await;
+ // Foreground list reads do not include the cache-only canonical previews.
+ write(
+ &mut engine,
+ PARTIAL,
+ &json!({"user":{"id":VIEWER,"soup":{"items":[
+ {"__typename":TYPE,"id":id(76),"inboxVisible":true,"isRead":false},
+ {"__typename":TYPE,"id":id(6),"inboxVisible":false,"isRead":false}
+ ]}}}),
+ )
+ .await;
+ let pending = format!("{TYPE}:{}", id(76));
+ let archived = format!("{TYPE}:{}", id(6));
+ let baseline = [pending.clone(), archived.clone()]
+ .map(|key| reconciliation_baseline_entry(key, "2026-01-01T00:00:00Z").unwrap());
+ let request = || PageRequest {
+ view: "INBOX".into(),
+ cursor: None,
+ through: None,
+ };
+ let PageResult::MailPage {
+ keys,
+ retained_keys,
+ sort_timestamps,
+ next_cursor,
+ ..
+ } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("Mail page expected")
+ };
+ assert_eq!(keys.first(), Some(&pending));
+ assert_eq!(retained_keys, vec![pending.clone()]);
+ assert_eq!(sort_timestamps[0], "2026-01-01T00:00:00+00:00");
+ assert!(!keys.contains(&archived));
+ assert_eq!(
+ keys.len(),
+ 11,
+ "retained evidence does not shrink the indexed page"
+ );
+ let PageResult::MailPage {
+ keys: next,
+ end_cursor: through,
+ ..
+ } = read(&mut engine, filters(), "INBOX", next_cursor).await
+ else {
+ panic!("continuation expected")
+ };
+ assert!(!next.is_empty());
+ assert!(
+ next.iter().all(|key| !keys.contains(key)),
+ "retained rows do not move the local cursor"
+ );
+
+ // A retained row below the indexed cursor must stay last when reading
+ // through the next page, without moving either continuation boundary.
+ let mut older = baseline.clone();
+ older[0] = reconciliation_baseline_entry(pending.clone(), "2024-01-01T00:00:00Z").unwrap();
+ let through_request = || PageRequest {
+ view: "INBOX".into(),
+ cursor: None,
+ through: through.clone(),
+ };
+ let PageResult::MailPage {
+ keys,
+ sort_timestamps,
+ next_cursor,
+ end_cursor,
+ ..
+ } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 20,
+ through_request(),
+ false,
+ &older,
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("through page expected")
+ };
+ assert_eq!(keys.last(), Some(&pending));
+ assert!(
+ sort_timestamps
+ .windows(2)
+ .all(|pair| micros(&pair[0]) >= micros(&pair[1]))
+ );
+ let PageResult::MailPage {
+ next_cursor: indexed_next,
+ end_cursor: indexed_end,
+ ..
+ } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 20,
+ through_request(),
+ false,
+ &[],
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("indexed page expected")
+ };
+ assert_eq!(next_cursor, indexed_next);
+ assert_eq!(end_cursor, indexed_end);
+
+ // Act on the incomplete row itself, not a different hydrated thread.
+ let archived_data = json!({"user":{"id":VIEWER,"soup":{"items":[
+ {"__typename":TYPE,"id":id(76),"inboxVisible":false,"isRead":false}
+ ]}}});
+ let vars = Map::new();
+ let updates = projection_updates(
+ cache_core::meta::bundled_schema_ref(),
+ engine.storage(),
+ PARTIAL,
+ None,
+ &vars,
+ &archived_data,
+ )
+ .await
+ .unwrap();
+ let (transaction, _) = engine
+ .begin_optimistic_write_with_projections(
+ None,
+ BeginOptimisticWrite {
+ client_metadata: None,
+ uuid: "00000000-0000-0000-0000-000000003076",
+ query: PARTIAL,
+ operation_name: None,
+ variables: &vars,
+ data: &archived_data,
+ link_patches: &[],
+ revalidations: &[],
+ created_at_ms: 1,
+ identity_bindings: &[],
+ },
+ optimistic_updates(updates),
+ )
+ .await
+ .unwrap();
+ let PageResult::MailPage { keys, .. } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ !keys.contains(&pending),
+ "optimistic archive must override unknown metadata"
+ );
+ let claim = engine
+ .claim_next_mutation(MutationClaimRequest {
+ owner: "test".into(),
+ now_ms: 1,
+ lease_expires_at_ms: 100,
+ })
+ .await
+ .unwrap()
+ .unwrap();
+ engine
+ .rollback_optimistic_write(
+ transaction,
+ MutationClaimToken {
+ owner: "test".into(),
+ generation: claim.lease_generation,
+ },
+ )
+ .await
+ .unwrap();
+ let PageResult::MailPage { keys, .. } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ keys.contains(&pending),
+ "rollback restores the retained row"
+ );
+ write(&mut engine, PARTIAL, &archived_data).await;
+ let PageResult::MailPage { keys, .. } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ !keys.contains(&pending),
+ "committed partial archive must still exclude the row"
+ );
+
+ write(
+ &mut engine,
+ PARTIAL,
+ &json!({"user":{"id":VIEWER,"soup":{"items":[
+ {"__typename":TYPE,"id":id(76),"inboxVisible":true,"isRead":true}
+ ]}}}),
+ )
+ .await;
+ let mut unread = filters();
+ unread["emailFilter"] = json!({"tree":{"literal":{"read":false}}});
+ let PageResult::MailPage { keys, .. } = page_impl(
+ &mut engine,
+ "generation",
+ unread,
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ !keys.contains(&pending),
+ "known read state must disprove unread membership"
+ );
+
+ // A known false branch does not disprove an OR whose other facts are
+ // missing. Conversely NOT of a known true flag proves non-membership.
+ for (tree, retained) in [
+ (
+ json!({"or":{"left":{"literal":{"read":false}},"right":{"literal":{"calendarOnly":true}}}}),
+ true,
+ ),
+ (
+ json!({"and":{"left":{"literal":{"read":true}},"right":{"literal":{"calendarOnly":true}}}}),
+ true,
+ ),
+ (json!({"not":{"literal":{"read":true}}}), false),
+ ] {
+ let mut compound = filters();
+ compound["emailFilter"] = json!({"tree":tree});
+ let PageResult::MailPage { keys, .. } = page_impl(
+ &mut engine,
+ "generation",
+ compound,
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert_eq!(keys.contains(&pending), retained);
+ }
+
+ let mut hydrated = row(76);
+ hydrated["linkId"] = json!(id(1000));
+ hydrated["ownerId"] = json!(VIEWER);
+ write(
+ &mut engine,
+ QUERY,
+ &json!({"user":{"id":VIEWER,"soup":{"items":[hydrated]}}}),
+ )
+ .await;
+ let PageResult::MailPage {
+ keys,
+ retained_keys,
+ ..
+ } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("hydrated page expected")
+ };
+ assert!(keys.contains(&pending));
+ assert!(retained_keys.is_empty());
+ assert!(!keys.contains(&archived));
+}
+
+#[test]
+fn memory_retains_unhydrated_server_mail_but_removes_confirmed_nonmembers() {
+ pollster::block_on(server_membership(InMemoryStorage::new()));
+}
+
+#[test]
+fn turso_retains_unhydrated_server_mail_but_removes_confirmed_nonmembers() {
+ pollster::block_on(server_membership(
+ cache_turso::TursoStorage::open_in_memory("mail-server-membership").unwrap(),
+ ));
+}
+
+#[test]
+fn maximum_baseline_does_not_count_indexed_rows_again() {
+ pollster::block_on(async {
+ let mut engine = Engine::new(InMemoryStorage::new());
+ write(&mut engine, QUERY, &seed()).await;
+ let baseline = (1000..6000)
+ .map(|n| {
+ reconciliation_baseline_entry(format!("{TYPE}:{}", id(n)), "2026-01-01T00:00:00Z")
+ .unwrap()
+ })
+ .collect::<Vec<_>>();
+ let PageResult::MailPage { keys, .. } = page_impl(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ PageRequest {
+ view: "INBOX".into(),
+ cursor: None,
+ through: None,
+ },
+ false,
+ &baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert_eq!(keys.len(), 10);
+ });
+}
+
+async fn write_current_mail<S: PredicateIndexStorage>(
+ engine: &mut Engine<S>,
+ query: &str,
+ operation: &str,
+ variables: &Map<String, Value>,
+ data: &Value,
+) {
+ let projections = projection_updates(
+ engine.schema(),
+ engine.storage(),
+ query,
+ Some(operation),
+ variables,
+ data,
+ )
+ .await
+ .unwrap();
+ let projections = crate::properties::augment_authoritative(
+ engine.schema(),
+ engine.storage(),
+ query,
+ Some(operation),
+ variables,
+ data,
+ true,
+ projections,
+ )
+ .await
+ .unwrap();
+ engine
+ .write_query_with_registration_and_projections(
+ None,
+ None,
+ NetworkWrite {
+ query,
+ operation_name: Some(operation),
+ variables,
+ data,
+ identity: Some(VIEWER),
+ },
+ projections,
+ )
+ .await
+ .unwrap();
+}
+
+async fn stale_baseline_after_authoritative_gap<S: PredicateIndexStorage>(storage: S) {
+ let mut engine = Engine::new(storage);
+ let page_variables = json!({"input":{"initial":{
+ "filters":filters(), "sortMethod":"UPDATED_AT", "sortDirection":"DESC",
+ "emailView":"INBOX", "limit":3
+ }}})
+ .as_object()
+ .unwrap()
+ .clone();
+ let old_baseline = [20, 18, 16].map(|n| {
+ reconciliation_baseline_entry(format!("{TYPE}:{}", id(n)), "2025-01-02T00:00:00.000002Z")
+ .unwrap()
+ });
+ let omitted = format!("{TYPE}:{}", id(18));
+ let request = || PageRequest {
+ view: "INBOX".into(),
+ cursor: None,
+ through: None,
+ };
+ let soup = include_str!("reconciliation.graphql");
+ for (operation, ids) in [
+ ("SoupMailBackfill", vec![20, 18, 16]),
+ ("Soup", vec![20, 16]),
+ ] {
+ let query = soup.replace("query Soup(", &format!("query {operation}("));
+ let items = ids
+ .into_iter()
+ .map(|n| {
+ let mut item = row(n);
+ item["properties"] = json!([]);
+ item["isFavorited"] = json!(false);
+ item
+ })
+ .collect::<Vec<_>>();
+ let data = json!({"user":{
+ "id":VIEWER,"emailLinks":[{"id":id(1000)}],
+ "soup":{"items":items,"nextCursor":null}
+ }});
+ write_current_mail(&mut engine, &query, operation, &page_variables, &data).await;
+ }
+ for baseline in [&[][..], old_baseline.as_slice()] {
+ let PageResult::MailPage { keys, .. } = page_current(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ !keys.contains(&omitted),
+ "an older reader's baseline must not reverse authoritative negative evidence"
+ );
+ }
+
+ // A partial committed update must preserve Dirty, rather than downgrade it
+ // to missing metadata that would let the old baseline revive the row.
+ let patch = json!({"user":{"id":VIEWER,"soup":{"items":[{
+ "__typename":TYPE,"id":id(18),"inboxVisible":true,"isRead":true
+ }]}}});
+ write_current_mail(&mut engine, PARTIAL, "Partial", &Map::new(), &patch).await;
+ let PageResult::MailPage { keys, .. } = page_current(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ &old_baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ !keys.contains(&omitted),
+ "partial updates do not restore invalidated facts"
+ );
+
+ // A local edit started after invalidation has its own optimistic precedence.
+ let variables = Map::new();
+ let optimistic_data = json!({"user":{"id":VIEWER,"soup":{"items":[{
+ "__typename":TYPE,"id":id(18),"inboxVisible":true,"isRead":false
+ }]}}});
+ let projections = optimistic_updates(
+ projection_updates(
+ engine.schema(),
+ engine.storage(),
+ PARTIAL,
+ None,
+ &variables,
+ &optimistic_data,
+ )
+ .await
+ .unwrap(),
+ );
+ let projections = crate::properties::augment_optimistic(
+ engine.schema(),
+ engine.storage(),
+ PARTIAL,
+ None,
+ &variables,
+ &optimistic_data,
+ projections,
+ )
+ .await
+ .unwrap();
+ let (transaction, _) = engine
+ .begin_optimistic_write_with_projections(
+ None,
+ BeginOptimisticWrite {
+ client_metadata: None,
+ uuid: "00000000-0000-0000-0000-000000003118",
+ query: PARTIAL,
+ operation_name: None,
+ variables: &variables,
+ data: &optimistic_data,
+ link_patches: &[],
+ revalidations: &[],
+ created_at_ms: 1,
+ identity_bindings: &[],
+ },
+ projections,
+ )
+ .await
+ .unwrap();
+ let PageResult::MailPage {
+ keys, optimistic, ..
+ } = page_current(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ &old_baseline,
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ keys.contains(&omitted),
+ "a pending local edit overrides durable invalidation"
+ );
+ assert!(optimistic);
+ let claim = engine
+ .claim_next_mutation(MutationClaimRequest {
+ owner: "test".into(),
+ now_ms: 1,
+ lease_expires_at_ms: 100,
+ })
+ .await
+ .unwrap()
+ .unwrap();
+ engine
+ .rollback_optimistic_write(
+ transaction,
+ MutationClaimToken {
+ owner: "test".into(),
+ generation: claim.lease_generation,
+ },
+ )
+ .await
+ .unwrap();
+ let PageResult::MailPage { keys, .. } = page_current(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ &old_baseline,
+ )
+ .await
+ .unwrap() else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ !keys.contains(&omitted),
+ "rollback restores the durable invalidation"
+ );
+
+ let mut restored = row(18);
+ restored["properties"] = json!([]);
+ restored["isFavorited"] = json!(false);
+ let restore_query = soup.replace("query Soup(", "query SoupMailBackfill(");
+ let restored_data = json!({"user":{
+ "id":VIEWER,"emailLinks":[{"id":id(1000)}],
+ "soup":{"items":[restored],"nextCursor":null}
+ }});
+ write_current_mail(
+ &mut engine,
+ &restore_query,
+ "SoupMailBackfill",
+ &page_variables,
+ &restored_data,
+ )
+ .await;
+ let PageResult::MailPage {
+ keys,
+ retained_keys,
+ ..
+ } = page_current(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ &old_baseline,
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ keys.contains(&omitted),
+ "a fresh complete snapshot restores membership"
+ );
+ assert!(retained_keys.is_empty());
+
+ let missing = format!("{TYPE}:{}", id(76));
+ let partial = json!({"user":{"id":VIEWER,"soup":{"items":[{
+ "__typename":TYPE,"id":id(76),"inboxVisible":true,"isRead":false
+ }]}}});
+ write_current_mail(&mut engine, PARTIAL, "Partial", &variables, &partial).await;
+ let baseline =
+ [reconciliation_baseline_entry(missing.clone(), "2026-01-01T00:00:00Z").unwrap()];
+ let PageResult::MailPage {
+ keys,
+ retained_keys,
+ ..
+ } = page_current(
+ &mut engine,
+ "generation",
+ filters(),
+ "UPDATED_AT",
+ "DESC",
+ 10,
+ request(),
+ &baseline,
+ )
+ .await
+ .unwrap()
+ else {
+ panic!("Mail page expected")
+ };
+ assert!(
+ keys.contains(&missing),
+ "never-established metadata still retains server evidence"
+ );
+ assert_eq!(retained_keys, [missing]);
+}
+
+#[test]
+fn an_older_reader_cannot_restore_an_authoritatively_invalidated_mail_row() {
+ pollster::block_on(stale_baseline_after_authoritative_gap(
+ InMemoryStorage::new(),
+ ));
+}
+
+#[test]
+fn turso_older_baseline_respects_invalidation_and_new_evidence() {
+ pollster::block_on(stale_baseline_after_authoritative_gap(
+ cache_turso::TursoStorage::open_in_memory("mail-stale-baseline").unwrap(),
+ ));
+}
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index f4a3378b0e..e0eb3af8b3 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -22,6 +22,12 @@ detail view. See [Email reminders](reminders.md#delivery-and-undo).
## Email — `/app/component/mail`
+Newly fetched mail, including calendar invitations, stays visible while local
+cache metadata loads. To check this transition, return to Inbox repeatedly and
+trigger a background cache refresh: rows should not disappear and return. A
+confirmed archive still removes its row. Cached pagination preserves its position
+while those server-confirmed rows load their canonical previews.
+
Email's Tags sidebar uses the [nested tag tree](tasks.md#nested-sidebar-tags).
Carets and folder-only parents expand branches; actual tags select their exact ID
and switch the mailbox to All. Parent selection does not include descendant tags.
@@ -324,7 +330,12 @@ means `inboxVisible = false`; it is **not** notification lifecycle state. Signal
retain their Inbox scope, so archived mail is found in Archived (All + Done).
A `Showing cached mail` notice identifies results over synchronized metadata, not a
-claim of complete mailbox coverage. These lists paginate locally beyond the first
+claim of complete mailbox coverage. On an online cold tab, hold the first server
+response and verify that an empty local page keeps the loading indicator visible;
+show the empty state only after the query settles. Nonempty cached rows remain
+immediately usable. Confirmed empty pages stay empty during background refreshes,
+and offline or cache-only views do not wait for HTTP.
+These lists paginate locally beyond the first
page without a server cursor. Filter or engine-generation changes restart
the local page chain, and a cache write re-reads it through the last row already loaded; online server results take over again when available. After
reconnecting, `Load more` follows the same server page chain as the displayed rows,
@@ -341,8 +352,10 @@ range (including timestamp/ID ties). An exhausted page covers the remaining
matching range, including an empty result. This checks at most 500 local matches
per write; larger stale sets converge over refreshes. It preserves normalized
threads and pending optimistic edits, and does not use cursor pages or backfill
-gaps as negative evidence. Invalidated facts stay unqueryable until a full
-canonical snapshot arrives, rather than guessing whether a thread was moved or
+gaps as negative evidence. An older open view's server snapshot cannot restore
+explicitly invalidated membership; pending local edits still take precedence.
+Invalidated facts stay unqueryable until a full canonical snapshot arrives,
+rather than guessing whether a thread was moved or
deleted. Verification: seed stale Noise matches between returned rows, apply a
first page, switch Drafts → Noise repeatedly, then reload without reseeding;
stale rows must stay absent while rows beyond the page remain. This runs against
@@ -372,7 +385,14 @@ necessarily evaluated from the last synchronized grants.
The lightweight metadata backfill runs before body hydration. Its refreshes scan all
metadata: message-time watermarks alone miss archive/read changes on old threads.
Filter availability therefore does not guarantee that opening every message body works offline. Missing
-projection proof is unknown, never false. Tag selections use cached property postings;
+projection proof is unknown, never false. A retained invitation keeps its fetched
+preview while read/archive flags update immediately, including rollback and undo.
+Check the retained invitation itself: mark it read, archive it, reject an archive,
+and undo a committed archive before metadata hydration finishes. Older cache hosts
+must still refresh affected lists after commit. Scroll across a retained row and
+check that the next page remains ordered; a baseline beyond 5,000 rows returns to
+the live server list instead of freezing local membership.
+Tag selections use cached property postings;
attachment chips refine the cached rows on the client. Sender/recipient filters and
non-created/updated sorts remain outside this local profile. Grouping and sort-selector
coverage are separate from the filter-selection matrix. No cache-format wipe is required: Mail uses a separate versioned profile