You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Narrow two broad exception handlers in the SourceHut adapter #953
Two except Exception handlers in tools/sourcehut/ swallow every error,
including ones that should surface. Narrow them to the exceptions actually
expected.
Background
CodeQL flagged both as empty-except. The concrete risk is a silently wrong
result rather than a crash: an unexpected error is discarded and the caller
carries on with incomplete data.
Where to look
tools/sourcehut/src/magpie_sourcehut/client.py line 82 - the handler around
parsing an HTTP error body is except Exception: with a comment and pass.
Only JSON-decoding failures are expected here, so (json.JSONDecodeError, KeyError, TypeError) is the intended set.
tools/sourcehut/src/magpie_sourcehut/lists.py line 125 - contextlib.suppress(Exception) around a sort. If the sort fails, emails[0]
is still used as the cover letter, so a malformed node silently yields the
wrong description and author. (TypeError, AttributeError) is the expected
set.
Acceptance criteria
Both handlers name the exceptions they expect.
An unexpected exception propagates rather than being discarded.
A test covers the expected-failure path for at least one of the two.
uv run --directory tools/sourcehut --group dev pytest passes.
Note: this issue was drafted by an AI-assisted mentoring tool and may contain
mistakes. A Magpie maintainer, a real person, will be the next to engage on it.
If something here looks wrong or unclear, please say so on the issue and a
maintainer will follow up. See CONTRIBUTING.md
for how Magpie handles contributions.
Activity
amh1k commentedon Jul 27, 2026
Would like to claim this issue
justinmclean commentedon Jul 27, 2026
Thanks @amh1k it's all yours.