Files
lucioandClaude Opus 5 06122c66dd fix: single-reader CDP session; prime walk no longer fails silently
prime ran the in-page click walk as a task while drain() also read the
websocket. `websockets` forbids concurrent recv(), so this was always broken --
it just failed differently by version: loudly on websockets 15.0.1, and
silently on 16.0, where the JS still executed but its return value was lost.
The `walk: None` in every prime summary was that failure being swallowed by a
bare `except Exception`, and I read past it.

CDPSession now runs exactly one reader coroutine that dispatches command
replies to futures and events to a queue, so call() and drain() can safely run
concurrently -- which priming genuinely needs, since the requests being observed
are triggered by the script being awaited.

call() also gains a timeout so a lost reply fails instead of hanging, and the
walk now reports its error rather than reporting None.

Tests use a fake websocket that asserts the socket never has more than one
concurrent reader.

129 tests, no network required.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-07-25 09:27:24 -07:00

29 lines
749 B
TOML

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "wodify"
version = "0.1.0"
description = "Read-only client for the Wodify athlete app (no browser at query time)"
requires-python = ">=3.11"
dependencies = []
[project.optional-dependencies]
# CDP is a WebSocket protocol, so priming needs a client. The query path is
# deliberately stdlib-only.
prime = ["websockets>=12"]
dev = ["pytest>=8", "pytest-asyncio>=0.23"]
[project.scripts]
wodify = "wodify.cli:main"
[tool.setuptools.packages.find]
where = ["src"]
[tool.pytest.ini_options]
testpaths = ["tests"]
# The CDP session spawns its reader task on construction, so its fixtures must
# be built inside a running loop.
asyncio_mode = "auto"