Commit graph

260 commits

Author SHA1 Message Date
Chirag Aggarwal
dc185be836 collapse 2026-04-15 13:52:20 +05:30
Chirag Aggarwal
f9efd803c1 refactor: remove unnecessary IIFE wrappers in resolver methods 2026-04-15 08:55:00 +05:30
Chirag Aggarwal
54d6470163 refactor: move acquire/release into ResolverLock as instance methods 2026-04-15 08:51:14 +05:30
Chirag Aggarwal
50640b5bb9 refactor: inline createResolverResponse — only called once 2026-04-15 08:50:14 +05:30
Chirag Aggarwal
4d4ba508ef fix: use spl_object_hash for lock keys instead of WeakMap
Replace WeakMap with a plain array keyed by spl_object_hash($utopia)
as suggested in review. Entry is cleaned up in the finally block to
prevent leaks.
2026-04-15 08:47:41 +05:30
Chirag Aggarwal
4f2f9fedfa fix: resolve merge conflict keeping both lock and route restore
Merge conflict in Resolvers.php between the coroutine lock
(fix/graphql-coroutine-safe-response) and the otel route restore
(fix-gql-route-reset from 1.9.x). Both changes are needed:
the lock serialises concurrent resolvers while the route restore
prevents otel span clobbering.
2026-04-15 08:40:12 +05:30
Jake Barnby
6c8b34c230
Merge pull request #11885 from appwrite/fix-gql-route-reset
(fix): reset route to avoid clobbering otel
2026-04-15 01:26:02 +12:00
Chirag Aggarwal
efadf17bfe Fix GraphQL 15 static analysis 2026-04-14 10:26:59 +05:30
Chirag Aggarwal
4b2e22d9da Fix graphql-php audit vulnerability 2026-04-14 09:27:14 +05:30
Chirag Aggarwal
fe02964ebd fix: finalize graphql coroutine response isolation 2026-04-13 19:01:20 +05:30
Jake Barnby
cc8eb62c83
(chore): rename 2026-04-14 01:15:06 +12:00
Jake Barnby
d52d6c0bf0
(fix): reset route to avoid clobbering otel 2026-04-14 01:13:32 +12:00
Chirag Aggarwal
f4f5494b85 fix: isolate graphql resolver responses 2026-04-13 17:48:48 +05:30
Chirag Aggarwal
fc0fd2f6ac fix: scope graphql resources to resolver coroutine 2026-04-13 17:10:38 +05:30
Chirag Aggarwal
70a75c2e7b fix: scope graphql resolver lock to request 2026-04-13 16:47:33 +05:30
Chirag Aggarwal
6bc2168e29 fix: isolate graphql resolver request state 2026-04-13 16:34:27 +05:30
Damodar Lohani
18b1c344e6 fix: serialize batched GraphQL queries for coroutine safety
When Swoole coroutine hooks are enabled (SWOOLE_HOOK_ALL), batched
GraphQL queries execute in parallel coroutines that share a single
Response object. Concurrent coroutines interleave writes to the
shared response payload, causing data mixing between queries.

Cloning the response is not viable because cookies/headers written
by the action (e.g. session tokens) must reach the real HTTP response.

Instead, serialize the critical section (execute → getPayload) using
a Swoole Channel as a coroutine-safe mutex. This ensures only one
batched query writes to the Response at a time while preserving
cookie/header propagation. The lock is released before resolve/reject
callbacks so downstream processing remains concurrent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 06:54:15 +00:00
Damodar Lohani
5b805d686b fix: reset response sent state between batched GraphQL queries
utopia-php/http 0.34.20 added a guard that skips the action if
$response->isSent() is true. In batched GraphQL requests the resolver
reuses a single Response across all queries — after the first query's
action calls send(), subsequent queries hit the guard, their actions
are skipped, and stale/null payloads are returned.

Add Response::clearSent() to the Appwrite Response subclass (which can
access the protected $sent property from the parent) and call it in
Resolvers::resolve() before each execute(). This ensures each batched
query gets a fresh sent state while keeping the guard active for normal
request paths.

Also bumps utopia-php/http from 0.34.19 to 0.34.20 so CE CI tests
against the same version used by downstream consumers (cloud).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 05:32:04 +00:00
Jake Barnby
0c3871a681
fix: pass response to Http::execute() in GraphQL resolver (#11876)
Http::execute() now requires a Response parameter as of utopia-php/http
0.34.20. The GraphQL resolver was only passing route and request,
causing all GraphQL queries to fail with "Internal server error".

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:33:32 +12:00
Chirag Aggarwal
4a905a6ac9 Merge branch '1.9.x' into feat/migrate-di-container
Resolve conflicts keeping DI container migration (container->set pattern)
while incorporating 1.9.x fixes: PHPStan unused variable cleanup in
GraphQL Resolvers, (int) casts in Builds.php, and phpstan-baseline removal.
2026-04-02 11:17:32 +05:30
Chirag Aggarwal
33f8e35b62 chore: remove phpstan baseline 2026-04-01 23:01:11 +05:30
Chirag Aggarwal
a76a03d988
Merge branch '1.9.x' into feat/migrate-di-container 2026-04-01 14:22:13 +05:30
Chirag Aggarwal
908e408480 Merge remote-tracking branch 'origin/1.9.x' into feat/migrate-di-container
# Conflicts:
#	app/init/resources.php
#	composer.json
#	composer.lock
#	phpstan-baseline.neon
2026-04-01 11:46:13 +05:30
Chirag Aggarwal
f2ea0b9b48 Fix PHPStan baseline cleanup issues (part 2) 2026-04-01 10:20:20 +05:30
Chirag Aggarwal
18ed6a9c59 Fix more PHPStan static access issues 2026-03-31 22:04:37 +05:30
Chirag Aggarwal
f6dc6359bb Merge branch '1.9.x' into feat/migrate-di-container 2026-03-23 10:01:03 +05:30
eldadfux
efeb3b4a00 fixes 2026-03-19 23:02:41 +01:00
Chirag Aggarwal
60939da801 fix graphql 2026-03-17 21:39:50 +05:30
Chirag Aggarwal
cdb301a293 fix PHPStan errors without regenerating baseline
- Fix dispatch() type hint to use \Swoole\Http\Server instead of Utopia adapter
- Remove unused $register from go() closure in http.php
- Remove unnecessary ?? '' on non-nullable $hostname
- Remove unsupported override: param from addHeader() call
- Update Resolvers.php for new getResource()/execute() signatures
- Migrate Installer/Server.php from static Http::setResource() to container
- Remove stale baseline entries, add 1 for pre-existing Deployment.php issue
2026-03-17 17:30:42 +05:30
Chirag Aggarwal
aaa2a0525f feat: migrate from static Http::setResource() to DI Container
Upgrade utopia-php/framework from 0.33.x to 0.34.x which removes the
static Http::setResource() API. Resources are now registered on a
Utopia\DI\Container instance.

- Replace 81 Http::setResource() calls in resources.php with $container->set()
- Refactor http.php to use Swoole HttpServer adapter with shared container
- Refactor realtime.php to use FPM adapter with global container
- Refactor cli.php to use direct $cli->setResource() calls
- Update Specs.php to use local container + FPM adapter
- Update Migrate.php to inject console document instead of creating Http instance
- Update GraphQL Schema.php to use instance setResource()
2026-03-16 23:00:36 +05:30
Jake Barnby
6582ec8e67 fix: register TYPE_ID in GraphQL Mapper and fix Schedules tests for ParaTest
- Add 'id' => Type::string() to GraphQL Mapper Registry defaults to handle
  Model::TYPE_ID used by Document and Row models ($sequence field)
- Refactor SchedulesConsoleClientTest to use static-cached setup helpers
  instead of @depends annotations, which don't work in ParaTest --functional mode

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:59:33 +13:00
Chirag Aggarwal
99d8eefdcf fix class issue 2026-02-10 12:41:59 +05:30
Chirag Aggarwal
2d05d608f4 Upgrade utopia-php dependencies and fix namespace changes
- Upgrade utopia-php/cli from 0.15 to 0.22
- Upgrade utopia-php/analytics from 0.10 to 0.15
- Upgrade utopia-php/orchestration from 0.9 to 0.19
- Use dev branches for utopia-php/framework and utopia-php/platform
- Remove utopia-php/swoole dependency (merged into framework)
- Migrate Utopia\CLI\Console to Utopia\Console across all files
- Migrate Utopia\Http to Utopia\Http\Http namespace
- Migrate Utopia\Swoole\Files to Utopia\Http\Files (now instance-based)
- Convert static CLI::setResource() calls to instance-based Dependency API
- Fix StatsResources task named parameter mismatch
2026-02-10 10:34:24 +05:30
Chirag Aggarwal
1eaf5d5ffa replace app usage with http 2026-02-04 11:22:04 +05:30
loks0n
cb66e50612 refactor: remove magic class strings 2026-01-27 11:58:34 +00:00
Eldad Fux
dc7bb627d5 Enhance avatar screenshot API with new parameters and validations; add GraphQL support and extensive tests for various scenarios 2025-10-22 01:24:31 +01:00
Chirag Aggarwal
31ed726409 keep graphql backwards 2025-09-16 09:48:17 +05:30
Chirag Aggarwal
1f9bc650de work in progress 2025-09-15 12:13:48 +05:30
Chirag Aggarwal
40eaf39d91 fix: graphql 2025-09-15 11:39:00 +05:30
ArnabChatterjee20k
4e164b0b3e updated graphql mapper 2025-09-05 16:42:26 +05:30
ArnabChatterjee20k
e7113a080d removed spaital type response and will be using the json type for the spatial responses 2025-09-04 12:57:43 +05:30
ArnabChatterjee20k
2755fd1fe6 updated graphql mappers 2025-09-03 00:47:05 +05:30
ArnabChatterjee20k
110d3d83cd added attribute endpoints 2025-08-22 12:47:15 +05:30
Jake Barnby
9ceeb76ad0
Merge branch '1.7.x' into 1.8.x
# Conflicts:
#	app/controllers/api/databases.php
#	composer.lock
#	src/Appwrite/GraphQL/Types/Mapper.php
2025-07-18 17:24:12 +12:00
Jake Barnby
0a5fbb7bc7
Handle redirect validator in specs + GraphQL type mapper 2025-07-18 11:59:32 +12:00
Jake Barnby
b2fa28754d
Merge remote-tracking branch 'origin/1.7.x' into 1.8.x
# Conflicts:
#	.github/workflows/benchmark.yml
#	composer.lock
#	src/Appwrite/Event/Database.php
2025-07-04 10:00:45 -04:00
Jake Barnby
98dccf6d15
Map null on missing default 2025-06-30 22:27:29 -04:00
Christy Jacob
63a02e11ac Fix default value assignment in Mapper class to handle null cases 2025-06-27 18:42:02 +04:00
Darshan
1ac22c0ae0 Merge branch '1.8.x' into 'database-aliases'. 2025-06-11 12:36:33 +05:30
Darshan
46ccf6f537 update: re-add legacy models; remove: filters. 2025-05-07 11:13:15 +05:30