Repository navigation
Log why a new repository couldn't be created - #436
Open
David Larsen (dc-larsen) wants to merge 3 commits into
Open
David Larsen (dc-larsen) wants to merge 3 commits into
David Larsen (dc-larsen) wants to merge 3 commits into
Conversation
get_repo_info mutes the socketdev logger around the repository lookup and only restored the level after a successful lookup. This module logs through the same logger, so when the lookup raised for a repository that isn't in Socket yet, the "attempting to create it" warning and the creation error were dropped, and the CLI exited 2 right after file discovery with nothing logged. A successful create also left logging muted for the rest of the run. Restore the level in a finally block, and include the repository, the HTTP status and, on a 403, a repo:create hint in the creation error. The SDK keeps only the API's "Insufficient permissions" message and drops the required scope. Bump to 2.11.9.
David Larsen (dc-larsen)
deployed
to
socket-firewall
November 1, 2026 22:39 — with
GitHub Actions
Active
The SDK appends the request path and the response headers to APIAccessDenied's message, so logging the exception as-is printed a multi-line header dump at the default log level. APIInsufficientPermissions carries no message at all, which left the line ending in ": ". Log the first line, falling back to the exception type. Quota and organization-not-allowed errors are also 403s, so the repo:create hint no longer fires for those. Bump to 2.11.10: v2.11.9 is already taken by an existing tag and GitHub release (#434), even though that release never reached PyPI.
Releases are immutable, so a published release's tag can't be moved or reused even when its release run fails. v2.11.8 and v2.11.9 were tagged one ahead of the package version at their commits, failed the release workflow's tag/version check, and left nothing on PyPI or Docker Hub. Only the person who published them was notified. - Version Check now fails when v<version> is already a tag, since PyPI alone can't tell that a version has been burned. - The release workflow opens an issue for the team when it fails, with the run, the tag, the package version and what to do next. - Fold the never-published 2.11.7 and 2.11.8 changelog entries into 2.11.10, which is the first release to ship them.
This branch was successfully deployed
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.
When a repository isn't in Socket yet and the API token can't create it (for example, the token has
repo:listbut notrepo:create), the CLI exits2right after file discovery with nothing logged, so CI users have no way to tell what went wrong. Related to CE-127.Root Cause
get_repo_infosets thesocketdevlogger toCRITICALaround the repository lookup and only restored the level after a successful lookup.socketsecurity.corelogs through that same logger, so when the lookup raised (a 404 for a repository Socket hasn't seen), the "attempting to create it" warning and the creation error were both dropped beforesys.exit(2). When the create succeeded, logging stayed muted for the rest of the run.Fix
finallyaround the lookup.repo:createhint in the creation error. The SDK keeps only the API'sInsufficient permissionsmessage and drops the required scope from the response.2).tests/core/test_sdk_methods.py. Both fail onmain: no records reach the log, and the logger is still atCRITICALafter a successful create.Testing
uv run pytest tests/unit tests/core: 729 passed.ruff checkclean,uv lock --lockedin sync,hatch build+twine checkpass.repo:listbut notrepo:create, on a repository Socket hadn't seen:2, the log ends atFile count (1) is within file descriptor limit.2withrepo:create: the CLI creates the repository and completes the scan (exit0), with logging continuing after the create. A rerun on the now-existing repository takes the normal path with no create attempt.Follow-up changes (pushed by lelia)
Creation error. The SDK appends the request path and the response headers to
APIAccessDenied's message, so the error now logs only its first line.APIInsufficientPermissionshas no message, so the line falls back to the exception type. Therepo:createhint no longer fires on quota or organization-not-allowed 403s.Version 2.11.10, not 2.11.9.
v2.11.8andv2.11.9are published, immutable GitHub releases with nothing on PyPI or Docker Hub. Each was tagged one ahead of the package version at its commit, so the release workflow's tag/version check correctly refused to publish. PyPI's latest is still 2.11.6, so this release also ships the Coana 15.13.3 and 15.14.0 bumps (#431, #434). The 2.11.7 and 2.11.8 CHANGELOG entries are folded into 2.11.10.Release process guards:
version-check.ymlfails whenv<version>is already a tag. It used to compare against PyPI and main only, which is why 2.11.9 passed here.release.ymlopens an issue that mentions @SocketDev/customer-engineering when a release run fails. Until now only the person who published the release was notified.Public Changelog
The Socket Python CLI now explains why it couldn't create a repository that isn't in Socket yet, including the HTTP status and a hint about the
repo:createscope, instead of exiting with no output. This release also bumps the pinned Coana CLI to 15.14.0.Note
Low Risk
Localized logging and error-message changes in
get_repo_info; no change to exit codes or API behavior beyond surfacing failures that were already occurring.Overview
Fixes a silent exit 2 when the CLI tries to auto-create a repository that is not in Socket yet but the API token cannot create it (for example missing
repo:create).In
Core.get_repo_info, thesocketdevlogger is temporarily set toCRITICALduring the repo lookup. The level is now restored in afinallyblock so a failed lookup no longer leaves logging muted for the rest of the run. That restores the “attempting to create it” warning and creation error lines that were previously dropped becausesocketsecurity.corealso logs throughsocketdev.When repository creation fails, errors now include the repo slug, HTTP status when available, and on 403 a hint that the token may need
repo:create. Exit code 2 on that path is unchanged. Release 2.11.9 with matching tests.Reviewed by Cursor Bugbot for commit aa2299b. Configure here.