fix(app): guard USB auto-ingest against a shell status without files (BIT-32038) #145

Merged
spark merged 1 commits from fix/BIT-32038-usb-status-files-undefined into main 2026-11-03 12:30:05 +00:00
Owner

Error Loop BIT-32038: TypeError: undefined is not an object (evaluating 'i.files.filter') in the desktop app, ERRSIG eec983840d8b / ERRCLUSTER 97bbf4a605ce.

Root cause

useUsbCamera's auto-ingest effect (added today in #141/#143, the USB card-list feature) reads status.files.filter(...) directly, guarded only by status?.tether. The Rust side always serializes files as an array, but nothing on the TS/IPC boundary enforces that invariant at runtime, so a status payload missing files crashes the passive-effects flush with the reported TypeError — matching the deeply recursive ky/wa React commit-phase stack in the report.

The render path in UsbCameraButton already defends this with status?.files ?? []; the auto-ingest effect did not.

Fix

Default to [] the same way the render path does, in apps/app/src/library/UsbCamera.tsx.

Testing

Added a regression test that reproduces the exact crash (status with tether: true but no files) and confirmed it throws on the pre-fix code and passes after the fix. Full UsbCamera.test.tsx suite (6 tests) passes.

Error Loop BIT-32038: `TypeError: undefined is not an object (evaluating 'i.files.filter')` in the desktop app, ERRSIG `eec983840d8b` / ERRCLUSTER `97bbf4a605ce`. ## Root cause `useUsbCamera`'s auto-ingest effect (added today in #141/#143, the USB card-list feature) reads `status.files.filter(...)` directly, guarded only by `status?.tether`. The Rust side always serializes `files` as an array, but nothing on the TS/IPC boundary enforces that invariant at runtime, so a status payload missing `files` crashes the passive-effects flush with the reported TypeError — matching the deeply recursive `ky`/`wa` React commit-phase stack in the report. The render path in `UsbCameraButton` already defends this with `status?.files ?? []`; the auto-ingest effect did not. ## Fix Default to `[]` the same way the render path does, in `apps/app/src/library/UsbCamera.tsx`. ## Testing Added a regression test that reproduces the exact crash (status with `tether: true` but no `files`) and confirmed it throws on the pre-fix code and passes after the fix. Full `UsbCamera.test.tsx` suite (6 tests) passes.
spark added 1 commit 2026-11-03 12:22:01 +00:00
fix(app): guard USB auto-ingest against a shell status without files (BIT-32038)
ci / rust (pull_request) Successful in 3m56s
ci / typescript (pull_request) Successful in 7m38s
dc977fdb6b
The auto-ingest effect in useUsbCamera read status.files.filter directly,
guarded only by status?.tether. The Rust side always serializes files as
an array, but nothing on the TS side enforces that invariant on the IPC
boundary, and a status shape missing files (e.g. a stale/partial Tauri
response) crashed with "undefined is not an object (evaluating
'i.files.filter')" during the passive-effects flush, matching the
desktop error loop report. Default to an empty array like the render
path at UsbCameraButton already does.

Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8)
Paperclip-Issue: BIT-32038
Paperclip-Run: 68339729-e8a7-47bb-ac2b-20ba0f3189dd
spark merged commit fbdc728ae7 into main 2026-11-03 12:30:05 +00:00
Sign in to join this conversation.