Skip to content

test(tui): nothing pins _poll's exclusive/group worker decoration #666

Description

@pbean

DashboardScreen._poll is declared @work(thread=True, exclusive=True, group="poll") (src/bmad_loop/tui/screens/dashboard.py:746). The exclusive=True
plus group="poll" pair is load-bearing: it is what makes an arriving poll cancel
an in-flight one instead of letting two threads feed ctx.log's pyte stream
concurrently.

Nothing in the suite asserts that decoration.

How it got here

test_poll_skips_while_another_holds_the_lock used to call screen._poll(...)
directly, so it ran through the decorator. PR #663 changed it to invoke
DashboardScreen._poll.__wrapped__ inside a private worker group, because the
decorated form was exactly what made the test flaky — an interval tick landing
between the hand-started worker and await worker.wait() cancelled the test's own
worker via cancel_group(node, group), raising WorkerCancelled on slow Windows
runners.

That coverage was never real in the old form either (the decorator was the thing
breaking the test, not a thing it verified), and the PR states the loss honestly in
its commit body. But the gap is now unpinned in both directions.

Suggested shape

A one-line seam assertion is enough — read the decoration off the class attribute
and assert exclusive and the group name, so a refactor that drops either one
fails a test rather than silently re-admitting concurrent polls. Sizing it
correctly means checking what textual's @work actually exposes on the wrapper in
the pinned version (>=8.0,<9) rather than assuming a public accessor exists.

Low priority — the behavior is exercised incidentally by every other test that
ticks the dashboard; what is missing is a direct, named guard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4Parked - needs design, blocked upstream/PR, or speculativearea:tuiTextual TUI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions