Skip to content

fix(purl): expose fail-open batch params and harden dedupe - #98

Open
lelia wants to merge 3 commits into
mainfrom
lelia/sdk-purl-post-bug
Open

fix(purl): expose fail-open batch params and harden dedupe#98
lelia wants to merge 3 commits into
mainfrom
lelia/sdk-purl-post-bug

Conversation

@lelia

@lelia lelia commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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-basics core-tool-watch (2026-07-29): a Dependabot bump to socketdev==3.3.0 was scored, its row was silently omitted, and the fail-closed guard turned that into a red build across main.

Changes (all backward-compat)

  • First-class typed params on purl.post(): poll, timeout_sec (→ timeoutSec), alerts, purl_errors (→ purlErrors). None = omit the param, so existing callers keep the server's fail-open default. **kwargs passthrough retained.
  • Docstring documenting the fail-open semantics, the "omitted ≈ no-data without alerts=true" gotcha, and the synthetic pendingScan/notFound alert types.
  • Dedupe hardeningDedupe.consolidate_and_merge_alerts now uses .get() for key/type/severity/action (identity tuples + consolidated dict), so synthetic status rows (built server-side from a minimal {type, key} base) no longer raise KeyError.
  • strict=True mode — compares requested component purls against returned inputPurl/purl and raises the new APIPartialResponse(missing=[...]) when inputs are absent; a first-class "partial batch" signal even without alerts=true.
  • Version 3.3.0 → 3.4.0 (version.py, pyproject.toml, uv.lock).

Tests

5 new unit tests (query-string per param, unset-param omission, synthetic pendingScan NDJSON parse, strict raise + pass). Full unit suite: 127 passed, 1 skipped.

Todos

Fixes CE-360

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>
@lelia
lelia requested a review from a team as a code owner August 5, 2026 03:52
@lelia
lelia temporarily deployed to socket-firewall August 5, 2026 03:52 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

🚀 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

@lelia lelia changed the title fix(purl): expose fail-open batch params and harden dedupe (CE-360) fix(purl): expose fail-open batch params and harden dedupe Aug 5, 2026
@lelia

lelia commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

@lelia
lelia deployed to socket-firewall August 5, 2026 04:55 — with GitHub Actions Active
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