From d54c758122855079e23ad853c86f54b34f941eca Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 22 Jul 2026 23:21:24 +1200 Subject: [PATCH 01/18] feat(vectorsdb): add POST query route for listing documents Mirror listVectorsDBDocuments as a POST endpoint so the queries array travels in the request body instead of the URL query string, allowing much larger query sets that would otherwise exceed URL length limits. Co-Authored-By: Claude Opus 4.8 --- docs/references/vectorsdb/create-query.md | 1 + .../Collections/Documents/Queries/Create.php | 63 +++++++++++++++++++ .../Databases/Services/Registry/VectorsDB.php | 2 + 3 files changed, 66 insertions(+) create mode 100644 docs/references/vectorsdb/create-query.md create mode 100644 src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php diff --git a/docs/references/vectorsdb/create-query.md b/docs/references/vectorsdb/create-query.md new file mode 100644 index 0000000000..dbe45922c9 --- /dev/null +++ b/docs/references/vectorsdb/create-query.md @@ -0,0 +1 @@ +Get a list of all the user's documents in a given collection using a POST request. This behaves identically to the list documents endpoint but accepts the queries in the request body, allowing much larger `queries` arrays than can fit in a URL query string. diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php new file mode 100644 index 0000000000..ce853b3a99 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php @@ -0,0 +1,63 @@ +setHttpMethod(self::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/query') + ->desc('Query documents') + ->groups(['api', 'database']) + ->label('scope', 'documents.read') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('sdk', new Method( + namespace: 'vectorsDB', + group: $this->getSdkGroup(), + name: 'createQuery', + description: '/docs/references/vectorsdb/create-query.md', + auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: SwooleResponse::STATUS_CODE_OK, + model: $this->getResponseModel(), + ) + ], + contentType: ContentType::JSON + )) + ->param('databaseId', '', new UID(), 'Database ID.') + ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') + ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) + ->param('transactionId', null, new UID(), 'Transaction ID to read uncommitted changes within the transaction.', true) + ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) + ->param('ttl', 0, new Range(min: 0, max: 86400), 'TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).', true) + ->inject('response') + ->inject('dbForProject') + ->inject('user') + ->inject('getDatabasesDB') + ->inject('usage') + ->inject('transactionState') + ->inject('authorization') + ->callback($this->action(...)); + } +} diff --git a/src/Appwrite/Platform/Modules/Databases/Services/Registry/VectorsDB.php b/src/Appwrite/Platform/Modules/Databases/Services/Registry/VectorsDB.php index bf9dd16589..ed20b6634b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Services/Registry/VectorsDB.php +++ b/src/Appwrite/Platform/Modules/Databases/Services/Registry/VectorsDB.php @@ -10,6 +10,7 @@ use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bul use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Create as CreateDocument; use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Delete as DeleteDocument; use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Get as GetDocument; +use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Queries\Create as CreateDocumentsQuery; use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Update as UpdateDocument; use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Upsert as UpsertDocument; use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\XList as ListDocuments; @@ -79,6 +80,7 @@ class VectorsDB extends Base $service->addAction(UpsertDocument::getName(), new UpsertDocument()); $service->addAction(GetDocument::getName(), new GetDocument()); $service->addAction(ListDocuments::getName(), new ListDocuments()); + $service->addAction(CreateDocumentsQuery::getName(), new CreateDocumentsQuery()); $service->addAction(DeleteDocument::getName(), new DeleteDocument()); $service->addAction(UpdateDocuments::getName(), new UpdateDocuments()); $service->addAction(UpsertDocuments::getName(), new UpsertDocuments()); From a879ea081425d9ad16cc053239920e7be4c9c49e Mon Sep 17 00:00:00 2001 From: Puller Review Date: Thu, 23 Jul 2026 15:54:38 +1200 Subject: [PATCH 02/18] fix(vectorsdb): correct query create route description Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Http/VectorsDB/Collections/Documents/Queries/Create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php index ce853b3a99..38444e71ca 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Queries/Create.php @@ -26,7 +26,7 @@ class Create extends XList $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_POST) ->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/query') - ->desc('Query documents') + ->desc('Create query') ->groups(['api', 'database']) ->label('scope', 'documents.read') ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') From 55955773f5eab5ccfcad39439d0372e49d4661ee Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 23 Jul 2026 11:49:32 +0530 Subject: [PATCH 03/18] Fix missing OpenAPI service descriptions for CLI help Emit spec tags from Method namespaces and resolve services.php subtitles case-insensitively so keys like tablesdb still describe tablesDB. Register webhooks, tokens, and presences with subtitles. Co-authored-by: Cursor --- app/config/services.php | 42 +++++++++++++++++++++++++++ src/Appwrite/Platform/Tasks/Specs.php | 39 +++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/app/config/services.php b/app/config/services.php index f0b4df590b..2c4b18f2be 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -197,6 +197,48 @@ return [ 'icon' => '', 'platforms' => ['client', 'server', 'console'], ], + 'webhooks' => [ + 'key' => 'webhooks', + 'name' => 'Webhooks', + 'subtitle' => 'The Webhooks service allows you to manage your project webhooks.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => false, + 'icon' => '', + 'platforms' => ['server', 'console'], + ], + 'tokens' => [ + 'key' => 'tokens', + 'name' => 'Tokens', + 'subtitle' => 'The Tokens service allows you to create and manage resource tokens for secure file access.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => false, + 'icon' => '', + 'platforms' => ['server', 'console'], + ], + 'presences' => [ + 'key' => 'presences', + 'name' => 'Presences', + 'subtitle' => 'The Presences service allows you to track and manage real-time user presence in your project.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => false, + 'icon' => '', + 'platforms' => ['client', 'server', 'console'], + ], 'sites' => [ 'key' => 'sites', 'name' => 'Sites', diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 8b3b9fc073..eb664d0422 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -615,6 +615,7 @@ class Specs extends Action $routes = []; $models = []; $services = []; + $routeNamespaces = []; foreach ($appRoutes as $key => $method) { foreach ($method as $route) { @@ -660,11 +661,27 @@ class Specs extends Action } $routes[] = $route; + $routeNamespaces[$sdk->getNamespace()] = true; } } } + /** + * Tag names must match Method namespaces (path tags), e.g. tablesDB. + * Service config keys stay lowercase (tablesdb); descriptions resolve + * case-insensitively from services.php. + */ + $serviceDescriptions = []; + $configuredServices = []; + foreach (Config::getParam('services', []) as $service) { + $serviceKey = $service['key'] ?? ''; + if ($serviceKey === '') { + continue; + } + + $serviceDescriptions[\strtolower($serviceKey)] = $service['subtitle'] ?? ''; + if ( !isset($service['docs']) // Skip service if not part of the public API || !isset($service['sdk']) @@ -679,9 +696,27 @@ class Specs extends Action continue; } + $configuredServices[$serviceKey] = $service['subtitle'] ?? ''; + } + + $seenServices = []; + + foreach (\array_keys($routeNamespaces) as $namespace) { $services[] = [ - 'name' => $service['key'] ?? '', - 'description' => $service['subtitle'] ?? '', + 'name' => $namespace, + 'description' => $serviceDescriptions[\strtolower($namespace)] ?? '', + ]; + $seenServices[\strtolower($namespace)] = true; + } + + foreach ($configuredServices as $serviceKey => $description) { + if (isset($seenServices[\strtolower($serviceKey)])) { + continue; + } + + $services[] = [ + 'name' => $serviceKey, + 'description' => $description, ]; } From 45a9a6cdc39bb5893e5b3276be0106202b8d9a96 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 12:55:50 +0530 Subject: [PATCH 04/18] [TEMP/TESTING] Point utopia-php/vcs at unreleased feat/gitlab-list-namespaces Testing GitLab::listNamespaces() (utopia-php/vcs#122) on staging before it's released. Do not merge -- revert to the pinned release version once the vcs PR merges and a real release is cut. --- composer.json | 6 +++++- composer.lock | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index c598d5ec66..b29cb6dfa8 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,10 @@ { "type": "vcs", "url": "https://github.com/utopia-php/auth" + }, + { + "type": "vcs", + "url": "https://github.com/utopia-php/vcs" } ], "require": { @@ -96,7 +100,7 @@ "utopia-php/telemetry": "^0.4", "utopia-php/user-agent": "0.1.*", "mustangostang/spyc": "0.6.*", - "utopia-php/vcs": "^4.4.2", + "utopia-php/vcs": "dev-feat/gitlab-list-namespaces", "utopia-php/websocket": "1.0.*", "dragonmantank/cron-expression": "3.4.*", "phpmailer/phpmailer": "6.9.*", diff --git a/composer.lock b/composer.lock index b5e0346c26..1ddbaad483 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": "7a2821539fc6e6063587e38e3eca19c4", + "content-hash": "54c4b8e9607f4b8b1ce387ad27d2726c", "packages": [ { "name": "adhocore/jwt", @@ -5165,16 +5165,16 @@ }, { "name": "utopia-php/vcs", - "version": "4.4.4", + "version": "dev-feat/gitlab-list-namespaces", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "37580b1a459c6b51f567b1720c118a8a0213f314" + "reference": "8bd586e9eae0f622b1a728c5b0269369b3efdde2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/37580b1a459c6b51f567b1720c118a8a0213f314", - "reference": "37580b1a459c6b51f567b1720c118a8a0213f314", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/8bd586e9eae0f622b1a728c5b0269369b3efdde2", + "reference": "8bd586e9eae0f622b1a728c5b0269369b3efdde2", "shasum": "" }, "require": { @@ -5195,7 +5195,25 @@ "Utopia\\VCS\\": "src/VCS" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "Utopia\\Tests\\": "tests/VCS" + } + }, + "scripts": { + "lint": [ + "./vendor/bin/pint --test --config pint.json" + ], + "format": [ + "./vendor/bin/pint --config pint.json" + ], + "check": [ + "./vendor/bin/phpstan analyse --level 8 --memory-limit 512M -c phpstan.neon src tests" + ], + "test": [ + "./vendor/bin/phpunit --configuration phpunit.xml --debug" + ] + }, "license": [ "MIT" ], @@ -5207,10 +5225,10 @@ "vcs" ], "support": { - "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/4.4.4" + "source": "https://github.com/utopia-php/vcs/tree/feat/gitlab-list-namespaces", + "issues": "https://github.com/utopia-php/vcs/issues" }, - "time": "2026-07-22T10:18:04+00:00" + "time": "2026-07-23T07:17:43+00:00" }, { "name": "utopia-php/websocket", @@ -8398,7 +8416,8 @@ "minimum-stability": "dev", "stability-flags": { "utopia-php/http": 5, - "utopia-php/platform": 5 + "utopia-php/platform": 5, + "utopia-php/vcs": 20 }, "prefer-stable": true, "prefer-lowest": false, From ffdc33d523664e5a2b0540af5606e72ccbfdf0ac Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 23 Jul 2026 20:15:25 +1200 Subject: [PATCH 05/18] fix(deps): move utopia-php/auth to 0.10.1 GitHub serves a truncated zip for 0.10.0's commit (fc6e786): a complete 75406-byte body with no end-of-central-directory record. That URL is the dist Packagist hands Composer, so any --prefer-dist install of 0.10.0 fails with libzip error 35 the moment the cached archive is hit. 0.10.1 is the same library at a new commit. Archives are keyed by sha and GitHub offers no self-service purge, so a new commit is the only way off the poisoned artifact. Verified: docker build --target composer completes and the image carries utopia-php/auth 0.10.1. Co-Authored-By: Claude Opus 4.8 --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index b5e0346c26..53a4259e66 100644 --- a/composer.lock +++ b/composer.lock @@ -3212,16 +3212,16 @@ }, { "name": "utopia-php/auth", - "version": "0.10.0", + "version": "0.10.1", "source": { "type": "git", "url": "https://github.com/utopia-php/auth.git", - "reference": "fc6e7861a0428415a7454ba808a511cc01bf8db4" + "reference": "0f1a342bceebc2659736e52a4496daf24ca4954c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/auth/zipball/fc6e7861a0428415a7454ba808a511cc01bf8db4", - "reference": "fc6e7861a0428415a7454ba808a511cc01bf8db4", + "url": "https://api.github.com/repos/utopia-php/auth/zipball/0f1a342bceebc2659736e52a4496daf24ca4954c", + "reference": "0f1a342bceebc2659736e52a4496daf24ca4954c", "shasum": "" }, "require": { @@ -3264,10 +3264,10 @@ "security" ], "support": { - "source": "https://github.com/utopia-php/auth/tree/0.10.0", + "source": "https://github.com/utopia-php/auth/tree/0.10.1", "issues": "https://github.com/utopia-php/auth/issues" }, - "time": "2026-07-15T15:52:58+00:00" + "time": "2026-07-23T07:34:27+00:00" }, { "name": "utopia-php/cache", From 90c7f02ad191f0110617c604d325a11736d64ea1 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 14:13:53 +0530 Subject: [PATCH 06/18] Add GET /v1/vcs/installations/:installationId/namespaces endpoint Exposes GitLab::listNamespaces() (utopia-php/vcs#122) so the console can build a group/namespace picker after OAuth connect -- GitLab has no per-installation org scoping like GitHub's App flow, so there's nowhere else in the stack that knows about a user's groups. For providers without listNamespaces() (currently everything but GitLab), falls back to a single-item list wrapping the installation's own organization, so the response shape stays uniform for callers. --- app/init/models.php | 3 + .../Http/Installations/Namespaces/XList.php | 119 ++++++++++++++++++ .../Platform/Modules/VCS/Services/Http.php | 2 + src/Appwrite/Utopia/Response.php | 2 + .../Utopia/Response/Model/VcsNamespace.php | 64 ++++++++++ 5 files changed, 190 insertions(+) create mode 100644 src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php create mode 100644 src/Appwrite/Utopia/Response/Model/VcsNamespace.php diff --git a/app/init/models.php b/app/init/models.php index 55101a27b8..d3b776b2bd 100644 --- a/app/init/models.php +++ b/app/init/models.php @@ -224,6 +224,7 @@ use Appwrite\Utopia\Response\Model\UsageVectorsDBs; use Appwrite\Utopia\Response\Model\User; use Appwrite\Utopia\Response\Model\Variable; use Appwrite\Utopia\Response\Model\VcsContent; +use Appwrite\Utopia\Response\Model\VcsNamespace; use Appwrite\Utopia\Response\Model\VectorsDBCollection; use Appwrite\Utopia\Response\Model\Webhook; @@ -259,6 +260,8 @@ Response::setModel(new BaseList('Function Templates List', Response::MODEL_TEMPL Response::setModel(new BaseList('Installations List', Response::MODEL_INSTALLATION_LIST, 'installations', Response::MODEL_INSTALLATION)); Response::setModel(new ProviderRepositoryFrameworkList()); Response::setModel(new ProviderRepositoryRuntimeList()); +Response::setModel(new VcsNamespace()); +Response::setModel(new BaseList('VCS Namespaces List', Response::MODEL_VCS_NAMESPACE_LIST, 'namespaces', Response::MODEL_VCS_NAMESPACE)); Response::setModel(new BaseList('Branches List', Response::MODEL_BRANCH_LIST, 'branches', Response::MODEL_BRANCH)); Response::setModel(new BaseList('Frameworks List', Response::MODEL_FRAMEWORK_LIST, 'frameworks', Response::MODEL_FRAMEWORK)); Response::setModel(new BaseList('Runtimes List', Response::MODEL_RUNTIME_LIST, 'runtimes', Response::MODEL_RUNTIME)); diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php new file mode 100644 index 0000000000..ef3fc3acbb --- /dev/null +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php @@ -0,0 +1,119 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/vcs/installations/:installationId/namespaces') + ->desc('List namespaces') + ->groups(['api', 'vcs']) + ->label('scope', 'vcs.read') + ->label('resourceType', RESOURCE_TYPE_VCS) + ->label('sdk', new Method( + namespace: 'vcs', + group: 'installations', + name: 'listNamespaces', + description: '/docs/references/vcs/list-namespaces.md', + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VCS_NAMESPACE_LIST, + ) + ] + )) + ->param('installationId', '', new Text(256), 'Installation Id') + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->param('queries', [], new Queries([new Limit(), new Offset()]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true) + ->inject('vcsFactory') + ->inject('installationTokens') + ->inject('response') + ->inject('dbForPlatform') + ->callback($this->action(...)); + } + + public function action( + string $installationId, + string $search, + array $queries, + VcsFactory $vcsFactory, + InstallationTokens $installationTokens, + Response $response, + Database $dbForPlatform + ) { + $installation = $dbForPlatform->getDocument('installations', $installationId); + + if ($installation->isEmpty()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + + $installation = $installationTokens->refreshForInstallation($installation, $dbForPlatform, $vcsFactory); + $vcs = $vcsFactory->fromInstallation($installation); + + $queries = Query::parseQueries($queries); + $limitQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_LIMIT)); + $offsetQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_OFFSET)); + + $limit = !empty($limitQuery) ? $limitQuery->getValue() : 20; + $offset = !empty($offsetQuery) ? $offsetQuery->getValue() : 0; + + if ($offset % $limit !== 0) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'offset must be a multiple of the limit'); + } + + $page = ($offset / $limit) + 1; + + // Only GitLab has more than one namespace per installation: GitHub's + // OAuth App flow already scopes an installation to a single org/user + // during authorization, so there's nothing else to list here. + if (\method_exists($vcs, 'listNamespaces')) { + ['items' => $namespaces, 'total' => $total] = $vcs->listNamespaces($page, $limit, $search); + } else { + $organization = $installation->getAttribute('organization', ''); + $matches = empty($search) || \stripos($organization, $search) !== false; + $namespaces = $matches ? [[ + 'id' => $installation->getAttribute('providerInstallationId', ''), + 'name' => $organization, + 'path' => $organization, + 'kind' => 'org', + 'avatarUrl' => '', + ]] : []; + $total = \count($namespaces); + } + + $namespaces = \array_map(fn ($namespace) => new Document($namespace), $namespaces); + + $response->dynamic(new Document([ + 'namespaces' => $namespaces, + 'total' => $total, + ]), Response::MODEL_VCS_NAMESPACE_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/VCS/Services/Http.php b/src/Appwrite/Platform/Modules/VCS/Services/Http.php index a9cedf40f6..063be6bd9d 100644 --- a/src/Appwrite/Platform/Modules/VCS/Services/Http.php +++ b/src/Appwrite/Platform/Modules/VCS/Services/Http.php @@ -14,6 +14,7 @@ use Appwrite\Platform\Modules\VCS\Http\Gitlab\Callback\Get as GetGitlabCallback; use Appwrite\Platform\Modules\VCS\Http\Gitlab\Events\Create as CreateGitlabEvent; use Appwrite\Platform\Modules\VCS\Http\Installations\Delete as DeleteInstallation; use Appwrite\Platform\Modules\VCS\Http\Installations\Get as GetInstallation; +use Appwrite\Platform\Modules\VCS\Http\Installations\Namespaces\XList as ListNamespaces; use Appwrite\Platform\Modules\VCS\Http\Installations\Repositories\Branches\XList as ListRepositoryBranches; use Appwrite\Platform\Modules\VCS\Http\Installations\Repositories\Contents\Get as GetRepositoryContents; use Appwrite\Platform\Modules\VCS\Http\Installations\Repositories\Create as CreateRepository; @@ -46,6 +47,7 @@ class Http extends Service $this->addAction(GetInstallation::getName(), new GetInstallation()); $this->addAction(ListInstallations::getName(), new ListInstallations()); $this->addAction(DeleteInstallation::getName(), new DeleteInstallation()); + $this->addAction(ListNamespaces::getName(), new ListNamespaces()); // Repositories $this->addAction(CreateRepository::getName(), new CreateRepository()); diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 156ebe532c..b5d85efc9e 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -195,6 +195,8 @@ class Response extends SwooleResponse public const MODEL_PROVIDER_REPOSITORY_FRAMEWORK_LIST = 'providerRepositoryFrameworkList'; public const MODEL_PROVIDER_REPOSITORY_RUNTIME = 'providerRepositoryRuntime'; public const MODEL_PROVIDER_REPOSITORY_RUNTIME_LIST = 'providerRepositoryRuntimeList'; + public const MODEL_VCS_NAMESPACE = 'vcsNamespace'; + public const MODEL_VCS_NAMESPACE_LIST = 'vcsNamespaceList'; public const MODEL_BRANCH = 'branch'; public const MODEL_BRANCH_LIST = 'branchList'; public const MODEL_DETECTION_FRAMEWORK = 'detectionFramework'; diff --git a/src/Appwrite/Utopia/Response/Model/VcsNamespace.php b/src/Appwrite/Utopia/Response/Model/VcsNamespace.php new file mode 100644 index 0000000000..dc0f38b07c --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/VcsNamespace.php @@ -0,0 +1,64 @@ +addRule('id', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) namespace ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) namespace display name.', + 'default' => '', + 'example' => 'Appwrite', + ]) + ->addRule('path', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) namespace path, used as the owner when listing repositories.', + 'default' => '', + 'example' => 'appwrite', + ]) + ->addRule('kind', [ + 'type' => self::TYPE_STRING, + 'description' => 'Namespace kind. Either the user\'s personal namespace or a group/organization.', + 'default' => '', + 'example' => 'user', + ]) + ->addRule('avatarUrl', [ + 'type' => self::TYPE_STRING, + 'description' => 'Namespace avatar URL.', + 'default' => '', + 'example' => 'https://example.com/avatar.png', + ]); + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'VcsNamespace'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_VCS_NAMESPACE; + } +} From 2a107511a0b04fdc22336683a72e9c23d3d06921 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 14:19:23 +0530 Subject: [PATCH 07/18] Add docs for listNamespaces SDK method (required for spec generation) --- docs/references/vcs/list-namespaces.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/references/vcs/list-namespaces.md diff --git a/docs/references/vcs/list-namespaces.md b/docs/references/vcs/list-namespaces.md new file mode 100644 index 0000000000..51b09caaea --- /dev/null +++ b/docs/references/vcs/list-namespaces.md @@ -0,0 +1 @@ +Get a list of namespaces a VCS (Version Control System) installation can browse, such as the user's personal namespace and any groups they belong to. This is primarily useful for providers like GitLab, where a single OAuth authorization grants access to multiple namespaces with no per-installation selection step. For providers that already scope one installation to a single organization, this returns that organization as the only namespace. You can optionally filter namespaces using a search term. From dd6560447f617f3e9eab7933979986b872e09a41 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 14:29:26 +0530 Subject: [PATCH 08/18] Accept providerNamespace on listRepositories to browse other namespaces Without this, the new namespaces/groups picker would be cosmetic -- this endpoint always resolved the owner via getOwnerName(), which for GitLab only ever returns the personal namespace. Optional param, so existing callers that don't pass it keep the current behavior. --- .../Modules/VCS/Http/Installations/Repositories/XList.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php index 75e7dfab7a..1be88e514a 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php @@ -97,6 +97,7 @@ class XList extends Action ->param('installationId', '', new Text(256), 'Installation Id') ->param('type', '', new WhiteList(['runtime', 'framework']), 'Detector type. Must be one of the following: runtime, framework', enum: new Enum(name: 'VCSDetectionType')) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->param('providerNamespace', '', new Text(256), 'Namespace (personal account or group) to list repositories from, as returned by listNamespaces\' `path` field. Defaults to the installation\'s own namespace.', true) ->param('queries', [], new Queries([new Limit(), new Offset()]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true) ->inject('vcsFactory') ->inject('installationTokens') @@ -109,6 +110,7 @@ class XList extends Action string $installationId, string $type, string $search, + string $providerNamespace, array $queries, VcsFactory $vcsFactory, InstallationTokens $installationTokens, @@ -141,7 +143,7 @@ class XList extends Action } $page = ($offset / $limit) + 1; - $owner = $vcs->getOwnerName($providerInstallationId); + $owner = !empty($providerNamespace) ? $providerNamespace : $vcs->getOwnerName($providerInstallationId); ['items' => $repos, 'total' => $total] = $vcs->searchRepositories($owner, $page, $limit, $search); $repos = \array_map(function ($repo) use ($installation) { From 07db322935e73a96b2251a7107d94a6490ba97fd Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 23 Jul 2026 12:09:11 +0100 Subject: [PATCH 09/18] chore(storage): update utopia-php/storage to 3.1.0 --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index c598d5ec66..56e88d11dd 100644 --- a/composer.json +++ b/composer.json @@ -91,7 +91,7 @@ "utopia-php/queue": "^0.22", "utopia-php/servers": "0.4.*", "utopia-php/registry": "0.5.*", - "utopia-php/storage": "3.*", + "utopia-php/storage": "^3.1", "utopia-php/system": "0.10.*", "utopia-php/telemetry": "^0.4", "utopia-php/user-agent": "0.1.*", diff --git a/composer.lock b/composer.lock index 53a4259e66..d543a8dac7 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": "7a2821539fc6e6063587e38e3eca19c4", + "content-hash": "45a96f275db3fcab689375890cd5b41d", "packages": [ { "name": "adhocore/jwt", @@ -4931,16 +4931,16 @@ }, { "name": "utopia-php/storage", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "171746978543323c2536edacd8ad8e8d3fde401c" + "reference": "38bfc0c14a16a7de2a86b3331865dad1230ed739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/171746978543323c2536edacd8ad8e8d3fde401c", - "reference": "171746978543323c2536edacd8ad8e8d3fde401c", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/38bfc0c14a16a7de2a86b3331865dad1230ed739", + "reference": "38bfc0c14a16a7de2a86b3331865dad1230ed739", "shasum": "" }, "require": { @@ -4975,9 +4975,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/3.0.0" + "source": "https://github.com/utopia-php/storage/tree/3.1.0" }, - "time": "2026-07-20T13:15:54+00:00" + "time": "2026-07-22T15:57:57+00:00" }, { "name": "utopia-php/system", From 78c3c6b4cd4b9489fd998646c9ba7b2ec20a83b4 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 17:57:56 +0530 Subject: [PATCH 10/18] Bump utopia-php/vcs to pick up native /namespaces endpoint fix --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 1ddbaad483..7ce9721b91 100644 --- a/composer.lock +++ b/composer.lock @@ -5169,12 +5169,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "8bd586e9eae0f622b1a728c5b0269369b3efdde2" + "reference": "2423618e32a1b3d0dd3e8e4327b5f85561d90cf3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/8bd586e9eae0f622b1a728c5b0269369b3efdde2", - "reference": "8bd586e9eae0f622b1a728c5b0269369b3efdde2", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/2423618e32a1b3d0dd3e8e4327b5f85561d90cf3", + "reference": "2423618e32a1b3d0dd3e8e4327b5f85561d90cf3", "shasum": "" }, "require": { @@ -5228,7 +5228,7 @@ "source": "https://github.com/utopia-php/vcs/tree/feat/gitlab-list-namespaces", "issues": "https://github.com/utopia-php/vcs/issues" }, - "time": "2026-07-23T07:17:43+00:00" + "time": "2026-07-23T12:23:30+00:00" }, { "name": "utopia-php/websocket", From 19f9a8824afed0d27c94ace98681baa31281bb79 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 19:02:49 +0530 Subject: [PATCH 11/18] Address VCS namespace review feedback --- docs/references/vcs/list-namespaces.md | 1 - .../Http/Installations/Namespaces/XList.php | 2 +- .../Http/Installations/Repositories/XList.php | 13 +++--- .../Queries/ProviderRepositories.php | 20 +++++++++ .../Validator/Query/ProviderOwner.php | 45 +++++++++++++++++++ 5 files changed, 72 insertions(+), 9 deletions(-) delete mode 100644 docs/references/vcs/list-namespaces.md create mode 100644 src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php create mode 100644 src/Appwrite/Utopia/Database/Validator/Query/ProviderOwner.php diff --git a/docs/references/vcs/list-namespaces.md b/docs/references/vcs/list-namespaces.md deleted file mode 100644 index 51b09caaea..0000000000 --- a/docs/references/vcs/list-namespaces.md +++ /dev/null @@ -1 +0,0 @@ -Get a list of namespaces a VCS (Version Control System) installation can browse, such as the user's personal namespace and any groups they belong to. This is primarily useful for providers like GitLab, where a single OAuth authorization grants access to multiple namespaces with no per-installation selection step. For providers that already scope one installation to a single organization, this returns that organization as the only namespace. You can optionally filter namespaces using a search term. diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php index c01bf3c676..9849fcd451 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php @@ -41,7 +41,7 @@ class XList extends Action namespace: 'vcs', group: 'namespaces', name: 'list', - description: '/docs/references/vcs/list-namespaces.md', + description: 'List provider namespaces available to a VCS installation. This can include the user personal namespace and any groups or organizations the installation can browse.', auth: [AuthType::ADMIN], responses: [ new SDKResponse( diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php index c8769c728c..2eabb6dd88 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\ProviderRepositories; use Appwrite\Utopia\Response; use Appwrite\Vcs\Factory as VcsFactory; use Appwrite\Vcs\InstallationTokens; @@ -17,9 +18,6 @@ use Utopia\Config\Exceptions\Parse; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; -use Utopia\Database\Validator\Queries; -use Utopia\Database\Validator\Query\Limit; -use Utopia\Database\Validator\Query\Offset; use Utopia\Detector\Detection\Framework\Analog; use Utopia\Detector\Detection\Framework\Angular; use Utopia\Detector\Detection\Framework\Astro; @@ -97,8 +95,7 @@ class XList extends Action ->param('installationId', '', new Text(256), 'Installation Id') ->param('type', '', new WhiteList(['runtime', 'framework']), 'Detector type. Must be one of the following: runtime, framework', enum: new Enum(name: 'VCSDetectionType')) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) - ->param('providerNamespace', '', new Text(256), 'Namespace (personal account or group) to list repositories from, as returned by the namespaces endpoint\'s `path` field. Defaults to the installation\'s own namespace.', true) - ->param('queries', [], new Queries([new Limit(), new Offset()]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true) + ->param('queries', [], new ProviderRepositories(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit, offset, and equal on owner.', true) ->inject('vcsFactory') ->inject('installationTokens') ->inject('response') @@ -110,7 +107,6 @@ class XList extends Action string $installationId, string $type, string $search, - string $providerNamespace, array $queries, VcsFactory $vcsFactory, InstallationTokens $installationTokens, @@ -134,16 +130,19 @@ class XList extends Action $queries = Query::parseQueries($queries); $limitQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_LIMIT)); $offsetQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_OFFSET)); + $ownerQueries = array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_EQUAL && $query->getAttribute() === 'owner'); $limit = !empty($limitQuery) ? $limitQuery->getValue() : 4; $offset = !empty($offsetQuery) ? $offsetQuery->getValue() : 0; + $ownerQuery = current($ownerQueries); + $providerOwner = !empty($ownerQuery) ? $ownerQuery->getValue('') : ''; if ($offset % $limit !== 0) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'offset must be a multiple of the limit'); } $page = ($offset / $limit) + 1; - $owner = !empty($providerNamespace) ? $providerNamespace : $vcs->getOwnerName($providerInstallationId); + $owner = !empty($providerOwner) ? $providerOwner : $vcs->getOwnerName($providerInstallationId); ['items' => $repos, 'total' => $total] = $vcs->searchRepositories($owner, $page, $limit, $search); $repos = \array_map(function ($repo) use ($installation) { diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php b/src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php new file mode 100644 index 0000000000..4713bd25e8 --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php @@ -0,0 +1,20 @@ +message = 'Query must be an instance of Query'; + return false; + } + + if ($value->getMethod() !== Query::TYPE_EQUAL) { + $this->message = 'Only equal queries are supported for owner'; + return false; + } + + if ($value->getAttribute() !== 'owner') { + $this->message = 'Only owner can be queried'; + return false; + } + + if (\count($value->getValues()) !== 1) { + $this->message = 'Owner query must have exactly one value'; + return false; + } + + if (!(new Text(256))->isValid($value->getValue())) { + $this->message = 'Owner query value must be a string with a maximum length of 256 characters'; + return false; + } + + return true; + } +} From bcfdbc829ed4346862dcb1ed0ac33a45200d325a Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 19:17:42 +0530 Subject: [PATCH 12/18] Address VCS namespace review feedback Rename owner terminology to namespace across the repositories listing endpoint, rename ProviderOwner/ProviderRepositories validators to VcsNamespace/VcsRepositories, rename VcsNamespace model's kind/id fields to type/$id, and relax the utopia-php/vcs composer constraint. --- composer.json | 2 +- .../Http/Installations/Namespaces/XList.php | 11 +++- .../Http/Installations/Repositories/XList.php | 14 ++--- ...erRepositories.php => VcsRepositories.php} | 6 +-- .../{ProviderOwner.php => VcsNamespace.php} | 12 ++--- .../Utopia/Response/Model/VcsNamespace.php | 8 +-- .../Validator/Queries/VcsRepositoriesTest.php | 41 ++++++++++++++ .../Validator/Query/VcsNamespaceTest.php | 54 +++++++++++++++++++ 8 files changed, 125 insertions(+), 23 deletions(-) rename src/Appwrite/Utopia/Database/Validator/Queries/{ProviderRepositories.php => VcsRepositories.php} (70%) rename src/Appwrite/Utopia/Database/Validator/Query/{ProviderOwner.php => VcsNamespace.php} (71%) create mode 100644 tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php create mode 100644 tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php diff --git a/composer.json b/composer.json index 6baa6b6123..c0c528c006 100644 --- a/composer.json +++ b/composer.json @@ -100,7 +100,7 @@ "utopia-php/telemetry": "^0.4", "utopia-php/user-agent": "0.1.*", "mustangostang/spyc": "0.6.*", - "utopia-php/vcs": "^4.4.5", + "utopia-php/vcs": "4.*.*", "utopia-php/websocket": "1.0.*", "dragonmantank/cron-expression": "3.4.*", "phpmailer/phpmailer": "6.9.*", diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php index 9849fcd451..b5c409ebc7 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php @@ -99,15 +99,22 @@ class XList extends Action if (\method_exists($vcs, 'listNamespaces')) { ['items' => $namespaces, 'total' => $total] = $vcs->listNamespaces($page, $limit, $search); + $namespaces = \array_map(fn ($namespace) => [ + '$id' => $namespace['id'] ?? '', + 'name' => $namespace['name'] ?? '', + 'path' => $namespace['path'] ?? '', + 'type' => ($namespace['kind'] ?? '') === 'user' ? 'user' : 'organization', + 'avatarUrl' => $namespace['avatarUrl'] ?? '', + ], $namespaces); } else { $providerInstallationId = $installation->getAttribute('providerInstallationId', ''); $owner = $vcs->getOwnerName($providerInstallationId); $matches = empty($search) || \stripos($owner, $search) !== false; $namespaces = $matches ? [[ - 'id' => $providerInstallationId, + '$id' => $providerInstallationId, 'name' => $owner, 'path' => $owner, - 'kind' => $installation->getAttribute('personal', false) ? 'user' : 'organization', + 'type' => $installation->getAttribute('personal', false) ? 'user' : 'organization', 'avatarUrl' => '', ]] : []; $total = \count($namespaces); diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php index 2eabb6dd88..fc7059ccb0 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php @@ -7,7 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; -use Appwrite\Utopia\Database\Validator\Queries\ProviderRepositories; +use Appwrite\Utopia\Database\Validator\Queries\VcsRepositories; use Appwrite\Utopia\Response; use Appwrite\Vcs\Factory as VcsFactory; use Appwrite\Vcs\InstallationTokens; @@ -95,7 +95,7 @@ class XList extends Action ->param('installationId', '', new Text(256), 'Installation Id') ->param('type', '', new WhiteList(['runtime', 'framework']), 'Detector type. Must be one of the following: runtime, framework', enum: new Enum(name: 'VCSDetectionType')) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) - ->param('queries', [], new ProviderRepositories(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit, offset, and equal on owner.', true) + ->param('queries', [], new VcsRepositories(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit, offset, and equal on namespace.', true) ->inject('vcsFactory') ->inject('installationTokens') ->inject('response') @@ -130,20 +130,20 @@ class XList extends Action $queries = Query::parseQueries($queries); $limitQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_LIMIT)); $offsetQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_OFFSET)); - $ownerQueries = array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_EQUAL && $query->getAttribute() === 'owner'); + $namespaceQueries = array_filter($queries, fn ($query) => $query->getMethod() === Query::TYPE_EQUAL && $query->getAttribute() === 'namespace'); $limit = !empty($limitQuery) ? $limitQuery->getValue() : 4; $offset = !empty($offsetQuery) ? $offsetQuery->getValue() : 0; - $ownerQuery = current($ownerQueries); - $providerOwner = !empty($ownerQuery) ? $ownerQuery->getValue('') : ''; + $namespaceQuery = current($namespaceQueries); + $providerNamespace = !empty($namespaceQuery) ? $namespaceQuery->getValue('') : ''; if ($offset % $limit !== 0) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'offset must be a multiple of the limit'); } $page = ($offset / $limit) + 1; - $owner = !empty($providerOwner) ? $providerOwner : $vcs->getOwnerName($providerInstallationId); - ['items' => $repos, 'total' => $total] = $vcs->searchRepositories($owner, $page, $limit, $search); + $namespace = !empty($providerNamespace) ? $providerNamespace : $vcs->getOwnerName($providerInstallationId); + ['items' => $repos, 'total' => $total] = $vcs->searchRepositories($namespace, $page, $limit, $search); $repos = \array_map(function ($repo) use ($installation) { $repo['id'] = \strval($repo['id'] ?? ''); diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php b/src/Appwrite/Utopia/Database/Validator/Queries/VcsRepositories.php similarity index 70% rename from src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php rename to src/Appwrite/Utopia/Database/Validator/Queries/VcsRepositories.php index 4713bd25e8..ada47ff42e 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/ProviderRepositories.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/VcsRepositories.php @@ -2,19 +2,19 @@ namespace Appwrite\Utopia\Database\Validator\Queries; -use Appwrite\Utopia\Database\Validator\Query\ProviderOwner; +use Appwrite\Utopia\Database\Validator\Query\VcsNamespace; use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; -class ProviderRepositories extends Queries +class VcsRepositories extends Queries { public function __construct() { parent::__construct([ new Limit(), new Offset(), - new ProviderOwner(), + new VcsNamespace(), ]); } } diff --git a/src/Appwrite/Utopia/Database/Validator/Query/ProviderOwner.php b/src/Appwrite/Utopia/Database/Validator/Query/VcsNamespace.php similarity index 71% rename from src/Appwrite/Utopia/Database/Validator/Query/ProviderOwner.php rename to src/Appwrite/Utopia/Database/Validator/Query/VcsNamespace.php index 6a61b8972d..87486bd758 100644 --- a/src/Appwrite/Utopia/Database/Validator/Query/ProviderOwner.php +++ b/src/Appwrite/Utopia/Database/Validator/Query/VcsNamespace.php @@ -6,7 +6,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Query\Base; use Utopia\Validator\Text; -class ProviderOwner extends Base +class VcsNamespace extends Base { public function getMethodType(): string { @@ -21,22 +21,22 @@ class ProviderOwner extends Base } if ($value->getMethod() !== Query::TYPE_EQUAL) { - $this->message = 'Only equal queries are supported for owner'; + $this->message = 'Only equal queries are supported for namespace'; return false; } - if ($value->getAttribute() !== 'owner') { - $this->message = 'Only owner can be queried'; + if ($value->getAttribute() !== 'namespace') { + $this->message = 'Only namespace can be queried'; return false; } if (\count($value->getValues()) !== 1) { - $this->message = 'Owner query must have exactly one value'; + $this->message = 'Namespace query must have exactly one value'; return false; } if (!(new Text(256))->isValid($value->getValue())) { - $this->message = 'Owner query value must be a string with a maximum length of 256 characters'; + $this->message = 'Namespace query value must be a string with a maximum length of 256 characters'; return false; } diff --git a/src/Appwrite/Utopia/Response/Model/VcsNamespace.php b/src/Appwrite/Utopia/Response/Model/VcsNamespace.php index dc0f38b07c..2903552668 100644 --- a/src/Appwrite/Utopia/Response/Model/VcsNamespace.php +++ b/src/Appwrite/Utopia/Response/Model/VcsNamespace.php @@ -10,7 +10,7 @@ class VcsNamespace extends Model public function __construct() { $this - ->addRule('id', [ + ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'VCS (Version Control System) namespace ID.', 'default' => '', @@ -24,13 +24,13 @@ class VcsNamespace extends Model ]) ->addRule('path', [ 'type' => self::TYPE_STRING, - 'description' => 'VCS (Version Control System) namespace path, used as the owner when listing repositories.', + 'description' => 'VCS (Version Control System) namespace path, used to filter repositories by namespace.', 'default' => '', 'example' => 'appwrite', ]) - ->addRule('kind', [ + ->addRule('type', [ 'type' => self::TYPE_STRING, - 'description' => 'Namespace kind. Either the user\'s personal namespace or a group/organization.', + 'description' => 'Namespace type. Either the user\'s personal namespace or a group/organization.', 'default' => '', 'example' => 'user', ]) diff --git a/tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php b/tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php new file mode 100644 index 0000000000..c59ecc35ee --- /dev/null +++ b/tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php @@ -0,0 +1,41 @@ +assertTrue($validator->isValid([]), $validator->getDescription()); + } + + public function testValidQueries(): void + { + $validator = new VcsRepositories(); + + $this->assertTrue($validator->isValid([Query::limit(25)]), $validator->getDescription()); + $this->assertTrue($validator->isValid([Query::offset(0)]), $validator->getDescription()); + $this->assertTrue($validator->isValid([Query::equal('namespace', ['appwrite'])]), $validator->getDescription()); + $this->assertTrue($validator->isValid([ + Query::limit(25), + Query::offset(0), + Query::equal('namespace', ['appwrite']), + ]), $validator->getDescription()); + } + + public function testInvalidQueries(): void + { + $validator = new VcsRepositories(); + + $this->assertFalse($validator->isValid([Query::equal('name', ['appwrite'])])); + $this->assertFalse($validator->isValid([Query::greaterThan('namespace', 'appwrite')])); + } +} diff --git a/tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php b/tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php new file mode 100644 index 0000000000..4f3f01a07b --- /dev/null +++ b/tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php @@ -0,0 +1,54 @@ +assertTrue($validator->isValid(Query::equal('namespace', ['appwrite'])), $validator->getDescription()); + } + + public function testInvalidNotQuery(): void + { + $validator = new VcsNamespace(); + + $this->assertFalse($validator->isValid('namespace')); + } + + public function testInvalidMethod(): void + { + $validator = new VcsNamespace(); + + $this->assertFalse($validator->isValid(Query::greaterThan('namespace', 'appwrite'))); + } + + public function testInvalidAttribute(): void + { + $validator = new VcsNamespace(); + + $this->assertFalse($validator->isValid(Query::equal('name', ['appwrite']))); + } + + public function testInvalidMultipleValues(): void + { + $validator = new VcsNamespace(); + + $this->assertFalse($validator->isValid(Query::equal('namespace', ['appwrite', 'utopia']))); + } + + public function testInvalidValueTooLong(): void + { + $validator = new VcsNamespace(); + + $this->assertFalse($validator->isValid(Query::equal('namespace', [\str_repeat('a', 257)]))); + } +} From 4bec2a30885406e80e0a2a8611c3595eeddaf371 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 19:20:47 +0530 Subject: [PATCH 13/18] Remove VCS query validator unit tests, no established coverage pattern for these classes --- .../Validator/Queries/VcsRepositoriesTest.php | 41 -------------- .../Validator/Query/VcsNamespaceTest.php | 54 ------------------- 2 files changed, 95 deletions(-) delete mode 100644 tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php delete mode 100644 tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php diff --git a/tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php b/tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php deleted file mode 100644 index c59ecc35ee..0000000000 --- a/tests/unit/Utopia/Database/Validator/Queries/VcsRepositoriesTest.php +++ /dev/null @@ -1,41 +0,0 @@ -assertTrue($validator->isValid([]), $validator->getDescription()); - } - - public function testValidQueries(): void - { - $validator = new VcsRepositories(); - - $this->assertTrue($validator->isValid([Query::limit(25)]), $validator->getDescription()); - $this->assertTrue($validator->isValid([Query::offset(0)]), $validator->getDescription()); - $this->assertTrue($validator->isValid([Query::equal('namespace', ['appwrite'])]), $validator->getDescription()); - $this->assertTrue($validator->isValid([ - Query::limit(25), - Query::offset(0), - Query::equal('namespace', ['appwrite']), - ]), $validator->getDescription()); - } - - public function testInvalidQueries(): void - { - $validator = new VcsRepositories(); - - $this->assertFalse($validator->isValid([Query::equal('name', ['appwrite'])])); - $this->assertFalse($validator->isValid([Query::greaterThan('namespace', 'appwrite')])); - } -} diff --git a/tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php b/tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php deleted file mode 100644 index 4f3f01a07b..0000000000 --- a/tests/unit/Utopia/Database/Validator/Query/VcsNamespaceTest.php +++ /dev/null @@ -1,54 +0,0 @@ -assertTrue($validator->isValid(Query::equal('namespace', ['appwrite'])), $validator->getDescription()); - } - - public function testInvalidNotQuery(): void - { - $validator = new VcsNamespace(); - - $this->assertFalse($validator->isValid('namespace')); - } - - public function testInvalidMethod(): void - { - $validator = new VcsNamespace(); - - $this->assertFalse($validator->isValid(Query::greaterThan('namespace', 'appwrite'))); - } - - public function testInvalidAttribute(): void - { - $validator = new VcsNamespace(); - - $this->assertFalse($validator->isValid(Query::equal('name', ['appwrite']))); - } - - public function testInvalidMultipleValues(): void - { - $validator = new VcsNamespace(); - - $this->assertFalse($validator->isValid(Query::equal('namespace', ['appwrite', 'utopia']))); - } - - public function testInvalidValueTooLong(): void - { - $validator = new VcsNamespace(); - - $this->assertFalse($validator->isValid(Query::equal('namespace', [\str_repeat('a', 257)]))); - } -} From 563c70db9562e9baa4d9b4c08fe18e859f75017d Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 23 Jul 2026 19:24:27 +0530 Subject: [PATCH 14/18] Regenerate composer.lock content-hash for relaxed utopia-php/vcs constraint --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 2e4f08c36e..fa94a2fb54 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": "e1219809bb21a3a8dc73aeb0d6107641", + "content-hash": "a811ab43bece6d9d01be1caab8a08a75", "packages": [ { "name": "adhocore/jwt", From 393bb7b8f71f568736e7b1960126575a8377480c Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Thu, 23 Jul 2026 19:27:26 +0530 Subject: [PATCH 15/18] Update src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matej Bačo --- .../Modules/VCS/Http/Installations/Namespaces/XList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php index b5c409ebc7..62b9172bc0 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Namespaces/XList.php @@ -40,7 +40,7 @@ class XList extends Action ->label('sdk', new Method( namespace: 'vcs', group: 'namespaces', - name: 'list', + name: 'listNamespaces', description: 'List provider namespaces available to a VCS installation. This can include the user personal namespace and any groups or organizations the installation can browse.', auth: [AuthType::ADMIN], responses: [ From ba22ec8c469b5f20a9e81ace7f02d4d93b1ce30b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 24 Jul 2026 13:52:18 +1200 Subject: [PATCH 16/18] fix(databases): route createAttribute DDL to the resolved database, not the project DB The databases worker resolves the collection's host database via getDatabasesDB($database) and passes it to deleteAttribute, createIndex and deleteIndex, but createAttribute was called with only $dbForProject. For a database whose collections live on a separate backing (e.g. a dedicated tablesdb/documentsdb/vectorsdb), the physical attribute DDL and its collection lookup then hit the shared project database, which doesn't hold the collection, and the column creation fails "Collection not found". Thread $dbForDatabases into createAttribute and run the createAttribute / createRelationship DDL on it, matching the sibling operations. For a non-dedicated database getDatabasesDB returns the project database, so this is a no-op there; the attributes metadata and cache purges stay on $dbForProject. Co-Authored-By: Claude Opus 4.8 --- .../Modules/Databases/Workers/Databases.php | 8 +- tests/unit/Platform/Workers/DatabasesTest.php | 91 +++++++++++++++++++ 2 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 tests/unit/Platform/Workers/DatabasesTest.php diff --git a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php index a6b13857a5..6dae0b15ae 100644 --- a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php +++ b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php @@ -93,7 +93,7 @@ class Databases extends Action match (\strval($type)) { DATABASE_TYPE_DELETE_DATABASE => $this->deleteDatabase($database, $dbForProject, $dbForDatabases), DATABASE_TYPE_DELETE_COLLECTION => $this->deleteCollection($database, $collection, $dbForProject, $dbForDatabases), - DATABASE_TYPE_CREATE_ATTRIBUTE => $this->createAttribute($database, $collection, $document, $project, $dbForPlatform, $dbForProject, $queueForRealtime), + DATABASE_TYPE_CREATE_ATTRIBUTE => $this->createAttribute($database, $collection, $document, $project, $dbForPlatform, $dbForProject, $dbForDatabases, $queueForRealtime), DATABASE_TYPE_DELETE_ATTRIBUTE => $this->deleteAttribute($database, $collection, $document, $project, $dbForPlatform, $dbForProject, $dbForDatabases, $queueForRealtime), DATABASE_TYPE_CREATE_INDEX => $this->createIndex($database, $collection, $document, $project, $dbForPlatform, $dbForProject, $dbForDatabases, $queueForRealtime), DATABASE_TYPE_DELETE_INDEX => $this->deleteIndex($database, $collection, $document, $project, $dbForPlatform, $dbForProject, $dbForDatabases, $queueForRealtime), @@ -108,6 +108,7 @@ class Databases extends Action * @param Document $project * @param Database $dbForPlatform * @param Database $dbForProject + * @param Database $dbForDatabases * @param Realtime $queueForRealtime * @return void * @throws Authorization @@ -122,6 +123,7 @@ class Databases extends Action Document $project, Database $dbForPlatform, Database $dbForProject, + Database $dbForDatabases, Realtime $queueForRealtime ): void { if ($collection->isEmpty()) { @@ -183,7 +185,7 @@ class Databases extends Action } if ( - !$dbForProject->createRelationship( + !$dbForDatabases->createRelationship( collection: 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), relatedCollection: 'database_' . $database->getSequence() . '_collection_' . $relatedCollection->getSequence(), type: $options['relationType'], @@ -202,7 +204,7 @@ class Databases extends Action } break; default: - if (!$dbForProject->createAttribute('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $key, $type, $size, $required, $default, $signed, $array, $format, $formatOptions, $filters)) { + if (!$dbForDatabases->createAttribute('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $key, $type, $size, $required, $default, $signed, $array, $format, $formatOptions, $filters)) { throw new Exception('Failed to create attribute/column'); } } diff --git a/tests/unit/Platform/Workers/DatabasesTest.php b/tests/unit/Platform/Workers/DatabasesTest.php new file mode 100644 index 0000000000..4449393fcf --- /dev/null +++ b/tests/unit/Platform/Workers/DatabasesTest.php @@ -0,0 +1,91 @@ + 'attr1', + 'key' => 'note', + 'type' => Database::VAR_STRING, + 'size' => 64, + 'required' => false, + 'default' => null, + ]); + + // The shared project DB owns the `attributes` metadata but must never + // receive the collection DDL for a dedicated backing. + $dbForProject = $this->createMock(Database::class); + $dbForProject->method('getDocument')->willReturnCallback( + fn (string $collection, string $id) => $collection === 'attributes' ? $attribute : new Document() + ); + $dbForProject->method('updateDocument')->willReturnArgument(2); + $dbForProject->expects($this->never())->method('createAttribute'); + + $dbForPlatform = $this->createMock(Database::class); + $dbForPlatform->method('getDocument')->willReturn(new Document(['$id' => 'proj1'])); + + // The resolved (dedicated) backing must receive the physical DDL. + $dbForDatabases = $this->createMock(Database::class); + $dbForDatabases->expects($this->once()) + ->method('createAttribute') + ->willReturn(true); + + $worker = new class () extends Databases { + protected function trigger( + Document $database, + Document $collection, + Document $project, + string $event, + Realtime $queueForRealtime, + Document|null $attribute = null, + Document|null $index = null, + ): void { + } + }; + + $message = new Message([ + 'pid' => 'pid', + 'queue' => 'v1-databases', + 'timestamp' => \time(), + 'payload' => [ + 'type' => DATABASE_TYPE_CREATE_ATTRIBUTE, + 'database' => ['$id' => 'db1', '$sequence' => '30360'], + 'collection' => ['$id' => 'proof', '$sequence' => '1'], + 'document' => ['$id' => 'attr1'], + ], + ]); + + $worker->action( + $message, + new Document(['$id' => 'proj1']), + $dbForPlatform, + $dbForProject, + static fn () => $dbForDatabases, + $this->createStub(Realtime::class), + $this->createStub(Log::class), + ); + } +} From f0862538ee86b71137788a73a011c7f8560de24b Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 24 Jul 2026 12:52:07 +0530 Subject: [PATCH 17/18] Accept providerNamespace on createRepository to create in a GitLab group Mirrors the listRepositories fix: without this, a GitLab user with groups could only ever create new repos in their personal namespace, since createRepository always resolved the owner from the installation itself. --- src/Appwrite/Auth/OAuth2/Gitea.php | 2 +- src/Appwrite/Auth/OAuth2/Github.php | 2 +- src/Appwrite/Auth/OAuth2/Gitlab.php | 12 +++++++++--- .../VCS/Http/Installations/Repositories/Create.php | 10 ++++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Auth/OAuth2/Gitea.php b/src/Appwrite/Auth/OAuth2/Gitea.php index 390189fc72..3494c3b622 100644 --- a/src/Appwrite/Auth/OAuth2/Gitea.php +++ b/src/Appwrite/Auth/OAuth2/Gitea.php @@ -137,7 +137,7 @@ class Gitea extends OAuth2 return $this->user; } - public function createRepository(string $accessToken, string $repositoryName, bool $private): array + public function createRepository(string $accessToken, string $repositoryName, bool $private, string $namespaceId = ''): array { $repository = $this->request('POST', $this->endpoint . '/api/v1/user/repos', ['Authorization: token ' . $accessToken, 'Content-Type: application/json'], \json_encode([ 'name' => $repositoryName, diff --git a/src/Appwrite/Auth/OAuth2/Github.php b/src/Appwrite/Auth/OAuth2/Github.php index f80c067daa..d8f6bfaa6d 100644 --- a/src/Appwrite/Auth/OAuth2/Github.php +++ b/src/Appwrite/Auth/OAuth2/Github.php @@ -235,7 +235,7 @@ class Github extends OAuth2 return $this->user; } - public function createRepository(string $accessToken, string $repositoryName, bool $private): array + public function createRepository(string $accessToken, string $repositoryName, bool $private, string $namespaceId = ''): array { $repository = $this->request('POST', 'https://api.github.com/user/repos', ['Authorization: token ' . \urlencode($accessToken)], \json_encode([ 'name' => $repositoryName, diff --git a/src/Appwrite/Auth/OAuth2/Gitlab.php b/src/Appwrite/Auth/OAuth2/Gitlab.php index fb6244bb52..db72385a12 100644 --- a/src/Appwrite/Auth/OAuth2/Gitlab.php +++ b/src/Appwrite/Auth/OAuth2/Gitlab.php @@ -183,12 +183,18 @@ class Gitlab extends OAuth2 * * @return array */ - public function createRepository(string $accessToken, string $repositoryName, bool $private): array + public function createRepository(string $accessToken, string $repositoryName, bool $private, string $namespaceId = ''): array { - $repository = $this->request('POST', $this->getEndpoint() . '/api/v4/projects', ['Authorization: Bearer ' . $accessToken, 'Content-Type: application/json'], \json_encode([ + $payload = [ 'name' => $repositoryName, 'visibility' => $private ? 'private' : 'public', - ])); + ]; + + if (!empty($namespaceId)) { + $payload['namespace_id'] = (int) $namespaceId; + } + + $repository = $this->request('POST', $this->getEndpoint() . '/api/v4/projects', ['Authorization: Bearer ' . $accessToken, 'Content-Type: application/json'], \json_encode($payload)); $repository = \json_decode($repository, true) ?? []; diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Create.php index 1277f44373..d8dae58f3b 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Create.php @@ -51,6 +51,7 @@ class Create extends Action ->param('installationId', '', new Text(256), 'Installation Id') ->param('name', '', new Text(256), 'Repository name (slug)') ->param('private', '', new Boolean(false), 'Mark repository public or private') + ->param('providerNamespace', '', new Text(256), 'Namespace of the git repository. Defaults to the installation\'s own namespace.', true) ->inject('vcsFactory') ->inject('installationTokens') ->inject('user') @@ -63,6 +64,7 @@ class Create extends Action string $installationId, string $name, bool $private, + string $providerNamespace, VcsFactory $vcsFactory, InstallationTokens $installationTokens, Document $user, @@ -99,14 +101,18 @@ class Create extends Action $accessToken = $installation->getAttribute('personalAccessToken'); try { - $repository = $oauth2->createRepository($accessToken, $name, $private); + if (!empty($providerNamespace)) { + $repository = $oauth2->createRepository($accessToken, $name, $private, $providerNamespace); + } else { + $repository = $oauth2->createRepository($accessToken, $name, $private); + } } catch (\Throwable $exception) { throw new Exception(Exception::GENERAL_PROVIDER_FAILURE, "VCS provider failed to process the request: " . $exception->getMessage()); } } else { $providerInstallationId = $installation->getAttribute('providerInstallationId'); $vcs = $vcsFactory->fromInstallation($installation); - $owner = $vcs->getOwnerName($providerInstallationId); + $owner = !empty($providerNamespace) ? $providerNamespace : $vcs->getOwnerName($providerInstallationId); try { $repository = $vcs->createRepository($owner, $name, $private); From a3d3d3476e56f5519f8f0a2a029b07dc2590185f Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 24 Jul 2026 12:18:59 +0100 Subject: [PATCH 18/18] chore(builds): bump orchestrator jobs-service and job-sidecar to 0.13.0 Co-Authored-By: Claude Fable 5 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c6b0330ee0..a23a2e1b8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1239,7 +1239,7 @@ services: options: max-file: "5" max-size: 10m - image: ghcr.io/open-runtimes/orchestrator/jobs-service:0.8.0 + image: ghcr.io/open-runtimes/orchestrator/jobs-service:0.13.0 restart: unless-stopped user: root networks: @@ -1250,7 +1250,7 @@ services: - ORCHESTRATOR_BACKEND=docker - ORCHESTRATOR_NETWORK=appwrite - ARTIFACT_ENDPOINT=http://orchestrator-jobs:8080 - - JOB_SIDECAR_IMAGE=ghcr.io/open-runtimes/orchestrator/job-sidecar:0.8.0 + - JOB_SIDECAR_IMAGE=ghcr.io/open-runtimes/orchestrator/job-sidecar:0.13.0 mariadb: image: mariadb:10.11