Repository navigation
chore(deps): bump utopia-php/database to ^8.3 and delete the stopgaps it replaces - #14560
Conversation
8.3.0 counts grouped, distinct and aggregate reads by their rows (#1020), refuses ordering by a relationship that holds no column (#1023), refuses a dotted path on a plain attribute (#1022), types and names aggregate rows as find() does (#1024) and refuses a floating aggregate that overflows (#1018, #1019). The monorepo packages that require the library move to the same floor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he library countRows() re-ran a grouped, distinct or aggregate read for up to APP_LIMIT_COUNT rows because count() ignored groupBy, distinct and aggregates. utopia-php/database#1020 counts them by their rows, so the total goes back to count() with APP_LIMIT_COUNT. The relationship order validator and its unit tests go too: utopia-php/database#1023 refuses ordering by a relationship that holds no column with the same message, as a QueryException the list already answers with 400 general_query_invalid. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Staged changes overlay rows by document ID. A distinct row that leaves out $id has none, so inside a transaction a staged delete or update never reached it, a staged create was appended even when it duplicated a distinct row, and the total counted those rows too. Such a read is refused like an aggregate; a distinct read that selects $id still overlays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
utopia-php/database#1022 refuses a filter or select on a dotted path under a plain attribute before the adapter runs, on every adapter. Before it the SQL engines answered 404 or 500 and MongoDB an empty 200. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php
assertRepresentable() turned a non-finite aggregate value into database_query_out_of_range because the engines answered an overflowed floating aggregate with 0, INF or DBL_MAX. utopia-php/database#1018 and #1019 refuse it in aggregate() with Exception\Limit on every adapter, which the list already maps to the same 400. The overflow test now expects the 400 for the sum on every adapter, not only PostgreSQL, and a 0 when an engine answers the deviation of two equal values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. No issues found. The change moves query-validation responsibility for ordering and aggregate overflow from Appwrite-side code into the upgraded
All parallel review passes and source-level verification found no confirmable defects at or above the reporting threshold; the main residual risk rests on unverifiable Reviewed commit: ec8f3b0 |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
🟢 Tier S · Ready to mergeMoves Appwrite and its database-dependent packages to utopia-php/database 8.3, removing local workarounds for query totals, aggregate overflow, and relationship ordering. It also rejects transactional distinct reads without Latest changes: The latest commits remove the explicit default-limit query injection, strengthen aggregate type and joined-key assertions, and keep the users dotted-path test focused on filters because user selects are disallowed.
📂 Walkthrough · 13
Reviewed the commits since |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
This reverts eb129ad. Refusing a distinct read without $id inside a transaction restricts reads that work today; the wrong total belongs to TransactionState's overlay and gets its own fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
$paged appended limit(APP_LIMIT_LIST_DEFAULT) only so countRows() could tell a short last page from a full one. countRows() is gone, and the library's read already defaults to a page of 25, the same as APP_LIMIT_LIST_DEFAULT. Co-Authored-By: Claude Opus 5.5 <[email protected]>
/users refuses select queries as a method of their own, so only the filter reaches the attribute check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rns them utopia-php/database#1024 types counts and bitwise aggregates as int, statistics as float, an integer sum as int and min/max as the attribute, and names a joined group by its alias. The assertions that cast numeric strings or fell back to the bare joined column now require the typed value and the qualified name, so they fail on a library that returns the raw row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Benchmark check: no regression from the database 8.3.0 bump. At The first run at
Main's "before" alone ranged from 174 to 216 RPS, and Account P95 moves ±30–37 ms on PRs that don't touch it, so the Account +36 ms here is within that noise. I also ran a local library microbenchmark of 8.1.4 against 8.3.0 on MySQL 8.0. The two versions alternated, and each figure is the median per-operation time over 2 rounds:
8.3.0 is level with 8.1.4 or slightly faster on every hot path, including the new filter, select and order validation (#1022, #1023) and count() through plan() (#1020). |
What
Bumps
utopia-php/databaseto^8.3(8.3.0) incomposer.jsonand in the monorepo packages that require it (abuse,audit,migration,usage), and deletes the server-side stopgaps that 8.3.0 now fixes at the source.Stopgaps deleted
XList::countRows()andPAGING_METHODS, which re-ran a grouped, distinct or aggregate read for up toAPP_LIMIT_COUNTrows to gettotal.totalgoes back tocount($queries, APP_LIMIT_COUNT)count()counts grouped, distinct and aggregate reads by their rowsXList::$paged, which appendedlimit(APP_LIMIT_LIST_DEFAULT)only socountRows()could tell a short page from a full one. Queries go to the library as they did before #14536; its read defaults to a page of 25, the same asAPP_LIMIT_LIST_DEFAULTAppwrite\Utopia\Database\Validator\Query\Order, its wiring inXListandOrderTestInvalid query: Cannot order by relationship attribute: <key>), as aQueryException. The list already maps that to 400general_query_invalidXList::assertRepresentable(), theis_float && !is_finitecheck on aggregate rowsaggregate()refuses a non-finite sum, average, deviation or variance withException\Limiton every adapter. The existingcatch (LimitException)still maps it to 400database_query_out_of_rangeNothing on main reads the raw
aggregate()row shape that #1024 changes:XListwraps each row in aDocument. The response-shape work stays in #14537, which will be reworked onto 8.3.0 after this merges.Tests that tolerated the old library are now strict
These now fail against the library behaviour they used to accept.
Oracle\Assertions::aggregateInteger()/aggregateFloat()require a real int / float. They no longer cast numeric strings.groupedValue()requires the alias-qualified name (ord.label) and has no fallback to the bare column.StatisticalAggregatesand the aggregate tests inDatabasesBase(count, sum, avg, min/max, groupBy, countDistinct, join sum) assert the typed values withassertSame,assertIsIntandassertIsFloat, with no casts.RejectedValues::testAggregateOverflowIsRejectedexpects 400database_query_out_of_rangefor an overflowedsumon every adapter, not only PostgreSQL. Astddevof two equal values must be either 400 or0.Queries/DottedPaths::testListRejectsADottedPathOnAPlainAttribute, for Databases and TablesDB. A filter and a select ontitle.xmust answer 400general_query_invalidon every adapter, MongoDB included, with no special case. Before 8.3.0, SQL answered 404 or 500 and MongoDB an empty 200.UsersBase::testListUsersRejectsADottedPathOnAPlainAttribute./usersvalidatesqueriesas a param, so a filter onname.xanswers 400general_argument_invalid, like its other invalid-query cases./usersrefusesselectas a method of its own.Queries/Totalsfor Updated the docker-compose link in the Installation Section of the README #1020testListDocumentsRejectsOrderByRelationshipWithoutColumnfor 0.7.2 release #1023Checks
Pint, PHPStan and Rector are clean locally. The unit suite passes, apart from local missing extensions (yaml, maxminddb, imagick).
🤖 Generated with Claude Code