[object Object]

← back to Delivery Address Fix

5x sweep 2: findTab multi-candidate match; ubereats matches both ubereats.com + auth.uber.com ('uber.com' is not a substring of 'ubereats.com')

8ecbebbc0a09980defe7e376d278f47ab9d838d2 · 2026-08-02 16:10:34 -0700 · Steve Abrams

Files touched

Diff

commit 8ecbebbc0a09980defe7e376d278f47ab9d838d2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun Aug 2 16:10:34 2026 -0700

    5x sweep 2: findTab multi-candidate match; ubereats matches both ubereats.com + auth.uber.com ('uber.com' is not a substring of 'ubereats.com')
---
 scripts/lib.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scripts/lib.js b/scripts/lib.js
index 911eea9..7c0947f 100644
--- a/scripts/lib.js
+++ b/scripts/lib.js
@@ -6,7 +6,10 @@ const PLATFORMS = {
   ubereats: {
     home: 'https://www.ubereats.com/',
     login: 'https://auth.uber.com/v2/?next_url=https%3A%2F%2Fwww.ubereats.com%2Flogin-redirect',
-    match: 'uber.com',
+    // BOTH domains: ubereats.com is the logged-in surface, auth.uber.com the
+    // login flow — and 'uber.com' is NOT a substring of 'ubereats.com'
+    // (caught live by 5x sweep 2, 2026-08-02).
+    match: ['ubereats.com', 'auth.uber.com'],
     emailField: '#PHONE_NUMBER_or_EMAIL_ADDRESS',
     emailSubmit: '#forward-button',
   },
@@ -74,12 +77,15 @@ function sessionDir(cfg, args) {
 // HARD RULE: select the tab by URL substring, never pages()[0] — other
 // automations share the browser (Tesla tab hijacked slot 0 on 2026-08-02).
 async function findTab(port, match) {
+  // match: url substring, comma-separated substrings, or array of substrings
+  const candidates = (Array.isArray(match) ? match : String(match).split(','))
+    .map(s => s.trim()).filter(Boolean);
   const { chromium } = requirePlaywright();
   const browser = await chromium.connectOverCDP(`http://127.0.0.1:${port}`);
   const pages = browser.contexts()[0].pages();
-  const page = pages.find(p => p.url().includes(match));
+  const page = pages.find(p => candidates.some(c => p.url().includes(c)));
   if (!page) {
-    console.error(`NO TAB matching "${match}". Open tabs: ${pages.map(p => p.url()).join(' | ')}`);
+    console.error(`NO TAB matching "${candidates.join(' | ')}". Open tabs: ${pages.map(p => p.url()).join(' | ')}`);
     process.exit(2);
   }
   return { browser, page };

← 1b1b314 5x sweep 1: playwright global-root fallback resolver (repo h  ·  back to Delivery Address Fix  ·  5x sweep 4: gitignore sessions/ (live-session screenshots mu 0b95e63 →