Skip to content

feat: build + runtime specification controls for sites and functions#2922

Merged
HarshMN2345 merged 8 commits intomainfrom
chore-sdk-bump
Mar 20, 2026
Merged

feat: build + runtime specification controls for sites and functions#2922
HarshMN2345 merged 8 commits intomainfrom
chore-sdk-bump

Conversation

@HarshMN2345
Copy link
Member

@HarshMN2345 HarshMN2345 commented Mar 20, 2026

What does this PR do?

image image image image

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • Functions and sites settings now let you choose build and runtime specifications independently.
  • Bug Fixes

    • Settings now automatically fall back to an enabled runtime/build specification when the current selection is unavailable.
  • Chores

    • Webhook management flows updated to use the region-scoped project API (create/update/delete/regenerate).
    • Project package configuration: console dependency bumped and a new small dependency added.

@appwrite
Copy link

appwrite bot commented Mar 20, 2026

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

HTTPS and SSL certificates are handled automatically for all your Sites

@HarshMN2345 HarshMN2345 requested a review from ChiragAgg5k March 20, 2026 11:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

Warning

Rate limit exceeded

@HarshMN2345 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f453daba-c106-4b6d-98bd-f43df639cc79

📥 Commits

Reviewing files that changed from the base of the PR and between 216e6b1 and 1499bcb.

📒 Files selected for processing (5)
  • src/lib/actions/analytics.ts
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/delete.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte

Walkthrough

This PR adds separate runtimeSpecification handling alongside buildSpecification for functions and sites: load handlers now validate and fallback runtimeSpecification to an enabled spec, component state and reactive bindings were extended to track buildSpecification and runtimeSpecification separately, and SDK update calls were extended to send runtimeSpecification. It also updates package.json (bumped @appwrite.io/console hash and added flatted with an overrides bump), injects a new webhooks service into the per-project SDK, and migrates many webhook API calls from the console-scoped client to the region-scoped project client.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing separate build and runtime specification controls for both sites and functions, which is reflected across multiple file modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore-sdk-bump
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR adds independent build specification and runtime specification controls to the settings pages for both Functions and Sites, allowing users to configure CPU/memory independently for build-time and runtime workloads. It also migrates all webhook CRUD operations from the console-scoped SDK (sdk.forConsole.projects.*Webhook) to the region-scoped SDK (sdk.forProject(...).webhooks.*), consistent with the rest of the project's API patterns.

Key changes:

  • updateResourceLimits.svelte (sites + functions): Splits the single "CPU and memory" dropdown into separate "Build specification" and "Runtime specification" selects, each with an info tooltip. State management is improved with an $id guard preventing user selections from being silently reset when other forms on the same settings page trigger a dependency invalidation.
  • updateBuildSettings.svelte (sites): Extends the existing build-spec fallback logic to also cover runtimeSpecification, using enabledSpecs for both the trigger condition and the fallback value. site.*Specification mutations are now correctly placed after the successful await to avoid stale prop state on API failure.
  • +page.ts (sites + functions): Adds a runtimeSpecification fallback alongside the pre-existing buildSpecification fallback, normalising disabled/missing specs to the first enabled alternative before data reaches the components.
  • Webhook migration: A Webhooks client is added to sdkForProject and all webhook pages are updated to use it, including passing an explicit webhookId: ID.unique() on creation.
  • One pre-existing bug in create/+page.svelte was not fixed: the catch block tracks errors under Submit.DomainCreate instead of Submit.WebhookCreate and passes error.message instead of the error object.

Confidence Score: 4/5

  • Safe to merge with a minor fix — one pre-existing analytics misattribution in the webhook create error handler should be corrected while the file is already being touched.
  • The core feature changes (dual spec controls, enabled-spec fallback, state management with $id guard) are well-structured and consistent between Sites and Functions. The webhook SDK migration is straightforward. The only issue found is a pre-existing bug in create/+page.svelte where trackError uses the wrong event enum (Submit.DomainCreate) and passes error.message instead of the error object — since this file is already modified in the PR it is a good opportunity to fix it, but it does not affect runtime correctness.
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/create/+page.svelte — error tracking uses wrong analytics event

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/settings/webhooks/create/+page.svelte Webhook creation migrated to region-scoped SDK and now passes an explicit webhookId. Error handler still uses Submit.DomainCreate and error.message instead of Submit.WebhookCreate and the full error object — analytics will misattribute webhook creation errors.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte Adds independent buildSpecification and runtimeSpecification controls. Uses a $id guard to protect user selections across invalidations and separates original-value tracking with a reactive block. Analytics events now correctly use FunctionUpdateResourceLimits.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte Mirrors the functions updateResourceLimits refactor for sites. Adds runtime specification control alongside build specification with $id-guarded state management. Fixed sites's typo to site's in description text.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte Adds runtimeSpecification support alongside buildSpecification. Uses enabled-spec filtering for both fallback logic and the API payload, and moves site.*Specification mutations to after the successful await to avoid stale state on failure.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/+page.ts Extends the existing buildSpecification fallback pattern to also cover runtimeSpecification for functions. Re-exports the mutated fn object as function in the page data so components receive corrected spec values.
src/lib/stores/sdk.ts Adds a region-scoped Webhooks client instance to sdkForProject, enabling webhook operations to be performed against the correct regional API endpoint.

Last reviewed commit: "use enabledspecs"

Copy link
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte (1)

114-120: ⚠️ Potential issue | 🟡 Minor

Use the enabled list for this fallback too.

This block falls back to specs.specifications[0], not the first enabled spec. If the first entry is disabled, the shared site object can be rewritten to a slug that the resource-limits form and API should not use.

