Repository navigation
fix: Keep room for an active bean candidate beside the inactive sample and revise bean pages on the condition toggle (#634) - #693
Merged
Conversation
… revise bean pages on the condition toggle (#634)
|
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.
Purpose
Two gaps in the bounded bean MCP tools (#634):
explyt_find_spring_beanwrote theinactiveCandidatessample before the page and gave it up to half ofmaxChars. A small budget then had no room left for even one active candidate and answeredRESPONSE_TOO_LARGE, and themaxCharsthat answer named still included the sample, so a retry with it failed again.Change
BoundedPageWriter.fitSamplecan reserve room for the first page item: the sample keeps only what still lets that item fit, down to none with the truncated flag. Without a first item (thenearestByPrefixsample of the endpoint tools, whose miss page has no items) the reserve is zero, so the endpoint tools answer as before.BoundedBeanResponseWriterusesfitSampleinstead of its own loop; the sample stays capped at 3 entries and at half ofmaxChars. When no sample entry fits,inactiveCandidatesis left out,inactiveCandidatesTruncated: trueis set andinactiveCountis kept. TheRESPONSE_TOO_LARGEhint names themaxCharsthat serves the first active candidate.BeanSnapshotService.modelStampOfadds the condition evaluation setting to the stamp of static selections, so a continuation after a toggle answersRESULT_CHANGED. Selections from a recorded native context are unchanged.Measurement (item 3)
On the test fixture at the default budget, a sample of 2 inactive candidates costs 910 chars and moves 3 of 5 active candidates to later pages (shortest candidate 180 chars, page 1647 chars). A guard test keeps the displacement within what the sample's own length explains.
Not in this PR
Item 1: beans inactive by
@Profileare filtered before the snapshot and never appear as inactive candidates.Verification
explyt_find_spring_beanandexplyt_get_spring_beans), each failing on its assertion; one green guard for item 3.maxCharseven when it fits beside the first candidate (811 chars of a 1372 budget failed).BoundedBeanResponseWriterTest14/14,SpringBeanMcpConditionVerdictTest27/27,BeanListingConditionTest17/17, endpoint page and lookup tests 13/13 and 16/16,BeanSnapshotServiceTest12/12.:spring-bootstrap:test --rerun-tasks, fresh JUnit XML): spring-core 2387, spring-web 905 (6 skipped), spring-ai 783, jpa 138, spring-data 140, base 35, aop 6, security 6, initializr 5; 0 failures, 0 errors.:spring-ai:teston 504506c (the half-cap delta touches spring-ai only): 784 tests; one Exodus teardown failure ("Finish all transactions before closing database environment") inSpringBootApplicationMcpToolsetServiceCallsTest, which passed 25/25 when rerun alone (known flake).Main only:
BoundedPageWriter,BoundedBeanResponseWriterandBeanSnapshotServiceare not on the release branches.Refs #634