electron+tests: zoom plumbing (construction-only lights), hermeticity fence for the jobs suite

- ZOOM: the ⌘±/⌘0 ladder is owned, not stock roles — applyZoom sets the
  factor and broadcasts 'lh:zoom'; the renderer publishes --lh-zoom; the
  gutter lengths (.lh-lights-gutter / .lh-closed-toggle) divide by it so
  their RENDERED size is a physical constant at every zoom — the graph
  button stays glued next to the lights, nothing slides under them.
  before-input-event catches ⌘=/layout variants the menu's Plus may not
  claim; did-finish-load re-pushes on reload; getZoom covers first paint.
  The lights themselves stay at construction position — Electron 44 has
  NO setTrafficLightPosition (options-only; the first run crashed on
  it). HIG-acceptable: native lights hug the corner; the web chrome
  compensates around them.
- JOBS SUITE FLAKE, actually fixed this time: the seams are
  module-global and the sweep scans every record — a timed-out async
  test left a running orphan + late wake that poisoned its NEIGHBORS
  (respawned 3 !== 0). New afterEach fence: settle every tracked
  running job, unregister aborts, seams reset to inert no-ops — every
  test starts from identical state regardless of upstream flake.
  Verified: two consecutive full-suite runs 1326/1326.
This commit is contained in:
amosblomqvist
2026-10-05 05:42:27 +03:00
parent f4775ebc93
commit 6b58d87d9e
5 changed files with 147 additions and 6 deletions
+17 -1
View File
@@ -54,7 +54,12 @@ const IS_ELECTRON = typeof navigator !== "undefined" && navigator.userAgent.incl
declare global {
interface Window {
/** Preload bridge (electron/preload.cjs) — Electron only, absent in the browser. */
lh?: { expandWindow: () => void };
lh?: {
expandWindow: () => void;
/** The zoom truth (owner round 7): subscribes to "lh:zoom" pushes; returns unsubscribe. */
onZoom?: (cb: (factor: number) => void) => () => void;
getZoom?: () => Promise<number>;
};
}
}
@@ -84,10 +89,21 @@ export function SidebarProvider({ children }: { children: React.ReactNode }) {
document.documentElement.classList.add("lh-electron");
}
// THE ZOOM TRUTH (owner round 7, 2026-10-05): ⌘±/⌘0 zoom the UI
// (Electron zoomFactor) while the native traffic lights stay
// physical-fixed — the CSS gutter lengths divide by this factor so
// their RENDERED size never moves. getZoom covers the first-paint
// race; every later change arrives as an lh:zoom push.
const setZoomVar = (factor: number) =>
document.documentElement.style.setProperty("--lh-zoom", String(factor));
const off = window.lh?.onZoom?.(setZoomVar);
void window.lh?.getZoom?.().then(setZoomVar);
const stored = localStorage.getItem(STORAGE_KEY);
// Default: open (first run introduces the sidebar).
setOpen(stored === null ? true : stored === "1");
setMounted(true);
return () => off?.();
}, []);
// Narrow-window auto-close/auto-restore (see SIDEBAR_AUTOCLOSE note):