Repository navigation
fix: honor the configured history_limit instead of a hardcoded cap - #245
Merged
Merged
Conversation
HttpMockServerBuilder::history_limit stored the value but build() ignored it, and the request-history trim used a hardcoded cap of 100 with a TODO. Store the limit in MockServerState and use it in the trim check. The default stays 100, so out-of-the-box behavior is unchanged.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Member
|
Thanks! The 100 + 1 thing seems unintended, so feel free to create a follow-up :) |
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.
Problem
HttpMockServerBuilder::history_limit(...)(and the--request-history-limitCLI flag in standalone mode) was dead plumbing: the builder stored the value, butbuild()discarded it, and the request-history trim inserve_mockused a hardcoded> 100check marked// TODO: Make max history configurable.Fix
DEFAULT_HISTORY_LIMIT = 100and store the configured limit inMockServerState.build()now passeshistory_limit.unwrap_or(DEFAULT_HISTORY_LIMIT)through.HttpMockStateManager::default()changes fromnew(usize::MAX)tonew(DEFAULT_HISTORY_LIMIT)— effective behaviour is unchanged since the old hardcoded cap was 100 regardless of that parameter.Notes
len > limitbefore pushing, so the history stabilises atlimit + 1entries. This PR preserves that behaviour (and the new test documents it) rather than silently changing it — happy to fix it here or in a follow-up if preferred.Verification
cargo test --all-featuresunit + integration suites pass locally (124 + 137 tests).