Repository navigation
feat: global search for projects, tasks and people (Cmd/Ctrl+K) - #830
Conversation
GET /search?q=&limit= returns matching projects, tasks and people for the
header search. The route is open to any authenticated caller and decides
what it returns in the handler, from the same project set as the workspace
counters:
- projects the caller holds projects:read on;
- tasks they may read in each project (the per-project tasks:read scope),
matched by title or by task key ("ABC-12", "Paca-AI#12"), with the task's type
(name, icon, color) so clients can draw it;
- people who are live members of a project whose member list the caller
may read (project.members:read), i.e. their teams; every user for a
holder of users:read.
The per-project checks use one AuthorizeMany call. The route is listed in
openRouteGroups next to the other handler-scoped endpoints.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A search box in the header (and Cmd/Ctrl+K, from anywhere) opens a command
dialog that searches projects, tasks and people through GET /search.
- Tasks show their key, project and status, with the task type's icon in
the project's color (Epic, Story, Bug, ...).
- Typing a task key ("ABC-12") puts that task first; the first result is
highlighted so Enter opens it.
- A person opens the team page of a project you share; someone outside
your teams (only found with users:read) opens the admin Users page.
- Mod+K replaces the note in the keymap that called it unusable: a page
that calls preventDefault() gets it, and it is the expected search key.
- Strings in all 9 locales; the shortcut is listed in the help dialog.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Important
Workspace admins, and anyone holding the workspace-wide projects:read, get an empty Projects group: the handler lists every project for them and then filters them all out on a per-project project/<id> check.
Approach: sound — one handler-scoped route reusing the existing project-set and per-project task-scope machinery, with row filtering in SQL and a batched AuthorizeMany. The only divergence is that the project filter ignores the collection-level grant the same code path relies on to build the project set.
Reviewed changes
GET /searchroute and handler — added next to the other handler-scoped endpoints inopenRouteGroups;ProjectHandler.Searchvalidatesq/limit, returns empty lists for an empty query, runs projects/people/tasks concurrently, maps todto.SearchResponse, and fails closed on authorizer errors.searchAccessFor— oneAuthorizeManyforprojects:read+project.members:readper project plus platformusers:read.SearchRepository—SearchProjects(name/description ILIKE, exact task-key prefix, exact-then-prefix ordering),SearchTasks(title ILIKE plusPRJ-12/#12/12number match sorted first, per-project scope viaprojectScopesSQL),SearchPeople(live human members of readable member lists,users:readwidens, agents/service accounts and the bot excluded). All patterns escaped withescapeLikePatternand bound as parameters.- Scope plumbing and docs — task scope via
ListScopes+iam.WithProjectScopes, matching workspace-stats;authorization.mdand the route-coverage comment updated; bootstrap wiring added. - Web — cmdk dialog in the header with debounced queries, manual first-result highlight,
TaskTypeMark, person navigation and disabled state; Mod+K bound inkeymap.tsand dispatched ahead of the typing-target guard; new strings in all 9 locales.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
GET /search matches with ILIKE '%…%' on task titles, project names, account names and usernames, which a B-tree cannot serve. Add GIN trigram indexes (pg_trgm, installed since 000091) so a query of three or more characters no longer reads the whole table. The task title index also serves the in-project task search, which matches the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nage users The built-in default role (USER) gives every user users:read, so using it to lift the team limit meant every user found every user. Finding people outside one's teams now takes users:write (managing users); everyone else finds only members of projects whose member list they may read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CommandDialog put its sr-only DialogHeader outside DialogContent, so the title stayed in the page while the dialog was closed: the header search added a stray "Search" heading to every page (caught by the changelog e2e spec, which lists the page's h2 headings). Inside the popup, it also labels the dialog. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New spec (features/ui/global-search.feature) against real roles:
- a member limited to one sprint finds their project, only that sprint's
task and only their teammates;
- a member without project.members:read finds tasks but no people;
- a user in no project finds nothing; the admin finds everything;
- a task key ("PRJ-12") puts that task first;
- Cmd/Ctrl+K opens the dialog and Enter opens the highlighted task.
The interaction-views search tests found the view's search button by its
magnifier icon, which now also matches the header search; they find it by
name instead.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
ℹ️ No new issues in the changes since the last review — one minor test-coverage suggestion inline.
Approach: sound — the users:write gate makes the API and web agree on who may find people outside their teams, and the trigram indexes address the ILIKE '%q%' cost without changing query semantics.
Reviewed changes — commits since a0194e2.
- People scoping switched to
users:write— the handler,authorization.md, and the web disabled-state now key off user management, withTestSearch_UsersReadAloneKeepsPeopleToTeamspinning that the default role'susers:readkeeps people scoped to the caller's teams. - Trigram indexes (
000098) — GINpg_trgmindexes ontasks.title,projects.name,accounts.nameandusers.usernameso the newILIKE '%q%'searches stop reading whole tables for 3+ character queries. - Command dialog title fix — the sr-only title and description moved inside
DialogContent, so a closed dialog no longer leaves a stray heading on the page. - End-to-end coverage — new
global-searchfeature/spec covering a sprint-scoped member, a member withoutproject.members:read, a user with no projects, the admin, a task-key lookup and Cmd/Ctrl+K → Enter, plus the backlog search-button locators moved to an accessible name.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
| }); | ||
| }); | ||
|
|
||
| it("only lets a user admin open someone outside their teams", async () => { |
There was a problem hiding this comment.
This test passes with the previous users:read gate too: mocks.permissions is left empty in beforeEach, so it only exercises the disabled path and never the permission name this PR switched. Setting mocks.permissions = ["users:read"] and asserting Lois stays disabled, plus a ["users:write"] case that opens /admin/users, would fail on a silent revert to the old gate.
pikann
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀

Summary
Adds a search box to the app header. Click it or press Cmd/Ctrl+K to search projects, tasks and people across the workspace. Results only include what the caller is allowed to see.
API:
GET /search?q=&limit=Any authenticated caller can call the route. The handler decides what to return, starting from the same set of projects as
workspace-stats: every project for a holder of platformprojects:read, otherwise the caller's own projects.projects:readontasks:readscope is applied in SQL (ListScopes+WithProjectScopes), so a role limited to one sprint only finds that sprint's tasks.project.members:read), i.e. their teammates. Only a user admin (users:write) finds people outside their teams. Agents and service accounts are not included.AuthorizeManycall. If the authorizer fails, the request returns a 500; results never widen.ABC-12finds exactly that task;#12or12matches that number in any project, and those matches come first.limitis 1–20 (default 5);qis at most 200 characters; an emptyqreturns empty lists.SearchRepository(postgres),ProjectHandler.Searchbehind theWithProjectSearchoption, and DTOs.users:writeand notusers:readfor finding anyone: the built-in default role (USER) gives every userusers:read, so the team limit would apply to nobody.000098adds GIN trigram indexes (pg_trgm, installed since000091) ontasks.title,projects.name,accounts.nameandusers.username, soILIKE '%q%'doesn't read the whole table for queries of 3+ characters. The task title index also serves the in-project task search.openRouteGroups, next to the other handler-scoped endpoints.docs/architecture/authorization.mddescribes the scoping.Web
/admin/users.preventDefault()gets it, and it's the search key users expect, so I updated the comment.TaskTypeMarkcomponent: the type's icon in its color, or a tinted name pill when the type has no icon.CommandDialog(shadcn) rendered its sr-only title outside the dialog, so the closed search left a stray "Search" heading on every page. The title is now inside the dialog, which also labels it.Screenshots
Mixed task types, dark and light:
People:
Header:
Test plan
SearchRepository:users:writefinds everyone whileusers:readalone does not; key formatting; parameter validation; empty query.global-search.test.tsx(grouping, type colors, Enter opens the first result, navigation targets, disabled people) and the keymap tests. Full suite: 1898 passed; Biome and tsc clean.tests/ui/global-search.spec.ts(6 scenarios, real roles on the e2e stack): sprint-scoped member, member withoutproject.members:read, user with no projects, admin, task-key lookup, and Cmd/Ctrl+K → Enter opens the task.docs.spec.ts:640"User can edit their own comment"interaction-views.spec.ts:1035"Clearing the filter restores all tasks"management.spec.ts:963"Toggling a permission off during edit persists after save"timeline.spec.ts:94"Timeline appears in the sidebar above Product Backlog"uiga-3then Enter opens the task.EXPLAINconfirms the planner can use the trigram indexes.🤖 Generated with Claude Code