Repository navigation
feat(rows): write rows as objects on api/2 with ?shape=object - #66
rjzondervan wants to merge 108 commits into
Conversation
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>
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>
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>
…the application After a delete, the dialog reset itself from the application it had just removed and read its sharing settings, which threw a TypeError. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Invalid node permissions were answered with "Unexpected node permissions", which does not say what is expected. Nodes stored before the rule may lack read, so a client that sends back the permissions it read gets this 400. Name the rule in the message instead: the permissions must include read (1) and may only combine 1, 2, 4, 8 and 16. 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>
Create and update accept, with shape=object, the same flat object the read side returns, so a row that was read can be written back unchanged. Relations are accepted by uuid, row id or label. A value that cannot be stored as given is no longer stored as empty: the request is refused with a 400 that names every invalid property. The cells shape and its lenient validation are unchanged. Closes nextcloud#3096 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>
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES (Strict) — self-review posted as COMMENT (GitHub blocks a verdict on your own PR)
Status: all 17 findings are addressed in a6024c0f, 625e7235, efb106aa, 5641551e, ca664750, 586f97bd (16 fixed; the stale metadata in write responses predates this PR and is a follow-up), after two pre-push checks; all threads are resolved. phpunit 786/786; live on the dev instance the four blockers now give a 400 on their property and store nothing, and a row read with
?shape=objectis written back unchanged. A re-review decides the verdict.
4 blockers and 7 concerns. All four blockers break the PR's central promise that an invalid value gets a 400 on its property instead of being stored silently, and each one reproduced live on the dev instance. The concerns are about the relation lookup, read-only view columns, the error body and tests that do not pin the strict and lenient paths. The fixes follow as new commits on this branch.
🔴 Blockers
- Selection-multi values are still stored as empty in the object shape
- Check column stores any string as false
- Impossible dates are rolled over and stored
- List for a text column gives 500 and an orphan row
🟡 Concerns
- Relation uuid lookup is global and leaks existence
- Strict path silently drops read-only view columns
- RowObjectInput accepts a list; errors then encode as array
- Strict collection of validateValue errors is untested
- Lenient mandatory refactor has no pinning test
- Write-back-unchanged claim fails for stale references
- Round-trip tests skip usergroup, column_{id} and views
🟢 Minor
- Datetime seconds are silently truncated
- Numeric string "0.0" is refused
- Link title and providerId are coerced, not validated
- Caller-supplied keys go into message and warning log
- Federation looked up twice; view refusal untested
- Write responses carry empty or stale @self metadata
✅ Verified clean
-
Create and update keep
RequirePermission(CREATE/UPDATE)and run the same service checks as the cells shape: permissions, value limits,validateValue, mandatory columns. -
Read access to a relation target is still enforced (
canReadRelationTarget); the relation lookup concern is only about its error messages. -
The lenient cells path matches the old code branch for branch (same exceptions, order and first error); the lenient-path concern asks for a test that pins it.
-
RowValidationErrorextendsBadRequestError, so every existing catch still maps it to a 400, and the OpenAPI 400 union matches the PHP. -
The object shape is refused on federated tables and views before anything is written.
-
Scope: the single commit
e3ac83f7(17 files, +899/−73) againstreview-base/3096-2(#65's head). -
Checks on this head: phpunit 739/739, psalm, cs and rector clean, openapi up to date. Gates: the runner is not available for this repo, so the repo's own checks stand in. CI was still queued.
-
Live on the dev instance: all four blockers reproduced (200 with
[],"false", March 2; a 500 that leaves a row behind), and the stale@selfmetadata was found there. -
Connected issues: nextcloud#3096 (open; closed by this PR on merge); depends on nextcloud#3095 (#63) and nextcloud#3093, both open.
🤖 Generated with Claude Code
Signed-off-by: Robert Zondervan <robert@conduction.nl> # Conflicts: # lib/Service/RowObjectSerializer.php
…ng else A multi-selection that parses to an empty list is now reported instead of stored as empty. A checkbox takes only true, false, "true" and "false". A datetime whose day or time does not exist is refused instead of rolled over to another date. A list is accepted only by multi-selection and usergroup columns, so a list sent to a text, date, time or single selection column is a 400 on that property instead of a TypeError and a partly written row. Refs nextcloud#3096 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>
…t shape A changed value for a read-only column of a view is reported on its property instead of dropped; an unchanged one still passes, so a row that was read can be written back through the view. An unknown relation uuid gets the message of a row outside the relation target, so it no longer tells whether a row exists elsewhere. Data that is a JSON list instead of an object is a 400 before the row service is called, so errors stays an object. Refs nextcloud#3096 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>
Limit violations are collected with the other invalid values, the cells shape still stops at the first missing mandatory column, and the round trip now includes usergroup, link and relation columns, a column without technical name and a write-back through a view with a read-only column. A relation whose target was deleted reads as null and is cleared when written back. The write-back promise in the serializer and converter now names its exception: a cell that refers to a user, group or selection option that no longer exists is reported on its property. Refs nextcloud#3096 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>
A datetime with seconds other than 00 is refused instead of truncated to the minute. A numeric string such as "0.0" is passed on as a number, so the number column no longer refuses it. A link title or providerId that is not a string is refused instead of cast. The validation message counts the invalid values instead of repeating the caller's keys, which stay in errors. The federation of the node is looked up once per write, and the refusal of the object shape is tested on federated views as well. Refs nextcloud#3096 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>
A null for a checkbox stays null instead of becoming "false", and an empty value or a relation to a deleted row counts as unchanged for a read-only column of a view, so such rows can be written back. A multi-selection is written as the list of option ids it is read as; a string of labels is refused instead of dropping unknown labels. A wall time in the daylight saving gap is refused instead of moved by an hour. Numeric keys are refused, so errors is always an object, and errors are sorted by key, so their order does not tell whether a relation uuid exists. The round-trip docblocks name the datetime exception, and one invalid value is counted in the singular. Refs nextcloud#3096 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>
A column whose technical name looks like a number arrives with an integer key; only a list is refused now, and errors is always encoded as a JSON object. The round-trip docblocks name every value that can no longer be stored as it was read, and what read-only columns do. The daylight saving check runs without the offset guard, which never changed its outcome. Refs nextcloud#3096 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>
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES (Strict) — self-review posted as COMMENT (GitHub blocks a verdict on your own PR)
Status: all round-2 findings and the reopened round-trip thread are addressed in 05e0bb13, 13e33c98, 9be784cf, d7795251, 79c7219d, 6f7145e7, dbede975, c34db7c9, after three pre-push checks (the last clean); all threads are resolved. One behaviour changed by design: a value written back as it is read is left out, so stale cells can be written back unchanged. phpunit 847/847. A re-review decides the verdict.
Round 1's four blockers stay fixed, and 15 of 17 findings are addressed. The read-only comparison those fixes added introduces a new blocker: an unchanged link through a read-only column gets a 400. Round 2 adds 1 🔴, 3 🟡 and 2 🟢, all from the fixes, and reopens the round-trip thread. The fixes follow as new commits on this branch.
| Round | Found | Status |
|---|---|---|
1 (e3ac83f7) |
🔴 4 · 🟡 7 · 🟢 6 | 15 resolved, f17 a follow-up by decision; the round-trip thread reopened (partly addressed) |
2 (586f97bd), this review |
🔴 1 · 🟡 3 · 🟢 2 | open |
| Finding | Was | Now | Where |
|---|---|---|---|
| Write-back exceptions: stale read-only values are still refused | 🟡 | partly addressed, reopened | thread |
| 🔴 Unchanged link written through a view with a read-only link column gives a 400 | new | new | thread |
| 🟡 Read-only columns with stale values are still refused, contrary to the new docblock | new | new | thread |
| 🟡 errors as stdClass is rendered empty in ?format=xml responses | new | new | thread |
| 🟡 Datetime in the first occurrence of the fall-back hour is stored as a different instant | new | new | thread |
| 🟢 List refusal still blocks numeric technical names and is no longer needed for the encoding | new | new | thread |
| 🟢 PR body's write-back exceptions and read-only sentence out of sync with the docblock and code | new | new | thread |
Details of this round
- Scope: the fix commits
a6024c0f,625e7235,efb106aa,5641551e,ca664750,586f97bd(0d768960..586f97bd, 10 files, 679 lines) and the merge0d768960of #65, whose resolution is clean. - Verified clean: The cells path behaves as before (every new branch is gated by the strict flag); the federation refactor refuses the object shape on every federated branch and looks federation up once; the four round-1 blockers stay refused; the merge took #65's code unchanged.
- Checks on this head: phpunit 786/786, psalm, cs and rector clean, openapi unchanged; CI php-cs, openapi and stylelint green, the rest queued. Gates: the runner is not available for this repo, so the repo's own checks stand in.
- Connected issues: nextcloud#3096 (open); depends on nextcloud#3095 (#63) and nextcloud#3093, both open.
The counts steer the next round: fix rules ON — 9 of 10 round-2 findings across #65 and #66 were introduced by the fixes (1 copy missed), so every round-3 fix goes through the class sweep and a pre-push check that repeats until it comes back clean.
🤖 Generated with Claude Code
[skip ci] Signed-off-by: Nextcloud bot <bot@nextcloud.com>
The errors were cast to an object so that names that look like numbers still gave a JSON object, but OCS renders an object as an empty element in XML, and the cast no longer matched TablesRowValidationError. The errors are an array again, and a property name that is a number is refused before the row is converted: a technical name starts with a letter, so such a name never matches a column, and refusing it keeps the errors keyed by name in both formats. This also refuses a list, which has only numbers as keys. Refs nextcloud#3096 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>
A read-only column compared the written value with the stored cell loosely, in storage form, after validation. A link stored by the UI, with a subline and unescaped slashes, never matched the JSON the converter builds, so an unchanged link was refused, and a stale value (a deleted user, a number above a lowered maximum, a relation outside the target view, a datetime with seconds, in an unknown format or in a daylight saving gap) was refused by the validation before the read-only check ran. Before a row in the object shape is converted, each value is now compared with the value its cell is read as, through the serializer, so that two spellings of one value match: a datetime by its instant, a link by url, title and provider, a usergroup without display names, a relation by uuid or row id. A value that matches is left out: it is neither validated nor written again, so a row that was read can be written back unchanged and an unchanged link is no longer rewritten. A null for a relation to a row that no longer exists is still written, so that it clears a writable relation. A read-only column is always left out, and reported only when its value differs. Refs nextcloud#3096 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>
A datetime column stores the naive local minute, so the two occurrences of 02:30 on the night daylight saving time ends are stored alike and read back as the second one. A datetime given as the first one, such as 2026-10-25T02:30+02:00 in Europe/Amsterdam, was stored as another instant with a 200. A datetime whose stored minute does not read back as the given instant is now refused, with the instant it could be stored as. Refs nextcloud#3096 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>
Comparing the given values with the values their cells are read as looked up the uuid of a relation target once per relation property. The stored relation ids of one write are now looked up in one query. Refs nextcloud#3096 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>
A value spelled differently from the one a cell is read as counted as unchanged even when the converter refuses it, such as February 30 for the March 2 it rolls over to, option ids as strings or floats, a usergroup type as a string, a link title as a number, or a list for an empty text. Such a value was left out silently. It now counts only when the converter accepts it, so it is reported; the value exactly as it was read still counts, also when the converter would refuse it. Refs nextcloud#3096 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>
A relation to a row that no longer exists reads as null, and writing that null back clears the relation. In a column that is mandatory in the table or the view, the clearing was then refused as a missing mandatory value, so such a row could not be written back unchanged. The null is now left out for a mandatory column, which keeps the stored relation; a writable relation that is not mandatory is still cleared. Refs nextcloud#3096 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>
…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>
Brings in the revert of nextcloud#3253 and nextcloud#3229 through the row listing. Conflicts: - RowOCSController: the single-row GET came from nextcloud#3253 and goes with the revert, together with the shape handling 3096/1 added to it; a numeric-id read of one row follows as its own commit. - RowSleeveMapper: findIdByUuid of nextcloud#3253 goes; findUuidsByIds of 3096/1 stays for now. - openapi.json and the TS types are regenerated. The controller and find-page tests that read a single row now read the listing; the findUuidsByIds tests use the sleeve helpers of nextcloud#3229. 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>
Row uuids are not used to address rows on the regular endpoints (nextcloud#3093), so the id in @self of the object shape is the numeric row id that the other api/2 routes take. The uuid of nextcloud#3229 is a separate read-only field, null for a row that has none yet. rowId goes, it would only repeat the id. 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>
A relation in the object shape is the row id of the target row, the identifier the api/2 routes and the filters take, and null when the target no longer exists. findUuidsByIds makes way for findExistingIds, which only tells which targets still exist. 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>
GET /api/2/{tables|views}/{nodeId}/rows/{rowId} returns one row of the
table or view, in the cells shape or with ?shape=object in the object
shape. The row id is the only identifier the route takes; a row outside
the table or view, or without read access to it, is not found. Federated
tables and views answer 400, as the listing does.
The single-row GET of nextcloud#3253 went with its revert; this one takes only
the numeric row id (nextcloud#3093).
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>
Conflicts: - RowOCSController::updateRow keeps the shape and validation handling of the object-shape write, with the integer row id of 3096/1; the uuid lookup of the row id is gone. - RowService keeps the helpers where 3096/1 placed them and the strict validation note on create(). - RowServiceImportRowTest is gone with nextcloud#3253; RowServiceUuidTest gets the RowObjectInputConverter constructor argument. 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>
Arthur decided on nextcloud#3093 that rows are not addressed by uuid on the normal endpoints. A relation in the object shape is no longer looked up by uuid: like the cells shape it is the row id or the label of the target, which the relation column resolves itself, labels before row ids and the first row with a matching label winning. A uuid is a string like any other, so a uuid that is no row's label gets the error of an unknown label. Only an integer equal to the stored row id counts as the value the cell is read as; a string is always resolved on write. The converter no longer needs Row2Mapper. Refs nextcloud#3096 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>
findRelationTargets() and readValue(), which 3096/2 shares with the write path, still described the targets as a uuid per row id; since findExistingIds() they are the target row ids that exist, as keys. Refs nextcloud#3096 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>
updateRow takes the integer row id since the merge of 3096/1; the controller tests no longer pass a uuid or a string id, and no longer stub the uuid lookup that is gone. Refs nextcloud#3096 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 API description of createRow and updateRow says how a relation is written in the object shape: by the row id or the label of its target, labels checked before row ids and the first matching label winning, so an integer is always a row id and a numeric string is tried as a label first. An @self block is ignored, its id and uuid included; the row written is the one named by the row id in the path. Spec and TypeScript types are regenerated. Refs nextcloud#3096 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>
An integration scenario writes a relation via api/2 in the object shape by the row id and by the label of its target, and checks that the uuid of a target and a label no row has are both refused for that property, leaving the stored relation as it was. Refs nextcloud#3096 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>
PUT and DELETE /api/2/{tables|views}/{nodeId}/rows/{rowId} had no
requirement on the row id, and the dispatcher casts it to an integer:
a uuid such as 0199f1a0-... in the path addressed row 199. Now that no
endpoint addresses a row by uuid, a client still sending one would
write or delete another row. Both routes take digits only, as the
single-row GET does, so a uuid in the path matches no route and gets a
404 without touching a row.
Refs nextcloud#3096
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 properties of a row in the object shape followed the order in which the database returned the columns, which PostgreSQL does not keep stable. They now follow the column order of the table, as its column settings list them and then its other columns by id (the order in which they were created), and for a view the order of the view's column settings, as the frontend shows them. 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>
Brings the column order of the object shape's properties; merged without conflicts. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rjzondervan
left a comment
There was a problem hiding this comment.
Verdict: APPROVE (delta re-review, Standard)
Delta since e69d7ef: two merges of part 1, relation writes by row id or label only (as the upstream relation column: labels first, first match wins; a uuid is just an unknown label), integer row ids on create/update, @self ignored on write, and (\d+) on the api/2 row routes so a uuid in the path gives 404 and changes nothing.
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.
🟡 Concerns
- PR description is stale: it still says "relations by uuid, row id or label".
Context
- Unit tests 989 OK on MySQL and PG16; Behat
@rows15/15 on both. - Follow-ups outside this PR: ambiguous labels pick the first match in both shapes (upstream RelationBusiness); main's own PUT/DELETE
{rowId}routes lack the\d+requirement.
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/3096-2isfeat/3096/1-object-readat 8ea1002 (the head of #65, merged into this branch), so the diff shows only this PR's own commits. The upstream PR description will be written separately.Part 2 of 2 of nextcloud#3096, split from #64: #65 reads rows as objects, this PR writes them. Depends on #65, nextcloud#3095 (#63) and nextcloud#3093.
Changes
?shape=objectonPOST /api/2/{tables|views}/{nodeId}/rowsandPUT .../rows/{rowId}accepts the same flat object feat(rows): read rows as objects on api/2 with ?shape=object #65 returns, keyed by technical name; the response comes back in the object shape too. A value that is the one its cell is read as (the same instant, the same link url/title/provider, a usergroup without display names, a relation by uuid or by its row id as a JSON integer) is neither validated nor written again, so a row that was read can be written back unchanged, also with stale cells (a deleted user or option, a lowered limit, a datetime with seconds or in an unknown format), and an unchanged link or usergroup is not rewritten. A differently spelled value counts as unchanged only when it is itself valid. A relation whose target was deleted reads asnull; writing it back clears a writable relation and leaves a read-only or mandatory one as it is.true/falseor"true"/"false"; a number as a number or numeric string; datetimes as ISO 8601 to the minute (seconds other than 00 refused; without an offset read in the instance'sdefault_timezone, a wall time in a daylight-saving gap is refused, and so is a time in the repeated autumn hour that cannot be stored as the given instant); links as{title, url, providerId}with string parts; a list only for multi-selection and usergroup columns.errorsobject names every invalid property, sorted by name, mandatory columns and value limits included (RowValidationError, handled inAOCSController); the message only gives the count. A changed value is validated as above; in a column that is read-only in the view it is reported. A key that is not a column of the table or view is reported; a property name that is a number (also a list) is a 400 before anything is looked up, soerrorsstays keyed by name (handleRowValidationError). The stored relation targets of a write are looked up in one query; each relation given by uuid is resolved on its own.format=xml, an XMLAcceptheader, or neither) is a 400 before anything is written. An XML serialization follows on its own branch.RowObjectInput,RowObjectInputConverter,RowValidationError; openapi.json and openapi.ts regenerated.Checks run locally
APIv2.feature @rows14/14, psalm, cs and rector clean, openapi.json and openapi.ts regenerate without a diff.?shape=objectis written back unchanged with a 200.Follow-ups (predate this PR, cells shape)
Row2Mapper::inserthas no transaction); the checkbox type stores any string asfalse; the multi-selection type casts labels to option ids;"0.0"is refused for numbers.createdBy/createdAt, previouslastEditAt).Row2::insertOrUpdateCellcompares loosely (!=), so e.g."1.0"over"1"counts as unchanged; an unchanged usergroup cell is marked as changed because the stored cell hasdisplayName.PUT /api/2/.../rows/{rowId}withdataas a{columnId: value}map gives a 500 (RowDataInput.php:90).🤖 Generated with Claude Code