From ae6ae92c7ec6834937f3d32b39c56883a9e23556 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sat, 17 Oct 2026 09:40:09 +0100 Subject: [PATCH] fix(ruby,node,python): declare the runtimes the generated packages support The gemspec named no Ruby floor although the code targets 2.7 and the e2e matrix starts there. The Node package.json had no engines field although undici 6 requires Node 18.17, so older runtimes installed it and failed at load. The Python classifiers stopped at 3.12 while the e2e matrix also runs 3.13. --- templates/node/package-lock.json.twig | 3 ++ templates/node/package.json.twig | 3 ++ templates/python/pyproject.toml.twig | 1 + templates/python/setup.py.twig | 1 + templates/ruby/gemspec.twig | 1 + tests/generation/GenerationTest.php | 54 +++++++++++++++++++++++++++ 6 files changed, 63 insertions(+) diff --git a/templates/node/package-lock.json.twig b/templates/node/package-lock.json.twig index c30d0be602..23186c5036 100644 --- a/templates/node/package-lock.json.twig +++ b/templates/node/package-lock.json.twig @@ -26,6 +26,9 @@ "typescript": "5.9.3", "typescript-eslint": "8.70.0" }, + "engines": { + "node": ">=18.17" + }, "overrides": { "esbuild": "^0.28.1", "js-yaml": "^4.2.0", diff --git a/templates/node/package.json.twig b/templates/node/package.json.twig index dd6f8e6146..90aeba1132 100644 --- a/templates/node/package.json.twig +++ b/templates/node/package.json.twig @@ -15,6 +15,9 @@ "lint:fix": "eslint --fix .", "analyse": "tsc --noEmit" }, + "engines": { + "node": ">=18.17" + }, "exports": { ".": { "import": { diff --git a/templates/python/pyproject.toml.twig b/templates/python/pyproject.toml.twig index 8b58432faf..083792aef8 100644 --- a/templates/python/pyproject.toml.twig +++ b/templates/python/pyproject.toml.twig @@ -30,6 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] [project.optional-dependencies] diff --git a/templates/python/setup.py.twig b/templates/python/setup.py.twig index 7b62345559..5b08018e24 100644 --- a/templates/python/setup.py.twig +++ b/templates/python/setup.py.twig @@ -35,5 +35,6 @@ setuptools.setup( 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', ], ) diff --git a/templates/ruby/gemspec.twig b/templates/ruby/gemspec.twig index 6a17f42f14..550fe9a203 100644 --- a/templates/ruby/gemspec.twig +++ b/templates/ruby/gemspec.twig @@ -7,6 +7,7 @@ Gem::Specification.new do |spec| spec.homepage = '{{ spec.info.contact.url }}' spec.email = '{{ spec.info.contact.email }}' spec.files = Dir['lib/**/*.rb'] + spec.required_ruby_version = '>= 2.7' spec.add_dependency 'mime-types', '~> 3.4.1' end diff --git a/tests/generation/GenerationTest.php b/tests/generation/GenerationTest.php index 0c7e488490..3c5a251121 100644 --- a/tests/generation/GenerationTest.php +++ b/tests/generation/GenerationTest.php @@ -110,6 +110,39 @@ final class GenerationTest extends TestCase 'rust' => ['src/enums/webhook_event.rs', 'pub const UserCreated', 'src/enums/localized_status.rs', 'Value1,', 'src/enums/province_type.rs', 'Capital,'], ]; + /** + * Package metadata each language must declare, by generated path: the + * runtime floor its code and dependencies need, and every interpreter + * version the e2e suite runs it on. + * + * @var array>> + */ + private const array PACKAGE_METADATA = [ + 'ruby' => [ + 'appwrite.gemspec' => ["spec.required_ruby_version = '>= 2.7'"], + ], + 'node' => [ + 'package.json' => ['"engines": {', '"node": ">=18.17"'], + 'package-lock.json' => ['"engines": {', '"node": ">=18.17"'], + ], + 'python' => [ + 'setup.py' => [ + "'Programming Language :: Python :: 3.9'", + "'Programming Language :: Python :: 3.10'", + "'Programming Language :: Python :: 3.11'", + "'Programming Language :: Python :: 3.12'", + "'Programming Language :: Python :: 3.13'", + ], + 'pyproject.toml' => [ + '"Programming Language :: Python :: 3.9"', + '"Programming Language :: Python :: 3.10"', + '"Programming Language :: Python :: 3.11"', + '"Programming Language :: Python :: 3.12"', + '"Programming Language :: Python :: 3.13"', + ], + ], + ]; + /** @var array> generated tree per language and platform */ private static array $generated = []; @@ -687,6 +720,27 @@ public function testEnumsAreDeclared(string $name): void } } + /** @return iterable */ + public static function packageLanguages(): iterable + { + foreach (\array_keys(self::PACKAGE_METADATA) as $name) { + yield $name => [$name]; + } + } + + #[DataProvider('packageLanguages')] + public function testPackageMetadataIsDeclared(string $name): void + { + $files = $this->generate($name, 'server'); + + foreach (self::PACKAGE_METADATA[$name] as $path => $declarations) { + $this->assertArrayHasKey($path, $files, "{$name} did not generate {$path}"); + foreach ($declarations as $declaration) { + $this->assertStringContainsString(\strtolower($declaration), $files[$path], "{$name}: {$path} lacks `{$declaration}`"); + } + } + } + /** * Twig autoescapes to HTML, so a description that reaches a template through * an unsafe filter arrives as `"` rather than `"`. Go doc comments are