Skip to content

feat: add per-function region parameter#641

Merged
eduardoboucas merged 2 commits into
masterfrom
feat/per-function-region
May 18, 2026
Merged

feat: add per-function region parameter#641
eduardoboucas merged 2 commits into
masterfrom
feat/per-function-region

Conversation

@eduardoboucas

Copy link
Copy Markdown
Member

@netlify

netlify Bot commented May 18, 2026

Copy link
Copy Markdown

Deploy Preview for open-api ready!

Name Link
🔨 Latest commit 8934397
🔍 Latest deploy log https://app.netlify.com/projects/open-api/deploys/6a0b168d44bca8000840d9fe
😎 Deploy Preview https://deploy-preview-641--open-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for specifying function deployment regions with global and per-function region override capabilities.
    • Functions can now be configured to deploy to specific geographic regions.
    • Deploy operations now accept region settings alongside per-function overrides.

Walkthrough

This PR extends the API schema and Go models to support per-region configuration for functions and deployments. The Swagger spec gains region properties on Function and FunctionConfig, plus functions_region and functions_region_overrides on Deploy. The Go models are updated correspondingly: Function and FunctionConfig each receive a Region field, while Deploy gains FunctionsRegion and a new FunctionsRegionOverrides slice field with validation logic. The manifest and orchestration layer reads region metadata and propagates it through the bundle creation process.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a per-function region parameter across the API models and configuration.
Description check ✅ Passed The description references a related PR in the bitballoon repository, indicating this change is part of a coordinated effort to implement per-function region parameters.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/per-function-region

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

@eduardoboucas eduardoboucas marked this pull request as ready for review May 18, 2026 13:39
@eduardoboucas eduardoboucas requested review from a team as code owners May 18, 2026 13:39

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@swagger.yml`:
- Around line 4589-4590: The schemas currently declare region as just "type:
string" and allow override items to omit name/region; tighten these by changing
the region property to a constrained string (e.g., add pattern: "^[A-Z]{3}$" and
minLength/maxLength as appropriate for your airport code format, or an enum if
you have a finite list) and update the override item schemas to mark "name" and
"region" as required; locate and update the occurrences of the region property
and the override item object definitions (the "region" field and the override
items referenced around the other occurrences) to include the pattern/length
constraints and add required: ["name","region"] so malformed payloads are
rejected by validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d13f8862-abe3-4863-aafa-5c28f4ca7f3f

📥 Commits

Reviewing files that changed from the base of the PR and between 44f599f and 8934397.

📒 Files selected for processing (7)
  • go/models/deploy.go
  • go/models/deploy_functions_region_overrides_items.go
  • go/models/function.go
  • go/models/function_config.go
  • go/porcelain/deploy.go
  • go/porcelain/functions_manifest.go
  • swagger.yml

Comment thread swagger.yml
Comment on lines +4589 to +4590
region:
type: string

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Tighten schema validation for region fields and overrides.

region is documented as an airport code, but these fields currently accept any string, and override items allow missing name/region. This weak contract lets malformed payloads pass client-side validation.

🔧 Suggested schema constraints
   function:
     type: object
     properties:
@@
       region:
         type: string
+        pattern: '^[a-z]{3}$'
+        minLength: 3
+        maxLength: 3

@@
       functions_region:
         type: string
         description: |
           The functions region for this deploy as an airport code.
+        pattern: '^[a-z]{3}$'
+        minLength: 3
+        maxLength: 3
       functions_region_overrides:
         type: array
         items:
           type: object
+          required:
+            - name
+            - region
           properties:
             name:
               type: string
+              minLength: 1
             region:
               type: string
+              pattern: '^[a-z]{3}$'
+              minLength: 3
+              maxLength: 3

@@
   functionConfig:
     type: object
     properties:
@@
       region:
         type: string
+        pattern: '^[a-z]{3}$'
+        minLength: 3
+        maxLength: 3

Also applies to: 4694-4709, 5568-5569

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@swagger.yml` around lines 4589 - 4590, The schemas currently declare region
as just "type: string" and allow override items to omit name/region; tighten
these by changing the region property to a constrained string (e.g., add
pattern: "^[A-Z]{3}$" and minLength/maxLength as appropriate for your airport
code format, or an enum if you have a finite list) and update the override item
schemas to mark "name" and "region" as required; locate and update the
occurrences of the region property and the override item object definitions (the
"region" field and the override items referenced around the other occurrences)
to include the pattern/length constraints and add required: ["name","region"] so
malformed payloads are rejected by validation.

@eduardoboucas eduardoboucas merged commit fe659d0 into master May 18, 2026
15 checks passed
@eduardoboucas eduardoboucas deleted the feat/per-function-region branch May 18, 2026 14:43
eduardoboucas pushed a commit that referenced this pull request May 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.54.0](v2.53.0...v2.54.0)
(2026-05-18)


### Features

* add per-function `region` parameter
([#641](#641))
([fe659d0](fe659d0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
Co-authored-by: token-generator-app[bot] <token-generator-app[bot]@users.noreply.github.com>
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