Skip to content

test: cover the delivery-failure branch of kiro_on_kas_notice.schedule() - #40576

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
mkt-pkg/kas-notice-delivery-failure-test
Nov 22, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
mkt-pkg/kas-notice-delivery-failure-test

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Keep the per-file coverage floor for src/kiro_crew/kiro_on_kas_notice.py stable by testing the delivery-failure branch of schedule() directly.

Coverage Gate applies 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, the except Exception branch of schedule()._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

  • No change to src/ and no coverage baseline edit.
  • No change to any other test or file.

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_failure in test/test_kiro_on_kas_notice.py, makes deliver_when_floor_lands raise, runs schedule(), 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.

Stmts Miss Missing
Before 76 16 102-104, 116-118, 128->132, 137-139, 147-154
After 76 9 102-104, 116-118, 128->132, 137-139

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

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

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.
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision bcce45f4658c818440c8cd220b54a05b851f2674 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision bcce45f4658c818440c8cd220b54a05b851f2674 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of bcce45f4658c818440c8cd220b54a05b851f2674 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed bcce45f4658c818440c8cd220b54a05b851f2674 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] bcce45f

Verdict parsed from the review's SHA-scoped output markers for commit bcce45f4658c818440c8cd220b54a05b851f2674.

False positive or not applicable? A repository writer can comment:
/ai-review override fable bcce45f4658c818440c8cd220b54a05b851f2674 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of bcce45f4658c818440c8cd220b54a05b851f2674 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] bcce45f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt bcce45f4658c818440c8cd220b54a05b851f2674 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision labels Nov 22, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: 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, 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.

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 bcce45f465 · 19 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 22, 2026 04:13

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit e06cfb4 into main Nov 22, 2026
113 of 114 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the mkt-pkg/kas-notice-delivery-failure-test branch November 22, 2026 04:13
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants