Skip to content

fix: follow-ups from the review of #187-#193 - #194

Merged
Derrors merged 1 commit into
mainfrom
fix/review-followups
Nov 25, 2026
Merged

Derrors merged 1 commit into
mainfrom
fix/review-followups

Conversation

@Derrors

@Derrors Derrors commented Nov 25, 2026

Copy link
Copy Markdown
Owner

What and why

Follow-ups from a review of #187–#193:

  1. /mcp chunked bodies. The decoded body was limited to 1 MB but the raw bytes weren't: endless short trailer lines, or long chunk extensions on tiny chunks, could grow the buffer for the whole 60 s body timeout. The raw body is now limited to 1 MB plus 64 KB of framing (413 past that). It is read in 64 KB pieces, so a 1 MB body takes about 16 decoding passes instead of 256. A broken chunk gets 400 instead of a closed connection.
  2. /mcp answers: 1xx, 204 and 304 are never sent chunked; they have no body (RFC 9112 6.3).
  3. MjpegStream errors follow the request's language (the stream ran outside the language scope, unlike ScreenStream).
  4. The scoped task's foreground check matches Route like the other dispatch sites.
  5. Native video: a page that closes while its connection waits for the next media stream (an unlock holds the device for seconds) no longer makes the daemon open the stream again for nobody.
  6. The viewer lets its port go before stopping the agents.
  7. Wording: with nobody watching, the phone's frames are still depacketized and scanned, only not copied or queued; media.rs's comment and the changelog said more than that.
  8. CONTRIBUTING: the per-package cargo fmt list includes ictl-ax, as CI does.
  9. CHANGELOG (Unreleased): a PR number on every line, the iOS 17–18 disk image fix (fix(ddi): mount the classic personalized DDI on iOS 17-18 (#185) #186) added, sections and wording as CONTRIBUTING asks.

Not changed: a TTL in front of the viewer's token-file stat (microseconds per request; a revoked token would keep working for the TTL).

Tests

1. Unit tests

  • cargo test --workspace --all-features --locked: 553 passed; clippy with -D warnings; cargo fmt --check for all 11 packages; node --test tests/viewer/*.test.mjs: 36 passed; tests/check_regression_cases.py: 0 missing
  • New assertions: in mcp_over_http_takes_a_chunked_body, a broken chunk gets 400 and endless trailer lines get 413 (through the real request path); in streams_are_chunked, 202 without a length is chunked and 204/304 aren't
  • Item 5 has no unit test (it needs a HID session)
  • No existing test removed, ignored or loosened

2. Real-device regression

  • Device, host: iPhone 15 Pro Max (iPhone16,2), iOS 27.2.1, native control; Debian 12
  • tests/device/run.py: 2 rounds, 32 calls, 0 failed
  • tests/device/scenarios.py --lock tools typing batch lock: 37/37
  • Not run on the iPad (WDA) this time

3. Regression cases

4. Real-device proof of the fix or feature

  • Device: iPhone 15 Pro Max, iOS 27.2.1
  • Item 5's path: two /video?src=device connections, one closed after 8 s, then lock and an action that unlocks first (10.2 s). The open one never ended, got about a frame a second while locked, none during the unlock, then resumed from a keyframe; the closed one ended normally. The exact moment item 5 is about (a page closing while its connection waits for the reopened stream) couldn't be timed by hand and rests on review
  • Item 3: mjpeg_stream for another device than the controlled one, sent straight to the daemon: The controlled device changed with lang: en, 正在控制的设备变了 with lang: zh
  • Untested on a device: items 1 and 2 against the deployed viewer (unit-tested through the real request path), item 6, the MJPEG picture itself (needs the iPad), a macOS host

Checklist

  • MCP tool names, parameters and default outputs stay compatible (D10)
  • No new dependencies
  • CHANGELOG.md and CHANGELOG.zh-CN.md: these refine unreleased changes, so no new lines; the section is tidied as above
  • No private data in the outputs above

🤖 Generated with Claude Code

- /mcp chunked bodies: the raw body is bounded too (the decoded 1 MB plus
  64 KB of framing; endless trailer lines or long chunk extensions got
  413 instead of growing for a minute), read in 64 KB pieces (about 16
  decoding passes for 1 MB instead of 256), and a broken chunk gets 400
  instead of a closed connection
- /mcp answers: 1xx, 204 and 304 are never sent chunked (they have no
  body, RFC 9112 6.3)
- MjpegStream errors are in the page's language (the stream ran outside
  the request's language scope)
- the scoped-task foreground check matches `Route` like the other
  dispatch sites
- a page's native video connection that closes while it waits for the
  next media stream (an unlock holds the device for seconds) no longer
  opens the stream again for nobody
- the viewer lets its port go before stopping the agents
- media.rs's comment and the changelog no longer say unwatched frames
  aren't assembled: they are depacketized and scanned, only not copied
  or queued
- CONTRIBUTING's per-package fmt list includes ictl-ax, as CI does
- the Unreleased changelog: PR numbers on every line, the iOS 17-18 disk
  image fix (#186), sections and wording per CONTRIBUTING

Not changed: a TTL in front of the token file's stat (microseconds per
request; a revoked token would keep working for the TTL).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@Derrors
Derrors merged commit 4dcbb78 into main Nov 25, 2026
7 checks passed
@Derrors
Derrors deleted the fix/review-followups branch November 25, 2026 07:25
Derrors added a commit that referenced this pull request Nov 25, 2026
…ay (#195)

#194 raced the whole of reopen_feed against the page closing. Once it
holds the device lock, reopen_feed opens the HID session (Tunnel::hid),
which must not stop halfway: a media stream started and never stopped.
Now only the wait (the pause, then the device lock) races the page; a
page that goes away while an unlock holds the device still gets nothing
opened for it, and once the lock is taken nothing is cancelled.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant