Skip to content

BUG-136 - Harden Final RC1 Review Follow-Up Hot Paths

Summary

Fix the concrete hot-path findings selected from the final RC1 C++ review pass. The fixes address shutdown null-safety and AICH close-awareness, stale Win32 timer callbacks, socket allocation cleanup, Arr search result lifetime and paging, and qBittorrent-compatible queue-cache invalidation after mutations.

Findings Addressed

  • Shared-file shutdown abandonment could make later known-file save and completion finalization dereference theApp.sharedfiles after it was deliberately nulled.
  • AICH sync could block indefinitely on hashing_mut and prevent the UI thread from reaching the bounded shared-hash shutdown path.
  • Already-queued UPnP and server retry timer callbacks could act on newer state after their original timer was killed.
  • Normal TCP accept and server connect still had low-memory allocation/list insertion paths that could escape handlers or leave connection state dirty.
  • Arr-created native searches were stopped but not deleted, retaining native tabs/results, and REST search paging still collected every visible result before applying the requested page.
  • qBittorrent-compatible transfer-info cache could return stale queue state immediately after successful qBit-visible mutations.

Acceptance Criteria

  • [x] Known-file save and completion finalization are null-safe when shared-file ownership has been abandoned during shutdown.
  • [x] AICH sync polls hashing_mut and exits promptly once shutdown is observed.
  • [x] UPnP timeout and server retry callbacks validate the live timer id before dispatching.
  • [x] TCP accept and server connect recover cleanly from client/server socket wrapper allocation or publication failure.
  • [x] Arr-created searches are deleted after result collection, and Arr polling can request a bounded non-exact search result page.
  • [x] qBit torrent-info cache is invalidated after successful add, delete, category, pause, stop, and resume mutations.

Implementation Evidence

  • 074d67ce BUG-136 harden shutdown hash completion edges
  • 93a3b515 BUG-136 ignore stale callback timers
  • e5ae4272 BUG-136 guard socket allocation failures
  • 1a018a37 BUG-136 bound Arr search result lifetime
  • 84c45465 BUG-136 invalidate qBit queue cache after mutations

Validation Evidence

  • git diff --check
  • Source normalization scan for touched app files.
  • Debug x64 app build through python -m emule_workspace build app --variant main --config Debug --platform x64 --build-output-mode ErrorsOnly at 20260529T104403Z-build-app.
  • Release x64 app build through python -m emule_workspace build app --variant main --config Release --platform x64 --build-output-mode ErrorsOnly at 20260529T104432Z-build-app.