test(core): lock inline rate_limit rps/rph acceptance (models & api keys) - #653
Merged
Conversation
…i keys #644 reported the Admin API rejected inline rate_limit.rps/rph. That held for the old hand-written validation schema but was already fixed by #638, which derives the model/api-key schemas from the RateLimit struct (rps, rpm, rph, rpd, tpm, tpd, concurrency). Add regression tests so the per-second and per-hour request windows can't silently drop out of the derived schema again.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds regression tests for inline ChangesInline rate_limit schema validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
#644 reported that the Admin API validation schema rejects inline
rate_limit.rps/rate_limit.rphfor models and API keys, even though the generated OpenAPI and theRateLimitstruct advertise them.That was accurate for the old hand-written validation schema, but it was already resolved by #638 (merged the day before the issue was filed). #638 made the resource structs the single source of truth:
model_root_schema()/apikey_root_schema()now derive from theModel/ApiKeystructs viaschemars, andRateLimitcarries all seven windows (rps/rpm/rph/rpd+tpm/tpd+concurrency). Sorps/rphare already accepted today.Change
No production change is needed. This adds the regression tests the issue asked for, so the per-second and per-hour request windows can't silently drop out of the derived schema again:
model_rate_limit_accepts_all_request_windows_incl_rps_rphapikey_rate_limit_accepts_rps_and_rphBoth pass on current
main, confirming the fix is in place.This is a schema-validation regression guard, tested at its own boundary (
aisix-corevalidators), so no separate data-plane E2E is added — there is no new end-to-end runtime behavior, the schema shipped in #638.Verified locally:
cargo test -p aisix-core,cargo fmt --all -- --check,cargo clippy -p aisix-core --all-targets.Fixes #644
Summary by CodeRabbit