Repository navigation
ci: test the SQL adapters on the utopia extension, require query 0.8.0 - #1084
Conversation
…ry classes Appwrite runs utopia-php/query from the utopia extension (Rust), not from the PHP package this library is tested against. The image now carries the extension, unloaded, and a second lane loads it with utopia.libraries=query for the unit suite and the MariaDB, MySQL, Postgres and SQLite adapters. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
0.8.0 is the first release whose Query class sits on the extension's NativeQuery when the extension is loaded, which the extension lane needs. It also declares LIKE's escape, which 10.2.5 made the SQLite builder tolerate. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Code review
Adds CI lanes that run unit tests and SQL adapter suites with the query classes provided by the utopia extension, and updates the Docker test image with the extension and its runtime libraries. Composer now requires utopia-php/query 0.8.0. Test expectations are updated for the query 0.8 SQL output, with deprecations ignored in tests that intentionally exercise Query::contains(). Latest changes: The newest commits update PostgreSQL SQL expectations, replace the old MySQL phrase binding assertion with a dedicated exact-phrase test, and mark five tests that intentionally call Query::contains() to ignore its deprecation. Walkthrough (10)
Reviewed the commits since Tip Comment |
Five unit tests pinned what 0.7.2 produced: - Raw conditions are now parenthesised where they are ANDed, so the three Postgres vector tests expect the extra pair. - MySQL and MariaDB no longer bind an exact phrase as a quoted string. They require each word and check the order with a pattern, so the phrase case moves out of the shared provider into its own test. Five tests call the deprecated Query::contains() on purpose and are marked IgnoreDeprecations. PHPUnit counted that deprecation only when the class came from the extension, which failed that lane under failOnDeprecation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Adds a second CI lane that runs this library on the Rust implementation of
utopia-php/query, which is what Appwrite runs in production, and requiresutopia-php/query0.8.0.Why
Appwrite Cloud serves
Utopia\Query\*from the utopia extension in every region. This library subclasses those builders and was only tested against the PHP package. On 2026-11-23 a query change broke the SQLite builder here (fixed in #1082) and nothing in either repository's CI saw it until Cloud's unit tests ran.What changes
utopia.sofromappwrite/utopia-extension:main, pinned by digest, and installslibheifandlibstdc++, which it needs to load. It is not loaded by default. Its ini file lives in/usr/local/etc/php/utopiaand setsutopia.libraries=query, so only the query classes come from the extension; without that switch it would also replaceutopia-php/validators.PHP_INI_SCAN_DIR=:/usr/local/etc/php/utopia. That is 9 more jobs. MongoDB, Redis, Memory, Mirror and Pool build no SQL and are left alone. The existing jobs are unchanged.utopia-php/querymoves from^0.7.2to^0.8.0.Why 0.8.0
Queryclass is not built on the extension'sNativeQuery, so the native builders refuse it: on 0.7.2 the SQLite adapter suite gave 1,021 errors on the extension lane, allA query must be of type Utopia\Query\Query. 0.8.0 loads the rightQuerythroughsrc/extension.php.LIKE's escape itself (ESCAPE '!'on MySQL and MariaDB,ESCAPE '\'on SQLite). Releases of this library before 10.2.5 append SQLite's clause unconditionally, which is why the query change was released as a minor and not as 0.7.3.Behaviour change for users of this library
SQL sent for
LIKEon MySQL and MariaDB gainsESCAPE '!'and escapes%,_and!with!in place of a backslash. Results are the same; the statement text is not.Test changes
Five unit tests pinned statements as 0.7.2 wrote them, and failed on 0.8.0 in both lanes:
"foo bar baz". It binds+foo +bar +bazand a pattern that checks the word order, because InnoDB can only match a quoted phrase with phrase positions in the index. The case moves out of the shared provider into its own test.Five tests call the deprecated
Query::contains()on purpose and are now marked#[IgnoreDeprecations]. Both implementations raise the sameE_USER_DEPRECATEDfrom the same line, but PHPUnit only counted it when the class came from the extension, andfailOnDeprecationthen failed that lane.Tested locally
In this branch's image, on the released 0.8.0:
Not run locally: MariaDB on 0.8.0 (it passed on the extension lane with the same package content before the release), SharedTables on the three server databases, and the linter on the last commit.
🤖 Generated with Claude Code