← Commit history

Taskbar mode switches are now race-proof: an identity generation token makes every mode change or new sweep supersede all in-flight stamp work, so rapid state clicking can no longer land stale AUMID stamps on top of a plain-mode strip, and the plain apply runs a verify re-strip after the settle so the glass converges even when a stamp had already passed its abort check when the click arrived.

John Lauer ·5c1a339f51 ·2mo ago ·parent 69776ca
4 files changed +25−7
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.215",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.215/adom-bridge-puppeteer-v2.0.215.zip",-  "sha256": "43644916f83de742dcd9344758adaac3dc40937f3613463b85cd95217bfcd952",-  "size": 939544,+  "version": "2.0.216",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.216/adom-bridge-puppeteer-v2.0.216.zip",+  "sha256": "f1d22786ddb6953da4ade781d17c3dabfc8dbf62414e8c4cb70056902865d0be",+  "size": 940143,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.215+2.0.216
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "2.0.215",+  "version": "2.0.216",   "description": "Drives a browser ALREADY on the machine \u2014 installed Chrome, else Microsoft Edge (every Windows PC ships with Edge) \u2014 launched with a FRESH isolated profile, so the common case has NO ~150 MB Chrome-for-Testing download and it never touches the user's real tabs/logins. Binds its local server to LOOPBACK (127.0.0.1) only, so no Windows Firewall 'allow Node through the firewall' prompt ever pops. Chrome for Testing is fetched only as a LAST RESORT if the machine has no Chromium browser at all. SPAWN-VERIFIED fallback: pup tries each detected browser (Chrome \u2192 Edge \u2192 CfT) and actually launches it, falling through to the next if one won't start (and handling browsers like Edge that relaunch onto another PID), so a corrupt/partial install never hard-fails an open. The browser that launches is cached as the default (persisted across restarts) so it isn't re-probed each time. On spawn the bridge SELF-WARMS: detects browsers + disk, and only if the box has no Chrome/Edge and no cached CfT does it background-fetch CfT so the first open is instant. pup_use pins a specific browser (chrome | edge | cft | auto); {browser:'chrome',install:true} downloads & installs REAL Google Chrome (user-scoped, no admin) on an Edge-only box. pup_readiness (READ-ONLY) reports which browser will be used + the full candidate list + the default + free disk. Every failure returns a specific errorCode + _hint (chrome_install_no_disk, chrome_download_network, chrome_install_permission, chrome_stable_not_detected, \u2026). Launches with FULL browser permissions by default for full debug (strictPermissions:true opts out). Headful automation: open/close windows+tabs, navigate, screenshot, eval JS, record. pup is a GENERIC, non-profile browser only \u2014 every session is a fresh isolated Chrome/Edge process, never the user's real signed-in browser; profile defaults to sessionId. To drive the user's REAL Chrome/Edge (their profile, cookies, SSO), use the Adom browser EXTENSION's nbrowser_* verbs \u2014 a separate bridge, not pup's job. macOS (v1.9.74+): full parity with mac-native mechanics \u2014 background-by-default is the app-level hide (windows stay drivable/screenshottable while hidden), raise/lower map to unhide+activate/hide, pup_alert_window posts a native toast whose click focuses the window, pup_use {browser:'chrome',install:true} installs Chrome from the official dmg, and taskbar identity/badging remains Windows-only.",   "homepage": "https://wiki.adom.inc/adom/adom-bridge",   "author": "Adom Inc.",
src/server.js+19−1
@@ -3949,6 +3949,7 @@ async function stampPupIdentity(sessionId, opts) {   // sweep with zero churn.   if (pupSettings().aumidIcons !== 'on') return false;   if (process.platform !== 'win32' || !sessionId || _identitySupported === false) return false;+  const _stampGen = _identityGen;   // v2.0.216: abort if a mode change lands while this stamp is in flight   if (!_identityRegistered) { await ensurePupIdentityRegistered(); if (_identitySupported === false) return false; }   try {     // v1.8.81: PER-SESSION AUMID (Adom.Pup.<sessionId>). A single shared AUMID made Windows@@ -4124,6 +4125,7 @@ async function stampPupIdentity(sessionId, opts) {         _cacheKey = `pup-thread-${threadSlug(_tn)}-${THREAD_TILE_GEN}`;       }     }+    if (_stampGen !== _identityGen) { console.log(`[identity] "${sessionId}" stamp ABORTED (identity generation moved: a mode switch superseded this in-flight stamp)`); return false; }     const r = await chrome.abCommand('desktop_set_window_identity', {       ...(_stampHwnd ? { hwnd: _stampHwnd } : {}),       titleContains: `(${TITLE_LABEL}: ${sessionId}`, cacheKey: _cacheKey,@@ -4558,6 +4560,7 @@ function pruneStaleAumids() { // Adom.Pup.* registry keys, and nudge each window — an UNREGISTERED appId falls back to the owning // exe's icon (AD's own doc), i.e. the stock Chrome-for-Testing look John calls plain jane. async function stripAllPupIdentities(reason) {+  _identityGen++;   // v2.0.216: invalidate every in-flight stamp before wiping   if (process.platform !== 'win32') return;   const ids = new Set(); const targets = [];   for (const [sid, s] of [...sessions]) {@@ -4728,12 +4731,19 @@ async function unregisterPupAumid(appId) { // This tracker is driven by the REAL apply promises, not timers alone, so the check mark is honest. let _modeApply = null; let _modeApplyTok = 0;+// v2.0.216 (John's plain-mode ralph: "you aren't removing the aumid when i switch to chrome plain+// choice?"): rapid state clicks RACED. A brandSweep fires 9 parallel per-window stamp chains that+// pass the aumidIcons gate instantly; a plain click two seconds later strips all 9 windows, and+// then the in-flight stamps land ON TOP of the wipe. Every identity-affecting change now bumps+// this generation; any stamp that captured an older generation aborts before touching the window.+let _identityGen = 0; function _startModeApply(val) {   const steps = [     { label: val === 'plain' ? 'Stripping pup identities (back to the stock Chrome button)' : 'Stamping taskbar identities', state: 'run' },     { label: 'Rebuilding taskbar buttons', state: 'pend' },     { label: 'Painting overlay badges', state: 'pend' },   ];+  _identityGen++;   // v2.0.216: supersede ALL in-flight identity work before this apply starts   _modeApply = { at: Date.now(), token: ++_modeApplyTok, mode: val, steps, done: false };   const my = _modeApply;   (async () => {@@ -4752,6 +4762,12 @@ function _startModeApply(val) {     // shell settle: the hide/show nudges plus (in tiles mode) the 5s thread-stamp overlay gate     await new Promise(r => setTimeout(r, val === 'tiles' ? 6000 : 2500));     if (_modeApply !== my) return;+    if (val === 'plain') {+      // verify pass: any stamp already past its generation check when the click landed has landed+      // by now (the settle above outlasts a desktop_set_window_identity round-trip) — wipe again so+      // the glass converges even in the worst race. Idempotent when nothing slipped through.+      try { await stripAllPupIdentities('settings-taskbarmode-plain (verify pass)'); } catch (e) {}+    }     my.steps[1].state = 'done';     if (pupSettings().overlayBadges === 'on') {       my.steps[2].state = 'run';@@ -5401,7 +5417,8 @@ async function updateTabCountBadge(session, sessionId) { // strand a window un-resolvable) then re-stamps it. Runs at startup (post-reattach) and after // every rescan. async function brandSweep(reason) {-  if (minimalTouch()) return;   // v1.9.185 minimal-touch: no cosmetic/shell machinery pushed at Chrome+  if (minimalTouch()) return;+  const _sweepGen = ++_identityGen;   // every new sweep supersedes ALL previous in-flight identity work   // v1.9.185 minimal-touch: no cosmetic/shell machinery pushed at Chrome   // v2.0.183 (John, 2nd enum report: "you're spamming enum_windows again"): a sweep re-stamps and   // NUDGES every window, and each nudge fires a window-opened event whose drain kicked   // reclaimUnmanagedWindows (an enum) — pup reacting to its own sweep, per window. The per-nudge@@ -5421,6 +5438,7 @@ async function brandSweep(reason) {   if (process.platform !== 'win32') return;   let n = 0;   for (const [sid, sess] of sessions) {+    if (_sweepGen !== _identityGen) { console.log(`[identity] brandSweep(${reason}) ABORTED mid-loop (superseded by a newer mode switch)`); break; }     try {       const tab = sess.tabs && sess.tabs[0];       if (!tab || !tab.page) continue;