Skip to content

harden(emulator-stream): bounded input + stall watchdog - #22

Merged
dev-josias merged 1 commit into
mainfrom
feat/harden-emulator-stream
Jun 30, 2026
Merged

harden(emulator-stream): bounded input + stall watchdog#22
dev-josias merged 1 commit into
mainfrom
feat/harden-emulator-stream

Conversation

@dev-josias

Copy link
Copy Markdown
Contributor

Non-breaking robustness fixes from an adversarial review of the M1/M2/M3 emulator core. Scoped to emulator_stream.rsno overlap with PR #21 (different file, no signature changes, no Cargo.*).

Fixes

Deferred (intentionally not here — would break #21's API use or need floem)

The review also caught false positives (the "256-byte row alignment" blocker — write_texture accepts any width; use-after-free claims — wgpu's BindGroup holds the texture Arc), excluded from the fix list.

Sole author: dev-josias.

From an adversarial review of the M1/M2/M3 core:
- Input now uses a bounded channel with try_send (drop latest-wins) instead of
  an unbounded channel, so gestures during the connect window can't grow memory
  unboundedly (review finding #2).
- The frame loop has a 10s stall watchdog: if the gRPC stream connects but stops
  emitting (half-open socket), the producer stops instead of hanging the thread
  + runtime forever (finding #3).
- Documented the view_to_device <-> floem letterbox contract (finding #8).

Deferred (need API/signal-type or floem changes; coordinate after PR #21):
the producer stop-handle/leak fix (#1), pre-decode-once (#4), and floem-side
texture eviction / per-frame buffer reuse (#5-#7).
@dev-josias
dev-josias merged commit e8ea910 into main Jun 30, 2026
7 checks passed
@dev-josias
dev-josias deleted the feat/harden-emulator-stream branch June 30, 2026 17:05
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