Skip to content

feat(rows): address rows on api/2 by application and table slug - #62

Draft
rjzondervan wants to merge 89 commits into
review-base/3094-2from
feat/3094/2-row-routes-by-name
Draft

rjzondervan wants to merge 89 commits into
review-base/3094-2from
feat/3094/2-row-routes-by-name

Conversation

@rjzondervan

@rjzondervan rjzondervan commented Nov 16, 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/3094-2 is feat/3093/row-uuid at 7d307e2, the state of nextcloud#3093 merged into this branch. The diff therefore also contains part 1 (the slug changes, reviewed in the part 1 PR) and, since upstream main was merged in, main's changes after 7d307e2; this PR's own commits are the non-merge commits from b170006 on that are not in part 1: the routes (b170006, b8871a9), their tests, and the review fixes on top. The upstream PR description will be written separately.

Refs nextcloud#3094. Depends on nextcloud#3093 (row uuids) and part 1.

Changes

  • New row routes addressed by application and table/view slug:
    • GET /api/2/contexts/{contextSlug}/{nodeSlug} (list, limit/offset)
    • POST /api/2/contexts/{contextSlug}/{nodeSlug}
    • GET|PUT|DELETE /api/2/contexts/{contextSlug}/{nodeSlug}/{rowId}, where rowId is an integer id or a uuid (UUIDs for rows nextcloud/tables#3093), looked up within the table or the view's table.
  • ContextService::resolveNode finds the node among the applications the user can access: unknown application or node gives 404, a slug matching applications of more than one owner gives 400.
  • The routes carry no node id, so instead of the RequirePermission attribute they run the same checks as PermissionMiddleware themselves, for local and federated tables and views: a table or view the user cannot access is not found (404), and creating, updating or deleting rows needs the matching row permission (403).
  • The id-based and slug-based routes share the create/update/delete code. Federated tables and views accept only integer row ids.
  • The route requirement reuses the slug pattern, so names outside the slug rule do not match.
  • The prefix stays /api/2/contexts/; renaming to apps happens separately for the whole API.
  • openapi.json and openapi.ts regenerated.

Checks run locally

  • cs, psalm, rector and php lint clean; openapi.json and openapi.ts regenerate without a diff.
  • phpunit 687/687 with upstream main merged in, including 52 controller tests for the row routes and a database test for the slug lookup's access scoping, with the owner, user-share, group-only and sender paths (mutation-checked).
  • Behat: a scenario with a read-only application member (list and get by slug return the right rows, create, update and delete give 403 and leave the rows as they were, no share 404), and all 46 @contexts scenarios pass.
  • Manual HTTP check on MariaDB: row CRUD by slug, with integer id and uuid.

Decisions

  • No UserRateLimit on the routes that change rows: they behave like the id-based row routes, which have none.

Follow-ups (not in this PR)

  • The id-based createRow, updateRow and deleteRow share the row helpers with the slug routes but still declare TablesRow for federated tables and views, where the remote link share's row (without tableId, createdBy, lastEditBy) comes back. That predates this PR and is left for a separate change.

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

🤖 Generated with Claude Code

blizzz and others added 30 commits November 11, 2026 15:04
…vice

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
…cal name

Applications get a technical name that is unique per owner, and every
table or view in an application gets one that is unique within that
application, so clients can address them by stable names instead of
per-instance ids. Names default to application_{id}, table_{id} and
view_{id}; a migration fills them in for existing applications and
makes them required and unique. An invalid or taken name is refused
with a 400, also when transferring an application to an owner who
already uses its name.

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
The routes by technical name take a row id or uuid, so they build on
nextcloud#3093.

Signed-off-by: Robert Zondervan <robert@conduction.nl>
…name

Add /api/2/contexts/{application}/{node} routes to list, get, create,
update and delete the rows of a table or view in an application, by
their technical names. The names are resolved to the node within the
application; an ambiguous application name is refused instead of
picking one. The routes share their implementation with the id routes,
so they behave the same, permissions included. A row of a view is only
found when the view's filter keeps it.

A row is addressed by its integer id or its uuid, like on the api/2 row
routes by table or view id. A uuid is looked up within the table or
view the technical names resolve to.

The page content route only accepts a numeric application id, so it
does not clash with the new routes.

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
test(unit): adapt activity and notification tests to RowVisibilityService
[skip ci]

Signed-off-by: Nextcloud bot <bot@nextcloud.com>
[skip ci]

Signed-off-by: Nextcloud bot <bot@nextcloud.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>
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)
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>
Rename the technical name of applications and of the tables and views in
them to slug, so it is not confused with the technical names of columns
and views. Slugs follow their own kebab-case rule and default to
application-{id}, table-{id} and view-{id}, with -2, -3, ... when taken.

