fix(feeds): handle null comment user in gh-sync content builder#602
fix(feeds): handle null comment user in gh-sync content builder#602norrietaylor wants to merge 1 commit into
Conversation
GitHub returns "user": null for issue/PR comments authored by deleted or
ghost accounts. _build_content used comment.get("user", {}).get("login"),
which returns None (not the {} default) when the key is present-but-null,
raising AttributeError and crashing the entire sync for that issue/PR.
Coerce a missing/null user object to {} before the login lookup so such
comments attribute to "unknown" instead of aborting the sync.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Complex PR? Review this PR in Change Stack to move by importance, not file order. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes a robustness issue in GitHub comment rendering where the API returns ChangesNull user handling in GitHub comments
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Root cause
GitHub's REST API returns
"user": nullfor issue/PR comments authored by deleted or ghost accounts. In_build_content(src/distillery/feeds/github_sync.py), the comment author was read with:dict.get("user", {})only returns the{}default when the key is absent. When the key is present with anull/Nonevalue, it returnsNone, soNone.get("login", ...)raisesAttributeError. This propagated out of_build_content→_issue_to_entry, crashing the sync for the affected issue/PR (bothsync()andsync_batched()paths).Fix
Coerce a missing or null
userobject to an empty dict before the lookup:Comments from ghost accounts now attribute to
"unknown"instead of aborting the sync. Surgical one-line change plus a clarifying comment.Acceptance
TestBuildContent::test_comment_with_null_userreproduces the crash (fails withAttributeErrorbefore the fix) and passes after.tests/test_github_sync.pyandtests/test_feeds.pysuites pass (171 tests).ruff checkandmypy --strictclean on the touched source file.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests