Skip to content

test: give the outcome deadline test its whole deadline - #512

Merged
hellices merged 1 commit into
mainfrom
fix/511-outcome-deadline-test
Oct 29, 2026
Merged

hellices merged 1 commit into
mainfrom
fix/511-outcome-deadline-test

Conversation

@hellices

Copy link
Copy Markdown
Owner

Closes #511

Summary

test_absolute_deadline_reaps_reader_that_suppresses_cancellation failed twice in a row on Windows in #509's CI, in code #509 does not touch.

  • Cause: the test used a 10 ms deadline and the real monotonic clock. DeploymentOutcomeController._observe subtracts the time since registration from the deadline before its first read. A runner that started the worker more than 10 ms late therefore marked the deadline elapsed without ever calling the reader, and the test waited 30 s for started.
  • Fix (test only): the test freezes the controller's clock (clock=lambda: 0.0), so the run gets its whole deadline however late its worker starts. It uses deadline_seconds=0.5, which the run's real asyncio.timeout still enforces, leaving room for the read task to start on a coarse Windows timer (about 15 ms).
  • What it proves is unchanged: the absolute deadline reaps a reader that suppresses cancellation, and the outcome is INCOMPLETE with a deadline summary.

Production is unaffected; the default deadline is 300 s.

Verification

  • Reproduced the race deterministically with a temporary test, not committed. With the old settings (deadline_seconds=0.01) and a clock that moves 20 ms on between registration and the worker running, the reader is never called and started.wait() times out. That is the CI failure.
  • uv run pytest -p no:tach tests/ui/test_deployment_outcome_controller.py -k absolute_deadline_reaps -q: passed 5 runs in a row, about 0.8 s each.
  • uv run pytest -p no:tach -n 8 tests/ui/test_deployment_outcome_controller.py -q: 35 passed.
  • The fixed test still catches both behaviours it is about. Dropping the second cancellation of a read that suppresses the first fails it, and so does not marking the deadline elapsed on TimeoutError.
  • ruff check, ruff format --check and mypy on the test file: clean.

Checklist

  • This closes an accepted issue in this repository that is assigned to me.
  • Tests cover the change, written to fail first where behavior changed. (Test-only change; the race was reproduced first.)
  • make check passes locally. (Test-only change. The affected file and lint/type checks were run; the full suite runs in CI.)
  • User-facing docs and the README match the change, or nothing user-facing changed.
  • No security invariant is weakened: writes still need a keystroke approval
    and a fail-closed audit entry, and sensitive reads are still masked.

test_absolute_deadline_reaps_reader_that_suppresses_cancellation built
the controller with a 10 ms deadline and the real monotonic clock.
_observe subtracts the time since registration from the deadline before
its first read, so a runner that started the worker more than 10 ms
late marked the deadline elapsed without ever calling the reader, and
the test waited 30 s for a start that never came. It failed twice in a
row on Windows in #509's CI.

The test now freezes the controller's clock, so the run gets its whole
deadline however late it starts, and uses a 0.5 s deadline, which the
run's real asyncio timeout still enforces with room for the read task to
start on a coarse Windows timer. It still proves the absolute deadline
reaps a reader that suppresses cancellation.

Closes #511.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 22:52
@hellices hellices added this to the v0.7.0 milestone Oct 29, 2026
@hellices hellices added area: ui Textual application, screens, widgets, and interaction design concern: testing Test infrastructure, evaluation, and quality measurement labels Oct 29, 2026
@hellices hellices self-assigned this Oct 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approved

No active review issues were identified for the test-only Windows timing adjustment.

No open issues 🎉

What changed in this PR

This test-only change addresses the Windows timing race in #511 by giving the deployment outcome observer its full deadline regardless of worker startup delay. Production behavior is unchanged.

Changes:

  • Freeze the controller’s clock and increase the test deadline from 10 ms to 500 ms.
  • Retain the real asyncio timeout to verify that the deadline reaps a reader that suppresses cancellation.
  • Explain the timing adjustment in an inline comment.
File Description
tests/​ui/​test_deployment_outcome_controller.py Adjust the clock and deadline to stabilize the cancellation test on Windows.

Review effort: Balanced

@my-reviewer-agent my-reviewer-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

검토 범위에서 보고할 이슈가 없습니다.

@hellices
hellices merged commit 68365a8 into main Oct 29, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui Textual application, screens, widgets, and interaction design concern: testing Test infrastructure, evaluation, and quality measurement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: the outcome deadline test can elapse before its reader starts

2 participants