Type-check with ty, annotate every function, add CLAUDE.md #2
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
schaefera/ute2edriver!2
Loading…
Reference in a new issue
No description provided.
Delete branch "build/types"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
ANN), andty checkmust pass with no warnings. CI runs both before the tests.CLAUDE.mdwith the project's rules, blast radius and testing tiers.agent.pynow reads the touchscreen's range withcapabilities(absinfo=False)plusdevice.absinfo(code). This is typed correctly, and it works with the phone's python3-evdev 1.7..python-versionpins 3.12, the phone's version. uv's own build of 3.12 has the headers evdev needs to build in CI.Blast radius
Tier: trunk
Trunk paths touched:
src/ute2edriver/agent.py,phone.py,transport.py,lock.py,cli.py,pyproject.toml,uv.lock,.forgejo/workflows/ci.ymlTesting tier: maximum: dev dependencies, the lockfile,
.python-versionand CI. Also: standard (annotations, the touch-range lookup) and ship on sight (README, CLAUDE.md).Gate / rollback: nothing is deployed. Rollback is reverting this merge; the previous main is
34127c0.Proof
--locked:ruff check .passes.ty checkpasses.python -m unittest discover -s tests: 22 tests OK.data.forgejo.org/oci/node:20-bookworm:.python-versionexisted, failed to build evdev: the image's 3.11 has noPython.h. That failure is why 3.12 is pinned.find()'s annotations stripped, ruff fails with 3ANNerrors.self.tap(*self.position(name))toself.tap(self.position(name))makes ty fail (missing-argument).ute2e infopushed the new agent, which read the touch range 1080×2400 viaabsinfo().modules.tomlpassed 9/9 steps andsearch.toml15/15.capabilities(absinfo=True)lookup fails ty.c02501fand run 715 onabb4209(head) are both green.Review
Reviewer: fresh-context
code-reviewat high (review 290 onc02501f): 5 low findings.abb4209:cli.pylisted as trunk).ecodesis generated at runtime; 1.7 compatibility is guarded by the phone E2E.noqa: TRY004is live, asruff check --ignore-noqashows.Review-Confidence: 100/100. All trunk files were reviewed at high, every finding is resolved with evidence, the one later commit is doc-only, and CI is green on both commits.
Confidence by part
agent.pytouch-range lookup: high. Tried on the phone with evdev 1.7..python-version: high. Previewed in the runner's image, and CI is green.agent.pychange for that reason.🤖 Generated with Claude Code
claude-review · level high · trunk · commit
c02501fb5d· range origin/main...HEADNo high or medium findings. Ran locally:
ruff check .,ty check, and the 22 unit tests all pass with--locked. Checked that the annotations match their callers (Path|str, None handling), thatcase "run" if flow is not Nonecannot skip a run (flow is always set when the command is "run"), that transport'scheck=Falseequals subprocess's default, and that agent.py uses only evdev 1.7 calls (capabilities(absinfo=False),InputDevice.absinfo(code)andinput_props()all exist in 1.7).Files: .forgejo/workflows/ci.yml, .python-version, CLAUDE.md, README.md, pyproject.toml, uv.lock, src/ute2edriver/{agent,cli,config,flow,lock,phone,positions,transport}.py, tests/{test_config,test_flow,test_phone,test_positions}.py
Low findings outside the diff:
evdev>=2.0.0, so ty checks agent.py against 2.0 stubs. A call that only 2.0 has would pass ty and CI, then fail on the phone's 1.7, yet CLAUDE.md says agent.py "uses only evdev calls that 1.7 has". Nothing enforces that. Nothing in CI runs agent.py; compileall only byte-compiles it. The maximum-tier checks (ruff on stripped annotations, ty on a wrong call) do not cover 1.7 compatibility or the touch-range change, which is tried only by the manual E2E.device_lockand decides which phone actions run under it. A change there can break "one driver per phone", which the Rules section calls a trunk concern.@ -37,2 +37,3 @@axes = device.capabilities(absinfo=False).get(e.EV_ABS, [])if e.ABS_MT_POSITION_X in axes and e.INPUT_PROP_DIRECT in device.input_props():return device, axes[e.ABS_MT_POSITION_X].max, axes[e.ABS_MT_POSITION_Y].maxreturn (device, device.absinfo(e.ABS_MT_POSITION_X).max,low · The touch range now comes from a second ioctl per axis (
device.absinfo(...)) rather than from the capabilities dict. This is a behaviour change inside an annotation PR. It is correct on 1.7, but only the manual E2E on the phone exercises it, because CI never runs agent.py and ty checks it against evdev 2.0 stubs.@ -72,2 +77,3 @@if not isinstance(value, ACTIONS[action]):raise ValueError(f"step {number}: {action} = {value!r} has the wrong type")# A mistake in the flow file, reported like the others: not a TypeError.raise ValueError(f"step {number}: {action} = {value!r} has the wrong type") # noqa: TRY004low ·
# noqa: TRY004is unused: the TRY rules are not selected (only the defaults plus ANN), so the comment does nothing. Drop it, or enable RUF100 so stale noqa comments are caught.Replies to review 290 (all low):
evdev>=1.7,<1.8. Itsecodesconstants are generated at runtime and carry no type information, so ty then reports 50 falseunresolved-attributeerrors on everye.EV_*/e.KEY_*.agent.pychange. For this PR,ute2e infoand both example flows passed on the phone (evdev 1.7.0).absinfo()lookup only covered by the manual E2E: agreed, no change. That E2E was run; see 1.node:20-bookwormwith uv's managed 3.12 (this was previewed in docker).c02501fis green, Lint and Types included.noqa: TRY004is inert: refuted. ruff 0.17's defaults include TRY004:ruff check --ignore-noqa src/ute2edriver/flow.pyreports it at flow.py:79.abb4209(CLAUDE.md only).WIP: Type-check with ty, annotate every function, add CLAUDE.mdto Type-check with ty, annotate every function, add CLAUDE.mdclaude-review merge gate · head
abb4209Checked:
c02501f) has no high or medium findings, only 5 low. Each low one is answered: fixed (cli.py now trunk), declined with a reason (evdev 1.7 pin gives false ty errors; phone E2E guards it), refuted, or covered by CI/E2E.abb4209. It changes CLAUDE.md only: cli.py moves from leaf to trunk in Blast radius. No code is touched.