GeezerVison is showing github.com — Normalize Slack issue severity and bump SDK to `v3.6.0` by lelia · Pull Request #331 · SocketDev/socket-python-cli
Conversation
lelia
commented
Sep 2, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Every severity lookup in the Slack reachability formatter is keyed on medium, but middle is what the API sends — it is the value in the OpenAPI spec's SocketIssueSeverity and in the SDK enum. A mid-severity finding therefore missed all of them at once:
- Not counted.
severity_counts has no middle key and the increment is guarded by if ... in severity_counts, so the summary always read Medium: 0.
- Excluded from
total_findings. Since omitted_count = total_findings - len(selected_vulnerabilities), a batch of mid-severity findings can drive the "and N more" line negative.
- Sorted below
low. SEVERITY_ORDER.get(severity, 4) returned the default of 4 against low's 3, so mid-severity findings sank to the bottom and were the first truncated at the block limit.
- Wrong emoji, which is the least of it.
The findings themselves were always listed — purl_groups drives that, not the counts — so this is a wrong summary and wrong ordering rather than a missing finding or a false all-clear.
Fixed by normalizing to one spelling where the alert is read, rather than adding a parallel middle key to four dicts. Messages.map_socket_severity_to_gitlab and the GitLab severity map already accept both forms with a comment calling middle the older format; this formatter never got the same treatment. Worth noting the live spec still lists middle, so it is the current value rather than a legacy one.
Seven regression tests; five of them fail without the one-line change.
Note Low Risk
Small, localized formatter change with regression tests; no auth, API, or scan-blocking behavior.
Overview
Release 2.6.13 fixes how mid-severity alerts appear in Slack reachability notifications when the API sends severity as middle (OpenAPI/SDK spelling) while the Slack formatter only keyed lookups on medium.
In _extract_alert_info, middle is now mapped to medium at read time (same idea as Messages.map_socket_severity_to_gitlab), so Medium counts, total_findings, sort order, emoji, and block-limit truncation behave correctly instead of treating mid findings as unknown/low-priority. Findings were still listed; the bug was summary math and ordering.
Adds unit tests in test_slack_severity_normalization.py and updates the changelog and package version (2.6.12 → 2.6.13).
Reviewed by Cursor Bugbot for commit 794ce00. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lelia
changed the title
Normalize Slack severity, and stage the socketdev 3.6.0 bump
Normalize Slack issue severity, and stage the socketdev v3.6.0 bump
Sep 2, 2026
lelia
changed the title
Normalize Slack issue severity, and stage the socketdev v3.6.0 bump
Normalize Slack issue severity, and stage the SDK v3.6.0 bump
Sep 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[agent] Verified the bug mechanically rather than just trusting the description: on main, SEVERITY_ORDER/SEVERITY_EMOJI/severity_counts all key on 'medium' with no 'middle' entry, so a mid-severity finding (which is what the API actually sends, matching the SDK's SocketIssueSeverity) misses the count, defaults to sort order 4 (below 'low' at 3), and gets the fallback emoji -- exactly the three symptoms described. The one-line normalization at the read site matches the pattern already used in Messages.map_socket_severity_to_gitlab. All 7 new regression tests pass.
Approving the fix itself. The socketdev 3.6.0 version-bump checklist in the description is correctly left undone and unchecked pending that release, so this stays unmerged until then -- nothing for me to act on there.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lelia reacted with rocket emoji
Every severity lookup in the Slack reachability formatter is keyed on "medium",
but "middle" is what the API sends. A mid-severity finding missed all of them
at once: uncounted in the summary, excluded from total_findings so the "and N
more" count can go negative, and sorted at the default order of 4 -- below
"low" -- so it was truncated out of the message first.
Normalized at the point the alert is read rather than by adding a parallel key
to each dict, so one canonical spelling flows downstream. The GitLab severity
map and the PR comment path already accept both forms; this formatter did not.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
lelia
changed the title
Normalize Slack issue severity, and stage the SDK v3.6.0 bump
Normalize Slack issue severity and bump SDK to v3.6.0
Sep 9, 2026
Unblocks the pin now that 3.6.0 is on PyPI. SocketPURL_Type gained ten
members -- alpm, chrome, clawhub, edge-extension, firefox-extension, qpkg,
socket, swid, vscode and vscode-extension -- and removed none, so artifacts
of those types stop falling back to "unknown".
No other CLI change is needed: none of the SDK's enum types are imported
here, and every severity and type lookup already has a default, so the new
members cannot reach an unguarded branch.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
lelia reacted with hooray emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The check required the PR version to exceed both main and PyPI. Comparing
against main forbids the legitimate case where several PRs ship under one
unreleased version: the first bumps main, and the rest ride it without
bumping again so they stay under a single changelog header. Every such PR
failed, and the only way to green it was a throwaway bump that would strand
a changelog header on a version that never ships.
PyPI is now the floor, since the real invariant is that a release cannot
reuse a published version. Main is still a floor in the one direction that
matters: a PR may leave the version alone or move it forwards, never back.
Every genuine failure the old check caught -- forgetting to bump, reusing a
published version, branching from a stale base -- still fails.
Also added this workflow to its own paths filter so a change to the check is
exercised by the PR that makes it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The version lives as two hand-maintained literals with nothing deriving one
from the other: pyproject.toml is what gets published, and __init__.py is
what the CLI reports as its User-Agent. Every comparison in this job read
only __init__.py, so bumping that alone passed the check and then published
under the old number -- surfacing late, as twine rejecting an existing file,
after the merge.
Both are now required to match before any other comparison runs. uv.lock
carries a third copy, but uv derives it and `uv lock --locked` in
python-tests already fails when it drifts, so it needs no check here.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
lelia
added a commit
that referenced
this pull request
Sep 10, 2026
#331 added this workflow to its own paths filter so an edit to the check gets
exercised by the PR making it. That had the side effect of demanding a version
bump from CI-only PRs, and now that 2.8.0 is published it fails outright: a PR
touching only version-check.yml sits at the published version with nothing to
bump, and is told to bump it.
The bump is now enforced only when the PR touches socketsecurity/,
pyproject.toml or uv.lock. The comparison still runs and reports its verdict
either way, so the check stays exercised without dictating a release. Matches
the gating already on socket-sdk-python.
This branch predates #331, so the file is taken from main -- picking up the
PyPI-only floor and the pyproject/__init__ consistency assertion -- with this
branch's own tweak reapplied on top: the version literal is stripped of both
quote styles, since ruff format rewrites __init__.py to double quotes.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
lelia
added a commit
that referenced
this pull request
Sep 11, 2026
main shipped 2.8.0 (#325 monorepo scan diagnostics and API exit codes, #331
Slack severity normalization and the socketdev 3.6.0 bump) while this branch
was open, so the 2.7.3 it targeted is now behind the published release.
Conflict resolution, in every case keeping main's shipped behaviour and this
branch's formatting and fixes:
- slack.py: kept the "middle" -> "medium" normalization from #331, restyled to
double quotes. Losing it would have silently reintroduced the wrong Slack
severity counts.
- socketcli.py: kept #325's _log_scan_mode_fallback diagnostics and the
force_api_mode branch; this branch's side was the older logic reformatted.
- core/__init__.py: kept #325's _log_scan_configuration helper and its call
sites, and the switch from sys.exit to raise so API failures reach the
configured infrastructure exit code. Kept this branch's contextlib.suppress
cleanup and modern annotations, and modernized the helper's own signature
since this branch drops the typing.List/Optional imports.
- version-check.yml: already assembled from main plus the enforcement gating
and this branch's both-quote version strip.
- CHANGELOG: this branch's section is now 2.8.1, above the shipped 2.8.0.
uv.lock regenerated from the merged pyproject with the pinned uv 0.12.8.
ruff check and ruff format are both clean; 584 passed, 2 skipped.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This branch was previously deployed
1 inactive
deployment
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|