Skip to content

perf: Add an ID-only response for rows - #393

Merged
priethor merged 10 commits into
mainfrom
priethor/add/rows-ids-shape
Jul 30, 2026
Merged

perf: Add an ID-only response for rows#393
priethor merged 10 commits into
mainfrom
priethor/add/rows-ids-shape

Conversation

@priethor

@priethor priethor commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

Part of #298.

The rows endpoint now accepts shape=ids, which returns the same ordered and filtered result as a full request, but with IDs and pagination totals instead of row data. It is available in edit context, supports up to 1,000 IDs per page, and leaves full responses as the default. Requested calculations still cover the entire result, not just the current page.

Core REST row responses now return the same cover and field data as the rows endpoint.

Why

This separates the row list from the row records before moving those records to core-data. The UI does not use shape=ids yet, but projected requests such as Gutenberg link suggestions already do less work.

How

ID-only requests use the field-value index when possible and fall back to postmeta otherwise. Core REST requests honor _fields, so they skip any row enrichment the caller did not request. The backend benchmark covers both row shapes and the link-suggestion projection.

Testing Instructions

  1. Open a collection with typed fields, relations, rollups, and covers. Search, sort, or filter it, then open and reload a row. Confirm its values and cover still appear correctly.
  2. Search for a Cortext document or row in Gutenberg's link picker. Confirm that the title and link are correct.
  3. Using an authenticated REST client, request the same collection with shape=full and shape=ids. Confirm that both return the same order and totals, and that the ID response contains only ids, total, totalPages, and any requested calculations.
  4. Add a calculations[field-X] operation and use a small per_page value. Confirm that both shapes return the same calculation for the entire filtered result, not just the current page.
  5. Request 1,000 IDs in edit context, then repeat the request with context=view. Confirm that the first succeeds and the second is rejected.

@priethor
priethor force-pushed the priethor/add/rows-ids-shape branch from ff41a32 to b446585 Compare July 17, 2026 20:33
Calculations aggregate the whole filter and search scope rather than the
current page, so they belong with the ID list, which is the only part of
the response that knows that scope. The shape=ids branch validated the
parameter and then dropped it without saying so.

Both shapes now share one calculations_for_scope() helper, so a paged
request reports the same totals whichever shape it asked for.
@priethor priethor added type: enhancement Improvement to existing behavior. area: performance Performance budgets, profiling, benchmarks, and regressions. labels Jul 28, 2026
@priethor
priethor marked this pull request as ready for review July 28, 2026 22:47
@priethor priethor changed the title Add an ID-only response for rows perf: Add an ID-only response for rows Jul 28, 2026
@priethor
priethor merged commit 6c2d5d1 into main Jul 30, 2026
16 of 17 checks passed
@priethor
priethor deleted the priethor/add/rows-ids-shape branch July 30, 2026 17:33
@github-actions github-actions Bot added this to the 0.2.0 milestone Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: performance Performance budgets, profiling, benchmarks, and regressions. type: enhancement Improvement to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant