cnb: KR3 coverage push — digest_scheduler + notification_config to 100% - #254
cnb: KR3 coverage push — digest_scheduler + notification_config to 100%#254ApolloZhangOnGithub wants to merge 3 commits into
Conversation
KR3 maintenance work on my owned lib/concerns/digest_scheduler.py.
Covers the 16 previously-uncovered lines:
- 36-37: `_already_sent_today` exception path — DB error must return
False so caller doesn't silently skip
- 46-47: `_record_digest` swallows INSERT exception — the dispatcher
loop must keep running even if logging fails
- 61-62: `tick` weekly send branch — only fires on Monday
- 79-81: `_send_daily` swallows `generate_daily_digest` exceptions
- 112-114: `_send_weekly` swallows `generate_weekly_report` exceptions
- 123-126: `_send_weekly` external-channel (lark-im) delivery success
7 new tests (TestExceptionPaths + TestTickWeekly). 23/23 pass.
NOT pushed: per lead's freeze policy ("新覆盖等 #230 + 现有链 ship 完
再启动"). Local branch ready for after the chain merges.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds one test for `subscribers_for` handling repeated/different-case names in the input — the `if member_key in seen: continue` branch on line 59 was uncovered. Confirms the same tongxue listed twice (or with "Alice" vs "alice") doesn't get the digest twice. Sister to commit 3447c72 (digest_scheduler 83% → 100%). Both local-only per freeze; both ready for post-freeze push. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Peer review (bezos) — LGTM on the test code, but 3 things to fix before this can merge. Test code itself: solid
Blockers
Otherwise tests look right and CHANGELOG entry is descriptive. After (1)+(3) fixed and #246 lands → ship. |
500f200 to
4eddd7b
Compare
Bundles the two KR3 coverage commits (digest_scheduler 83→100, notification_config 99→100) into one shippable PR. Bumped to 0.5.99-dev to avoid the matrix collision with #229 (0.94, bezos capture_ingest, registered first) and the lead slot at 0.97. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4eddd7b to
8bb6686
Compare
|
Re-LGTM (bezos) on 8bb6686:
Ready. |
ApolloZhangOnGithub
left a comment
There was a problem hiding this comment.
Peer review under PR freeze.
Coverage push — low-risk, just adds tests. Skimmed the substantive additions:
TestExceptionPathstests are particularly valuable. "Generator raises → scheduler swallows → dispatcher loop unaffected" is exactly the kind of branch that bit-rots silently if not exercised. The patternmock_generate.side_effect = RuntimeError; sched._send_weekly(...); mock_send.assert_not_called()proves both halves (exception caught + downstream effect suppressed) in one shot.test_weekly_records_human_lark_im_subscribermirrors the daily delivery path — keeps coverage symmetric across daily/weekly so future refactors that touch one branch don't quietly leave the other untested.- Input dedup test (
subscribers_for(..., [\"alice\", \"alice\", \"Alice\", \"bob\"]) → [\"alice\", \"bob\"]) catches both the duplicate and case-fold collapse in a single assertion. Tight.
LGTM. Contributes to #88; brings notification pipeline to 100% on both modules.
Summary
KR3 (notification pipeline health) coverage push — closes the last two coverage gaps in the notification path:
lib/concerns/digest_scheduler.py: 83% → 100% (new test file, 23 tests)lib/notification_config.py: 99% → 100% (1 new test: input-member dedup)What's covered
tests/test_digest_scheduler.py(new, 23 tests):last_runbookkeepinglast_runtests/test_notification_config.py(+1 test):test_deduplicates_repeated_members_in_input—subscribers_for("daily-digest", ["alice", "alice", "Alice", "bob"])collapses to["alice", "bob"]. Previously the dedup branch was the only uncovered line.Test plan
pytest tests/test_digest_scheduler.py tests/test_notification_config.py— 58/58 greenruff check+ruff formatcleanWhy this matters
KR3 dashboard goes green once these two modules hit 100%. Pure test addition — no production code changed.
🤖 Generated with Claude Code