Skip to content

feat: update constraints on db endpoints#637

Merged
paulo merged 1 commit intomasterfrom
pa/db-nits
Apr 7, 2026
Merged

feat: update constraints on db endpoints#637
paulo merged 1 commit intomasterfrom
pa/db-nits

Conversation

@paulo
Copy link
Copy Markdown
Contributor

@paulo paulo commented Apr 7, 2026

Follow-up to #635, I didn't see the rabbit very valid comments

@paulo paulo requested review from a team as code owners April 7, 2026 09:08
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 7, 2026

Deploy Preview for open-api ready!

Name Link
🔨 Latest commit eb6b73f
🔍 Latest deploy log https://app.netlify.com/projects/open-api/deploys/69d4d0aaab7efc00084f139f
😎 Deploy Preview https://deploy-preview-637--open-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1d80aab3-6d3a-48c4-9966-32c5cd5c4e44

📥 Commits

Reviewing files that changed from the base of the PR and between 1ee8780 and eb6b73f.

📒 Files selected for processing (3)
  • go/models/database_compute_settings_request.go
  • go/models/database_compute_settings_request_validate.go
  • swagger.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • swagger.yml

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Database compute settings (max_cu, min_cu, sleep_timeout_seconds) can be omitted (treated as optional/null).
  • Bug Fixes

    • Added range validations (CPU units: 0.25–16; timeout: minimum -1) and cross-field checks: max_cu >= min_cu and difference ≤ 8.0.
    • Validation now reports multiple issues together and returns detailed 422 responses when input is invalid.

Walkthrough

The PR changes DatabaseComputeSettingsRequest so MaxCu, MinCu, and SleepTimeoutSeconds are pointer types to represent optionality. The generated Validate now delegates to per-field validators, skips nil/zero fields, enforces min/max bounds, and aggregates validation errors. A new method ValidateCrossFieldConstraints() was added to check MaxCu >= MinCu and MaxCu - MinCu <= 8.0 when both are set. The OpenAPI schema (swagger.yml) marks those fields nullable and adds numeric bounds (min_cu/max_cu: 0.25–16; sleep_timeout_seconds: minimum -1).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: update constraints on db endpoints' accurately describes the main change: adding validation constraints (minimum/maximum bounds and nullable metadata) to database compute settings request fields.
Description check ✅ Passed The description references a follow-up to PR #635 and mentions 'rabbit very valid comments', which appears to relate to the changeset, though the phrasing is unclear and lacks detail.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pa/db-nits

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.

Copy link
Copy Markdown

@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 `@go/models/database_compute_settings_request.go`:
- Around line 51-58: The cross-field check using m.MinCu and m.MaxCu must be
moved out of the generated file to avoid being lost on regen; create a
non-generated validation function (e.g.,
ValidateDatabaseComputeSettingsRequestCrossFields(m
*DatabaseComputeSettingsRequest) in a new file like
database_compute_settings_request_validation.go in the same package) that
performs the same checks (MaxCu >= MinCu and MaxCu - MinCu <= 8.0) and return
appropriate errors, and then invoke that function from the
request-handling/service validation layer (or add it to a generation template
hook) so the logic lives outside generated code.
🪄 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: 50b40621-b0de-4fae-a61a-9a8583a904b8

📥 Commits

Reviewing files that changed from the base of the PR and between b9d885b and 1ee8780.

📒 Files selected for processing (2)
  • go/models/database_compute_settings_request.go
  • swagger.yml

@paulo paulo enabled auto-merge (squash) April 7, 2026 09:47
@paulo paulo merged commit 0de7447 into master Apr 7, 2026
15 checks passed
@paulo paulo deleted the pa/db-nits branch April 7, 2026 10:40
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