fix(bfabric): reserve query elements for other fields in read_multi - #574
Merged
Conversation
The B-Fabric API counts every value of a query towards its limit of 100
elements, but MultiQuery.read_multi chunked the multi-query values at the
full limit, so any additional query field pushed the request over it:
read_multi("importresource", {"containerid": cid}, "relativepath", paths)
failed with "Query has 101 elements and exceeds the maximum of 100 allowed
elements" once 100 paths were passed.
The chunk size is now reduced by the number of elements the remaining query
fields use (nested containers counted by their leaves, so unknown shapes
over- rather than under-count), and a query that leaves no room at all
raises ValueError instead of being sent. Values inside multi_query_vals are
still counted as one element each.
page_iter gains a type parameter so the query dict is no longer inferred as
partially unknown; both basedpyright baselines shrink accordingly.
Fixes #379
Contributor
📝 "TODO" Changes DetectedSummary: ➕ 1 "TODO" added, ✅ 2 "TODO"s removed ➕ Added "TODO"s (1)
✅ Removed "TODO"s (2)
This comment is automatically updated when "TODO" changes are detected. |
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.
MultiQuery.read_multinow shrinks its chunk size by the elements the other query fields use, so e.g.read_multi("importresource", {"containerid": cid}, "relativepath", paths)no longer fails with "Query has 101 elements and exceeds the maximum of 100 allowed elements".ValueErrorinstead of being sent.Fixes #379
🤖 Prepared with assistance from Claude Opus 5 via Claude Code.