feat(tasks): label hierarchy with path names and a label filter in the Tasks view
Merged
KI
2mo ago+687+687+012345678901234567890123456789-32-32-01234567890123456789
Refs #8454 (label hierarchy and grouping by company and project).
What changes
- Path labels. A label named
acme/websitecreates its parents (acme) and links each label to its parent throughtask_labels.parent_id. Names stay unique per organization, so there is no migration, and clients that match labels by name keep working.normalizeLabelNametrims each segment, soAcme / Websitebecomesacme/website. - Filter includes sub-labels. The
labelsfilter ontask.listandtask.listPage(from #8458) now matches a label and its sub-labels, soacmereturns tasks labelledacme/website. A name prefix does not match:acmreturns nothing. CLI--labels, MCPtasks_list, and the docs say so. - Desktop Tasks view: Label filter. A new top-bar filter shows the labels as a tree and filters on the server, so it covers every task and not only the loaded pages. It is in the URL (
?label=), kept when opening a task and going back, and when leaving Tasks and coming back through the sidebar. - Label picker. Sub-labels are indented under their parent. The Create item stays visible when the typed path has spaces around the slash; before, cmdk's fuzzy match hid it and nothing could be created.
The sidebar of companies and projects from the issue is not in this PR. The Label filter covers the same navigation.
Tests
- Unit:
ensureLabelscreates and links parents (newlabels.test.ts), the SQL matches sub-labels with LIKE escaped (task-list-query.test.ts), the routers forward labels (list.test.ts), and path helpers and tree order (packages/shared/src/labels.test.ts). The new server tests fail onmain. - End to end on a local API and the dev desktop over CDP. Screenshots are on the Superset page linked in the comments.
- Seeded 9 tasks through
task.createwith path labels. The DB shows each label linked to its parent, 3 levels deep forglobex/platform/api. listPagewithacmereturns all 5 Acme tasks,acme/websitereturns 2,globex/platformreturns 1, andacmreturns 0.- In the app, choosing
acme, thenacme/website, thenglobex(board view) shows the right tasks. "All labels" clears the filter. The filter is kept when opening a task and going back, and through a sidebar round trip. - Created
Acme / Designfrom the task's label picker. It saved asacme/designand is linked toacme. - No console errors during the flow.
- Seeded 9 tasks through
bun test: shared, db, trpc, mcp, cli, i18n, and the desktop dashboard all pass.check:i18npasses, with translations for all 16 locales. The filter button's "Label" has its own context, because the existing "Label" string means a field name.
Summary by cubic
Adds label hierarchy with path names and a server-side Label filter in the desktop Tasks view (refs #8454).
New Features
- A label named
acme/webcreates its parents (acme) and links each label to its parent viatask_labels.parent_id; names stay unique per organization, so no migration is needed. - Creating a path label runs in a transaction, so a failure can't leave a partial label tree.
normalizeLabelNametrims each segment, soAcme / Websitebecomesacme/website.- The
labelsfilter ontask.listandtask.listPagematches a label, its sub-labels, and the stored name of labels saved before normalization.acmereturns tasks labelledacme/website, butacmmatches nothing; a filter that cannot be a label (over 64 characters, or only slashes) matches nothing instead of being dropped. - The Tasks view's Label filter shows labels as a tree, filters server-side, and persists in the URL (
?label=). - Sub-labels are indented in the label picker, and the Create item stays visible when the typed path has spaces around the slash.
- The company/project sidebar from the issue is not included; the Label filter covers that navigation.
Summary by CodeRabbit
- New Features
- Filter tasks by label with searchable selection and nested labels displayed in a hierarchy.
- Preserve the selected label when navigating between the task list and task details, and when creating tasks.
- Label filters match the selected label and its sub-labels, ignoring letter case and surrounding spaces.
- Documentation
- Clarified that task label filters match sub-labels as well as exact labels.