fix(purl): expose fail-open batch params and harden dedupe - #98
Open
lelia wants to merge 3 commits into
Open
Conversation
purl.post() defaulted to the batch API's fail-open behavior with no way to
opt out: unresolved input purls are silently omitted from the response, so
callers could not tell "clean" from "dropped". Add typed poll/timeout_sec/
alerts/purl_errors params (None => omit, preserving the fail-open default for
existing callers) plus a strict=True guard that raises APIPartialResponse when
requested purls are missing from the response.
Also harden Dedupe.consolidate_and_merge_alerts to use .get() for
key/type/severity/action so synthetic pendingScan/notFound status rows (built
server-side from a minimal {type, key} base) no longer raise KeyError.
Bump 3.3.0 -> 3.4.0.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketdev==3.4.0.dev6 |
Contributor
Author
|
bugbot run |
|
Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings. |
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 & why
purl.post()inherited the batch purl API's fail-open behavior with no way to opt out: input purls whose resolution/analysis hasn't finished are silently omitted from the response, so a caller can't tell "this version is clean" from "this version was dropped." This bit socket-basicscore-tool-watch(2026-07-29): a Dependabot bump tosocketdev==3.3.0was scored, its row was silently omitted, and the fail-closed guard turned that into a red build across main.Changes (all backward-compat)
purl.post():poll,timeout_sec(→timeoutSec),alerts,purl_errors(→purlErrors).None= omit the param, so existing callers keep the server's fail-open default.**kwargspassthrough retained.alerts=true" gotcha, and the syntheticpendingScan/notFoundalert types.Dedupe.consolidate_and_merge_alertsnow uses.get()forkey/type/severity/action(identity tuples + consolidated dict), so synthetic status rows (built server-side from a minimal{type, key}base) no longer raiseKeyError.strict=Truemode — compares requested component purls against returnedinputPurl/purland raises the newAPIPartialResponse(missing=[...])when inputs are absent; a first-class "partial batch" signal even withoutalerts=true.version.py,pyproject.toml,uv.lock).Tests
5 new unit tests (query-string per param, unset-param omission, synthetic
pendingScanNDJSON parse, strict raise + pass). Full unit suite: 127 passed, 1 skipped.Todos
v3.4.0to PyPI.socketdevfloor + migratescripts/check_core_tools.pyoff the stringly-typed kwargs workaround.purl.post()still swallows non-raised non-200s intolog.error + return []; consider raising given Add transient-error classification to APIFailure #93.Fixes CE-360