refactor(apple): drop unread recorder phases and one-caller helpers from USB capture recording
Merged
TH
6h ago+45+45+01234567890123456789-165-165-012345678901234567890123456789
Summary
Behavior-preserving simplification of the USB capture recorder from #5201. Net production lines: โ91.
- Recorder lifecycle: the
stopping,stoppedandfailedphases and thestop,stoppedandfailevents are removed. The lifecycle is local to onestartAppleRecordingcall and nothing read those phases. Every removedapplywas guarded or always allowed, so none could throw.select,fall-backandfirst-framestay: a fallback happens only fromstarting(usb-capture), and its reason still reachesrecorderFallbackReason. The unusedstategetter goes too. HOST_RECORDERS: thebackendfield repeated the record key. Callers now pass the key.selectAppleRecorder,nameShared,compileUsbCaptureHelper: each had one caller and is now inlined. The compile uses the same cache name, sources, timeout and signal.- Inventory check: one
.catch(() => false)replaces two. A read that fails still counts as "not unique", and the rejection is still handled before the helper starts. recovery.ts: removed a duplicate doc comment onreattachHostRecording.
Swift is unchanged: a source edit would make every host recompile the helper.
Before / after
No observable change. Recorder selection, the fallback rule, exit-code meanings, timings and output stay the same.
Value
- Production lines: โ91 (+45/โ165 total, including tests).
recorder-state.ts: 96 โ 50 lines.
Validation
Head 6868f8f: recorder-state.test.ts, recording/runtime.test.ts and apple-usb-capture-host.test.ts pass locally (35 tests). The two tests for the deleted post-first-frame phases are removed. CI owns typecheck and the other gates. No device run: the start and stop sequences are unchanged.
๐ค Generated with Claude Code
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.