Skip to content

feat: batched KB lookup — kb= accepts a list of up to 30 KB numbers#12

Merged
jonnybottles merged 1 commit into
mainfrom
feat/multi-kb-lookup
Jul 11, 2026
Merged

feat: batched KB lookup — kb= accepts a list of up to 30 KB numbers#12
jonnybottles merged 1 commit into
mainfrom
feat/multi-kb-lookup

Conversation

@jonnybottles

Copy link
Copy Markdown
Owner

What

msrc_search now accepts kb=["5094123", "KB5094127", ...] (up to 30, deduplicated, order preserved) and returns a grouped response: total_kbs, per-KB results entries (kb, found, and either the single-KB response body or a per-KB error/error_kind), and a top-level total_found summed 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

  • Compat contract: a plain-string kb returns today's exact flat shape — the grouped shape is triggered only by list input (pinned by test_kb_string_shape_unchanged_by_batch_feature).
  • Honest failure: per-KB misses distinguish not_found from upstream (incomplete scan), same as the single-KB path — each list entry delegates to the existing _lookup_kb scan.
  • No extra upstream load: the in-process month cache means each monthly document is fetched at most once per batch (pinned by test_kb_list_fetches_each_month_once).
  • Strict input: a malformed list entry fails the whole call with 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 the include_* row options all work in batch mode.

Testing

  • 12 new offline tests in tests/test_tools.py; suite green at 94% coverage, ruff clean.
  • New endpoint_upstream test test_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.
  • Version bumped to 0.7.0 in both places + uv lock.

🤖 Generated with Claude Code

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>
@jonnybottles
jonnybottles merged commit 0221241 into main Jul 11, 2026
6 checks passed
@jonnybottles
jonnybottles deleted the feat/multi-kb-lookup branch July 11, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant