Repository navigation
Fix SMTP connection handling, add logging and improve debugging - #88
Open
ThisIsMissEm wants to merge 4 commits into
Open
ThisIsMissEm wants to merge 4 commits into
ThisIsMissEm wants to merge 4 commits into
Conversation
SMTP: - Parse SMTP_SSL / SMTP_TLS as real booleans via envFlag(); previously the mere presence of a key (even "false") enabled it, which put SMTP_SSL on port 587 and failed with WRONG_VERSION_NUMBER - STARTTLS is now on by default (SMTP_TLS=false to disable) and never runs on top of SMTP_SSL; use a verifying default SSL context - Only log in when SMTP_USERNAME is set - Fix except ordering (SMTPConnectError was shadowed), catch OSError for refused/unreachable connections, coerce SMTP_TIMEOUT to a number - envFlag() rejects anything other than true/false so typos fail loudly Logging: - Replace warn()/stderr with a module logger; configure in __main__ - DEBUG=true enables debug logging, logs config with secrets masked, and logs digests instead of sending them - Log every outgoing HTTP request (URL, status, timing/cache hit) - Log non-200 GitHub API responses and repoList fetch failures that were previously swallowed Cleanup: resolve Ruff warnings (f-strings, open/OSError, specific exception types, sorted imports, mutable default argument). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFwWBnugzhAj6E1NAt5oFP
…o the mailing list or involving github
Since October 2025 the GitHub Events API sends a trimmed pull_request object in PullRequestEvents, without title or html_url, so new PRs appeared in digests as "940 (by aboba)". When the title is missing, fetch the full pull request and merge it in; on failure, log a warning and fall back to the computed html_url as before. Update the digest test fixtures, which encoded the missing title. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFwWBnugzhAj6E1NAt5oFP
Author
|
@dontcallmedom if you want, I can split 97a4e97 out into a separate PR |
This was referenced Oct 26, 2026
Owner
|
A separate PR for the specific bug fix would be great (although the other changes are also definitely worth consideration) |
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.
SMTP:
Logging:
Debugging:
send-test-email.pyfor debugging connectivity issues without sending to the mailing list or involving githubindex.py test-email ADDRESS: sends a one-off email through the same config and SMTP path as the digest, which makes it possible to debug mail delivery without involving GitHub or the mailing list.Fixed:
pull_requestinPullRequestEvents (notitle/html_url), so new PRs showed up as643 (by JinDX). The digest now fetches the full PR when the title is missing, and falls back to the computed URL if that fails. The test fixtures had encoded the missing title, so I updated them as well.Cleanup: resolve Ruff warnings (f-strings, open/OSError, specific exception types, sorted imports, mutable default argument).
Tested on the SWICG deployment (Debian 13, Python 3.13.5, Mailgun on 587 with STARTTLS): a test email arrived, and a
DEBUG=truedry run of the weekly digest rendered correctly, including the PR titles.This was based on the code I'd written to make the public-swicg github-notify-ml work, where I'd been getting all sorts of errors with TLS/SSL for SMTP with mailjet. The additional logging was added because I couldn't see anything about where it was at when it failed, and using the logging package allows loglines that include the date.