Slugs stay unique per owner (applications) and per application (nodes).
While an application is shared with anyone but its owner, its slug and the
slugs of its nodes cannot change, so the routes others rely on stay stable.

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…s-by-name

Brings in the rename of the application and node technical names to
slugs. The resolveNode tests move to ContextServiceSlugTest.

Assisted-by: ClaudeCode:claude-opus-5-5
The row routes by name now take the slugs of the application and of the
table or view: /api/2/contexts/{contextSlug}/{nodeSlug}[/{rowId}]. The
route requirement reuses the slug rule, so a name with an underscore no
longer matches.

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
enjeck and others added 10 commits November 17, 2026 06:30
…ed-federated-share

fix(sharing): remove federated share when sending to remote fails
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Enjeck C. <patrathewhiz@gmail.com>
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…dling

Signed-off-by: Enjeck C. <patrathewhiz@gmail.com>
…phar-7.x

chore(deps): update dependency psalm/phar to v7 (main)
An integration scenario where a user reaches a table only through an
application shared with read permission: listing and getting rows by slug
work, creating, updating and deleting by slug give 403, a user without the
share gets 404, and the owner can still create by slug. The scenario fails
when both the controller check and RowService's create check are removed.

Review: #62 f5

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…-names

# Conflicts:
#	lib/Controller/ContextController.php
#	openapi.json
#	src/types/openapi/openapi.ts
Comment thread tests/unit/Db/ContextMapperSlugTest.php Resolved
Comment thread lib/Controller/RowOCSController.php Resolved

@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: REQUEST_CHANGES (Strict) — self-review posted as COMMENT (GitHub blocks a verdict on your own PR)

Update after the fixes: all 4 round-2 findings are fixed (n4 in the PR description) and every thread is resolved — 0 open threads, nothing left to address. Head dfa43d65: phpunit 687/687, Behat @contexts 46/46, psalm, cs, rector and openapi clean.

Round Found Status
1 (a20370f1) 🔴 2 (federated writes read-checked only, federated reads ignored) · 🟡 3 · 🟢 2 all 7 resolved in 9c7e0675…db14e8e8 (f4 decided against)
2 (8933457c) 🟡 2 (group share untested alone, Behat never re-reads the row) · 🟢 2 (create/update/delete return type, PR body) all resolved
Finding Was Now Where
🟡 ContextMapperSlugTest never tests a group share alone; removing the group clause stays green new resolved in a565b57e thread
🟡 Behat slug scenario: final assertion reads the local alias cache, so it never checks that the refused update/delete left the row unchanged new resolved in 00e3093d, b4d046c1 thread
🟢 Create/update/delete by slug still promise TablesRow for federated nodes; cc582e0 fixed only the list route new resolved in 7652282c, dfa43d65 thread
🟢 PR body is stale: own-commit list and test count new resolved in PR description verdict, details
Details of this round
  • Scope: this PR's own fix commits f0d7188a..db14e8e8 (9c7e067, 3de65d2, ea7b952, 75f227a, cc582e0, db14e8e); the later merge 8933457c of #61 with main was clean and is not reviewed here.
  • Round 1 re-checked: f1/f2 fixed — resolveContextNode runs PermissionMiddleware's pre-test (404) and the verb's row permission (403) before any local or federated access; federated list forwards with limit/offset, federated single-row answers 400 like getRow. f3 guard in resolveNode; f4's decision holds (id routes have no rate limit; AGENTS.md still states the rule, so the upstream description must carry the decision); f6/f7 fixed.
  • Verified clean: the five slug routes against PermissionMiddleware::checkPermission line by line; catch order and status mapping; no message reveals an inaccessible application or node; findIdsBySlug keeps owner/sender/user/group scoping.
  • PR description (not inline): 🟢 the own-commit list in the intro misses the 6 fix commits, and the checks say phpunit 681 where this head runs 682.
  • Checks on this head: phpunit 682/682, psalm, cs, rector clean, openapi fresh; Behat @contexts 45/45 incl. @slugs on db14e8e8. Gates: the mechanical gate runner is not available for this upstream app; the repo's own checks stand in. CI was still running.
  • Connected issues: nextcloud#3094 (open); depends on nextcloud#3093 (open, PR nextcloud#3253).

Before the next round: this round's findings were mostly fix-induced — next round's fixes go through the class sweep and the pre-push check first.

🤖 Generated with Claude Code

…repeated one

Nodes added with a requested slug were inserted before the others so that
a default slug could not take their slug. That changed the start-page
order of nodes added in one request, because added nodes get the same
order value and insertion order then decides. Creating an application and
the user migration import had the opposite problem: a default slug could
take the slug a later node of the same request asked for.

All three paths now keep the request order and reserve the requested
slugs up front, so a default slug skips them. The scheme import also keeps
the last entry of a node listed twice, as the update does.

Review: #61 n3, n4

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…slug

The scheme API took the application's slug, but the import dialog rebuilt
the request from the preview, which had no slug, so an application
imported through the UI kept its local application-{id}. The preview now
shows the slug change, and a "Slug" switch next to title and icon sends
the scheme's slug with the import; the server still keeps the current
slug when the scheme's one is taken, invalid or the application is shared.

Checked on a live instance: preview-changes returns the slug change. The
frontend builds (npm run dev) and eslint is clean.

Review: #61 n1

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
The scheme preview showed the scheme's slug as the new one even when the
import would keep the current slug, because it is taken, invalid or the
application is shared. The preview now shows the slug the import will
actually take, and the dialog offers the slug switch only when that slug
differs from the current one.

A Behat scenario pins the preview's slug for a free, a taken and an
invalid slug and for a shared application; it fails without the slug
entry and with the old preview.

Review: pre-push check of the #61 round-2 fixes

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
The database test reached the group share only through a user who also
had a user share, so it stayed green with the group clause removed, and
the share-sender clause had no test at all. Two tests now reach an
application only through a group share and only as the share's sender;
each goes red when its clause is removed.

Review: #62 n1

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
The read-only member scenario asserted only the status codes, and its last
step read the cached row instead of the server's. After the refused
create, update and delete the owner now fetches the table again: it still
has exactly the one row, with its original value. Getting a row by slug
also asserts which row came back.

Review: #62 n2

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
Creating, updating and deleting a row of a federated table or view by
slug returns the remote link share's row, without tableId, createdBy and
lastEditBy, as listing already said. The return types and 200
descriptions of the three routes now say so too.

Review: #62 n3

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…r test after what it covers

The read-only member scenario had a single row, so asserting which row the
fetch by slug returned could not fail on a wrong row; it now has two. The
mapper test that reaches its user through a user share and a group share
at once is renamed for what it shows: the application is found once.

Review: pre-push check of the #62 round-2 fixes

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
createRowInNode, updateRowInNode and deleteRowInNode return the remote
link share's row for a federated table or view; their return types now
say TablesRow|TablesPublicRow like the slug routes that call them.

Review: pre-push check of the #62 round-2 fixes

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
Comment thread lib/Controller/RowOCSController.php Resolved

@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 (Strict) — self-review posted as COMMENT (GitHub blocks a verdict on your own PR)

Update after the fixes: both round-3 🟢 are handled and their threads resolved — r3-1 fixed in 53d6c40a, r3-2 (pre-existing) listed as a follow-up in the PR description — 0 open threads, nothing left to address. Head 40461792: phpunit 688/688, psalm, openapi clean.

Round Found Status
1 (a20370f1) 🔴 2 · 🟡 3 · 🟢 2 all 7 resolved (f4 decided against)
2 (8933457c) 🟡 2 · 🟢 2 all 4 resolved (a565b57e, 00e3093d, 7652282c, b4d046c1, dfa43d65, PR description)
3 (dfa43d65) 🟢 2 (fetch-by-slug assertion, id-route return types — pre-existing) resolved in 53d6c40a; r3-2 follow-up
Finding Was Now Where
🟢 The fetch by slug asserts the first row, so a resolver that ignores the row id stays green new resolved in 53d6c40a thread
🟢 The id routes call the same helpers but still declare TablesRow only new follow-up (pre-existing), in PR description thread
Details of this round
  • Scope: this PR's own commits 7e13604f..dfa43d65 (a565b57, 00e3093, 7652282, b4d046c, dfa43d6); 7e13604 merges #61's branch.
  • Convergence (round 3): no fix-commit regression, no new 🔴, no new 🟡 in this PR's code; r3-2 is in code that predates the PR and stays a non-blocking 🟢.
  • Verified clean: the group-only and sender-only mapper tests each go red without their clause, and the renamed test really exercises DISTINCT; the Behat re-read goes back to the server and would catch a refused write that went through; the union types agree across docblocks, openapi.json and openapi.ts; nothing in src/ calls the slug write routes.
  • Checks on this head: phpunit 687/687, psalm, cs, rector clean, openapi fresh, Behat @contexts 46/46. Gates: runner not available; the repo's own checks stand in. CI was still running.
  • Connected issues: nextcloud#3094 (open); depends on nextcloud#3093 (open, PR nextcloud#3253).

Before the next round: fix rules are off for the next round; the two 🟢 that get a fix are test and ordering details.

🤖 Generated with Claude Code

The scheme import took a repeated node's values from its last entry but
kept it at the place of its first, while an update puts it at the place
of its last entry. It now drops the earlier entry before taking the later
one, so both paths agree on values and position.

Review: #61 r3-m1

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…ows apart

The scenario fetched the first row it created, so a slug route that
ignored the row id and returned the first row would still pass. It now
fetches and asserts the second row.

Review: #62 r3-1

Refs nextcloud#3094

Assisted-by: ClaudeCode:claude-opus-5-5
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 (Quick) — self-review posted as COMMENT (GitHub blocks a verdict on your own PR)

Nothing left to address: round 4 finds nothing new and 0 threads are open. No branch rules gate the merge.

Round Found Status
1 (a20370f1) 🔴 2 · 🟡 3 · 🟢 2 all 7 resolved (f4 decided against)
2 (8933457c) 🟡 2 · 🟢 2 all 4 resolved
3 (dfa43d65) 🟢 2 r3-1 resolved in 53d6c40a; r3-2 follow-up (pre-existing)
4 (40461792) — this review nothing —
Finding Was Now Where
🟢 Fetch by slug could not tell rows apart round 3 — 🟢 verified in 53d6c40a APIv2.feature, @slugs scenario
Details of this round
  • Scope: this PR's own commit 53d6c40a (XS: 1 file, 4 lines) and the clean merge 40461792 of #61's 9f68e219.
  • Verified clean: the scenario fetches and asserts r-other, the second row, so a route ignoring the row id would fail; the merged #61 fix is reviewed on #61.
  • Checks on this head: phpunit 688/688, psalm clean, openapi fresh; the @slugs scenarios passed on the same content before signing. CI was still running.
  • Follow-up (PR description): the id-based routes' TablesRow for federated rows, pre-existing.
  • Connected issues: nextcloud#3094 (open); depends on nextcloud#3093 (open, PR nextcloud#3253).

🤖 Generated with Claude Code

The create tests left the inserted page and its contents without an id,
which PHP 8.5 reports as a deprecated null array offset.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
A slug is fixed once the application or node gets it, so the routes that
use it never change. This replaces the lock while the application is
shared.

- The update endpoint no longer takes an application slug, and a node it
  keeps cannot get another slug. An added node can still choose one,
  also the slug of a node removed in the same request.
- The scheme import and its preview leave the application slug alone;
  new nodes still take their slug from the scheme.
- ShareService::isContextShared is gone, as nothing uses it any more.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Robert Zondervan <robert@conduction.nl>
…s-by-name

# Conflicts:
#	tests/unit/Service/ContextServiceSlugTest.php
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.

7 participants