Port the missing Electron/backend regression from PR #118267. The production fix and hook tests are already integrated; preserve the source test behavior with formatting-only adjustments. Source-Commit: 82cc062378d1dccd38f60932651a1de0a61d0012 (cherry picked from commit ea0e0180f389be9bf755460006d0c953325ada66)