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 <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-02-13 23:54:39 +13:00
parent 5cf272b21a
commit f7ba5e39b7
5 changed files with 30 additions and 14 deletions
+1 -1
View File
@@ -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.*",
Generated
+18 -9
View File
@@ -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": {
@@ -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),
];
@@ -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) {
@@ -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',