Skip to content

fix: correct typos in default rate limit YAML keys#6835

Merged
michel-laterman merged 5 commits intoelastic:mainfrom
michel-laterman:bug/pgp-defaults
Apr 16, 2026
Merged

fix: correct typos in default rate limit YAML keys#6835
michel-laterman merged 5 commits intoelastic:mainfrom
michel-laterman:bug/pgp-defaults

Conversation

@michel-laterman
Copy link
Copy Markdown
Contributor

What is the problem this PR solves?

All 6 embedded default YAML files under internal/pkg/config/defaults/ used pgp_retieval_limit (missing 'r') instead of pgp_retrieval_limit. Because the Go struct tag is config:"pgp_retrieval_limit", the YAML values never deserialized — PGP retrieval rate limits silently fell back to hardcoded defaults regardless of agent-count tier.

Additionally, lte10000_limits.yml used policy_interval instead of policy_limit, causing the same silent fallback for the policy rate limit at the 5001-10000 agent tier.

How does this PR solve the problem?

  • Fixes pgp_retieval_limitpgp_retrieval_limit in all 6 default YAML files
  • Fixes policy_intervalpolicy_limit in lte10000_limits.yml
  • Renames lte2500_limite.ymllte2500_limits.yml for consistency
  • Adds TestDefaultLimitsYAMLKeys regression test that verifies all embedded YAML files populate every limit field with non-zero values, catching future key/struct-tag mismatches

How to test this PR locally

go test ./internal/pkg/config/ -run "TestDefaultLimitsYAMLKeys" -v

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool

@michel-laterman michel-laterman added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-active-all Automated backport with mergify to all the active branches labels Apr 14, 2026
@michel-laterman michel-laterman self-assigned this Apr 14, 2026
The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@michel-laterman michel-laterman marked this pull request as ready for review April 14, 2026 22:43
@michel-laterman michel-laterman requested a review from a team as a code owner April 14, 2026 22:43
Copy link
Copy Markdown
Member

@ebeahan ebeahan left a comment

Choose a reason for hiding this comment

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

Are these config values only exposed internally?

I agree that these changes are a bugfix, but could any of these changes be "breaking" in the sense they are changing the current default behavior?

@michel-laterman
Copy link
Copy Markdown
Contributor Author

@ebeahan, our defaults are much lower than what the fix would load

Copy link
Copy Markdown
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

Thanks for catching and fixing both typos. Config keys are now properly aligned with the struct tags in config.ServerLimits.

Thanks for adding the test too. It would be nice to make this test more generic, such that it iterates over all the server_limits keys in each YAML file and, for each key, requires that there is a corresponding struct field with that struct tag. I'll push up a commit for that.

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ycombinator
Copy link
Copy Markdown
Contributor

It would be nice to make this test more generic, such that it iterates over all the server_limits keys in each YAML file and, for each key, requires that there is a corresponding struct field with that struct tag. I'll push up a commit for that.

I made the test more generic using reflection, in 5ad7478. This way we don't have to enumerate all the struct fields in the assertions. But if you prefer the original implementation, feel free to revert/remove my commit.

ycombinator
ycombinator previously approved these changes Apr 15, 2026
Comment thread internal/pkg/config/env_defaults_test.go Outdated
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
@michel-laterman michel-laterman merged commit 47b6210 into elastic:main Apr 16, 2026
10 checks passed
@michel-laterman michel-laterman deleted the bug/pgp-defaults branch April 16, 2026 22:41
@github-actions
Copy link
Copy Markdown
Contributor

@Mergifyio backport 8.19 9.3 9.4

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 16, 2026

backport 8.19 9.3 9.4

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Apr 16, 2026
* fix: correct typos in default rate limit YAML keys

The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: use reflection to validate YAML keys match struct tags

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Cleanup test code

* Update internal/pkg/config/env_defaults_test.go

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
(cherry picked from commit 47b6210)
mergify bot pushed a commit that referenced this pull request Apr 16, 2026
* fix: correct typos in default rate limit YAML keys

The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: use reflection to validate YAML keys match struct tags

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Cleanup test code

* Update internal/pkg/config/env_defaults_test.go

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
(cherry picked from commit 47b6210)
mergify bot pushed a commit that referenced this pull request Apr 16, 2026
* fix: correct typos in default rate limit YAML keys

The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: use reflection to validate YAML keys match struct tags

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Cleanup test code

* Update internal/pkg/config/env_defaults_test.go

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
(cherry picked from commit 47b6210)
michel-laterman added a commit that referenced this pull request Apr 16, 2026
* fix: correct typos in default rate limit YAML keys

The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.



* test: use reflection to validate YAML keys match struct tags

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.



* Cleanup test code

* Update internal/pkg/config/env_defaults_test.go



---------



(cherry picked from commit 47b6210)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
michel-laterman added a commit that referenced this pull request Apr 16, 2026
* fix: correct typos in default rate limit YAML keys

The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.



* test: use reflection to validate YAML keys match struct tags

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.



* Cleanup test code

* Update internal/pkg/config/env_defaults_test.go



---------



(cherry picked from commit 47b6210)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
michel-laterman added a commit that referenced this pull request Apr 16, 2026
* fix: correct typos in default rate limit YAML keys

The embedded default YAML files used `pgp_retieval_limit` (missing 'r')
instead of `pgp_retrieval_limit`, causing the values to never deserialize
into the Go struct. PGP retrieval limits silently fell back to hardcoded
defaults for all agent-count tiers.

Also fixes `policy_interval` -> `policy_limit` in lte10000_limits.yml
and renames `lte2500_limite.yml` -> `lte2500_limits.yml`.

Adds a regression test that verifies all embedded YAML files populate
every limit field, catching future key/struct-tag mismatches.



* test: use reflection to validate YAML keys match struct tags

Replace manually enumerated field assertions with a reflection-based
approach that reads raw YAML keys and verifies each has a matching
`config` struct tag on serverLimitDefaults. This catches typos
automatically without needing to update the test when fields are added.



* Cleanup test code

* Update internal/pkg/config/env_defaults_test.go



---------



(cherry picked from commit 47b6210)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants