Skip to content

perf(platform): page listProjects and read visibility as a join #5156

Closed

Description

@tale-code-bot

Split from #4708 (item 4 of 7), as triaged on TALE-117.

What the read does now

At feature-train 9173785 (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:
    • listTasksForAccessibleProjects (backend/domains/tasks/service.ts:4091);
    • getTaskOpsIndicatorsForAccessibleProjects (:5342).
  • Callers:
    • 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.

Activity

  1. added
    agent-ready
    on Oct 30, 2026
  2. tale-code-bot commented on Oct 31, 2026

    @tale-code-bot
    CollaboratorAuthor

    The change for this issue is on the branch perf/page-projects-visibility-join (head 2e3f952168573cf05993169f1613be396c95ac73, base feature-train c2bb3eaa6a5c39850a6dec0c35624ee4a970d2aa), 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:

  3. added a commit that references this issue on Oct 31, 2026
    dbec110
  4. added 2 commits that reference this issue on Oct 31, 2026
    6f1ceca
    3317600
  5. tale-code-bot commented on Oct 31, 2026

    @tale-code-bot
    CollaboratorAuthor

    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 main df6105c 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.

  6. added
    perf
    on Oct 31, 2026
  7. added 19 commits that reference this issue on Oct 31, 2026
    d7ba1ff
    9fb6583
    05fe0e4
    bf8a477
    7dfde88
    ed009a5
    16df8af
    ce433f4
    50f161c
    01100cd
    43840fc
    9c504f5
    f6d38e3
    5d671e3
    bcb3c82
    5820405
    3fd63c2
    12942d2
    c657ea4
  8. added a commit that references this issue on Nov 15, 2026
    92dfb90
  9. added a commit that references this issue on Nov 23, 2026
    1097ede
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyperf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions