Skip to content

feat(memory): add bounded cursor pagination for Memory entries #1656

Description

@knqiufan

Feature description

Add an authorized, bounded Server query for Memory entries, implementing the directory portion of D2 in RFC #1455. Track this as a focused deliverable related to the broader capacity problem in #1321.

Problem and proposed solution

At aa697c5315204249e090acdf1a00d0582e851c5f, POST /v1/memory/entries/list accepts Scope, inactive-entry, and tag-filter inputs but has no page size or cursor. Its response contains the complete selected entries. The persistence implementation loads entry versions referenced by the complete Memory manifest.

Client-side pagination or slicing the fully assembled HTTP response leaves the Server work unbounded. Generic Artifact pagination also does not paginate entries inside one Memory Artifact.

Specify and implement a bounded query with an explicit default/maximum page size, deterministic ordering, an opaque continuation cursor, and clear consistency/error semantics. Agree on whether this is an additive operation or a versioned evolution; do not silently change existing clients from complete results to an undisclosed first page.

Acceptance criteria

  • Publish request/response schemas, ordering, page-size bounds, end-of-list behavior, and cursor invalidation/expiry rules.
  • Apply current authorization and supported inactive/tag filtering before page selection; continuation requests reauthorize access.
  • Bind continuation to the relevant resource/query context. Reject tampered, mismatched, and invalid/expired cursors without revealing other Scopes or private data.
  • Define concurrent append/revise/retire behavior: traverse a pinned revision or explicitly require restart when the consistency boundary changes. Do not silently skip or duplicate entries.
  • Preserve exact Memory and entry/citation identities so a listed item can be inspected correctly.
  • Bound entry-body loading and response assembly, not just the final response slice. State and measure any remaining whole-manifest cost; if it prevents the promised bound, agree the necessary storage/index work before claiming bounded browsing.
  • Cover empty and multi-page results, the final page, inactive/tag filters, unauthorized requests, permission changes, invalid cursors, and concurrent mutations through observable behavior tests.
  • Include a scale fixture or measurement demonstrating the declared bounds without freezing private call counts.
  • Document compatibility/migration for existing clients; keep old full-list semantics explicit while supported. Regenerate OpenAPI-derived code and run contract/relevant behavior checks.

Alternatives considered

  • Fetch everything and page in the UI: does not bound Server work or network payload.
  • Truncate responses without continuation: loses data and misrepresents completeness.
  • Reuse Artifact-directory pagination: addresses a different level of the data model.

Additional context

Desktop consumer: #1654.

Related history-pagination deliverable: #1657. Both issues cover focused portions of #1321 and should agree on shared consistency/compatibility decisions.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions