Skip to content

_alloc_time_for_strategy floors to 0, silently asserting nothing under a tight timeout #507

Description

@chinmayajha

Found while investigating dead-Appium-session error masking (see PR fixing that, #506).

_alloc_time_for_strategy (used by StrategyManager.assert_presence, common/strategies.py) divides the total timeout evenly across applicable strategies. When timeout=1 and there are 2+ applicable strategies, integer/float flooring allocates 0 seconds to each strategy — so assert_presence silently asserts nothing instead of erroring or falling back to a sane minimum per-strategy budget.

Ask: floor each strategy's allocation at some sane minimum (e.g. never below ~0.5s), or raise a clear configuration error when the requested timeout can't be meaningfully divided across the number of applicable strategies, instead of silently no-op'ing the assertion.

Not independently reproduced end-to-end in this pass — flagging from source-level analysis for someone to verify against a real assertion call with a short timeout.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions