Skip to content

Separate specifications#10849

Merged
Meldiron merged 6 commits intofeat-1.8.x-new-schemafrom
feat-separate-specifications
Nov 24, 2025
Merged

Separate specifications#10849
Meldiron merged 6 commits intofeat-1.8.x-new-schemafrom
feat-separate-specifications

Conversation

@Meldiron
Copy link
Copy Markdown
Contributor

What does this PR do?

Separates build and runtime specs

Test Plan

Updated tests

Related PRs and Issues

x

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 20, 2025

📝 Walkthrough

Walkthrough

The PR splits the single specification attribute into two fields: buildSpecification (for deployment/builds) and runtimeSpecification (for executions). Updates touch configuration (collections), request/response filters (V21 request conversion; new Response V21 and added Response V20 imports/ordering), HTTP handlers and method signatures for Functions and Sites (create/update), worker paths for builds/executions, response models (Func, Site), and many tests/fixtures. Request parsing converts legacy specification to the new shape; response filters map the new fields back for older client response formats. Tests updated to assert the new fields and adjusted resource behavior.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention during review:

  • Method signature and parameter binding changes in Functions and Sites Create/Update handlers — verify all call sites, action routing, and constructor param definitions were updated consistently.
  • Enforcement of cold start / deployment invalidation logic — ensure comparisons now check both buildSpecification and runtimeSpecification and handle missing deployments identically to prior behavior.
  • Request V21 conversion (convertSpecs) and new Response V21 filter behavior plus Response V20/V21 ordering — validate round-trip mapping for MODEL_FUNCTION(S) and MODEL_SITE(S) across response format versions.
  • Worker paths and execution code that select specs — ensure runtime selection now reads runtimeSpecification while build flows read buildSpecification.
  • Response model changes (Func, Site) — confirm rule identifiers, descriptions, defaults, and examples align with the new fields and tests.
  • Large test changes (e2e and service tests) — check assertions for expected CPU/memory values and response shapes for potential mismatches.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Separate specifications' directly and clearly summarizes the main change: splitting a single specification field into separate build and runtime specifications.
Description check ✅ Passed The description 'Separates build and runtime specs' is directly related to the changeset and clearly conveys the main purpose of the PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-separate-specifications

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7444f5c and 5817aea.

📒 Files selected for processing (2)
  • app/controllers/general.php (3 hunks)
  • tests/e2e/General/UsageTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/General/UsageTest.php
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-18T07:42:08.734Z
Learnt from: atharvadeosthale
Repo: appwrite/appwrite PR: 10486
File: src/Appwrite/Utopia/Request/Filters/V21.php:25-33
Timestamp: 2025-09-18T07:42:08.734Z
Learning: In Appwrite's V21 request filter for backward compatibility, clients will never send both old (`version`) and new (`type`/`reference`) parameters simultaneously - they use either the old 1.8.0 format or the new 1.8.1+ format, not a mix of both.

Applied to files:

  • app/controllers/general.php
🧬 Code graph analysis (1)
app/controllers/general.php (5)
src/Appwrite/Utopia/Request/Filters/V20.php (1)
  • V20 (12-203)
src/Appwrite/Utopia/Response/Filters/V20.php (1)
  • V20 (8-26)
src/Appwrite/Utopia/Response/Filters/V21.php (1)
  • V21 (9-51)
src/Appwrite/Utopia/Request/Filters/V21.php (1)
  • V21 (7-51)
src/Appwrite/Utopia/Request.php (1)
  • addFilter (88-91)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: scan
🔇 Additional comments (3)
app/controllers/general.php (3)

28-35: Response V20/V21 imports correctly wired

The new ResponseV20 and ResponseV21 imports are consistent with their later usage in the response-format block and with existing request filter aliases; no issues here.


309-311: Using runtimeSpecification for execution spec is aligned with new schema

Switching $spec to be derived from runtimeSpecification matches this router’s responsibility (actual execution + compute metrics) and the new build/runtime split. Just ensure migrations/backfills always set runtimeSpecification (or omit it entirely) so you don’t end up indexing Config::getParam('specifications') with an empty or unexpected key on older resources.


