Commit Graph

31033 Commits

Author SHA1 Message Date
Jake Barnby f79e846cb2 Fix GraphQL hanging by running both promise queues
The graphql-php library uses its own SyncPromise queue for Deferred
resolution, which is separate from our SwoolePromise queue. The wait()
method now runs both queues to ensure all deferred tasks are processed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:20:11 +13:00
Jake Barnby 9ed02eb194 Fix GraphQL promise resolution hanging by using wait()
Replace WaitGroup-based promise waiting with adapter's wait() method
which properly runs the deferred task queue. The previous implementation
would hang indefinitely because the queue was never processed, causing
the WaitGroup callback to never be called.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:20:37 +13:00
Jake Barnby a39627e555 Use queue-based deferred execution matching SyncPromise
- Callbacks are now enqueued to task queue instead of executed immediately
- wait() runs the queue until promise settles (like SyncPromiseAdapter)
- This properly supports graphql-php's deferred execution model

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:50:44 +13:00
Jake Barnby 5138ebec7b Use GQLPromise::then() in all() to match SyncPromiseAdapter
Call through GQLPromise::then() instead of directly on adopted promise.
This matches how SyncPromiseAdapter handles promise chaining.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:32:09 +13:00
Jake Barnby ca30269486 Execute promise callbacks synchronously for WaitGroup compat
The GraphQL controller uses Swoole WaitGroup to wait for promise callbacks.
Queue-based deferred execution causes deadlock because runQueue() is never
called. This change executes callbacks immediately when then() is called
on settled promises, allowing the WaitGroup pattern to work correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:17:23 +13:00
Jake Barnby 6ae070c3f1 Fix create() to match SyncPromiseAdapter pattern
Call resolver synchronously instead of enqueuing it.
This matches how graphql-php's SyncPromiseAdapter works.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:53:29 +13:00
Jake Barnby 233c4761d6 Implement task queue and wait() for graphql-php compatibility
- Add task queue mechanism to SwoolePromise matching SyncPromise behavior
- Callbacks are enqueued instead of executed immediately
- Add wait() method to Swoole adapter to process queue until promise settles
- This fixes hanging tests by properly executing deferred promise callbacks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:35:58 +13:00
Jake Barnby d7174d0de3 Fix PSR-12 style for arrow functions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:05:13 +13:00
Jake Barnby 66c83162d3 Rewrite SwoolePromise to be fully synchronous
Remove all coroutine-based execution. The executor now runs
synchronously in the constructor, matching graphql-php's SyncPromise
behavior. This ensures all promise operations complete immediately
without scheduling issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:02:47 +13:00
Jake Barnby 8b297f5a89 Simplify all() to use SwoolePromise.then() directly
Call then() on the adopted SwoolePromise directly instead of going
through the GQLPromise wrapper. This ensures callbacks are properly
registered and fired via SwoolePromise's processWaiting().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:48:30 +13:00
Jake Barnby 4604c77939 Fix createFulfilled/createRejected to resolve immediately
These methods should return already-resolved promises, not promises
that will resolve in a future coroutine. This fixes the issue where
graphql-php's synchronous execution returns "fulfilled" promises that
are actually still pending.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:33:32 +13:00
Jake Barnby ef46367fa3 Use Channel-based polling in all() implementation
Instead of relying on then() callbacks which may not fire correctly,
poll the adopted promise state directly using Swoole Coroutine::sleep
for proper yielding. Each promise is waited on in its own coroutine.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:21:07 +13:00
Jake Barnby 3078e6bff5 Run promise callbacks synchronously instead of in new coroutines
This avoids scheduling issues where spawned coroutines don't get a
chance to run before the main coroutine continues waiting.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:06:34 +13:00
Jake Barnby 80643faacc Rewrite SwoolePromise with callback-based resolution
Replace busy-waiting in then() with proper callback queuing:
- Store waiting callbacks in array when promise is pending
- When promise resolves/rejects, process all waiting callbacks
- Run callbacks in coroutines for proper async execution
- This eliminates deadlocks from busy-wait polling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 21:35:49 +13:00
Jake Barnby cd75f17815 Add public resolve/reject to Promise and fix all() implementation
- Add public resolve() and reject() methods to Promise class
- Create combined promise without executor (no coroutine spawned)
- Use direct resolve/reject calls instead of captured callbacks
- This ensures the promise can be settled regardless of coroutine timing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:56:28 +13:00
Jake Barnby 7b9970af9c Rewrite all() to match SyncPromiseAdapter pattern
Use callback-based approach similar to graphql-php's SyncPromiseAdapter:
- Create a combined promise and capture resolve/reject callbacks
- Register then() callbacks on each input promise
- Resolve when all callbacks have fired

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:35:33 +13:00
Jake Barnby 2544baa669 Fix batch promises with coroutine-based synchronization
- Use Swoole Coroutine::sleep for proper coroutine yielding instead of
  callback-based completion tracking
