You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(platform): page listProjects and read visibility as a join #5156
Split from #4708 (item 4 of 7), as triaged on TALE-117.
What the read does now
At feature-train9173785 (paths under services/platform/):
listProjects (backend/domains/projects/service.ts:3151-3165) has no LIMIT. It returns every readable active project, ORDER BY updated_at_ms DESC.
Its visibility filter is visibilityClause → audienceClause (backend/core/lib/audience.ts:187-188). That is an array overlap per row (cardinality(…) = 0 OR … && ${teamIds}::text[]), and no index serves it.
Its callers then pass the whole id list on as project_id = ANY(<ids>), for example:
GET /api/app/projects, used by useProjects, by Home (app/features/home/hooks/use-home-data.ts:183) and by chat;
the all-projects task views (GET /api/app/tasks, GET /api/app/tasks/ops-indicators);
searchTasks;
several server-side readers: knowledge, chat, documents, automations and MCP tools.
What to do
Page listProjects for the screens that list projects.
Express project visibility as a join, from projects to the caller's teams, shared by the readers that take "every project I can read". This replaces building the id list and sending it back as ANY(<ids>).
Done means:
Home and the project list read one page;
the all-projects task reads filter visibility in the same statement;
tests cover the page and each visibility rule: admin, a project with no teams, and a team-shared project.
The change for this issue is on the branch perf/page-projects-visibility-join (head 2e3f952168573cf05993169f1613be396c95ac73, base feature-trainc2bb3eaa6a5c39850a6dec0c35624ee4a970d2aa), waiting for review on TALE-252. It does what this issue asks:
the projects list and Home each read one page of projects;
the board, task search and the ops indicators join the projects the caller may read (readableProjectsSql) in the statement that reads the tasks, with no ANY(<ids>) of the caller's project list;
tests cover the page and the visibility rules.
Two further parts are filed as their own issues:
perf(platform): join readable projects in the server-side readers #5193: the server-side readers that still read every readable project (documents, automations, knowledge, the projects settings resource, the MCP tools, chat, and the create-task fallback) move to the join, or to a bounded read.
perf(platform): search projects on the server in the pickers #5194: the project pickers (chat, the breadcrumb switcher, automations, the budget editor, the API key's owner and the metrics scope) and Home's features beyond its 100 projects search on the server, and GET /api/app/projects stops returning every project.
Landed on release/0.6 with feature train #5197 (#5197, rebased in at 2026-10-31 11:15:15Z) as 6f1ceca (TALE-252, "perf(platform): page listProjects and read visibility as a join"). release/0.6 was then rebased onto maindf6105c at 11:25Z, where this commit is now 3317600. It ships with 0.6.0. GitHub closes an issue only for a commit on main, so the feature-train role (TALE-239) closes it.
Activity
tale-code-bot commentedon Oct 31, 2026
The change for this issue is on the branch
perf/page-projects-visibility-join(head2e3f952168573cf05993169f1613be396c95ac73, basefeature-trainc2bb3eaa6a5c39850a6dec0c35624ee4a970d2aa), waiting for review on TALE-252. It does what this issue asks:readableProjectsSql) in the statement that reads the tasks, with noANY(<ids>)of the caller's project list;Two further parts are filed as their own issues:
GET /api/app/projectsstops returning every project.perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
tale-code-bot commentedon Oct 31, 2026
Landed on
release/0.6with feature train #5197 (#5197, rebased in at 2026-10-31 11:15:15Z) as 6f1ceca (TALE-252, "perf(platform): page listProjects and read visibility as a join").release/0.6was then rebased ontomaindf6105c at 11:25Z, where this commit is now 3317600. It ships with 0.6.0. GitHub closes an issue only for a commit onmain, so the feature-train role (TALE-239) closes it.perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join
perf(platform): page listProjects and read visibility as a join