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(tasks): restore urgent-first priority groups (#9363)
dev-rb443808e29c95
diff --git a/apps/web/src/features/tasks-view/AGENTS.md b/apps/web/src/features/tasks-view/AGENTS.mdindex d53cdd2a43..ded09368d0 100644--- a/apps/web/src/features/tasks-view/AGENTS.md+++ b/apps/web/src/features/tasks-view/AGENTS.md@@ -15,6 +15,7 @@ Main Tasks and reusable task-list hosts. Projects and CRM embed `TasksViewProvid## Gotchas- Group task lists by the Project property, matching the Project column and Board. The server labels project groups with the initiative name the viewer can read, and the cache's local grouping projection carries that label; a header resolves the name through the authorized project identity query only while its group is still labeled by its key. Projects sort by name with No Project last in every layout.+- Keep Priority groups in Urgent, High, Medium, Low order with unset priority last through the shared Soup group comparator; group presentation does not follow item sort direction or stored option display order.- Keep project navigation in a separate Projects section above Saved views, with assigned-to-me, all-accessible, and created-by-me views; replace individual-project shortcuts and use one mobile Projects picker.- Preserve project scope through detail navigation, history, pagination, and editable-filter clearing; keep project views out of task queries and saved-task-view capture.- Align wide desktop group-header glyphs with the first row control; keep caret containers square and preserve each header's caret-to-content gap and value-icon slot across widths without changing padding, the 44px touch target, or the layout-neutral border.diff --git a/apps/web/src/lib/queries/soup/grouped/api.test.ts b/apps/web/src/lib/queries/soup/grouped/api.test.tsindex 4d2039f76a..a577013d40 100644--- a/apps/web/src/lib/queries/soup/grouped/api.test.ts+++ b/apps/web/src/lib/queries/soup/grouped/api.test.ts@@ -1,4 +1,4 @@-import { SYSTEM_PROPERTY_IDS } from '@property/constants';+import { PROPERTY_OPTION_IDS, SYSTEM_PROPERTY_IDS } from '@property/constants';import { expect, it } from 'vitest';import { makeGroupComparator } from './api';import { type GroupMeta, NOT_SET_GROUP_KEY } from './types';@@ -36,3 +36,69 @@ it('orders project groups by name with No Project last', () => {.map((g) => g.label)).toEqual(ordered);});++it('keeps priority groups urgent-first despite ascending server display order', () => {+ const groups: GroupMeta[] = [+ { ...group(PROPERTY_OPTION_IDS.PRIORITY.LOW, 'Low'), displayOrder: 0 },+ { ...group(NOT_SET_GROUP_KEY, 'No priority'), displayOrder: -1 },+ {+ ...group(PROPERTY_OPTION_IDS.PRIORITY.MEDIUM, 'Medium'),+ displayOrder: 1,+ },+ { ...group(PROPERTY_OPTION_IDS.PRIORITY.HIGH, 'High'), displayOrder: 2 },+ {+ ...group(PROPERTY_OPTION_IDS.PRIORITY.URGENT, 'Urgent'),+ displayOrder: 3,+ },+ ];++ const compare = makeGroupComparator({+ type: 'property',+ propertyDefinitionId: SYSTEM_PROPERTY_IDS.PRIORITY,+ });++ expect(groups.sort(compare).map((g) => g.label)).toEqual([+ 'Urgent',+ 'High',+ 'Medium',+ 'Low',+ 'No priority',+ ]);+ expect(+ groups+ .map((g) => ({ ...g, displayOrder: null }))+ .reverse()+ .sort(compare)+ .map((g) => g.label)+ ).toEqual(['Urgent', 'High', 'Medium', 'Low', 'No priority']);+});++it('keeps stored group ordering for status and custom properties', () => {+ for (const propertyDefinitionId of [+ SYSTEM_PROPERTY_IDS.STATUS,+ '10000000-0000-4000-8000-000000000001',+ ]) {+ const groups: GroupMeta[] = [+ {+ ...group(PROPERTY_OPTION_IDS.PRIORITY.URGENT, 'Last option'),+ displayOrder: 3,+ },+ { ...group(NOT_SET_GROUP_KEY, 'Not set'), displayOrder: -1 },+ {+ ...group(PROPERTY_OPTION_IDS.PRIORITY.LOW, 'First option'),+ displayOrder: 0,+ },+ ];++ expect(+ groups+ .sort(+ makeGroupComparator({+ type: 'property',+ propertyDefinitionId,+ })+ )+ .map((g) => g.label)+ ).toEqual(['First option', 'Last option', 'Not set']);+ }+});diff --git a/apps/web/src/lib/queries/soup/grouped/api.ts b/apps/web/src/lib/queries/soup/grouped/api.tsindex 5a34a4dc53..5ba43d083d 100644--- a/apps/web/src/lib/queries/soup/grouped/api.ts+++ b/apps/web/src/lib/queries/soup/grouped/api.ts@@ -1,3 +1,4 @@+import { TASK_PRIORITY_OPTIONS } from '@entity/utils/task-properties';import { SYSTEM_PROPERTY_IDS } from '@property/constants';import type { SoupProperty } from '@service-storage/generated/schemas';import type { ApiGroupByField as ApiGroupedSoupField } from '@service-storage/generated/schemas/apiGroupByField';@@ -196,6 +197,10 @@ function getGroupedPropertyValueType(return value?.type;}+const PRIORITY_GROUP_ORDER: readonly string[] = TASK_PRIORITY_OPTIONS.map(+ (option) => option.value+);+function keyRank(order: readonly string[], key: string): number {const i = order.indexOf(key);return i === -1 ? order.length : i;@@ -233,6 +238,12 @@ export function makeGroupComparator(if (aNotSet && bNotSet) return 0;if (aNotSet) return 1;if (bNotSet) return -1;+ if (groupBy.propertyDefinitionId === SYSTEM_PROPERTY_IDS.PRIORITY) {+ const priority =+ keyRank(PRIORITY_GROUP_ORDER, a.key) -+ keyRank(PRIORITY_GROUP_ORDER, b.key);+ if (priority !== 0) return priority;+ }// Server metadata uses the definition's option display_order, also used by item sorting.return defaultOrder(a, b);};diff --git a/docs/agent-guide/tasks.md b/docs/agent-guide/tasks.mdindex 58018b4616..599c756682 100644--- a/docs/agent-guide/tasks.md+++ b/docs/agent-guide/tasks.md@@ -47,6 +47,11 @@ wrapping property pills, description, and discussion for Overview; toolbar androws for Tasks. The mobile skeleton uses the same compact insets as the content.The description has its own subtle three-line skeleton while its collaborativeeditor initializes; the project title, properties, and discussion stay visible.++Priority groups appear in **Urgent → High → Medium → Low** order, followed by+the unset-priority group, in desktop and mobile lists. Verify this order with+REST and GraphQL Soup before and after refresh; item sorting is independent.+Task lists, including project and CRM task lists, load a group's next page whenthe end of that group scrolls into view, with a spinner row instead of a`Load More` button. A faileddiff --git a/docs/design/date-property-queries.md b/docs/design/date-property-queries.mdindex 71fa5fafd9..db2ffcc570 100644--- a/docs/design/date-property-queries.md+++ b/docs/design/date-property-queries.md@@ -161,10 +161,12 @@ refreshes all property-dependent queries.Tasks uses cached property definitions/options for its local numeric comparator,with missing values last and the same update/ID tie-breakers as SQL. Group-metadata uses the same stored option `display_order`; leave assignee labels in-alphabetical order. Status and Priority are explicit sort choices. Do not add-property sorting or date predicates to the WASM reconciliation engine:-property-sorted pages remain server-backed.+metadata uses the stored option `display_order`; the client presents system+Priority groups in Urgent, High, Medium, Low order with unset priority last,+independently of item sort direction. Leave assignee labels in alphabetical order. Status and+Priority are explicit sort choices. Do not add property sorting or date+predicates to the WASM reconciliation engine: property-sorted pages remain+server-backed.## Alternatives rejected