- Spawn a coroutine for each promise to wait for its completion
- Use Channel for synchronization between coroutines
- Add public accessors to Promise class for state checking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:10:07 +13:00
Jake Barnby 4d6a3d36f7 Fix batch promise handling with callback-based completion tracking
Use callback-based counting instead of channel synchronization to track
promise completion. Work directly with GQLPromise objects and use their
then() method which properly chains through the adapter to the underlying
SwoolePromise.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:46:36 +13:00
Jake Barnby ab936a7ce4 Simplify Swoole adapter all() by delegating to SwoolePromise::all
Instead of reimplementing the promise aggregation logic, extract adopted
promises from GQLPromise wrappers and delegate to SwoolePromise::all()
which already handles the coroutine synchronization properly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:17:32 +13:00
Jake Barnby b671bfb1c7 Fix Swoole adapter all() to work directly with GQLPromise objects
Instead of extracting adopted promises and delegating to SwoolePromise::all(),
implement the batch handling logic directly to properly work with GQLPromise
wrappers. Uses Swoole Channel for synchronization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:55:20 +13:00
Jake Barnby a70d67810e Fix Promise::all() to handle mixed values and promises
The graphql-php executor passes both promises and plain values to
the PromiseAdapter::all() method. Updated SwoolePromise::all() to
properly handle plain values by storing them directly without
attempting to call ->then() on them.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:36:40 +13:00
Jake Barnby 762be367e1 Fix collision 2026-01-21 18:09:03 +13:00
Jake Barnby f3b2562add Flag dirty across workers 2026-01-21 17:22:33 +13:00
Jake Barnby 0d26a2a2dd Merge remote-tracking branch 'origin/1.8.x' into feat-dynamic-graphql
# Conflicts:
#	app/init/resources.php
#	composer.lock
2026-01-21 14:02:19 +13:00
Jake Barnby 124ee0df8f Remove redundant type locking 2026-01-21 13:59:52 +13:00
Jake Barnby 802379366a Fix project/collection schema sanitization 2026-01-21 13:59:40 +13:00
Jake Barnby 9b8dcfda07 Fix custom scalar 2026-01-21 13:59:24 +13:00
Jake Barnby e9698c96f0 Allow dynamic types 2026-01-21 01:32:34 +13:00
Chirag Aggarwal ddbddafbf9 Merge pull request #11161 from appwrite/release-cli-13.0.1 2026-01-19 18:00:59 +05:30
Chirag Aggarwal 86a4bfa74e chore: release cli 13.0.1 2026-01-19 17:58:43 +05:30
Jake Barnby 8124b07860 Merge pull request #11033 from appwrite/add-webhooks-and-functions-events 2026-01-19 22:02:49 +13:00
Jake Barnby a7898b3d5b Merge pull request #11159 from appwrite/feat-graphql-introspection 2026-01-19 21:58:56 +13:00
Jake Barnby 5d24b51421 Allow separately enabling graphql introspection 2026-01-19 19:26:17 +13:00
shimon 0203323b4a Remove 'authorization' injection from Bulk Delete, Update, and Upsert classes 2026-01-18 14:01:35 +02:00
shimon 94e29cff53 Fix typo in Authorization parameter in API action definition 2026-01-18 13:11:05 +02:00
shimon 72def3b2fb Refactor API action parameters to include Authorization dependency 2026-01-18 13:05:43 +02:00
shimon d015a75e81 linter 2026-01-18 12:48:36 +02:00
shimon 1306c85eb5 merge with 1.8x 2026-01-18 11:03:06 +02:00
shimon c3ea66b37a Merge branch '1.8.x' of github.com:appwrite/appwrite into add-webhooks-and-functions-events
# Conflicts:
#	app/controllers/shared/api.php
#	app/init/resources.php
#	src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php
#	src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php
#	src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php
#	src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php
#	src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php
#	src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php
#	src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php
2026-01-18 11:01:40 +02:00
Damodar Lohani 72ce068714 Merge pull request #11057 from appwrite/feat-health-module
Feat: Health module
2026-01-18 07:27:19 +05:45
Chirag Aggarwal ea76213dd2 Merge pull request #11146 from appwrite/feat-cleanup-stale-executions 2026-01-17 12:44:15 +05:30
Matej Bačo 12b79363d1 Merge pull request #11148 from appwrite/feat-new-schema-dualwriting
Feat: Support dual-writing for new schema features
2026-01-16 15:38:23 +01:00
Jake Barnby 0723101397 Merge pull request #11005 from appwrite/dat-969 2026-01-17 03:31:50 +13:00
Matej Bačo d56a3c1534 Apply suggestion from @Meldiron 2026-01-16 14:53:05 +01:00
Darshan b86d7ac3fa Merge pull request #11149 from appwrite/clean-on-async 2026-01-16 19:07:17 +05:30
ArnabChatterjee20k b1fab79dc4 updated query logic in array to be of and format 2026-01-16 19:06:55 +05:30
Darshan 2f066a6ba8 add: check. 2026-01-16 18:41:22 +05:30
Darshan e8ca0610ee fix: type 2026-01-16 18:40:37 +05:30
Darshan 15caa27977 lint. 2026-01-16 18:38:40 +05:30
Darshan 5f22022527 fix: async being missed. 2026-01-16 18:33:27 +05:30