Skip to content

Activity Threads list: implement ListOrganizationThreads (filter/sort/pagination) + participant @nickname enrichment + auth #27

Description

@rowan-stein

User request

Implement the Threads-side backend changes to support the Console Activity Threads view moving to server-side filter/sort/pagination with updated authorization.

Source spec: https://github.com/agynio/architecture/blob/main/changes/2026-04-24-activity-server-side-lists.md

Specification (architecture/product)

From:

  • changes/2026-04-24-activity-server-side-lists.md
  • architecture/threads.md#listorganizationthreads-request-shape
  • product/console/console.md (Threads section)

Key requirements:

  • New org-scoped list endpoint: ListOrganizationThreads with server-side filter/sort/pagination.
  • Deterministic cursor pagination: stable secondary sort by id (ascending); cursor includes tie-breaker.
  • List response includes:
    • message_count
    • participants rendered as @NickNames (resolved server-side; client must not do reverse lookup)
  • Auth: Threads Activity view is available to org owners + cluster admins (can_view_threads).

Work items

1) Adopt new agynio/api RPC/proto changes

  • Update buf.lock and regenerate after agynio/api adds ListOrganizationThreads + Participant.nickname.

2) Implement ListOrganizationThreads

  • Add server implementation for the new RPC.
  • Filters (combine with AND; *_in values combine with OR):
    • status_in
    • participant_identity_id_in
    • created_after / created_before
  • Sort fields: created, updated, message_count, status (+ direction)
  • Deterministic cursor pagination:
    • stable tie-breaker by id
    • cursor includes primary sort key + id

3) Participant nickname enrichment

  • For each participant identity_id in the list response, populate Participant.nickname.
  • Use the new Identity batch/reverse nickname lookup (see agynio/identity + agynio/api issue).

4) Auth enforcement

  • Ensure can_view_threads is enforced for org-scoped list.
  • Keep existing behavior for other endpoints unless updated by spec.

5) Tests

Add/extend tests to cover:

  • filter semantics and pagination reset behavior
  • deterministic pagination for each sort
  • nickname enrichment behavior (including missing nicknames)
  • auth denied cases

Acceptance

  • ListOrganizationThreads meets the list-envelope behavior from the spec and is deterministic under pagination.
  • Participants include @nickname from server-side enrichment.
  • Auth uses can_view_threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions