From f7ba5e39b7206cd62abfffce4baec2d03f2decad Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 13 Feb 2026 23:54:39 +1300 Subject: [PATCH] fix: update Sequence validator, fix messaging race condition, improve auth retry - Update utopia-php/database to fix Sequence validator rejecting integer $sequence values on MongoDB (VAR_UUID7) adapters - Fix Base.php Filter constructor passing APP_DATABASE_QUERY_MAX_VALUES as $idAttributeType instead of the correct Database::VAR_INTEGER - Fix Messaging testUpdateScheduledAt race condition by increasing initial scheduledAt from 3s to 30s so scheduler doesn't fire before the PATCH update processes - Improve Functions callWithAuthRetry to refresh project credentials after 4 consecutive 401 failures and increase max retries to 10 Co-Authored-By: Claude Opus 4.6 --- composer.json | 2 +- composer.lock | 27 ++++++++++++------- .../Database/Validator/Queries/Base.php | 2 +- .../e2e/Services/Functions/FunctionsBase.php | 9 ++++++- .../e2e/Services/Messaging/MessagingBase.php | 4 +-- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index ced9a65219..d534ea236a 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "utopia-php/cli": "0.22.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", - "utopia-php/database": "5.*", + "utopia-php/database": "dev-fix/sequence-validator-integer as 5.1.3", "utopia-php/detector": "0.2.*", "utopia-php/domains": "1.*", "utopia-php/emails": "0.6.*", diff --git a/composer.lock b/composer.lock index c6991086e9..7c1867ae03 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c9436e3de3d010184dc928a7f1ff4721", + "content-hash": "a8eed08cb94072ce519450aa66d6da81", "packages": [ { "name": "adhocore/jwt", @@ -3797,16 +3797,16 @@ }, { "name": "utopia-php/database", - "version": "5.1.2", + "version": "dev-fix/sequence-validator-integer", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "1530a1c7608daf31f412f8f9a487a3b2eadd83af" + "reference": "6f9d4117175bd894450235ac749219a9fd11150d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/1530a1c7608daf31f412f8f9a487a3b2eadd83af", - "reference": "1530a1c7608daf31f412f8f9a487a3b2eadd83af", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6f9d4117175bd894450235ac749219a9fd11150d", + "reference": "6f9d4117175bd894450235ac749219a9fd11150d", "shasum": "" }, "require": { @@ -3849,9 +3849,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/5.1.2" + "source": "https://github.com/utopia-php/database/tree/fix/sequence-validator-integer" }, - "time": "2026-02-13T01:41:26+00:00" + "time": "2026-02-13T09:34:51+00:00" }, { "name": "utopia-php/detector", @@ -8887,9 +8887,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-fix/sequence-validator-integer", + "alias": "5.1.3", + "alias_normalized": "5.1.3.0" + } + ], "minimum-stability": "dev", - "stability-flags": {}, + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Base.php b/src/Appwrite/Utopia/Database/Validator/Queries/Base.php index 02f2a57c5b..954c1eedcf 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Base.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Base.php @@ -93,7 +93,7 @@ class Base extends Queries new Limit(), new Offset(), new Cursor(), - new Filter($attributes, APP_DATABASE_QUERY_MAX_VALUES), + new Filter($attributes, Database::VAR_INTEGER, APP_DATABASE_QUERY_MAX_VALUES), new Order($attributes), ]; diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index 0145568cba..60d03cd2bb 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -24,10 +24,17 @@ trait FunctionsBase */ protected function callWithAuthRetry(string $method, string $path, array $headers, mixed $params = []): array { - $maxRetries = 8; + $maxRetries = 10; $response = null; for ($attempt = 1; $attempt <= $maxRetries; $attempt++) { + // Refresh project credentials after several failed attempts + if ($attempt === 5) { + $project = $this->getProject(true); + $headers['x-appwrite-project'] = $project['$id']; + $headers['x-appwrite-key'] = $project['apiKey']; + } + $response = $this->client->call($method, $path, array_merge($headers), $params); if ($response['headers']['status-code'] !== 401) { diff --git a/tests/e2e/Services/Messaging/MessagingBase.php b/tests/e2e/Services/Messaging/MessagingBase.php index f5fdbc93ba..cbad20efa3 100644 --- a/tests/e2e/Services/Messaging/MessagingBase.php +++ b/tests/e2e/Services/Messaging/MessagingBase.php @@ -1245,13 +1245,13 @@ trait MessagingBase 'targets' => [$targetId], 'subject' => 'New blog post', 'content' => 'Check out the new blog post at http://localhost', - 'scheduledAt' => DateTime::addSeconds(new \DateTime(), 3), + 'scheduledAt' => DateTime::addSeconds(new \DateTime(), 30), ]); $this->assertEquals(201, $message['headers']['status-code']); $this->assertEquals(MessageStatus::SCHEDULED, $message['body']['status']); - $scheduledAt = DateTime::addSeconds(new \DateTime(), 10); + $scheduledAt = DateTime::addSeconds(new \DateTime(), 15); $message = $this->client->call(Client::METHOD_PATCH, '/messaging/messages/email/' . $message['body']['$id'], [ 'content-type' => 'application/json',