1039-1058: Response filter chain for legacy formats looks correct; confirm spec mapping choice

The new response-format logic:

  • Applies ResponseV21 for any x-appwrite-response-format < 1.9.0, so older SDKs keep seeing a single specification field.
  • Adds ResponseV20 for formats < 1.8.0, preserving the existing $sequence removal behavior.
  • Keeps V19–V16 in descending version order, so the overall chain V21 → V20 → V19 → V18 → V17 → V16 remains consistent with the request-side filters.

This ordering should correctly transform 1.9+ internals down to any earlier response format. One thing to double‑check across the PR: ResponseV21::parseSpecs() currently maps specification from buildSpecification, while runtime execution here reads from runtimeSpecification; if you ever allow those to diverge, older clients will see the build spec, not the runtime spec. Please confirm that’s the intended compatibility behavior.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 20, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
imagemagick 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-c++ 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-dev 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-heic 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-jpeg 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-jxl 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-libs 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-openexr 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-webp 7.1.2.3-r0 CVE-2025-62171 HIGH
libecpg 17.6-r0 CVE-2025-12818 HIGH
libecpg-dev 17.6-r0 CVE-2025-12818 HIGH
libpq 17.6-r0 CVE-2025-12818 HIGH
libpq-dev 17.6-r0 CVE-2025-12818 HIGH
libxml2 2.13.8-r0 CVE-2025-49794 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49796 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49795 HIGH
libxml2 2.13.8-r0 CVE-2025-6021 HIGH
postgresql17-dev 17.6-r0 CVE-2025-12818 HIGH
github.com/containerd/containerd/v2 v2.0.2 CVE-2024-25621 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH
stdlib 1.22.10 CVE-2025-58183 HIGH
stdlib 1.22.10 CVE-2025-58186 HIGH
stdlib 1.22.10 CVE-2025-58187 HIGH
stdlib 1.22.10 CVE-2025-58188 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (7)
tests/e2e/General/UsageTest.php (1)

942-944: Function creation specs wiring looks correct

Using both buildSpecification and runtimeSpecification in the payload aligns with the new Functions.Create contract; constants and field names look consistent. You might later want to either adjust the comment or the values to actually exercise differing specs, but that’s purely optional.

tests/e2e/Services/Sites/SitesCustomServerTest.php (2)

36-72: Specs listing test is aligned with the new API

The use of buildSpecification and runtimeSpecification in creation and assertions matches the new schema and exercises both valid and invalid values. If you ever expect environments with a single spec configured, you may want to assert index 1 exists before using it, but with current defaults this is acceptable.


1292-1359: Runtime spec update and validation tests look consistent

Updating runtimeSpecification and then asserting both the stored value and the error messages for invalid buildSpecification / runtimeSpecification align with how the validators are expected to behave. Only very minor nits: the comment “Change the function specs” is slightly misleading in a sites test, and the hard‑coded error message prefixes must stay in sync with the validator text, but that’s in line with existing patterns.

src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (1)

81-93: Site create: spec parameters are correct; minor wording nit

buildSpecification and runtimeSpecification are set up consistently with the compute base (default via plan‑aware getDefaultSpecification, Specification validator, injected plan) and persisted under matching document keys. That part looks good.

Only nit is the description string:

), 'Runtime specification for the function SSR executions.'

which could be updated to drop “function” to avoid confusion in a sites context.

-            ), 'Runtime specification for the function SSR executions.', true, ['plan'])
+            ), 'Runtime specification for SSR executions.', true, ['plan'])

Also applies to: 120-121, 172-173

tests/e2e/Services/Functions/FunctionsCustomServerTest.php (1)

35-68: Guard against assuming at least two specs in testListSpecs

The test indexes both specifications[0] and specifications[1] but only asserts that index 0 exists. If config is ever reduced to a single specification, this will notice via a PHP notice rather than a clean assertion failure.

