Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(command): search projects from the GraphQL cache instead of per query (#9144)
gbirman283cf1ab1fc6
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 0af37fa370..26060e7523 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -358,6 +358,7 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription to- Keep mobile Search history lightweight: save query/category/mode, account-scoped item anchors, and at most 200 ordering IDs per mode; never save row objects or virtualizer caches. Restore from current sources with at most three additional pages, fall back when an anchor disappears, and stop restoration on user interaction or scope changes. Dock navigation starts a fresh search session; cached rows belong to the source, not history.- Release per-history-entry state when its router entry is replaced, pruned, or closed; retain only the latest per-view session snapshot and the latest split event outside reachable Back/Forward history.- Keep Quick Access cache availability reactive to the GraphQL rollout flag; it can arrive after the provider mounts, and email has no legacy source fallback.+- Cmd+K and mobile name search take task projects from the Quick Access `initiative` bucket (typed All queries and the Projects category), searched from the GraphQL cache like other entities. Don't give them a per-query server search: its rows drop out while each new query loads, so projects flash as you type.- Merge the complete channel list into Quick Access even with the GraphQL cache enabled; preserve newer viewed timestamps and apply the channel boost before the extra DM boost in shared command/mobile name ranking.- Include all channel metadata in Quick Access item versions; record complete, cached-recent, and merged channel counts plus the last index-build duration on cache-search traces.- Virtualize mobile name results like desktop Command Menu; local Quick Access sources are unbounded, and mounting them all stalls iOS keyboard focus during layout. Load additional search pages near the scroll end instead of reserving a paging bar.diff --git a/apps/web/docs/graphql-normalized-cache-plan.md b/apps/web/docs/graphql-normalized-cache-plan.mdindex 32a282b681..0cb424b60c 100644--- a/apps/web/docs/graphql-normalized-cache-plan.md+++ b/apps/web/docs/graphql-normalized-cache-plan.md@@ -991,7 +991,9 @@ See [cached Mail verification](../../../docs/agent-guide/email.md#cached-mail-fi## Cached email Quick Access-The disposable Quick Access projection is version 3. Email rows index the thread+The disposable Quick Access projection is version 4; version 4 added task+projects (`GraphqlSoupInitiative`, bucket `initiative`), searched on their display+name with viewed-first recency read from their embedded `metadata`. Email rows index the threadsubject, latest sender name/address, and embedded `senders` names/addresses, so anearlier sender remains searchable after another participant replies. Snippets andmessage bodies are excluded. The frontend materializes only matched thread keysdiff --git a/apps/web/src/features/command/CommandItem.tsx b/apps/web/src/features/command/CommandItem.tsxindex 680b86bbd8..17567d2b7c 100644--- a/apps/web/src/features/command/CommandItem.tsx+++ b/apps/web/src/features/command/CommandItem.tsx@@ -225,11 +225,17 @@ function AskAiDisplay(props: { item: AskAiItem }) {export function ItemDisplay(props: { item: CommandMenuItem }) {return (<Switch>- <Match when={props.item.kind === 'initiative' && props.item}>- {(item) => (+ <Match+ when={+ isEntityItem(props.item) &&+ props.item.data.type === 'initiative' &&+ props.item.data+ }+ >+ {(project) => (<div class="flex items-center gap-2 flex-1 min-w-0"><ProjectIcon class="size-4 mobile:scale-150 text-ink-muted shrink-0" />- <span class="truncate">{item().name}</span>+ <span class="truncate">{project().name}</span><span class="ml-auto text-xs text-ink-muted">{t('commandMenu.projectBadge')}</span>diff --git a/apps/web/src/features/command/CommandMenu.tsx b/apps/web/src/features/command/CommandMenu.tsxindex 909d99bab9..a60f585ed9 100644--- a/apps/web/src/features/command/CommandMenu.tsx+++ b/apps/web/src/features/command/CommandMenu.tsx@@ -509,10 +509,7 @@ function CommandSearchMenu(};const selectedIsEntity = () => {const item = selectedItem();- return (- item &&- (isEntityItem(item) || isUserItem(item) || item.kind === 'initiative')- );+ return item && (isEntityItem(item) || isUserItem(item));};const selectedIsSearch = () => {const item = selectedItem();@@ -528,7 +525,8 @@ function CommandSearchMenu(function handleItemAction(item: CommandMenuItem, openInNewSplit = false) {if (!item) return;if (- (item.kind === 'new-project' || item.kind === 'initiative') &&+ (item.kind === 'new-project' ||+ (isEntityItem(item) && item.bucket === 'initiative')) &&!projectsFlag().enabled)return;diff --git a/apps/web/src/features/command/mobile/MobileSearchResults.test.tsx b/apps/web/src/features/command/mobile/MobileSearchResults.test.tsxindex 9a6cdadb73..d9c2df8765 100644--- a/apps/web/src/features/command/mobile/MobileSearchResults.test.tsx+++ b/apps/web/src/features/command/mobile/MobileSearchResults.test.tsx@@ -1,5 +1,9 @@import type { EntryState } from '@components/app/split-layout/layoutManager';-import type { EntityItem, UserItem } from '@core/context/quickAccess';+import type {+ EntityItem,+ QuickAccessItem,+ UserItem,+} from '@core/context/quickAccess';import type { EntityData, SearchLocation } from '@entity';import {cleanup,@@ -13,7 +17,6 @@ import { CombinedError } from '@urql/core';import { type Accessor, createSignal, onMount, Show } from 'solid-js';import { afterEach, beforeEach, expect, it, vi } from 'vitest';import { mergeCommandPeople } from '../contact-items';-import type { EntitySearchItem } from '../queries/entity-search';import { MobileSearchInput } from './MobileSearchInput';import { MobileSearchResults } from './MobileSearchResults';import { SearchState } from './mobileSearchState';@@ -37,7 +40,7 @@ const mocks = vi.hoisted(() => ({deferLayout: false,measureLayout: () => {},fetchNextPage: vi.fn(),- items: (() => []) as Accessor<EntitySearchItem[]>,+ items: (() => []) as Accessor<QuickAccessItem[]>,loadingEntities: (() => false) as Accessor<boolean>,refreshError: (() => false) as Accessor<boolean>,fullTextError: (() => undefined) as Accessor<Error | undefined>,@@ -112,7 +115,7 @@ vi.mock('@queries/storage/databases', () => ({useDatabaseDiscoverySync: vi.fn(),}));vi.mock('../CommandItem', () => ({- ItemDisplay: (props: { item: EntitySearchItem }) => (+ ItemDisplay: (props: { item: QuickAccessItem }) => (<span>{props.item.searchText}</span>),}));@@ -153,7 +156,7 @@ vi.mock('@entity', () => ({vi.mock('../queries/entity-search', () => ({useEntitySearch: () => ({items: () => mocks.items(),- rankItems: (items: EntitySearchItem[]) => items,+ rankItems: (items: QuickAccessItem[]) => items,isLoadingEntities: () => mocks.loadingEntities(),isSettling: () => mocks.loadingEntities(),hasError: () => mocks.refreshError(),@@ -278,7 +281,7 @@ it('offers full text above empty results, only mounts it explicitly, and keeps t});it('omits full text for Projects and hides search on result opening', async () => {- const [items, setItems] = createSignal<EntitySearchItem[]>([]);+ const [items, setItems] = createSignal<QuickAccessItem[]>([]);mocks.items = items;render(() => <MobileSearchResults />);SearchState.setQuery('teo');@@ -289,9 +292,14 @@ it('omits full text for Projects and hides search on result opening', async () =setItems([{id: 'project',- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: 'Teo project',+ data: {+ id: 'project',+ type: 'initiative',+ name: 'Teo project',+ ownerId: 'owner',+ },searchText: 'Teo project',sortTimestamp: 0,timestamps: {},@@ -387,9 +395,14 @@ it('bounds mounted recent rows while keeping the first result usable', () => {mocks.items = () =>Array.from({ length: 2000 }, (_, index) => ({id: `project-${index}`,- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: `Project ${index}`,+ data: {+ id: `project-${index}`,+ type: 'initiative',+ name: `Project ${index}`,+ ownerId: 'owner',+ },searchText: `Project ${index}`,sortTimestamp: 0,timestamps: {},@@ -528,13 +541,18 @@ it('reveals the same scrolled results when native Back uncovers search', () => {it('restores the name list order and scroll after opening promotes a result by recency', async () => {mocks.hasMore = false;- const originalItems: EntitySearchItem[] = Array.from(+ const originalItems: QuickAccessItem[] = Array.from({ length: 100 },(_, index) => ({id: `project-${index}`,- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: `Project ${index}`,+ data: {+ id: `project-${index}`,+ type: 'initiative',+ name: `Project ${index}`,+ ownerId: 'owner',+ },searchText: `Project ${index}`,sortTimestamp: 0,timestamps: {},@@ -675,13 +693,18 @@ it.each(['before navigation', 'while away'])();it('reloads name rows on remount instead of storing them in history', async () => {- const savedItems: EntitySearchItem[] = Array.from(+ const savedItems: QuickAccessItem[] = Array.from({ length: 100 },(_, index) => ({id: `project-${index}`,- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: `Project ${index}`,+ data: {+ id: `project-${index}`,+ type: 'initiative',+ name: `Project ${index}`,+ ownerId: 'owner',+ },searchText: `Project ${index}`,sortTimestamp: 0,timestamps: {},@@ -730,9 +753,14 @@ it('does not show a loading footer for available name results during a backgrounmocks.items = () => [{id: 'project',- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: 'Project',+ data: {+ id: 'project',+ type: 'initiative',+ name: 'Project',+ ownerId: 'owner',+ },searchText: 'Project',sortTimestamp: 0,timestamps: {},@@ -751,21 +779,31 @@ it.each(['name', 'full-text'] as const)(const [authenticated, setAuthenticated] = createSignal(true);mocks.accountId = accountId;mocks.authenticated = authenticated;- const [nameItems, setNameItems] = createSignal<EntitySearchItem[]>([+ const [nameItems, setNameItems] = createSignal<QuickAccessItem[]>([{id: 'first',- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: 'First',+ data: {+ id: 'first',+ type: 'initiative',+ name: 'First',+ ownerId: 'owner',+ },searchText: 'First',sortTimestamp: 0,timestamps: {},},{id: 'second',- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: 'Second',+ data: {+ id: 'second',+ type: 'initiative',+ name: 'Second',+ ownerId: 'owner',+ },searchText: 'Second',sortTimestamp: 0,timestamps: {},@@ -868,12 +906,17 @@ it.each(['name', 'full-text'] as const)();it('does not revive saved name rows after a failed refresh or successful empty result', () => {- const [items, setItems] = createSignal<EntitySearchItem[]>([+ const [items, setItems] = createSignal<QuickAccessItem[]>([{id: 'project',- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: 'Project',+ data: {+ id: 'project',+ type: 'initiative',+ name: 'Project',+ ownerId: 'owner',+ },searchText: 'Project',sortTimestamp: 0,timestamps: {},@@ -972,9 +1015,14 @@ it('loads another name page near the end without a persistent paging bar', asyncmocks.items = () =>Array.from({ length: 100 }, (_, index) => ({id: `project-${index}`,- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: `Project ${index}`,+ data: {+ id: `project-${index}`,+ type: 'initiative',+ name: `Project ${index}`,+ ownerId: 'owner',+ },searchText: `Project ${index}`,sortTimestamp: 0,timestamps: {},@@ -1019,7 +1067,7 @@ it('loads full-text pages near the end without a persistent paging bar', () => {});it('fills an empty name page without requiring a scroll and stops once rows fill the viewport', async () => {- const [items, setItems] = createSignal<EntitySearchItem[]>([]);+ const [items, setItems] = createSignal<QuickAccessItem[]>([]);mocks.items = items;mocks.loadMore.mockImplementationOnce(async () => {setItems([]);@@ -1028,9 +1076,14 @@ it('fills an empty name page without requiring a scroll and stops once rows fillsetItems(Array.from({ length: 100 }, (_, index) => ({id: `project-${index}`,- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: `Project ${index}`,+ data: {+ id: `project-${index}`,+ type: 'initiative',+ name: `Project ${index}`,+ ownerId: 'owner',+ },searchText: `Project ${index}`,sortTimestamp: 0,timestamps: {},@@ -1166,9 +1219,14 @@ it('resumes viewport paging when editing a restored search in the dock', async (mocks.items = () => [{id: 'first',- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name: 'First',+ data: {+ id: 'first',+ type: 'initiative',+ name: 'First',+ ownerId: 'owner',+ },searchText: 'First',sortTimestamp: 0,timestamps: {},diff --git a/apps/web/src/features/command/mobile/MobileSearchResults.tsx b/apps/web/src/features/command/mobile/MobileSearchResults.tsxindex dbf16c3fab..4e9f8101ed 100644--- a/apps/web/src/features/command/mobile/MobileSearchResults.tsx+++ b/apps/web/src/features/command/mobile/MobileSearchResults.tsx@@ -9,6 +9,7 @@ import { useSplitLayout } from '@components/app/split-layout/layout';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import { toast } from '@core/component/Toast/Toast';+import type { QuickAccessItem } from '@core/context/quickAccess';import { useIsAuthenticated, useUserId } from '@core/context/user';import { fireAndForget } from '@core/util/fireAndForget';import { isTransientRequestError } from '@core/util/request-error';@@ -28,10 +29,7 @@ import { type VirtualizerHandle, VList } from 'virtua/solid';import { useUniversalInputEnabled } from '../../universal-input/use-universal-input';import { ItemDisplay } from '../CommandItem';import { commandSearchResultKey } from '../contact-items';-import {- type EntitySearchItem,- useEntitySearch,-} from '../queries/entity-search';+import { useEntitySearch } from '../queries/entity-search';import { createMobileFullTextSearch } from '../queries/mobile-full-text-search';import { createMobileSearchEntry } from './create-mobile-search-entry';import { createSearchPagination } from './create-search-pagination';@@ -56,7 +54,7 @@ function MobileNameResults(props: {const incoming = createMemo(() =>source.rankItems(source.items(), state.query()));- const itemKey = (item: EntitySearchItem) =>+ const itemKey = (item: QuickAccessItem) =>commandSearchResultKey(item, props.accountId);const results = createSearchResultWindow({key: 'mobileSearch.nameOrder',@@ -125,11 +123,11 @@ function MobileNameResults(props: {const { openWithSplit } = useSplitLayout();const panel = useSplitPanelOrThrow();const directMessage = useGetOrCreateDirectMessageMutation();- const open = async (item: EntitySearchItem) => {+ const open = async (item: QuickAccessItem) => {await Telemetry.span('mobile.search.open', async (span) => {span.setAttr('entity.id', item.id);span.setAttr('entity.type', item.bucket);- if (item.kind === 'initiative') {+ if (item.kind === 'entity' && item.bucket === 'initiative') {openWithSplit({type: 'component',id: projectRouteId({ id: item.id, section: 'overview' }),@@ -149,7 +147,7 @@ function MobileNameResults(props: {}});};- const select = async (item: EntitySearchItem) => {+ const select = async (item: QuickAccessItem) => {results.preserveOrder();try {await open(item);diff --git a/apps/web/src/features/command/open-command-result.ts b/apps/web/src/features/command/open-command-result.tsindex 9134aba706..1e5b601204 100644--- a/apps/web/src/features/command/open-command-result.ts+++ b/apps/web/src/features/command/open-command-result.ts@@ -115,8 +115,9 @@ export function createCommandResultOpener(};return (item: CommandMenuItem, openInNewSplit = false): boolean => {- if (item.kind === 'initiative' && !projectsFlag().enabled) return false;- if (item.kind === 'initiative') {+ const isProject = isEntityItem(item) && item.bucket === 'initiative';+ if (isProject && !projectsFlag().enabled) return false;+ if (isProject) {openWithSplit({type: 'component',diff --git a/apps/web/src/features/command/project-items.test.tsx b/apps/web/src/features/command/project-items.test.tsxdeleted file mode 100644index 0fd732d11f..0000000000--- a/apps/web/src/features/command/project-items.test.tsx+++ /dev/null@@ -1,185 +0,0 @@-import { refreshActiveGraphqlSoupQueries } from '@queries/soup/graphql/active-queries';-import { cleanup, render, waitFor } from '@solidjs/testing-library';-import {- CombinedError,- createClient,- type Exchange,- type Operation,- type OperationResult,-} from '@urql/core';-import { createSignal, Suspense } from 'solid-js';-import { afterEach, beforeEach, expect, it, vi } from 'vitest';-import { filter, fromPromise, mergeMap, pipe } from 'wonka';--const fixtures = vi.hoisted(() => ({- reply:- vi.fn<- (operation: Operation) => Promise<Pick<OperationResult, 'data' | 'error'>>- >(),- client: undefined as unknown,- projectFlag: (): boolean | undefined => true,-}));-vi.mock('@app/lib/analytics/posthog', () => ({- useFeatureFlag: (flag: { key: string }) => () => ({- enabled: flag.key === 'enable-projects' && fixtures.projectFlag() === true,- loading: fixtures.projectFlag() === undefined,- }),-}));-vi.mock('@core/context/user', () => ({- useUserId: () => () => 'macro|[email protected]',-}));-vi.mock('@service-storage/graphql-soup', () => ({- getGraphqlSoupClient: () => fixtures.client,- mapGraphqlProperties: () => [],-}));-vi.mock('@queries/activity/push-registry', () => ({- registerActivityRevalidator: () => () => {},-}));-vi.mock('@entity/extractors-property/property-helpers', () => ({- soupPropertyToProperty: vi.fn(),-}));--import { useProjectCommandItems } from './project-items';--const page = (id: string, nextCursor: string | null = null) => ({- data: {- user: {- soup: {- nextCursor,- items: [- {- __typename: 'GraphqlSoupInitiative',- id,- displayName: id,- metadata: { updatedAt: '2026-09-22T12:00:00Z' },- viewerPermission: {- __typename: 'GraphqlAccessLevelPermission',- accessLevel: 'EDIT',- },- properties: [],- },- ],- },- },- },-});--beforeEach(() => {- fixtures.projectFlag = () => true;- const exchange: Exchange = () => (operations) =>- pipe(- operations,- filter((operation) => operation.kind !== 'teardown'),- mergeMap((operation) =>- fromPromise(- (async () => ({- operation,- stale: false,- hasNext: false,- ...(await fixtures.reply(operation)),- }))()- )- )- );- fixtures.client = createClient({- url: 'https://example.test/graphql',- exchanges: [exchange],- });-});-afterEach(() => {- cleanup();- fixtures.reply.mockReset();-});--it('does not search until enabled and hides cached results when disabled', async () => {- const [enabled, setEnabled] = createSignal<boolean | undefined>(undefined);- fixtures.projectFlag = enabled;- fixtures.reply.mockResolvedValue(page('first', 'next'));- let source!: ReturnType<typeof useProjectCommandItems>;- render(() => {- source = useProjectCommandItems(- () => '',- () => true- );- return <div>{source.items().length}</div>;- });- expect(source.enabled()).toBe(false);- expect(source.isLoading()).toBe(false);- expect(fixtures.reply).not.toHaveBeenCalled();- setEnabled(false);- await source.loadMore();- expect(fixtures.reply).not.toHaveBeenCalled();- setEnabled(true);- expect(source.isLoading()).toBe(true);- await waitFor(() => expect(source.items()).toHaveLength(1));- expect(source.isLoading()).toBe(false);- expect(source.hasMore()).toBe(true);- setEnabled(false);- expect(source.enabled()).toBe(false);- expect(source.items()).toEqual([]);- expect(source.hasMore()).toBe(false);- expect(source.isLoading()).toBe(false);- await source.loadMore();- expect(fixtures.reply).toHaveBeenCalledTimes(1);-});--it('pages authorized Soup results and reports loading when the search changes', async () => {- fixtures.reply- .mockResolvedValueOnce(page('first', 'next'))- .mockResolvedValueOnce(page('second'))- .mockImplementation(() => new Promise(() => {}));- const [query, setQuery] = createSignal('Launch');- let source!: ReturnType<typeof useProjectCommandItems>;- const view = render(() => (- <Suspense fallback={<div>Suspended</div>}>- <Probe />- </Suspense>- ));- function Probe() {- source = useProjectCommandItems(query, () => true);- return <div>Results: {source.items().length}</div>;- }- await waitFor(() => expect(source.items()).toHaveLength(1));- expect(- fixtures.reply.mock.calls[0][0].variables!.input.initial.filters- .initiativeFilter- ).toEqual({- and: {- left: { literal: { include: true } },- right: { literal: { nameContains: 'Launch' } },- },- });- await source.loadMore();- await waitFor(() => expect(source.items()).toHaveLength(2));- expect(fixtures.reply.mock.calls[1][0].variables).toMatchObject({- input: { continuation: { cursor: 'next' } },- });- setQuery('Other');- await waitFor(() => expect(fixtures.reply).toHaveBeenCalledTimes(3));- expect(source.items()).toEqual([]);- expect(source.isLoading()).toBe(true);- expect(view.queryByText('Suspended')).toBeNull();-});--it('hides cached names when project access is revoked', async () => {- fixtures.reply- .mockResolvedValueOnce(page('Private project'))- .mockResolvedValue({- error: new CombinedError({- graphQLErrors: [- { message: 'Access revoked', extensions: { code: 'FORBIDDEN' } },- ],- }),- });- let source!: ReturnType<typeof useProjectCommandItems>;- render(() => {- source = useProjectCommandItems(- () => '',- () => true- );- return <div>{source.items().length}</div>;- });- await waitFor(() => expect(source.items()).toHaveLength(1));- await refreshActiveGraphqlSoupQueries();- await waitFor(() => expect(source.items()).toEqual([]));-});diff --git a/apps/web/src/features/command/project-items.ts b/apps/web/src/features/command/project-items.tsindex 0c49cf25ef..629711ca9a 100644--- a/apps/web/src/features/command/project-items.ts+++ b/apps/web/src/features/command/project-items.ts@@ -1,20 +1,5 @@-import { useFeatureFlag } from '@app/lib/analytics/posthog';import { t } from '@app/lib/i18n';-import { enableProjects } from '@core/constant/featureFlags';-import { useUserId } from '@core/context/user';import type { TimestampedItem } from '@core/util/freshSort';-import type { Accessor } from 'solid-js';-import { useProjectSearchQuery } from '../projects/project-search';--export type ProjectCommandItem = {- id: string;- kind: 'initiative';- bucket: 'initiative';- searchText: string;- sortTimestamp: number;- timestamps: TimestampedItem;- name: string;-};export type CreateProjectCommandItem = {id: 'new-project';@@ -36,40 +21,3 @@ export const newProjectCommand: CreateProjectCommandItem = {sortTimestamp: 0,timestamps: { viewedAt: undefined, updatedAt: undefined },};--/** Authorized server search for native projects, independent of the folder index. */-export function useProjectCommandItems(- search: Accessor<string>,- searchActive: Accessor<boolean>-) {- const userId = useUserId();- const projectsFlag = useFeatureFlag(enableProjects);- const enabled = () => projectsFlag().enabled && searchActive();- const query = useProjectSearchQuery(search, enabled, userId);- return {- enabled,- items: (): ProjectCommandItem[] =>- enabled() && !query.error()- ? (query.rows()?.map(({ project }) => ({- id: project.id,- kind: 'initiative',- bucket: 'initiative',- name: project.name,- searchText: project.name,- sortTimestamp: Date.parse(project.updatedAt),- timestamps: {- updatedAt: project.updatedAt,- viewedAt: undefined,- },- })) ?? [])- : [],- isLoading: () => enabled() && query.loading(),- error: () => (enabled() ? query.error() : undefined),- hasMore: () => enabled() && query.hasMore(),- isLoadingMore: () => enabled() && query.loadingMore(),- loadMore: async () => {- if (enabled() && query.hasMore() && !query.loadingMore())- await query.loadMore();- },- };-}diff --git a/apps/web/src/features/command/queries/entity-search.ts b/apps/web/src/features/command/queries/entity-search.tsindex ce84eab00c..735020c068 100644--- a/apps/web/src/features/command/queries/entity-search.ts+++ b/apps/web/src/features/command/queries/entity-search.ts@@ -8,10 +8,6 @@ import { useUserId } from '@core/context/user';import { isTransientRequestError } from '@core/util/request-error';import { type Accessor, createMemo } from 'solid-js';import { contactCommandItems, mergeCommandPeople } from '../contact-items';-import {- type ProjectCommandItem,- useProjectCommandItems,-} from '../project-items';import { rankCommandSearchItems } from '../rank-command-search-items';import type { CategoryFilter } from '../types';import type { CommandContactSource, CommandMenuItem } from '../useCommandItems';@@ -19,8 +15,6 @@ import type { CommandContactSource, CommandMenuItem } from '../useCommandItems';export type EntitySearchCategory =| Exclude<CategoryFilter, 'commands'>| 'email';-export type EntitySearchItem = QuickAccessItem | ProjectCommandItem;-const QUICK_ACCESS_BUCKETS_BY_CATEGORY: Partial<Record<EntitySearchCategory, Bucket[]>> = {@@ -31,6 +25,7 @@ const QUICK_ACCESS_BUCKETS_BY_CATEGORY: Partial<documents: ['note', 'document', 'snippet', 'project', 'database', 'form'],tasks: ['task'],chats: ['chat'],+ projects: ['initiative'],people: ['person'],};const CONTACT_CATEGORIES = new Set<EntitySearchCategory | 'commands'>([@@ -71,6 +66,11 @@ export function useEntitySearch(if ((category === 'all' || category === 'dms') && hasQuery()) {buckets = [...buckets, 'person'];}+ // Like people, projects join All only for typed searches; the empty+ // recency list leaves them to the Projects category.+ if (category === 'all' && hasQuery()) {+ buckets = [...buckets, 'initiative'];+ }return quickAccess.useList({buckets: options.excludeEmails? buckets.filter((bucket) => bucket !== 'email')@@ -79,10 +79,6 @@ export function useEntitySearch(enabled: searchActive,});});- const projectEnabled = () =>- searchActive() &&- (categoryFilter() === 'all' || categoryFilter() === 'projects');- const projects = useProjectCommandItems(scopedSearchTerm, projectEnabled);const contactsActive = () =>searchActive() && CONTACT_CATEGORIES.has(categoryFilter()) && hasQuery();const contacts = options?.contactDiscovery?.(@@ -94,7 +90,7 @@ export function useEntitySearch(directMessages: quickAccess.useList('dm').items,viewerId: useUserId(),};- const contactItems = createMemo((): EntitySearchItem[] =>+ const contactItems = createMemo((): QuickAccessItem[] =>contacts && contactsActive()? contactCommandItems({contacts: contacts.contacts(),@@ -107,16 +103,15 @@ export function useEntitySearch(const contactItemIds = createMemo(() => new Set(contactItems().map((item) => item.id)));- const cachedItems = (): EntitySearchItem[] => activeList()?.items() ?? [];+ const cachedItems = (): QuickAccessItem[] => activeList()?.items() ?? [];const withDiscovery = <T extends CommandMenuItem>(baseItems: T[]- ): (T | EntitySearchItem)[] => {- const items = [...baseItems, ...projects.items()];+ ): (T | QuickAccessItem)[] => {// A contact's row keeps its CRM name searchable, so it replaces the same// conversation listed under its own name.const contactIds = contactItemIds();const discovered = [- ...items.filter((item) => !contactIds.has(item.id)),+ ...baseItems.filter((item) => !contactIds.has(item.id)),...contactItems(),];return CONTACT_CATEGORIES.has(categoryFilter()) && query().trim()@@ -145,40 +140,28 @@ export function useEntitySearch(cachedItems,withDiscovery,rankItems,- projectsEnabled: projects.enabled,isSettling: () =>!!activeList()?.isLoading() ||- projects.isLoading() ||(contactsActive() && (contacts?.isLoading() ?? false)),hasError: () =>- !!activeList()?.error() ||- !!projects.error() ||- (contactsActive() && !!contacts?.error()),+ !!activeList()?.error() || (contactsActive() && !!contacts?.error()),hasAuthoritativeError: () => {- const projectError = projects.error();const contactError = contactsActive() ? contacts?.error() : undefined;- return !!(- (projectError && !isTransientRequestError(projectError)) ||- (contactError && !isTransientRequestError(contactError))- );+ return !!contactError && !isTransientRequestError(contactError);},isLoadingEntities: () =>(!!activeList()?.isLoading() && activeList()?.items().length === 0) ||- projects.isLoading() ||(contactsActive() && (contacts?.isLoading() ?? false)),pagination: {hasMore: () =>(activeList()?.hasMore() ?? false) ||- projects.hasMore() ||(contactsActive() && (contacts?.hasMore() ?? false)),isLoadingMore: () =>(activeList()?.isLoadingMore() ?? false) ||- projects.isLoadingMore() ||(contactsActive() && (contacts?.isLoadingMore() ?? false)),loadMore: async () => {await Promise.all([activeList()?.loadMore(),- projects.loadMore(),contactsActive() ? contacts?.loadMore() : undefined,]);},diff --git a/apps/web/src/features/command/rank-command-search-items.test.ts b/apps/web/src/features/command/rank-command-search-items.test.tsindex 69d23cbe13..d42da3b688 100644--- a/apps/web/src/features/command/rank-command-search-items.test.ts+++ b/apps/web/src/features/command/rank-command-search-items.test.ts@@ -48,12 +48,12 @@ function command(id: string, name: string, viewedAt: number): CommandMenuItem {function project(id: string, name: string, updatedAt = NOW): CommandMenuItem {return {id,- kind: 'initiative',+ kind: 'entity',bucket: 'initiative',- name,searchText: name,sortTimestamp: updatedAt,timestamps: { updatedAt: new Date(updatedAt).toISOString() },+ data: { id, type: 'initiative', name, ownerId: 'owner' },};}diff --git a/apps/web/src/features/command/rank-command-search-items.ts b/apps/web/src/features/command/rank-command-search-items.tsindex 59df39936a..47a2719100 100644--- a/apps/web/src/features/command/rank-command-search-items.ts+++ b/apps/web/src/features/command/rank-command-search-items.ts@@ -6,7 +6,6 @@ import type { CommandMenuItem } from './useCommandItems';function displayName(item: CommandMenuItem): string {return match(item).with({ kind: 'entity' }, { kind: 'user' }, (row) => row.data.name)- .with({ kind: 'initiative' }, (row) => row.name).with({ kind: 'command' }, ({ data }) =>typeof data.description === 'function'? data.description()@@ -88,8 +87,7 @@ export function rankCommandSearchItems<T extends CommandMenuItem>(.map(({ item }) => item);const preserved = (item: CommandMenuItem) =>options.preservedIds?.has(item.id) ||- (options.preserveAdditionalEntityMatches &&- (item.kind === 'entity' || item.kind === 'initiative'));+ (options.preserveAdditionalEntityMatches && item.kind === 'entity');if (!options.preserveAdditionalEntityMatches && !options.preservedIds?.size)return prioritizeInternalPeople(ranked);diff --git a/apps/web/src/features/command/useCommandItems.contacts.test.ts b/apps/web/src/features/command/useCommandItems.contacts.test.tsindex 898f3afae7..5a37f6d295 100644--- a/apps/web/src/features/command/useCommandItems.contacts.test.ts+++ b/apps/web/src/features/command/useCommandItems.contacts.test.ts@@ -25,12 +25,6 @@ vi.mock('@app/lib/analytics/posthog', () => ({vi.mock('@core/context/user', () => ({useUserId: () => () => 'macro|[email protected]',}));-vi.mock('../projects/project-search', () => ({- useProjectSearchQuery: () => ({- rows: () => undefined,- error: () => undefined,- }),-}));vi.mock('@app/constants/hotkeys', () => ({GO_TO_COMMAND_SCOPE: 'go-to',GO_TO_LEADER_KEY: 'g',diff --git a/apps/web/src/features/command/useCommandItems.test.ts b/apps/web/src/features/command/useCommandItems.test.tsindex 4808323c17..130c2d2b16 100644--- a/apps/web/src/features/command/useCommandItems.test.ts+++ b/apps/web/src/features/command/useCommandItems.test.ts@@ -25,12 +25,6 @@ vi.mock('@app/lib/analytics/posthog', () => ({vi.mock('@core/context/user', () => ({useUserId: () => () => 'owner',}));-vi.mock('../projects/project-search', () => ({- useProjectSearchQuery: () => ({- rows: () => undefined,- error: () => undefined,- }),-}));vi.mock('@app/constants/hotkeys', () => ({GO_TO_COMMAND_SCOPE: 'go-to',GO_TO_LEADER_KEY: 'g',diff --git a/apps/web/src/features/command/useCommandItems.test.tsx b/apps/web/src/features/command/useCommandItems.test.tsxindex 09aaaf6f09..e1ab1dcacb 100644--- a/apps/web/src/features/command/useCommandItems.test.tsx+++ b/apps/web/src/features/command/useCommandItems.test.tsx@@ -1,17 +1,36 @@+import type {+ Bucket,+ QuickAccessItem,+ QuickAccessListOptions,+} from '@core/context/quickAccess/types';import type { CommandWithInfo } from '@core/hotkey/getCommands';import { TOKENS } from '@core/hotkey/tokens';-import { cleanup, render, waitFor } from '@solidjs/testing-library';-import { type Client, createClient, type Exchange } from '@urql/core';+import { cleanup, render } from '@solidjs/testing-library';import { createSignal } from 'solid-js';import { afterEach, expect, it, vi } from 'vitest';-import { filter, fromPromise, mergeMap, pipe } from 'wonka';-const fixtures = vi.hoisted(() => ({- commands: [] as CommandWithInfo[],- page: vi.fn(),- client: undefined as Client | undefined,- projectFlag: (): boolean | undefined => undefined,-}));+const fixtures = vi.hoisted(() => {+ const project: QuickAccessItem = {+ id: 'launch',+ kind: 'entity',+ bucket: 'initiative',+ searchText: 'Launch',+ sortTimestamp: 1,+ timestamps: {},+ data: {+ id: 'launch',+ type: 'initiative',+ name: 'Launch',+ ownerId: 'owner',+ },+ };+ return {+ commands: [] as CommandWithInfo[],+ projectFlag: (): boolean | undefined => undefined,+ requests: [] as Bucket[][],+ project,+ };+});vi.mock('@app/lib/analytics/posthog', () => ({useFeatureFlag: (flag: { key: string }) => () => ({@@ -24,9 +43,21 @@ vi.mock('@core/context/user', () => ({vi.mock('@core/context/quickAccess', () => ({exclude: () => [],useQuickAccess: () => ({- useList: () => ({ items: () => [], hasMore: () => false }),+ useList: (options: Bucket | QuickAccessListOptions) => {+ if (typeof options === 'string') return { items: () => [] };+ fixtures.requests.push([...options.buckets]);+ return {+ items: () =>+ options.buckets.includes('initiative') ? [fixtures.project] : [],+ isLoading: () => false,+ hasMore: () => false,+ isLoadingMore: () => false,+ error: () => undefined,+ loadMore: async () => {},+ };+ },usesRecordSelection: () => false,- usesSearchProjection: () => false,+ usesSearchProjection: () => true,}),}));vi.mock('@core/hotkey/getCommands', () => ({@@ -37,123 +68,67 @@ vi.mock('@core/hotkey/state', () => ({activeScope: () => 'root',hotkeyScopeTree: new Map(),}));-vi.mock('@service-storage/graphql-soup', () => ({- getGraphqlSoupClient: () => fixtures.client,- mapGraphqlProperties: () => [],-}));-vi.mock('@queries/activity/push-registry', () => ({- registerActivityRevalidator: () => () => {},-}));-vi.mock('@queries/client', async () => {- const { QueryClient } = await import('@tanstack/solid-query');- return {- queryClient: new QueryClient({- defaultOptions: { queries: { retry: false } },- }),- };-});-import { queryClient } from '@queries/client';import type { CategoryFilter } from './types';import { useCommandItems } from './useCommandItems';afterEach(() => {cleanup();- queryClient.clear();- fixtures.page.mockReset();+ fixtures.requests = [];});-it('gates Projects results and creation commands without hiding Folder', async () => {- const [flag, setFlag] = createSignal<boolean | undefined>(undefined);+const createCommands: CommandWithInfo[] = [+ {+ hotkeyToken: TOKENS.create.initiative,+ description: 'Create project',+ scopeId: 'root',+ scopeLevel: 0,+ hotkeyIsShadowed: false,+ runWithInputFocused: false,+ },+ {+ hotkeyToken: TOKENS.create.project,+ description: 'Create folder',+ scopeId: 'root',+ scopeLevel: 0,+ hotkeyIsShadowed: false,+ runWithInputFocused: false,+ },+];++it('lists Projects from Quick Access and gates project creation without hiding Folder', () => {+ const [flag, setFlag] = createSignal<boolean | undefined>(true);const [category, setCategory] = createSignal<CategoryFilter>('projects');fixtures.projectFlag = flag;- fixtures.commands = [- {- hotkeyToken: TOKENS.create.initiative,- description: 'Create project',- scopeId: 'root',- scopeLevel: 0,- hotkeyIsShadowed: false,- runWithInputFocused: false,- },- {- hotkeyToken: TOKENS.create.project,- description: 'Create folder',- scopeId: 'root',- scopeLevel: 0,- hotkeyIsShadowed: false,- runWithInputFocused: false,- },- ];- fixtures.page.mockImplementation(async (operation) => ({- operation,- stale: false,- hasNext: false,- data: {- user: {- id: 'viewer',- soup: {- nextCursor: null,- items: [- {- __typename: 'GraphqlSoupInitiative',- id: 'launch',- displayName: 'Launch',- metadata: { updatedAt: '2026-09-22T12:00:00Z' },- viewerPermission: {- __typename: 'GraphqlAccessLevelPermission',- accessLevel: 'OWNER',- },- properties: [],- },- ],- },- },- },- }));- const exchange: Exchange = () => (operations) =>- pipe(- operations,- filter((operation) => operation.kind === 'query'),- mergeMap((operation) => fromPromise(fixtures.page(operation)))- );- fixtures.client = createClient({- url: 'http://test.invalid/graphql',- exchanges: [exchange],- });+ fixtures.commands = createCommands;let source!: ReturnType<typeof useCommandItems>;render(() => {source = useCommandItems(() => '', category, {searchActive: () => true,});- return (- <div>- {source- .items()- .map((item) => item.id)- .join(',')}- </div>- );+ return null;});- expect(source.items()).toEqual([]);- expect(fixtures.page).not.toHaveBeenCalled();- setFlag(true);- await waitFor(() =>- expect(source.items().map((item) => item.id)).toEqual([- 'launch',- 'new-project',- ])- );+ const ids = () => source.items().map((item) => item.id);++ expect(fixtures.requests.at(-1)).toEqual(['initiative']);+ expect(ids()).toEqual(['launch', 'new-project']);setCategory('commands');- expect(source.items().map((item) => item.id)).toEqual([- 'command-Create-project',- 'command-Create-folder',- ]);+ expect(ids()).toEqual(['command-Create-project', 'command-Create-folder']);setFlag(false);- expect(source.items().map((item) => item.id)).toEqual([- 'command-Create-folder',- ]);+ expect(ids()).toEqual(['command-Create-folder']);setCategory('projects');- expect(source.items()).toEqual([]);- expect(fixtures.page).toHaveBeenCalledTimes(1);+ expect(ids()).not.toContain('new-project');+});++it('adds projects to All only for typed queries', () => {+ fixtures.projectFlag = () => true;+ const [query, setQuery] = createSignal('');+ render(() => {+ useCommandItems(query, () => 'all', { searchActive: () => true }).items();+ return null;+ });++ expect(fixtures.requests.at(-1)).not.toContain('initiative');+ setQuery('launch');+ expect(fixtures.requests.at(-1)).toContain('initiative');});diff --git a/apps/web/src/features/command/useCommandItems.ts b/apps/web/src/features/command/useCommandItems.tsindex aaff4bc065..35d59a5316 100644--- a/apps/web/src/features/command/useCommandItems.ts+++ b/apps/web/src/features/command/useCommandItems.ts@@ -22,7 +22,6 @@ import { type Accessor, createMemo } from 'solid-js';import {type CreateProjectCommandItem,newProjectCommand,- type ProjectCommandItem,} from './project-items';import { useEntitySearch } from './queries/entity-search';import { getCommandLastUsedAt } from './recency';@@ -73,7 +72,6 @@ type CommandMenuItem =| CommandItem| SearchItem| AskAiItem- | ProjectCommandItem| CreateProjectCommandItem;export type PaginationControls = {@@ -387,6 +385,7 @@ export function useCommandItems(excludeEmails: true,contactDiscovery: options?.contactDiscovery,});+ const projectsFlag = useFeatureFlag(enableProjects);const categoryItems = (): CommandMenuItem[] => {if (commandScopeCommands().length > 0 ||@@ -405,7 +404,7 @@ export function useCommandItems(const items = entities.items();return [...items,- ...(entities.projectsEnabled() && categoryFilter() === 'projects'+ ...(projectsFlag().enabled && categoryFilter() === 'projects'? [newProjectCommand]: []),];diff --git a/apps/web/src/features/projects/project-search.ts b/apps/web/src/features/projects/project-search.tsdeleted file mode 100644index de7619cc3b..0000000000--- a/apps/web/src/features/projects/project-search.ts+++ /dev/null@@ -1,16 +0,0 @@-import { getGraphqlSoupClient } from '@service-storage/graphql-soup';-import type { Accessor } from 'solid-js';-import { createProjectSoupSource } from './queries/project-soup';--/** The command menu searches the same authorized Soup collection as Tasks. */-export function useProjectSearchQuery(- search: Accessor<string>,- enabled: Accessor<boolean>,- userId: Accessor<string | undefined>-) {- return createProjectSoupSource(- getGraphqlSoupClient,- () => ({ query: search().trim() || undefined }),- () => Boolean(userId()) && enabled()- );-}diff --git a/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.test.ts b/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.test.tsindex fad1166a6c..e3258973fc 100644--- a/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.test.ts+++ b/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.test.ts@@ -72,6 +72,7 @@ const mocks = vi.hoisted(() => ({initiatives: [] as InitiativeEntity[],databases: [] as ListedDatabase[],crmEnabled: (): boolean => true,+ projectsEnabled: (): boolean => true,graphqlEnabled: (): boolean => true,cacheEnabled: true,queries: {} as Partial<@@ -91,6 +92,7 @@ vi.mock('@core/constant/featureFlags', () => ({enableDatabases: {},enableForms: {},enableGraphqlSoup: { key: 'enable-graphql-soup' },+ enableProjects: { key: 'enable-projects' },isFeatureEnabled: () => mocks.crmEnabled(),}));vi.mock('@app/lib/analytics/posthog', () => ({@@ -98,7 +100,9 @@ vi.mock('@app/lib/analytics/posthog', () => ({enabled:flag.key === 'enable-graphql-soup'? mocks.graphqlEnabled()- : mocks.crmEnabled(),+ : flag.key === 'enable-projects'+ ? mocks.projectsEnabled()+ : mocks.crmEnabled(),}),}));vi.mock('@core/constant/allBlocks', () => ({@@ -257,6 +261,7 @@ beforeEach(() => {mocks.initiatives = [];mocks.databases = [];mocks.crmEnabled = () => true;+ mocks.projectsEnabled = () => true;mocks.graphqlEnabled = () => true;mocks.cacheEnabled = true;mocks.queries = {};@@ -306,6 +311,23 @@ const companyHit: SearchDocumentWire = {timestampMs: Date.parse(cachedCompany.updatedAt),sourceHash: 'company-hash',};+const cachedInitiative = {+ __typename: 'GraphqlSoupInitiative',+ displayName: 'Launch plan',+ metadata: {+ ownerId: 'owner',+ createdAt: '2025-01-01T00:00:00.000Z',+ updatedAt: '2025-01-02T00:00:00.000Z',+ },+};+const initiativeHit: SearchDocumentWire = {+ profile: 'quick-access-v1',+ recordKey: 'GraphqlSoupInitiative:initiative-1',+ bucket: 'initiative',+ searchText: 'launch plan',+ timestampMs: Date.parse(cachedInitiative.metadata.updatedAt),+ sourceHash: 'initiative-hash',+};const restCompany: CrmCompanyEntity = {id: 'company-1',type: 'crm_company',@@ -1084,6 +1106,102 @@ describe('Quick Access source integration', () => {});+ it('finds a cached project absent from the REST feed', async () => {+ mocks.readRecordsByKeys.mockResolvedValue({+ revision: INITIAL_CACHE_REVISION,+ records: [+ {+ recordKey: 'GraphqlSoupInitiative:initiative-1',+ record: cachedInitiative,+ },+ ],+ });+ mocks.search.mockResolvedValue({+ documents: [initiativeHit],+ nextCursor: null,+ });+ const list = setup((source) =>+ source.useList({ buckets: ['initiative'], searchTerm: () => 'launch' })+ );+ await vi.waitFor(() => expect(list.items()).toHaveLength(1));+ expect(mocks.search).toHaveBeenCalledWith(+ expect.objectContaining({ buckets: ['initiative'], query: 'launch' })+ );+ expect(list.items()[0]).toMatchObject({+ id: 'initiative-1',+ kind: 'entity',+ bucket: 'initiative',+ searchText: 'Launch plan',+ data: { type: 'initiative', name: 'Launch plan', ownerId: 'owner' },+ });+ });++ it('merges project cache hits with the REST feed without duplicates', async () => {+ mocks.initiatives = [+ {+ id: 'initiative-1',+ type: 'initiative',+ name: 'Launch plan',+ ownerId: 'owner',+ updatedAt: '2025-01-02T00:00:00.000Z',+ },+ ];+ mocks.search.mockResolvedValue({+ documents: [initiativeHit],+ nextCursor: null,+ });+ const list = setup((source) =>+ source.useList({ buckets: ['initiative'], searchTerm: () => 'launch' })+ );+ await vi.waitFor(() => expect(list.isLoading()).toBe(false));+ expect(list.items().map((item) => item.id)).toEqual(['initiative-1']);+ });++ it('shows a renamed project by its cached name while the REST feed is stale', async () => {+ mocks.initiatives = [+ {+ id: 'initiative-1',+ type: 'initiative',+ name: 'Old name',+ ownerId: 'owner',+ updatedAt: '2025-01-01T00:00:00.000Z',+ },+ ];+ mocks.readRecordsByKeys.mockResolvedValue({+ revision: INITIAL_CACHE_REVISION,+ records: [+ {+ recordKey: 'GraphqlSoupInitiative:initiative-1',+ record: cachedInitiative,+ },+ ],+ });+ mocks.search.mockResolvedValue({+ documents: [initiativeHit],+ nextCursor: null,+ });+ const list = setup((source) =>+ source.useList({ buckets: ['initiative'], searchTerm: () => 'launch' })+ );+ await vi.waitFor(() =>+ expect(list.items()[0]).toMatchObject({+ id: 'initiative-1',+ searchText: 'Launch plan',+ data: { name: 'Launch plan' },+ })+ );+ expect(list.items()).toHaveLength(1);+ });++ it('does not search cached projects when Projects is disabled', () => {+ mocks.projectsEnabled = () => false;+ const list = setup((source) =>+ source.useList({ buckets: ['initiative'], searchTerm: () => 'launch' })+ );+ expect(list.items()).toEqual([]);+ expect(mocks.search).not.toHaveBeenCalled();+ });+it('merges CRM cache hits with the REST feed without duplicates', async () => {mocks.companies = [restCompany];mocks.search.mockResolvedValue({@@ -1304,7 +1422,7 @@ describe('Quick Access source integration', () => {).toEqual(['folder', 'note', 'task']);});- it('lists task projects with document search hits without searching the cache for them', async () => {+ it('lists task projects from the REST feed with document hits while searching cached projects too', async () => {mocks.initiatives = [{type: 'initiative',@@ -1343,7 +1461,7 @@ describe('Quick Access source integration', () => {).toMatchObject({ bucket: 'initiative', data: { type: 'initiative' } });expect(mocks.search).toHaveBeenCalledWith(expect.objectContaining({- buckets: expect.not.arrayContaining(['initiative']),+ buckets: expect.arrayContaining(['initiative']),}));});diff --git a/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.tsx b/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.tsxindex 7a497377d7..bdf3fab2c1 100644--- a/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.tsx+++ b/apps/web/src/lib/core/context/quickAccess/QuickAccessSource.tsx@@ -13,6 +13,7 @@ import {enableDatabases,enableForms,enableGraphqlSoup,+ enableProjects,} from '@core/constant/featureFlags';import {useChannelsContext,@@ -31,6 +32,7 @@ import type {CrmContactEntity,DatabaseEntity,FormEntity,+ InitiativeEntity,SkillEntity,SnippetEntity,} from '@entity';@@ -47,6 +49,7 @@ import {import { queryReadyGate } from '@queries/gate';import { materializeCachedGraphqlHistoryItems } from '@queries/history/graphql';import { type HistoryItem, useHistoryQuery } from '@queries/history/history';+import { materializeCachedGraphqlInitiatives } from '@queries/soup/graphql/initiatives';import { useQuickAccessAgentSessionsQuery } from '@queries/soup/quick-access-agent-sessions';import { useQuickAccessInitiativesQuery } from '@queries/soup/quick-access-initiatives';import { useQuickAccessSkillsQuery } from '@queries/soup/quick-access-skills';@@ -245,6 +248,25 @@ function channelToQuickAccessItem(};}+function initiativeToQuickAccessItem(+ initiative: InitiativeEntity,+ viewedAt: DateValue | null | undefined+): QuickAccessItem {+ return {+ kind: 'entity',+ id: initiative.id,+ bucket: 'initiative',+ searchText: initiative.name,+ sortTimestamp: toTimestamp(viewedAt) || toTimestamp(initiative.updatedAt),+ timestamps: {+ viewedAt,+ updatedAt: initiative.updatedAt,+ createdAt: initiative.createdAt,+ },+ data: { ...initiative, viewedAt },+ };+}+function equalActivityMaps(previous: Map<string, DateValue>,next: Map<string, DateValue>@@ -377,6 +399,7 @@ function sortIndexEntries(entries: IndexEntry[]): IndexEntry[] {/** Builds Quick Access from history and its supporting entity sources. */export function createQuickAccessValue(): QuickAccessContextValue {const crmFlag = useFeatureFlag(enableCrm);+ const projectsFlag = useFeatureFlag(enableProjects);const graphqlFlag = useFeatureFlag(enableGraphqlSoup);// queriesconst historyQuery = useHistoryQuery();@@ -937,30 +960,17 @@ export function createQuickAccessValue(): QuickAccessContextValue {const entries: IndexEntry[] = [];for (const initiative of initiativesAccessor()) {const viewedAt = viewedAtMap.get(initiative.id) ?? initiative.viewedAt;- const sortTimestamp =- toTimestamp(viewedAt) || toTimestamp(initiative.updatedAt);- const entity = { ...initiative, viewedAt };- const version = JSON.stringify(entity);+ const item = initiativeToQuickAccessItem(initiative, viewedAt);+ const version = JSON.stringify(item.data);const cached = itemCache.get(initiative.id);if (!cached || cached.version !== version) {- itemCache.set(initiative.id, {- version,- item: {- kind: 'entity',- id: initiative.id,- bucket: 'initiative',- searchText: initiative.name,- sortTimestamp,- timestamps: {- viewedAt,- updatedAt: initiative.updatedAt,- createdAt: initiative.createdAt,- },- data: entity,- },- });+ itemCache.set(initiative.id, { version, item });}- entries.push({ id: initiative.id, bucket: 'initiative', sortTimestamp });+ entries.push({+ id: initiative.id,+ bucket: 'initiative',+ sortTimestamp: item.sortTimestamp,+ });}return sortIndexEntries(entries);});@@ -1090,8 +1100,9 @@ export function createQuickAccessValue(): QuickAccessContextValue {const projectedBuckets = createMemo(() =>(buckets.length ? buckets : BUCKET_COMBINATIONS.all).filter((bucket) =>- (bucket !== 'crm_company' && bucket !== 'crm_contact') ||- crmFlag().enabled+ ((bucket !== 'crm_company' && bucket !== 'crm_contact') ||+ crmFlag().enabled) &&+ (bucket !== 'initiative' || projectsFlag().enabled)));const baseList = createLazyMemo(() => {@@ -1183,12 +1194,14 @@ export function createQuickAccessValue(): QuickAccessContextValue {cachedCompanies,cachedContacts,cachedEmails,+ cachedInitiatives,] = await Promise.all([materializeCachedGraphqlHistoryItems(projectionHost, missing),materializeCachedGraphqlChannels(projectionHost, documents),materializeCachedGraphqlCrmCompanies(projectionHost, missing),materializeCachedGraphqlCrmContacts(projectionHost, missing),materializeCachedEmailItems(projectionHost, documents),+ materializeCachedGraphqlInitiatives(projectionHost, documents),]);const historyById = new Map(historyItems.map((item) => [item.id, item])@@ -1205,6 +1218,12 @@ export function createQuickAccessValue(): QuickAccessContextValue {const emailsById = new Map(cachedEmails.map((item) => [item.id, item]));+ const initiativesById = new Map(+ cachedInitiatives.map((initiative) => [+ initiative.id,+ initiative,+ ])+ );return documents.flatMap((document): QuickAccessItem[] => {const id = idOf(document.recordKey);if (document.bucket === 'email') {@@ -1223,6 +1242,15 @@ export function createQuickAccessValue(): QuickAccessContextValue {}),];}+ const initiative = initiativesById.get(id);+ if (initiative) {+ return [+ initiativeToQuickAccessItem(+ initiative,+ soupViewedAtMap().get(id)+ ),+ ];+ }const cached = itemCache.get(id)?.item;if (cached) return [cached];const historyItem = historyById.get(id);@@ -1300,9 +1328,13 @@ export function createQuickAccessValue(): QuickAccessContextValue {.map((item) => {const cached = itemCache.get(item.id)?.item;if (!cached) return item;- // Projected channels carry current cache metadata even when the- // complete list still has an older name. Only overlay newer views.- if (item.kind === 'entity' && item.data.type === 'channel') {+ // Projected channels and projects carry current cache metadata even+ // when their REST list still has an older name. Only overlay newer+ // views.+ if (+ item.kind === 'entity' &&+ (item.data.type === 'channel' || item.data.type === 'initiative')+ ) {const viewedAt = latestDate(item.timestamps.viewedAt,cached.timestamps.viewedAtdiff --git a/apps/web/src/lib/core/context/quickAccess/projected-list.ts b/apps/web/src/lib/core/context/quickAccess/projected-list.tsindex 721cea0d41..32aa82eb01 100644--- a/apps/web/src/lib/core/context/quickAccess/projected-list.ts+++ b/apps/web/src/lib/core/context/quickAccess/projected-list.ts@@ -29,6 +29,7 @@ const PROJECTED_BUCKETS: ReadonlySet<Bucket> = new Set(['dm','crm_company','crm_contact',+ 'initiative',]);const BROWSE_PAGE_SIZE = 50;const SEARCH_LIMIT = 500;diff --git a/apps/web/src/lib/queries/soup/backfill.test.tsx b/apps/web/src/lib/queries/soup/backfill.test.tsxindex 90f6fe1756..5ae255efa1 100644--- a/apps/web/src/lib/queries/soup/backfill.test.tsx+++ b/apps/web/src/lib/queries/soup/backfill.test.tsx@@ -329,6 +329,7 @@ describe('runSoupBackfills', () => {DEFAULT_SOUP_BACKFILL_LANES.map((lane) => lane.checkpointId)).toEqual(['core-entities',+ 'initiatives','email-signal-filter-metadata','email-noise-filter-metadata','shared-email-filter-metadata',diff --git a/apps/web/src/lib/queries/soup/backfill.ts b/apps/web/src/lib/queries/soup/backfill.tsindex 362b3d7a80..6993718a8d 100644--- a/apps/web/src/lib/queries/soup/backfill.ts+++ b/apps/web/src/lib/queries/soup/backfill.ts@@ -103,6 +103,31 @@ export const CORE_SOUP_BACKFILL_LANE: SoupBackfillParams = {},};+/** Task projects (initiatives), which Soup returns only when a filter opts in,+ * so Quick Access can search them from the cache. */+export const INITIATIVE_SOUP_BACKFILL_LANE: SoupBackfillParams = {+ checkpointId: 'initiatives',+ input: {+ limit: PAGE_LIMIT,+ expand: true,+ sortMethod: 'VIEWED_UPDATED',+ emailView: 'ALL',+ filters: {+ calendarEventFilter: { literal: { id: EXCLUDED_ENTITY_ID } },+ documentFilter: { literal: { id: EXCLUDED_ENTITY_ID } },+ projectFilter: { literal: { projectIdSelf: EXCLUDED_ENTITY_ID } },+ chatFilter: { literal: { chatId: EXCLUDED_ENTITY_ID } },+ emailFilter: { tree: { literal: { threadId: EXCLUDED_ENTITY_ID } } },+ channelFilter: { literal: { channelId: EXCLUDED_ENTITY_ID } },+ channelThreadFilter: { literal: { threadId: EXCLUDED_ENTITY_ID } },+ callFilter: { literal: { callId: EXCLUDED_ENTITY_ID } },+ crmCompanyFilter: { literal: { id: EXCLUDED_ENTITY_ID } },+ foreignEntityFilter: { literal: { id: EXCLUDED_ENTITY_ID } },+ initiativeFilter: { literal: { include: true } },+ },+ },+};+/*** Email threads and the first message page used by the thread view, excluding* every other entity variant with an impossible id filter.@@ -212,6 +237,7 @@ export const AUXILIARY_SOUP_BACKFILL_LANE: SoupBackfillParams = {/** Independently checkpointed backfills run serially in priority order. */export const DEFAULT_SOUP_BACKFILL_LANES = [CORE_SOUP_BACKFILL_LANE,+ INITIATIVE_SOUP_BACKFILL_LANE,SIGNAL_EMAIL_FILTER_BACKFILL_LANE,NOISE_EMAIL_FILTER_BACKFILL_LANE,SHARED_EMAIL_FILTER_BACKFILL_LANE,diff --git a/apps/web/src/lib/queries/soup/graphql/initiatives.ts b/apps/web/src/lib/queries/soup/graphql/initiatives.tsnew file mode 100644index 0000000000..4a864c6c06--- /dev/null+++ b/apps/web/src/lib/queries/soup/graphql/initiatives.ts@@ -0,0 +1,42 @@+import type { InitiativeEntity } from '@entity';+import {+ type CacheHost,+ readRecordsByKeys,+ type SearchDocumentWire,+ selectRecords,+} from '@graphql-cache/index';+import { InitiativeQuickAccessFieldsFragmentDoc } from '@service-storage/graphql/generated/graphql';++/** Materializes cached project search hits, including projects beyond the+ * bounded REST feed. */+export async function materializeCachedGraphqlInitiatives(+ cacheHost: Pick<CacheHost, 'readRecordsByKeys'>,+ documents: SearchDocumentWire[]+): Promise<InitiativeEntity[]> {+ const keys = documents+ .filter((document) =>+ document.recordKey.startsWith('GraphqlSoupInitiative:')+ )+ .map((document) => document.recordKey);+ if (keys.length === 0) return [];++ const result = await readRecordsByKeys(+ cacheHost,+ selectRecords(InitiativeQuickAccessFieldsFragmentDoc),+ keys+ );+ return result.records.flatMap(({ recordKey, record }): InitiativeEntity[] =>+ record.__typename === 'GraphqlSoupInitiative'+ ? [+ {+ type: 'initiative',+ id: recordKey.slice(recordKey.indexOf(':') + 1),+ name: record.displayName ?? 'Untitled project',+ ownerId: record.metadata.ownerId ?? '',+ createdAt: record.metadata.createdAt,+ updatedAt: record.metadata.updatedAt,+ },+ ]+ : []+ );+}diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.tsindex b73e3dc10a..45402cea6c 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@@ -12486,6 +12486,8 @@ export type InitiativeIdentityFieldsFragment = { __typename: 'GraphqlSoupInitiat| { __typename: 'GraphqlTeamRolePermission' }| null };+export type InitiativeQuickAccessFieldsFragment = { __typename: 'GraphqlSoupInitiative', displayName: string | null, metadata: { ownerId: string | null, createdAt: string | null, updatedAt: string | null } };+export type InitiativeDetailFieldsFragment = { __typename: 'GraphqlSoupInitiative', id: string, displayName: string | null, taskCount: number, completedTaskCount: number, memberIds: Array<string>, taskIds: Array<string>, metadata: { ownerId: string | null, createdAt: string | null, updatedAt: string | null }, viewerPermission:| { __typename: 'GraphqlAccessLevelPermission', accessLevel: GraphqlEntityAccessLevel }| { __typename: 'GraphqlChannelRolePermission' }@@ -21198,6 +21200,7 @@ export const GraphqlChatQuickAccessNameFragmentDoc = {"kind":"Document","definitexport const GraphqlProjectQuickAccessNameFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlProjectQuickAccessName"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"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"}}]}}]} as unknown as DocumentNode<GraphqlProjectQuickAccessNameFragment, unknown>;export const GraphqlChannelQuickAccessFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlChannelQuickAccessFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","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":"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":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}}]}}]}}]} as unknown as DocumentNode<GraphqlChannelQuickAccessFieldsFragment, unknown>;export const InitiativeIdentityFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"InitiativeIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"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":"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"}}]}}]}}]}}]} as unknown as DocumentNode<InitiativeIdentityFieldsFragment, unknown>;+export const InitiativeQuickAccessFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"InitiativeQuickAccessFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"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"}}]}}]}}]} as unknown as DocumentNode<InitiativeQuickAccessFieldsFragment, unknown>;export const InitiativeDetailFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"InitiativeDetailFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"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":"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":"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":"Field","name":{"kind":"Name","value":"taskCount"}},{"kind":"Field","name":{"kind":"Name","value":"completedTaskCount"}},{"kind":"Field","name":{"kind":"Name","value":"memberIds"}},{"kind":"Field","name":{"kind":"Name","value":"taskIds"}},{"kind":"Field","name":{"kind":"Name","value":"sharePermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"owner"}},{"kind":"Field","name":{"kind":"Name","value":"linkShare"}},{"kind":"Field","name":{"kind":"Name","value":"linkShareAccessLevel"}},{"kind":"Field","name":{"kind":"Name","value":"teamShareAccessLevel"}},{"kind":"Field","name":{"kind":"Name","value":"channelSharePermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"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":"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<InitiativeDetailFieldsFragment, unknown>;export const ItemPreviewFieldsFragmentDoc = {"kind":"Document","definitions":[{"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"}}]}}]}}]} as unknown as DocumentNode<ItemPreviewFieldsFragment, unknown>;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>;diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/initiatives.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/initiatives.graphqlindex 56f3096510..126f3e846c 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/initiatives.graphql+++ b/apps/web/src/lib/service-clients/service-storage/graphql/initiatives.graphql@@ -12,6 +12,19 @@ fragment InitiativeIdentityFields on GraphqlSoupInitiative {}}+# Quick Access reads cached projects by key after a cache search hit. Select+# only fields every initiative write includes (create and update replies carry+# no viewedAt), so a new or renamed project stays complete.+fragment InitiativeQuickAccessFields on GraphqlSoupInitiative {+ __typename+ displayName+ metadata {+ ownerId+ createdAt+ updatedAt+ }+}+fragment InitiativeDetailFields on GraphqlSoupInitiative {__typenameiddiff --git a/crates/client/cache-core/AGENTS.md b/crates/client/cache-core/AGENTS.mdindex 8f148654c8..017347e6b3 100644--- a/crates/client/cache-core/AGENTS.md+++ b/crates/client/cache-core/AGENTS.md@@ -24,7 +24,7 @@ GraphQL response shape for callers. A concrete `Storage` impl (e.g.- `src/store.rs`: the `Storage` trait every backend (e.g. `cache-turso`) implements.- `src/predicate.rs` + `src/record_selection.rs`: the predicate/projection IRused to select which cached records satisfy a query.-- `src/search.rs`: disposable Quick Access projection (version 3); email matches subjects and all embedded senders, never snippets or bodies.+- `src/search.rs`: disposable Quick Access projection (version 4); email matches subjects and all embedded senders, never snippets or bodies; task projects (`GraphqlSoupInitiative`) index their display name with recency from `metadata`.- `src/queue.rs`: the optimistic mutation queue.- `tests/`: the primary spec for engine behavior — one file per concern(optimistic updates, calendar range, search, subscriptions, fuzz).diff --git a/crates/client/cache-core/src/search.rs b/crates/client/cache-core/src/search.rsindex 409f0729b7..da7d789526 100644--- a/crates/client/cache-core/src/search.rs+++ b/crates/client/cache-core/src/search.rs@@ -53,6 +53,7 @@ impl SearchProfile {"email","crm_company","crm_contact",+ "initiative",],}}@@ -132,7 +133,7 @@ pub enum SearchError {/// Revision of the derived Quick Access rows. Storage adapters rebuild existing/// rows when this changes; normalized records and pending writes remain valid.-pub const QUICK_ACCESS_PROJECTION_VERSION: u32 = 3;+pub const QUICK_ACCESS_PROJECTION_VERSION: u32 = 4;/// Normalized entity types used by the Quick Access projection. Storage rebuilds/// restrict decoding to this set so unrelated payloads do not delay readiness.@@ -144,6 +145,7 @@ pub const QUICK_ACCESS_TYPENAMES: &[&str] = &["GraphqlSoupChannel","GraphqlSoupCrmCompany","GraphqlSoupCrmContact",+ "GraphqlSoupInitiative","GraphqlUser","User",];@@ -209,6 +211,7 @@ fn quick_access_fields<'a>("GraphqlSoupChannel" => (channel_bucket(record), &["channelName", "name"]),"GraphqlSoupCrmCompany" => ("crm_company", &["crmCompanyName", "name", "domains"]),"GraphqlSoupCrmContact" => ("crm_contact", &["crmContactName", "name", "email"]),+ "GraphqlSoupInitiative" => ("initiative", &["displayName"]),"GraphqlUser" | "User" => ("person", &["name", "email"]),_ => return None,};@@ -310,6 +313,16 @@ fn normalize_search_text(value: &str) -> String {}fn quick_access_timestamp(typename: &str, record: &Record) -> i64 {+ // Initiatives keep their timestamps in an embedded metadata object.+ if typename == "GraphqlSoupInitiative" {+ let Some(CacheValue::Object(metadata)) = record.fields.get("metadata") else {+ return 0;+ };+ return ["viewedAt", "updatedAt", "createdAt"]+ .into_iter()+ .find_map(|field| metadata.get(field).and_then(value_timestamp))+ .unwrap_or(0);+ }if typename == "GraphqlSoupCrmContact" {return ["lastInteraction", "updatedAt", "createdAt"].into_iter()diff --git a/crates/client/cache-core/src/search/test.rs b/crates/client/cache-core/src/search/test.rsindex 874d11762a..92498ff7d1 100644--- a/crates/client/cache-core/src/search/test.rs+++ b/crates/client/cache-core/src/search/test.rs@@ -118,6 +118,46 @@ fn soup_entity_recency_prefers_viewed_at_over_newer_activity() {}}+#[test]+fn initiative_projection_indexes_display_name_and_reads_metadata_recency() {+ let mut record = string_record(&[+ ("__typename", "GraphqlSoupInitiative"),+ ("displayName", " Launch Plan "),+ ]);+ let metadata = |fields: &[(&str, &str)]| {+ CacheValue::Object(+ fields+ .iter()+ .map(|(key, value)| ((*key).into(), CacheValue::String((*value).into())))+ .collect(),+ )+ };+ record.fields.insert(+ "metadata".into(),+ metadata(&[+ ("viewedAt", "2025-01-01T00:00:00Z"),+ ("updatedAt", "2025-01-03T00:00:00Z"),+ ]),+ );+ let key = EntityKey::entity("GraphqlSoupInitiative", &["initiative"]);+ let document = project_search_documents(&key, &record).pop().unwrap();+ assert_eq!(document.bucket, "initiative");+ assert_eq!(document.search_text, "launch plan");+ assert_eq!(+ document.timestamp_ms,+ parse_rfc3339_millis("2025-01-01T00:00:00Z").unwrap()+ );++ record.fields.insert(+ "metadata".into(),+ metadata(&[("updatedAt", "2025-01-03T00:00:00Z")]),+ );+ assert_eq!(+ project_search_documents(&key, &record)[0].timestamp_ms,+ parse_rfc3339_millis("2025-01-03T00:00:00Z").unwrap()+ );+}+#[test]fn crm_contact_projection_indexes_name_email_and_removes_hidden_records() {let mut record = string_record(&[diff --git a/crates/client/cache-core/tests/initiative.rs b/crates/client/cache-core/tests/initiative.rsindex b8bde858fd..dff1bcbcd1 100644--- a/crates/client/cache-core/tests/initiative.rs+++ b/crates/client/cache-core/tests/initiative.rs@@ -1,6 +1,7 @@//! Initiative list, detail, and mutation responses share one normalized entity.use cache_core::engine::{Engine, NetworkWrite, QueryRegistration, ReadResult};+use cache_core::search::{SearchProfile, SearchRequest};use cache_core::store::InMemoryStorage;use pollster::block_on;use serde_json::{Value as Json, json};@@ -165,3 +166,116 @@ fn mutation_updates_list_and_detail_without_losing_detail_fields() {}});}++const SEARCHABLE_SOUP_QUERY: &str = r#"+query Projects($input: SoupInput!) {+ user {+ id+ soup(input: $input) {+ items {+ __typename+ id+ ... on GraphqlSoupInitiative {+ displayName+ metadata { updatedAt viewedAt }+ }+ }+ nextCursor+ }+ }+}+"#;++fn initiative_search(query: &str) -> SearchRequest {+ SearchRequest {+ profile: SearchProfile::QuickAccessV1,+ buckets: vec!["initiative".into()],+ query: query.into(),+ cursor: None,+ limit: 20,+ now_ms: 1_000,+ }+}++#[test]+fn soup_initiatives_are_searchable_and_follow_renames() {+ block_on(async {+ let mut engine = Engine::new(InMemoryStorage::new());+ engine+ .write_query(+ None,+ SEARCHABLE_SOUP_QUERY,+ Some("Projects"),+ &object(json!({ "input": { "limit": 10 } })),+ &json!({+ "user": {+ "id": "user-1",+ "soup": {+ "items": [{+ "__typename": "GraphqlSoupInitiative",+ "id": "initiative-1",+ "displayName": "Launch plan",+ "metadata": {+ "updatedAt": "2025-01-03T00:00:00Z",+ "viewedAt": "2025-01-01T00:00:00Z"+ }+ }],+ "nextCursor": null+ }+ }+ }),+ None,+ )+ .await+ .unwrap();++ let found = engine.search(&initiative_search("launch")).await.unwrap();+ assert_eq!(found.documents.len(), 1);+ let document = &found.documents[0];+ assert_eq!(+ document.record_key.as_ref(),+ "GraphqlSoupInitiative:initiative-1"+ );+ assert_eq!(document.bucket, "initiative");+ assert_eq!(document.timestamp_ms, 1_735_689_600_000);++ engine+ .write_query(+ None,+ UPDATE_MUTATION,+ Some("UpdateProject"),+ &object(json!({+ "id": "initiative-1",+ "input": { "name": "Roadmap" }+ })),+ &json!({+ "updateInitiative": {+ "__typename": "GraphqlSoupInitiative",+ "id": "initiative-1",+ "displayName": "Roadmap"+ }+ }),+ None,+ )+ .await+ .unwrap();++ assert!(+ engine+ .search(&initiative_search("launch"))+ .await+ .unwrap()+ .documents+ .is_empty()+ );+ assert_eq!(+ engine+ .search(&initiative_search("roadmap"))+ .await+ .unwrap()+ .documents+ .len(),+ 1+ );+ });+}diff --git a/docs/agent-guide/documents.md b/docs/agent-guide/documents.mdindex f79ceaf497..190cbe6bb1 100644--- a/docs/agent-guide/documents.md+++ b/docs/agent-guide/documents.md@@ -2490,7 +2490,7 @@ With Projects enabled, type `@` followed by a project name in an editor,composer or spreadsheet cell. Projects (not folders) come from Quick Access, sothey appear alongside documents and tasks in the **Documents, Agents, & Tasks**section and in entity property pickers that accept projects. The command menu-keeps its own project search. Selecting one inserts a document mention with the+searches the same Quick Access projects. Selecting one inserts a document mention with theproject's icon and current name, like a channel mention. Clicking it orpressing Enter on it opens the project the way a task mention opens a task:in Tasks, under **Projects** › the project (on touch devices, as the projectdiff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.mdindex bec45d3d60..55843736a4 100644--- a/docs/agent-guide/navigation.md+++ b/docs/agent-guide/navigation.md@@ -313,9 +313,12 @@ trail so the project remains a return destination. The standard side-paneltoggle shows project properties. Their URLs preserve the selected section on reload;discussion links append `~<message-uuid>` to the project's `overview` route.Existing `activity` routes open Overview, preserving a target message when present.-Cmd+K includes a Projects category, authorized project search results, and-`New project`. Selecting a project opens its overview; Shift-selection opens a-new split. The global Create menu also offers `Project` (C, then P), including+Cmd+K includes a Projects category, projects matching a typed All query, and+`New project`. Projects come from Quick Access like documents and channels:+the GraphQL cache backfills them in its `initiatives` lane and indexes them for+local search, so typing never waits on a request and rows stay in place. Cmd+K+finds only projects the cache or the Quick Access feed has loaded. Selecting a+project opens its overview; Shift-selection opens a new split. The global Create menu also offers `Project` (C, then P), includingthe full mobile Create sheet. Project opens the same popover host as task creation: a dialogon desktop and a bottom drawer on touch. It keeps focus in the project-nameinput, and `Continue editing in split` transfers the current draft. Existing@@ -1230,9 +1233,9 @@ search cached entities without waiting for a server search. Background hydrationupdates an already-open menu only when a bucket it uses changes. Email/body/tag-onlyhydration must not reread History or the cached channel list; a newly hydrated noterefreshes History and matching menus, and a channel/DM refreshes channel consumers.-Ordinary query responses use the same bucket scoping. A project-search response-that only caches another viewer Soup page must not refresh History, channel lists,-or unrelated active query pages. Renames, ownership/recency changes, and moves+Ordinary query responses use the same bucket scoping. A Projects list response+changes only the `initiative` bucket, so it refreshes menus searching projects but+not History, channel lists, or unrelated active query pages. Renames, ownership/recency changes, and movesbetween buckets must still appear without retyping in every affected view.Older cache runtimes without bucket metadata, mutations, and identity resetsrefresh conservatively. For an empty search, scroll toward the end (or use