Skip to content

api: make RateLimitRedisSettings.url a pointer#9538

Open
guanchzhou wants to merge 1 commit into
envoyproxy:mainfrom
guanchzhou:redis-url-ptr
Open

api: make RateLimitRedisSettings.url a pointer#9538
guanchzhou wants to merge 1 commit into
envoyproxy:mainfrom
guanchzhou:redis-url-ptr

Conversation

@guanchzhou

Copy link
Copy Markdown
Contributor

What type of PR is this?

api

What this PR does / why we need it:

Follow-up to #9143. In that PR RateLimitRedisSettings.url became optional (mutually exclusive with the new urlRef) but stayed a non-pointer string, so an unset value could not be distinguished from an explicit empty string. This changes it to *string as requested in review, so nil means unset and the has(self.url) CEL rule reflects field presence correctly.

The JSON serialization is unchanged (url,omitempty), so this is backward-compatible for the (unreleased) field. Go config validation and the rate-limit Deployment rendering are updated to deref the pointer; generated deepcopy and the API reference are regenerated.

Which issue(s) this PR fixes:

Follow-up to #9143 (review comment from @arkodg).

Release Notes: No

Follow-up to envoyproxy#9143. url became optional (mutually exclusive with
urlRef) but stayed a non-pointer string, so an unset value could not
be distinguished from an explicit empty string. Make it *string so
nil means unset, per review feedback.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
@guanchzhou
guanchzhou requested a review from a team as a code owner July 21, 2026 11:34
@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit c6dccbf
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a5f59614049270007fcc1b9
😎 Deploy Preview https://deploy-preview-9538--cerulean-figolla-1f9435.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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6dccbfaf4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Type: egv1a1.RedisBackendType,
Redis: &egv1a1.RateLimitRedisSettings{
URL: ":foo",
URL: new(":foo"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Stop calling new with string literals

When any of the modified Go test packages are compiled, new(":foo") is invalid because new takes a type, not a value, so these updated tests fail before running. The same URL: new("...") pattern appears throughout this commit; use a string pointer helper such as ptr.To(...) or assign the literal to a variable and take its address.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a false positive. Go 1.26 (this module is go 1.26.4) added the two-argument-style new(expr) builtin that allocates and initializes from a value, so new(":foo") is valid and returns *string. The sibling RateLimitRedisSettings tests already use this form (Optional: new(true) / new(false)) from #9143 and pass upstream CI. go test ./... on the modified packages compiles and passes (473 tests).

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.55%. Comparing base (2874485) to head (c6dccbf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9538      +/-   ##
==========================================
- Coverage   75.59%   75.55%   -0.04%     
==========================================
  Files         252      252              
  Lines       41713    41713              
==========================================
- Hits        31531    31515      -16     
- Misses       8057     8067      +10     
- Partials     2125     2131       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zirain zirain added this to the v1.9.0-rc.1 Release milestone Jul 21, 2026
}

hasURL := redis.URL != ""
hasURL := redis.URL != nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not use ptr.Deref?

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