Consider explicitly asserting there are at least two specs before using index 1, e.g. assertGreaterThanOrEqual(2, $specifications['body']['specifications']);.

src/Appwrite/Platform/Workers/Functions.php (1)

359-359: Use of runtimeSpecification here matches new separation

Switching to $function->getAttribute('runtimeSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT) is consistent with using build specs for builds and runtime specs for executions; downstream usage of $spec (env vars, executor resources, metrics) remains valid.

If you ever harden this path, consider guarding against unknown spec keys (e.g. falling back when Config::getParam('specifications') lacks the given index) to avoid notices/fatal errors on bad data.

src/Appwrite/Platform/Modules/Functions/Workers/Builds.php (1)

255-255: Build paths now consistently use buildSpecification

Both the build execution (buildDeployment) and usage accounting (sendUsage) now derive $spec from buildSpecification, which correctly separates build-time sizing from runtime sizing. The min-memory logic and metrics based on $spec['cpus']/$spec['memory'] remain coherent.

You may want to defensively handle unknown spec IDs (missing array key in Config::getParam('specifications')) with a fallback or explicit error, to avoid hard failures if data is corrupted or misconfigured.

Also applies to: 1357-1357

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4616a2e and 62173b8.

📒 Files selected for processing (14)
  • app/config/collections/projects.php (2 hunks)
  • app/controllers/general.php (1 hunks)
  • src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php (1 hunks)
  • src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php (3 hunks)
  • src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (4 hunks)
  • src/Appwrite/Platform/Modules/Functions/Workers/Builds.php (2 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (3 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (4 hunks)
  • src/Appwrite/Platform/Workers/Functions.php (1 hunks)
  • src/Appwrite/Utopia/Response/Model/Func.php (1 hunks)
  • src/Appwrite/Utopia/Response/Model/Site.php (1 hunks)
  • tests/e2e/General/UsageTest.php (1 hunks)
  • tests/e2e/Services/Functions/FunctionsCustomServerTest.php (8 hunks)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (6 hunks)
🧰 Additional context used
🧬 Code graph analysis (8)
src/Appwrite/Utopia/Response/Model/Site.php (1)
src/Appwrite/Utopia/Response/Model.php (1)
  • addRule (90-102)
tests/e2e/Services/Sites/SitesCustomServerTest.php (2)
tests/e2e/Services/Sites/SitesBase.php (7)
  • getSite (177-185)
  • createSite (107-115)
  • updateSite (117-125)
  • setupDeployment (36-83)
  • packageSite (239-251)
  • getDeployment (187-195)
  • cleanupSite (85-94)
tests/e2e/Services/Functions/FunctionsBase.php (3)
  • setupDeployment (35-67)
  • getDeployment (160-168)
  • createExecution (297-305)
src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (2)
src/Appwrite/GraphQL/Types/Mapper.php (1)
  • param (255-363)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
src/Appwrite/Utopia/Response/Model/Func.php (1)
src/Appwrite/Utopia/Response/Model.php (1)
  • addRule (90-102)
src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (2)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
src/Executor/Executor.php (1)
  • deleteRuntime (143-164)
src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (2)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
src/Executor/Executor.php (1)
  • deleteRuntime (143-164)
src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php (1)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
tests/e2e/Services/Functions/FunctionsCustomServerTest.php (2)
tests/e2e/Services/Functions/FunctionsBase.php (3)
  • getFunction (150-158)
  • cleanupFunction (69-78)
  • createFunction (80-88)
tests/e2e/Client.php (1)
  • Client (8-342)
🪛 PHPMD (2.15.0)
tests/e2e/Services/Sites/SitesCustomServerTest.php

3007-3007: Avoid unused local variables such as '$functionId'. (undefined)

(UnusedLocalVariable)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: scan
🔇 Additional comments (13)
src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php (1)

96-107: Function create: build/runtime spec parameters are wired correctly

The introduction of buildSpecification and runtimeSpecification mirrors the existing specification pattern: defaults via getDefaultSpecification($plan), validation via Specification, proper DI of plan, and the values are persisted under the expected keys on the function document. Signature updates and persistence look consistent with the rest of the module.

Also applies to: 145-147, 241-243

src/Appwrite/Utopia/Response/Model/Site.php (1)

164-176: Site response model updated to expose both build and runtime specs

Adding buildSpecification and runtimeSpecification with string type and APP_COMPUTE_SPECIFICATION_DEFAULT defaults cleanly reflects the new API surface. Descriptions for deployments vs SSR executions are clear; this matches how you’ve shaped the backend documents.

src/Appwrite/Utopia/Response/Model/Func.php (1)

179-190: Function response model correctly splits build vs runtime specs

Exposing buildSpecification alongside runtimeSpecification, both using APP_COMPUTE_SPECIFICATION_DEFAULT as default/example, matches the new persistence fields and clarifies the distinction between build and execution machine specs.

src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (3)

92-103: New build/runtime specification params are wired correctly

The parameter definitions for buildSpecification and runtimeSpecification correctly reuse getDefaultSpecification($plan) and the Specification validator with the same config/env inputs as elsewhere, and they’re marked as plan-dependent. This looks consistent with the rest of the compute module.


134-135: Action signature matches new parameters

The added string $buildSpecification and string $runtimeSpecification arguments line up with the new param definitions and downstream usage. No issues spotted with ordering or types.


286-287: Persisting build/runtime specs on the function document looks correct

Storing buildSpecification and runtimeSpecification alongside other function attributes in the update payload matches the new API surface and is consistent with the cold-start logic and tests.

tests/e2e/Services/Functions/FunctionsCustomServerTest.php (3)

1378-1425: Runtime spec update and validation coverage looks solid

The testUpdateSpecs changes exercising runtimeSpecification updates (1 vCPU / 1GB then 1 vCPU / 512MB) and validating the resulting APPWRITE_FUNCTION_CPUS/APPWRITE_FUNCTION_MEMORY values, plus the failure cases for invalid buildSpecification and runtimeSpecification messages, align well with the new semantics and error surface.

Also applies to: 1442-1465


2047-2083: Response-format compatibility tests correctly cover new spec fields

The extended testResponseFilters checks that:

  • 1.5.0 responses expose neither specification nor the new buildSpecification / runtimeSpecification fields,
  • 1.8.0 responses expose legacy specification but not the new fields, and
  • latest responses drop specification and include buildSpecification and runtimeSpecification.

This nicely protects backward-compat behavior across formats.


2233-2244: End-to-end build/runtime spec separation is well tested

testFunctionSpecifications now:

  • sets buildSpecification to S_2VCPU_2GB and runtimeSpecification to S_1VCPU_1GB,
  • asserts these values are echoed back in the function document,
  • verifies build logs contain 2048:2 (build-time resources), and
  • verifies runtime env reports APPWRITE_FUNCTION_MEMORY=1024 and APPWRITE_FUNCTION_CPUS=1.

This cleanly exercises the intended separation between build and runtime specs.

Also applies to: 2262-2263

app/config/collections/projects.php (2)

769-789: Functions: separated build/runtime specs look consistent

buildSpecification and runtimeSpecification are defined with identical shape, sane size (128), nullable, and defaulting to APP_COMPUTE_SPECIFICATION_DEFAULT, which matches how they’re read elsewhere. No issues from the schema side.

Please confirm there is a migration/patch that copies existing specification values into these two new attributes so old functions keep their configured specs after upgrade.


1204-1223: Sites: build/runtime spec attributes align with functions

The new buildSpecification / runtimeSpecification attributes for sites mirror the functions schema and are compatible with the way Builds and router() now read them. Looks correct.

src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php (1)

167-167: Execution API correctly switched to runtimeSpecification

Reading $spec from runtimeSpecification aligns this HTTP execution path with the worker and router, so all execution‑time CPU/memory and MB‑seconds metrics now consistently use the runtime spec instead of the build spec.

app/controllers/general.php (1)

308-308: Router now uses runtime spec for proxied executions

Using $resource->getAttribute('runtimeSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT) ensures the custom‑domain router aligns with the new build/runtime split: build paths use buildSpecification, while proxied executions (functions and sites) rely on the runtime spec for env vars, executor resources, and MB‑seconds metrics.

Please double‑check that all relevant resources (including older ones created before this change) have runtimeSpecification populated via defaults or migrations so routed traffic doesn’t silently revert to the global default spec.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 20, 2025

✨ Benchmark results

  • Requests per second: 1,200
  • Requests with 200 status code: 216,114
  • P99 latency: 0.161571933

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,200 1,217
200 216,114 219,172
P99 0.161571933 0.166259629

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (1)

85-96: Clarify runtimeSpecification description for sites

The new param wiring looks good, but the description still says “Runtime specification for the function SSR executions.” which is confusing in a sites endpoint.

Suggest aligning with the Site model wording:

-            ), 'Runtime specification for the function SSR executions.', true, ['plan'])
+            ), 'Runtime specification for the site SSR executions.', true, ['plan'])

