Skip to content

feat(rows): list rows on api/2 with filter, sort, search and paging - #63

Draft
rjzondervan wants to merge 143 commits into
review-base/3095from
feat/3095/row-listing
Draft

rjzondervan wants to merge 143 commits into
review-base/3095from
feat/3095/row-listing

Conversation

@rjzondervan

@rjzondervan rjzondervan commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Internal review draft. This PR exists only to run the review skills on the fork before the upstream PR is opened. The base review-base/3095 is feat/3093/row-uuid at b5977db, the head of nextcloud#3253, so the diff shows only this PR's own commit. The upstream PR description will be written separately.

Refs nextcloud#3095. Depends on nextcloud#3093 (row uuids).

Changes

  • GET /api/2/{tables|views}/{nodeId}/rows returns a page of rows as {results, total, limit, page, pages}.
  • Paging by page or offset, limit (default 25); sort by technical name, column id or meta field; fields to pick columns.
  • search over text cells and selection labels.
  • Filters as filter[field]=value or filter[field][operator]=value, with the operators of the view filter. Without an operator a filter checks equality, or on multi-value columns whether the value is one of them.
  • On a view, the request filters and the search are added to each OR group of the view filter, so a request never widens the view; besides the meta fields, which every row carries, only the view's columns can be used.
  • An operator must fit the field's type (the operators the view filter UI offers per type), and the value too (a number, a date, a row id); filter values and the search term are compared as given, placeholders such as @me only work in the view's own filter.
  • page, offset and limit must be integers in range; a page whose offset does not fit gives a 400.
  • Invalid parameters give a 400; federated tables and views are not supported yet.
  • filter is a deep object in the query string; the generated openapi shows it as a string because the generator cannot describe nested query parameters, and its description spells out the format.
  • New RowListQuery (parsed request) and RowQueryResolver (field and operator resolution); Row2Mapper and RowService::findPage do the paged query. openapi.json and openapi.ts regenerated.

Checks run locally

  • On this head, with the dependencies from this branch's lock file: phpunit 691/691, psalm, cs and rector clean, openapi.json and openapi.ts regenerate without a diff.
  • Live on MariaDB: request filters in each column type's stored format find the rows, other spellings (a T, seconds, labels, yes) give a 400.
  • Moved onto the current UUIDs for rows nextcloud/tables#3093 on 2026-11-17: RowService takes both RowVisibilityService (from main via UUIDs for rows nextcloud/tables#3093) and RowQueryResolver.

Benchmark (issue acceptance criterion)

MariaDB, the 100k-row benchmark table (30 columns: 10 text, 6 number, 6 selection, 4 date, 4 usergroup, with the nextcloud#3092 indices), via the API as the owner, median of 7 requests [min–max], response time including the total count:

Request Rows found Time
page 1, 25 rows 100,000 0.35 s [0.33–0.39]
page 2000 (offset 49,975) 100,000 0.35 s [0.35–0.38]
filter text equals (1 in 5,000) 25 1.28 s [1.10–1.41]
filter number > p99 1,000 0.37 s [0.35–0.40]
sort by number, descending 100,000 0.70 s [0.67–0.75]
filter + sort 1,000 0.37 s [0.36–0.71]
search, rare text 212 8.0 s [7.2–9.5]
search, selection label 99,210 12.5 s [10.9–15.1]
search + filter 111 13.1 s [10.5–14.9]

Paging, filters and sorting stay well under a second, also deep in the table. Search does not: it is one OR group per searchable column (10 text columns plus the matching selection options), each a subquery over the table, run for the page and again for the count. As the issue says, a better search follows separately; the search index of nextcloud#3207 addresses this. A single combined subquery is not the answer on MariaDB: written by hand it did not finish within 10 minutes.

Follow-ups (not in this PR)

  • Row2Mapper includes rows without a value in a datetime column for is-lower-than (and the other comparisons), because the default-value check reads the column's number default, which is null for datetime columns. That predates this PR and affects view filters as well.

AI assistance: Claude Code (claude-opus-5-5) was used for implementation and testing; commits carry Assisted-by trailers.

🤖 Generated with Claude Code

nextcloud-bot and others added 30 commits November 13, 2026 02:23
[skip ci]

Signed-off-by: Nextcloud bot <bot@nextcloud.com>
An application receives its tables and views as a list of nodes. Add
ContextNodeInputSet and ContextNodeInput to turn that request parameter
into a normalised list. It has to be a list of objects whose id, type,
permissions and order are integers, or strings of digits as form encoded
requests send them, within the range of the 32-bit columns they are
stored in. Missing permissions default to read. Anything else is
rejected with an InvalidArgumentException instead of being cast.

Nothing uses the value objects yet.

Refs: nextcloud#3262
Assisted-by: ClaudeCode:claude-fable-5-2
Assisted-by: Codex:gpt-6.1-sol
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Jiajun Xu <foolfitz@gmail.com>
PUT /api/2/contexts/{contextId} passed its nodes parameter to the
service nearly unchecked. A new node without permissions, a node that
is kept without permissions, or an object in place of the list made the
request fail with a 500, in part after earlier changes of the same
request were written.

Parse the nodes into a ContextNodeInputSet before the service is
called. Missing permissions now default to read, as they do when an
application is created, and that includes the nodes that are kept.
Nodes that are not a list, or that carry values other than integers,
are answered with a 400 before anything is written.

A JSON object whose keys count up from zero cannot be told apart from
a list once the request body is decoded, so it is still accepted.

Refs: nextcloud#3262
Assisted-by: ClaudeCode:claude-fable-5-2
Assisted-by: Codex:gpt-6.1-sol
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Jiajun Xu <foolfitz@gmail.com>
POST /api/2/contexts shared its node handling with the update endpoint.
A node without an id or type was answered with a 500, although the
endpoint documents a 400 for invalid parameters, and other values were
cast to integers without a check.

Use the same ContextNodeInputSet as the update endpoint and drop
sanitizeInputNodes(), which has no caller left.

Creating an application is therefore stricter as well. Nodes given as
an object rather than a list, floats, booleans or arrays in place of an
integer, negative values and values beyond the 32-bit range were
accepted so far and are now answered with a 400.

Refs: nextcloud#3262
Assisted-by: ClaudeCode:claude-fable-5-2
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Jiajun Xu <foolfitz@gmail.com>
The nodes parameter of PUT /api/2/contexts/{contextId} was documented
as a single object with four required properties. The endpoint takes a
list of nodes, in which permissions and order are optional.

Regenerate openapi.json and the TypeScript types.

Refs: nextcloud#3262
Assisted-by: ClaudeCode:claude-fable-5-2
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Jiajun Xu <foolfitz@gmail.com>
Every icon button was labelled 'Select icon for the application'. Label each one with its translatable icon name instead.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: AhmadAnzar <177634035+AhmadAnzar@users.noreply.github.com>
An application update set the permissions of a node it kept to read
when the request did not state them, although they are optional. A
client that only reorders the nodes would thereby remove the write
permissions of every node.

Leave missing permissions out of ContextNodeInput and let the service
decide: a node that is kept keeps its permissions, a node that is added
gets read. Creating an application is unchanged, as the service already
defaults missing permissions to read there.

The scheme import calls the same update, so a node without permissions
in an imported scheme follows these rules as well. It made the import
fail before.

Refs: nextcloud#3262
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jiajun Xu <foolfitz@gmail.com>
Name each icon by what it depicts, with a translator hint per string, so names do not collide with existing strings. Do not HTML-escape the icon name in labels, and show it as a tooltip.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: AhmadAnzar <177634035+AhmadAnzar@users.noreply.github.com>
[skip ci]

Signed-off-by: Nextcloud bot <bot@nextcloud.com>
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…phar-6.x

chore(deps): update dependency psalm/phar to ^6.20.9 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ight-monorepo

chore(deps): update dependency @playwright/test to ^1.65.0 (main)
…norepo

fix(deps): update dependency vue to ^3.5.45 (main)
The permissions of a node were accepted as any integer within the range
of the 32-bit column.

Read is the base permission of a node in an application. The dialogs
always grant it and only let create, update and delete be added on top,
and without read the people the application is shared with cannot see
the data of a node it lists. Bits beyond manage are not read anywhere.

Accept only a bitmask of read, create, update, delete and manage that
includes read, and answer other values with a 400. Manage stays
allowed, as the permission checks honour it for applications.

The scheme import and the user migration import do not pass through
ContextNodeInput and are not covered by this check.

Refs: nextcloud#3262
Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-fable-5-2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jiajun Xu <foolfitz@gmail.com>
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…phar-6.x

chore(deps): update dependency psalm/phar to ^6.20.10 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-monorepo

chore(deps): update dependency eslint to ^10.14.0 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
fix(deps): update tiptap to ^3.33.0 (main)
Signed-off-by: GitHub <noreply@github.com>
…update-nextcloud-ocp

[main] Update nextcloud/ocp dependency
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ice-phpspreadsheet-5.x

fix(deps): update dependency phpoffice/phpspreadsheet to ^5.11.0 (main)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
build(vendor): mark phpoffice/wmf as a prod dep
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
github-actions Bot and others added 26 commits November 21, 2026 11:55
chore(deps): update dependency vite to ^7.3.8 (main)
…t-phpunit-9.x

chore(deps): update dependency phpunit/phpunit to v9.6.39 (main)
Signed-off-by: GitHub <noreply@github.com>
[skip ci]

Signed-off-by: Nextcloud bot <bot@nextcloud.com>
Signed-off-by: GitHub <noreply@github.com>
…update-nextcloud-ocp

[main] Update nextcloud/ocp dependency
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ify-3.x

fix(deps): update dependency dompurify to ^3.4.18 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…phar-7.x

chore(deps): update dependency psalm/phar to ^7.6.0 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-rector-2.x

chore(deps): update dependency rector/rector to ~2.8.5 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…rse-5.x

fix(deps): update dependency papaparse to ^5.7.1 (main)
…uter-5.x

fix(deps): update dependency vue-router to ^5.5.1 (main)
…al-symbols-svg-400-0.x

fix(deps): update dependency @material-symbols/svg-400 to ^0.49.0 (main)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ce-4.x

fix(deps): update dependency debounce to v4 (main)
Upstream continues with nextcloud#3229 for the row uuid, so take
out the net change of nextcloud#3253 (the diff from its merge base with main to
b5977db). The single-row GET and the uuid addressing of the row routes
go with it. The row listing keeps the node helpers it uses.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Robert Zondervan <robert@conduction.nl>
The row uuid of nextcloud#3229: column with a unique index, set on insert,
backfill job, kept on user-migration import, uuid in TablesRow.
It brings main up to 466339b and the version 2.5.0-dev.1.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The revert of nextcloud#3253 took findViewOrFail() with it, which the listing
uses, so it comes back as a private helper. The tests construct
RowService without the IDBConnection that nextcloud#3229 dropped and with the
RowQueryResolver the listing added.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Robert Zondervan <robert@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Robert Zondervan <robert@conduction.nl>
Compare each listed row's uuid with the uuid of its row sleeve, so a
wrong or freshly minted uuid fails the test, and check the RFC 4122
variant next to the version.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Robert Zondervan <robert@conduction.nl>

@rjzondervan rjzondervan left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE (delta re-review, Standard)

Delta since 71cdd25: the round-3 fix, the main merge and its psalm fix, the nextcloud#3253 revert, the merge of nextcloud#3229 (01a3567) and the listing rebuilt on it. uuid is still refused as a filter/sort field; listed rows carry nextcloud#3229's uuid (null when federated).

Context: the stack moved off nextcloud#3253 (closed) onto nextcloud#3229 and follows the maintainer rule on nextcloud#3093: no row uuid addressing on normal endpoints; row ids only, uuid only as data.

🟢 Minor

🟡 Concerns

  • PR description is stale: it still says "Depends on nextcloud#3093 (row uuids)" and describes the base as feat/3093; the branch now merges nextcloud#3229.

Context

  • Unit tests 794 OK on MySQL and PG16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.