Repository navigation
test: cover the delivery-failure branch of kiro_on_kas_notice.schedule() - #40576
Conversation
schedule() must swallow a failed delivery so a missing note never reaches the gateway. Nothing tested that branch directly; it was only hit by accident through another test's failing gateway path. Add a test that makes deliver_when_floor_lands raise and checks that schedule() logs the failure and ends without an exception.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. This PR only adds one test that targets an untested error branch, so there is no design question to decide. [DESIGN-REVIEWED] bcce45f Description read[DESCRIPTION-READ] edd13260e079b0180919b1c50b14446c99d69b0f34d2550cf63c7e7eddff403f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: ApproveWhy: the decider estimates a 4% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. This PR adds only one test, Tier: 1, every tier gate passed. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved automatically by the code change approver, not by a person. The decider estimates a 4% chance that this change introduces a defect, within the 12% limit for approving on its own, and the change has at most 400 changed lines.
This PR adds only one test, test_schedule_logs_and_swallows_a_delivery_failure in test/test_kiro_on_kas_notice.py. It makes deliver_when_floor_lands raise, then checks that the task started by schedule() ends without an exception and logs "Kiro CLI on KAS notice failed". That covers the except Exception branch in schedule()._run() at src/kiro_crew/kiro_on_kas_notice.py:150-151. If that handler were removed, task.exception() would no longer be None and the log check would fail, so the test does check the behaviour. The test patches the module-level name, and _run looks that name up when it runs, so the patch takes effect. The test file already imports asyncio, MagicMock and notice. Nothing under src/ changes. The PR's non-goals hold. CI is green, including Coverage Gate, Flake Pattern Ratchet and all backend test shards.
Tier: 1, every tier gate passed.
Criteria: no merge conflict, no owner block, no change request, the default branch, no security-sensitive path, no design document to agree on, the readiness status, the review lanes, the P0 history, the linked issues' tier, the review lessons, no concern label, the file count, a safe change category, not its own change, the decider, the security checklist, the change matches its title, no competing change.
Decider v3c (217fe607). To overrule it, request changes or dismiss this review.
Problem / Motivation
Goal: Keep the per-file coverage floor for
src/kiro_crew/kiro_on_kas_notice.pystable by testing the delivery-failure branch ofschedule()directly.Coverage Gateapplies a per-file 80% floor. For this file it flips between green and red on PRs that do not touch it: 78.9% (60/76) on #38807 @9a38b828 and on #38689 @9212053b, against 80.26% (61/76) on main. The only line that moves is line 151, theexcept Exceptionbranch ofschedule()._run()(logger.warning("Kiro CLI on KAS notice failed", exc_info=True)). No test targets it; some other test's failing gateway path hits it by accident.Why it matters
Unrelated PRs go red on Coverage Gate and need a maintainer to look at a file they never changed. The branch also guards a real contract: a missing note must not reach the gateway.
Not a goal
src/and no coverage baseline edit.What changed (motivation -> approach -> change)
Line 151 is hit only by accident, so the file's coverage depends on which other tests run. A direct test removes that dependency. One new test,
test_schedule_logs_and_swallows_a_delivery_failureintest/test_kiro_on_kas_notice.py, makesdeliver_when_floor_landsraise, runsschedule(), and checks that the task ends without an exception and that the failure is logged. Test-only, no src change.Backwards compatibility
Compatible: only a test is added; no runtime code changes.
Removes nothing: the diff adds one test and deletes no code.
Tests
The new test locks in that
schedule()logs "Kiro CLI on KAS notice failed" and swallows a delivery failure.Local coverage, this file only. Command:
pytest test/test_kiro_on_kas_notice.py --cov=kiro_crew.kiro_on_kas_notice --cov-report=term-missing, on main 7b9a62b.Line 151 is missing before and covered after. Lines 147-150 and 152-154 were also missing in this single-file run and are covered now; in the full CI suite other tests already hit them, so only line 151 moved there.
With the test's stub changed to return instead of raise, the run fails:
AssertionError: assert 'Kiro CLI on KAS notice failed' in ''. The stub was restored before the commit.Proof: not provable -- test-only change
Manual verification
N/A -- unit coverage sufficient; the change is one unit test.
Real-machine verification
N/A -- the diff adds a unit test that runs on the CI runner and nothing else.
Related Issues
None.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.