(or simply “Runtime specification for SSR executions.” to match the model.)

src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (1)

81-92: Site creation specs are wired correctly; adjust runtime description

The new buildSpecification/runtimeSpecification params use the expected default resolver and validator and are persisted into the site document consistently; no functional issues.

Small wording tweak to avoid “function” terminology on a site endpoint:

-            ), 'Runtime specification for the function SSR executions.', true, ['plan'])
+            ), 'Runtime specification for the site SSR executions.', true, ['plan'])

(or match the model’s “Machine specification for SSR executions.”)

Also applies to: 119-120, 171-172

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62173b8 and cbb96f8.

📒 Files selected for processing (9)
  • app/controllers/general.php (3 hunks)
  • src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (4 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (3 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (4 hunks)
  • src/Appwrite/Utopia/Request/Filters/V21.php (2 hunks)
  • src/Appwrite/Utopia/Response/Filters/V21.php (1 hunks)
  • src/Appwrite/Utopia/Response/Model/Site.php (1 hunks)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (6 hunks)
  • tests/resources/sites/astro/src/pages/specs.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: atharvadeosthale
Repo: appwrite/appwrite PR: 10486
File: src/Appwrite/Utopia/Request/Filters/V21.php:25-33
Timestamp: 2025-09-18T07:42:08.734Z
Learning: In Appwrite's V21 request filter for backward compatibility, clients will never send both old (`version`) and new (`type`/`reference`) parameters simultaneously - they use either the old 1.8.0 format or the new 1.8.1+ format, not a mix of both.
📚 Learning: 2025-09-18T07:42:08.734Z
Learnt from: atharvadeosthale
Repo: appwrite/appwrite PR: 10486
File: src/Appwrite/Utopia/Request/Filters/V21.php:25-33
Timestamp: 2025-09-18T07:42:08.734Z
Learning: In Appwrite's V21 request filter for backward compatibility, clients will never send both old (`version`) and new (`type`/`reference`) parameters simultaneously - they use either the old 1.8.0 format or the new 1.8.1+ format, not a mix of both.

Applied to files:

  • app/controllers/general.php
  • src/Appwrite/Utopia/Response/Filters/V21.php
  • src/Appwrite/Utopia/Request/Filters/V21.php
🧬 Code graph analysis (7)
app/controllers/general.php (3)
src/Appwrite/Utopia/Response/Filters/V20.php (1)
  • V20 (8-26)
src/Appwrite/Utopia/Request/Filters/V21.php (1)
  • V21 (7-51)
src/Appwrite/Utopia/Response/Filters/V21.php (1)
  • V21 (9-51)
src/Appwrite/Utopia/Response/Model/Site.php (1)
src/Appwrite/Utopia/Response/Model.php (1)
  • addRule (90-102)
src/Appwrite/Utopia/Response/Filters/V21.php (2)
src/Appwrite/Utopia/Response.php (1)
  • Response (159-983)
src/Appwrite/Utopia/Request/Filters/V21.php (2)
  • V21 (7-51)
  • parse (10-25)
src/Appwrite/Utopia/Request/Filters/V21.php (1)
src/Appwrite/Utopia/Response/Filters/V21.php (1)
  • parse (11-30)
src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (2)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
src/Executor/Executor.php (1)
  • deleteRuntime (143-164)
src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (2)
src/Appwrite/GraphQL/Types/Mapper.php (1)
  • param (255-363)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (2)
src/Appwrite/Platform/Modules/Compute/Base.php (1)
  • getDefaultSpecification (30-53)
src/Executor/Executor.php (1)
  • deleteRuntime (143-164)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: E2E Service Test (Migrations)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (VCS)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Proxy)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Health)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Databases/TablesDB)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (Site Screenshots)
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: Unit Test
  • GitHub Check: E2E General Test
  • GitHub Check: Benchmark
  • GitHub Check: scan
