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
co-authored by Claude Opus 4.6
parent 5cf272b21a
commit f7ba5e39b7
5 changed files with 30 additions and 14 deletions
@@ -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',