fix: correct typos in default rate limit YAML keys#6835
fix: correct typos in default rate limit YAML keys#6835michel-laterman merged 5 commits intoelastic:mainfrom
Conversation
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>
3b20013 to
29269d3
Compare
ebeahan
left a comment
There was a problem hiding this comment.
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?
|
@ebeahan, our defaults are much lower than what the fix would load |
There was a problem hiding this comment.
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>
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. |
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
|
@Mergifyio backport 8.19 9.3 9.4 |
✅ Backports have been createdDetails
|
* 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)
* 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)
* 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)
* 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>
* 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>
* 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>
What is the problem this PR solves?
All 6 embedded default YAML files under
internal/pkg/config/defaults/usedpgp_retieval_limit(missing 'r') instead ofpgp_retrieval_limit. Because the Go struct tag isconfig:"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.ymlusedpolicy_intervalinstead ofpolicy_limit, causing the same silent fallback for the policy rate limit at the 5001-10000 agent tier.How does this PR solve the problem?
pgp_retieval_limit→pgp_retrieval_limitin all 6 default YAML filespolicy_interval→policy_limitinlte10000_limits.ymllte2500_limite.yml→lte2500_limits.ymlfor consistencyTestDefaultLimitsYAMLKeysregression test that verifies all embedded YAML files populate every limit field with non-zero values, catching future key/struct-tag mismatchesHow to test this PR locally
Design Checklist
Checklist
./changelog/fragmentsusing the changelog tool