Skip to content

ci: test the SQL adapters on the utopia extension, require query 0.8.0 - #1084

Merged
loks0n merged 3 commits into
mainfrom
ci/query-extension-lane
Nov 24, 2026
Merged

loks0n merged 3 commits into
mainfrom
ci/query-extension-lane

Conversation

@loks0n

@loks0n loks0n commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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 requires utopia-php/query 0.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

  • Dockerfile: copies utopia.so from appwrite/utopia-extension:main, pinned by digest, and installs libheif and libstdc++, which it needs to load. It is not loaded by default. Its ini file lives in /usr/local/etc/php/utopia and sets utopia.libraries=query, so only the query classes come from the extension; without that switch it would also replace utopia-php/validators.
  • tests.yml: the unit job and the MariaDB, MySQL, Postgres and SQLite adapter jobs (plain and SharedTables) each get a second run with 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.
  • composer.json: utopia-php/query moves from ^0.7.2 to ^0.8.0.

Why 0.8.0

  • 0.7.2 predates the extension. Its PHP Query class is not built on the extension's NativeQuery, so the native builders refuse it: on 0.7.2 the SQLite adapter suite gave 1,021 errors on the extension lane, all A query must be of type Utopia\Query\Query. 0.8.0 loads the right Query through src/extension.php.
  • 0.8.0 declares 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 LIKE on MySQL and MariaDB gains ESCAPE '!' 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:

  • Postgres vector queries (3 tests): 0.8.0 puts parentheses around a raw condition where it is ANDed with others. The expected strings gain that pair.
  • Exact phrase search on MySQL and MariaDB (2 cases): 0.8.0 no longer binds "foo bar baz". It binds +foo +bar +baz and 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 same E_USER_DEPRECATED from the same line, but PHPUnit only counted it when the class came from the extension, and failOnDeprecation then failed that lane.

Tested locally

In this branch's image, on the released 0.8.0:

Suite PHP lane Extension lane
Unit 13,226 pass 13,226 pass
SQLite adapter 1,268 pass 1,268 pass
MySQL adapter not run 1,271 pass
Postgres adapter not run 1,273 pass
SharedTables/SQLite adapter not run 1,268 pass

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

…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>
@loks0n loks0n self-assigned this Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1bb305d and cbfdbea.

Files selected for processing: 6

  • tests/unit/Adapter/SQLArrayWritesTest.php
  • tests/unit/Builder/SearchTermTest.php
  • tests/unit/MongoContainsFilterTest.php
  • tests/unit/PostgresQueryBehaviorTest.php
  • tests/unit/Validator/Query/FilterMalformedValuesTest.php
  • tests/unit/Validator/QueryValidationTest.php

No actionable comments were generated in the recent review.

Walkthrough

The Docker image now includes the Utopia query extension, and the utopia-php/query constraint is updated to ^0.8.0. CI runs unit and adapter tests with extension-enabled variants.

Changes: Utopia Query Extension Test Support

Layer / File(s) Summary
Query dependency and runtime setup
composer.json, Dockerfile
The utopia-php/query constraint changes to ^0.8.0. The Docker image includes the pinned extension library, required packages, and PHP configuration that limits the extension to the query library.
Extension-enabled CI test variants
.github/workflows/tests.yml
The unit-test matrix includes default and extension-enabled runs. The adapter matrix adds extension-enabled variants for MariaDB, MySQL, Postgres, SQLite, and their SharedTables variants. Test commands pass the matrix environment to docker compose exec.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Suggested reviewers: abnegate, arnabchatterjee20k

Merge Risk: Minimal · previous review 1bb30 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main parts of the change: a CI lane that tests the SQL adapters on the Utopia extension, and the bump of utopia-php/query to 0.8.0. The changeset adds the extension-backed CI l…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the two main parts of the change: a CI lane that tests the SQL adapters on the Utopia extension, and the bump of utopia-php/query to 0.8.0. The changeset adds the extension-backed CI lane in tests.yml, installs the extension in the Dockerfile, and changes the query constraint in composer.json from ^0.7.2 to ^0.8.0. The title is specific and matches the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 84bf247 and 1bb305d.

Files ignored due to path filters: 1

  • composer.lock is excluded by !**/*.lock
Files selected for processing: 3

  • .github/workflows/tests.yml
  • Dockerfile
  • composer.json

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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>
@loks0n loks0n changed the title ci: test the SQL adapters on the utopia extension's query classes ci: test the SQL adapters on the utopia extension, require query 0.8.0 Nov 24, 2026
@loks0n
loks0n marked this pull request as ready for review November 24, 2026 16:27
@appwrite

appwrite Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Code review

Commit Status Tier Verdict Details
cbfdbea Reviewed Reviewed 🟢 S · Ready to merge ✅ Approved View review

The reviewed test updates align expectations with query 0.8 behavior and correctly scope deprecation suppression to tests intentionally using the deprecated API.

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)
File Change
.github/workflows/tests.yml Adds extension-enabled unit and SQL adapter matrix runs.
Dockerfile Adds the pinned utopia extension and its runtime libraries to the test image, with query-only configuration.
composer.json Requires utopia-php/query ^0.8.0.
composer.lock Locks utopia-php/query 0.8.0 and refreshes Composer metadata.
tests/unit/Adapter/SQLArrayWritesTest.php Ignores the intentional Query::contains() deprecation in the array-write test.
tests/unit/Builder/SearchTermTest.php Tests the query 0.8 MySQL/MariaDB exact-phrase bindings separately.
tests/unit/MongoContainsFilterTest.php Ignores deprecations in tests that intentionally exercise Query::contains().
tests/unit/PostgresQueryBehaviorTest.php Updates expected SQL condition parentheses for query 0.8.
tests/unit/Validator/Query/FilterMalformedValuesTest.php Ignores the intentional Query::contains() deprecation in the list-values test.
tests/unit/Validator/QueryValidationTest.php Ignores the intentional Query::contains() deprecation in the join-filter test.

Reviewed the commits since 1bb305d

Tip

Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

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>
@loks0n
loks0n merged commit d8053fc into main Nov 24, 2026
31 checks passed
@loks0n
loks0n deleted the ci/query-extension-lane branch November 24, 2026 17:30
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.

1 participant