chore(photon): clean up ty type-checker warnings from lint-diff bot

The advisory lint-diff bot flagged 17 new ty diagnostics. 6 are
`unresolved-import` for httpx/aiohttp/pytest, which is structural
(CI lint env has no project deps) and matches every other platform
plugin's noise floor. The remaining 11 are real and fixable:

- `Optional[callable]` → `Optional[Callable[..., None]]` (auth.py)
  invalid-type-form on `callable` as a type expression. Added the
  proper `typing.Callable` import. Two sites: on_pending in
  poll_for_token, on_user_code in login_device_flow.

- Dropped three unused `# type: ignore` comments on
  hermes_constants / hermes_cli.config imports — ty can resolve
  those modules fine, the comments were dead.

- _supervise_sidecar(proc) widened `proc.stdout` from
  `IO[Any] | None` to a narrowed local after an early `is None`
  guard. Defensive against subprocesses launched without
  stdout=PIPE.

- cli.py _cmd_setup: dropped the `has_existing_project = bool(...)`
  intermediate, did the narrowing inline with `if existing_id and
  existing_secret:` so ty can see project_id/project_secret are
  non-None when create_user is called.

- test_inbound.py: replaced three `adapter.handle_message =
  fake_handle  # type: ignore[assignment]` with
  `monkeypatch.setattr(adapter, 'handle_message', fake_handle)`.
  Same behavior, no type-ignore, and the monkeypatch reverts
  cleanly between tests.

Validation:
  ty check plugins/platforms/photon/ tests/plugins/platforms/photon/
    → All checks passed!
  tests/plugins/platforms/photon/ → 26/26 pass
  py_compile clean
  Windows footgun checker → 0 footguns
This commit is contained in:
teknium1
2026-06-08 13:38:30 -07:00
committed by Teknium
parent 083d8b2d60
commit 8f89c4615f
4 changed files with 16 additions and 12 deletions
@@ -32,7 +32,7 @@ async def test_dispatch_text_dm(monkeypatch: pytest.MonkeyPatch) -> None:
async def fake_handle(event: MessageEvent) -> None:
captured.append(event)
adapter.handle_message = fake_handle # type: ignore[assignment]
monkeypatch.setattr(adapter, "handle_message", fake_handle)
payload = {
"event": "messages",
@@ -70,7 +70,7 @@ async def test_dispatch_group_id_detected(monkeypatch: pytest.MonkeyPatch) -> No
async def fake_handle(event: MessageEvent) -> None:
captured.append(event)
adapter.handle_message = fake_handle # type: ignore[assignment]
monkeypatch.setattr(adapter, "handle_message", fake_handle)
payload = {
"event": "messages",
@@ -97,7 +97,7 @@ async def test_dispatch_attachment_surfaces_marker(
async def fake_handle(event: MessageEvent) -> None:
captured.append(event)
adapter.handle_message = fake_handle # type: ignore[assignment]
monkeypatch.setattr(adapter, "handle_message", fake_handle)
payload = {
"event": "messages",