feat: batched KB lookup — kb= accepts a list of up to 30 KB numbers#12
Merged
Conversation
kb=["5094123", "KB5094127", ...] resolves a whole machine's update list in one call, returning a grouped response with one per-KB entry (found or per-KB not_found/upstream error) plus a summed top-level total_found. A plain-string kb keeps today's flat shape unchanged (compat contract); malformed list entries fail the whole call so a report built on the result can't silently miss a KB. The in-process month cache guarantees each monthly document is fetched upstream at most once per batch. Version 0.7.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
msrc_searchnow acceptskb=["5094123", "KB5094127", ...](up to 30, deduplicated, order preserved) and returns a grouped response:total_kbs, per-KBresultsentries (kb,found, and either the single-KB response body or a per-KBerror/error_kind), and a top-leveltotal_foundsummed across KBs. Motivated by a user request: feed a machine's installed-KB list in as context for a patch report in one call.Design notes
kbreturns today's exact flat shape — the grouped shape is triggered only by list input (pinned bytest_kb_string_shape_unchanged_by_batch_feature).not_foundfromupstream(incomplete scan), same as the single-KB path — each list entry delegates to the existing_lookup_kbscan.test_kb_list_fetches_each_month_once).invalid_input— a silently dropped KB would corrupt any report built on the result. Empty list and >30 entries are rejected too.include_chain,month=,limit/offset(per KB), and theinclude_*row options all work in batch mode.Testing
tests/test_tools.py; suite green at 94% coverage, ruff clean.endpoint_upstreamtesttest_kb_batch_lookup_groups_results; full endpoint suite (17 tests, incl. burst) green against the 0.7.0 container locally; container runs non-root and healthy.uv lock.🤖 Generated with Claude Code