Suggested fix
-            if (specs && specs.specifications?.length) {
-                if (!specs.specifications.some((s) => s.slug === site.buildSpecification)) {
-                    site.buildSpecification = specs.specifications[0].slug;
-                }
-                if (!specs.specifications.some((s) => s.slug === site.runtimeSpecification)) {
-                    site.runtimeSpecification = specs.specifications[0].slug;
-                }
+            if (specs?.specifications?.length) {
+                const enabledSpecs = specs.specifications.filter((s) => s.enabled);
+                if (!enabledSpecs.some((s) => s.slug === site.buildSpecification)) {
+                    site.buildSpecification = enabledSpecs[0]?.slug;
+                }
+                if (!enabledSpecs.some((s) => s.slug === site.runtimeSpecification)) {
+                    site.runtimeSpecification = enabledSpecs[0]?.slug;
+                }
             }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/routes/`(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte
around lines 114 - 120, The fallback currently assigns specs.specifications[0]
to site.buildSpecification and site.runtimeSpecification even if that spec is
disabled; change the logic to pick the first enabled spec instead (e.g. find the
first entry in specs.specifications where s.enabled is true) and use that slug
as the fallback for both site.buildSpecification and site.runtimeSpecification
so the site object never gets set to a disabled spec that the resource-limits
form/API should ignore.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte (1)

34-74: ⚠️ Potential issue | 🟡 Minor

Telemetry still points at the logging action.

trackEvent and trackError still emit Submit.FunctionUpdateLogging, so resource-limit changes will be counted as logging updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/routes/`(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte
around lines 34 - 74, The telemetry calls in updateResourceLimits() are using
the wrong event constant (Submit.FunctionUpdateLogging); change both
trackEvent(...) and trackError(...) to the resource-limits-specific constant
(e.g., Submit.FunctionUpdateResourceLimits) so telemetry reflects resource limit
updates, ensuring you update the reference in both the success path and the
catch block within updateResourceLimits().
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte (1)

33-68: ⚠️ Potential issue | 🟡 Minor

Telemetry is still tagged as a function logging update.

This handler now updates site resource limits, but trackEvent / trackError still use Submit.FunctionUpdateLogging. These submissions will be misclassified in analytics and error dashboards.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/routes/`(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte
around lines 33 - 68, The telemetry calls in updateResourceLimits still
reference Submit.FunctionUpdateLogging which mislabels this handler; update the
tracking to use a meaningful constant like Submit.SiteResourceLimitsUpdate (or
add that enum value if missing) and replace both
trackEvent(Submit.FunctionUpdateLogging) and trackError(error,
Submit.FunctionUpdateLogging) with trackEvent(Submit.SiteResourceLimitsUpdate)
and trackError(error, Submit.SiteResourceLimitsUpdate) respectively so analytics
and error dashboards reflect a site resource-limits update; ensure the new enum
value is defined in the Submit enum where other submit types live.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@src/routes/`(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte:
- Around line 34-74: The telemetry calls in updateResourceLimits() are using the
wrong event constant (Submit.FunctionUpdateLogging); change both trackEvent(...)
and trackError(...) to the resource-limits-specific constant (e.g.,
Submit.FunctionUpdateResourceLimits) so telemetry reflects resource limit
updates, ensuring you update the reference in both the success path and the
catch block within updateResourceLimits().

In
`@src/routes/`(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte:
- Around line 114-120: The fallback currently assigns specs.specifications[0] to
site.buildSpecification and site.runtimeSpecification even if that spec is
disabled; change the logic to pick the first enabled spec instead (e.g. find the
first entry in specs.specifications where s.enabled is true) and use that slug
as the fallback for both site.buildSpecification and site.runtimeSpecification
so the site object never gets set to a disabled spec that the resource-limits
form/API should ignore.

In
`@src/routes/`(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte:
- Around line 33-68: The telemetry calls in updateResourceLimits still reference
Submit.FunctionUpdateLogging which mislabels this handler; update the tracking
to use a meaningful constant like Submit.SiteResourceLimitsUpdate (or add that
enum value if missing) and replace both trackEvent(Submit.FunctionUpdateLogging)
and trackError(error, Submit.FunctionUpdateLogging) with
trackEvent(Submit.SiteResourceLimitsUpdate) and trackError(error,
Submit.SiteResourceLimitsUpdate) respectively so analytics and error dashboards
reflect a site resource-limits update; ensure the new enum value is defined in
the Submit enum where other submit types live.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d163cc81-a914-4758-a286-e1665d03f12a

📥 Commits

Reviewing files that changed from the base of the PR and between a90a0ea and fe98ce0.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • package.json
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/+page.ts
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.ts
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte

Copy link
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/routes/`(console)/project-[region]-[project]/settings/webhooks/[webhook]/delete.svelte:
- Line 17: The code calls sdk.forProject($project.region, $project.$id) which
can pass a nullable project region; replace the first argument with the route
param region (the route's params.region / local variable named region) when
scoping the SDK and validate it (or fall back explicitly) before calling
webhooks.delete; update the call in the function that invokes sdk.forProject
(referencing sdk.forProject, $project.$id and the route param region) so the SDK
is always scoped with the route param region rather than $project.region.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 387a92fc-7159-4152-be31-18ae1fb0e0cb

📥 Commits

Reviewing files that changed from the base of the PR and between 4be40a2 and 216e6b1.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • package.json
  • src/lib/stores/sdk.ts
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/+page.ts
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/+layout.ts
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/delete.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/details.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/regenerate.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/updateEvents.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/updateName.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/updateSecurity.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/updateURL.svelte
  • src/routes/(console)/project-[region]-[project]/settings/webhooks/create/+page.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateResourceLimits.svelte

@HarshMN2345 HarshMN2345 merged commit 1e7e199 into main Mar 20, 2026
5 checks passed
@HarshMN2345 HarshMN2345 deleted the chore-sdk-bump branch March 20, 2026 12:46
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