🔇 Additional comments (8)
app/controllers/general.php (3)

32-33: LGTM! Import additions for new response filters.

The imports for ResponseV20 and ResponseV21 are correctly added and follow the existing pattern for other version-specific response filters.


310-310: LGTM! Correct use of runtimeSpecification for execution context.

The change from specification to runtimeSpecification is appropriate here since this code path handles runtime execution and needs the runtime resource specifications for CPU/memory allocation. The fallback to APP_COMPUTE_SPECIFICATION_DEFAULT ensures backward compatibility.


1053-1058: LGTM! Response filters added for backward compatibility.

The addition of ResponseV20 and ResponseV21 filters ensures backward compatibility for clients using API versions before 1.8.0 and 1.9.0 respectively. The V21 filter converts the new dual-spec format (buildSpecification and runtimeSpecification) back to the legacy single specification field for older clients.

Please verify that the backward compatibility works correctly for older SDK clients (< 1.9.0) by testing:

  1. Creating/updating functions and sites with older SDKs
  2. Retrieving function and site documents with older SDKs
  3. Ensuring the specification field appears correctly in responses

Based on learnings: The V21 response filter exposes buildSpecification as the backward-compatible specification value. Ensure this provides the expected behavior for clients that previously used a single specification for both build and runtime contexts.

tests/resources/sites/astro/src/pages/specs.js (1)

1-13: Simple specs endpoint looks correct

Returns the expected env fields as JSON with appropriate content type; fine for the test use case.

src/Appwrite/Utopia/Request/Filters/V21.php (1)

9-25: Specs back-compat mapping for V21 requests looks sound

For create/update you only translate legacy specification into buildSpecification and runtimeSpecification when it’s present, leaving newer payloads (that already send the split fields) untouched. This aligns with the non-mixed-format assumption and gives older clients identical values in both specs.

Also applies to: 41-50

src/Appwrite/Utopia/Response/Model/Site.php (1)

164-175: Site spec fields are modeled consistently

buildSpecification and runtimeSpecification are exposed with string type, default/example from APP_COMPUTE_SPECIFICATION_DEFAULT, and clear descriptions; this matches how they’re validated and stored elsewhere.

src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (1)

243-252: Cold-start on spec changes now uses correct attributes

The spec-change block correctly compares both runtimeSpecification and buildSpecification against the stored values and calls deleteRuntime only when either differs, while tolerating 404s from the executor. Persistence of buildSpecification/runtimeSpecification into the site document matches the parameter list. This addresses the earlier attribute name typo and aligns with the functions update behavior.

Also applies to: 281-282

src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (1)

92-103: Function spec parameters and cold-start handling look consistent

buildSpecification/runtimeSpecification are validated and defaulted via the compute Specification validator, passed into the action, and persisted under matching attribute names. The cold-start section now compares both stored specs against the incoming values using the correct keys and only calls deleteRuntime when something changes, while ignoring 404s from the executor. This is aligned with the site update logic and fixes the earlier attribute typo.

Also applies to: 134-135, 245-263, 286-287

@Meldiron Meldiron merged commit 96f79fa into feat-1.8.x-new-schema Nov 24, 2025
38 checks passed
@Meldiron Meldiron mentioned this pull request Nov 24, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants