From 35e08cff2c7fb2e0fa99d44b6400bb316bb0d332 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Tue, 14 Jul 2026 04:45:00 -0700 Subject: [PATCH] fix(rebrand): rename double-underscore global identifiers missed by Phase 6 __gittensoryMinerOpportunityBadge and 5 sibling window-scoped globals in the extension/miner-extension test-hook internals survived Phase 6's sweep because they weren't covered by either the initial sed pass or the later perl-based fix for non-underscore-prefixed identifiers. --- apps/loopover-extension/content.js | 2 +- apps/loopover-miner-extension/background.js | 6 +++--- apps/loopover-miner-extension/content.js | 4 ++-- apps/loopover-miner-extension/opportunity-badge.js | 4 ++-- apps/loopover-miner-extension/options.js | 2 +- apps/loopover-miner-extension/test/helpers.ts | 6 +++--- apps/loopover-miner-extension/toolbar-badge.js | 4 ++-- test/unit/extension-content.test.ts | 2 +- test/unit/miner-extension-content.test.ts | 12 ++++++------ test/unit/miner-extension-live-fetch.test.ts | 2 +- test/unit/miner-toolbar-badge.test.ts | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/loopover-extension/content.js b/apps/loopover-extension/content.js index acb8734920..001418500f 100644 --- a/apps/loopover-extension/content.js +++ b/apps/loopover-extension/content.js @@ -182,7 +182,7 @@ function renderActions(body, actions) { } if (globalThis.__LOOPOVER_EXTENSION_TEST__) { - globalThis.__gittensoryContentInternals = { + globalThis.__loopoverContentInternals = { matchGitHubPageTarget, matchPullRequestTarget, renderPullContext, diff --git a/apps/loopover-miner-extension/background.js b/apps/loopover-miner-extension/background.js index 11a4fb010c..ef7a6ffe05 100644 --- a/apps/loopover-miner-extension/background.js +++ b/apps/loopover-miner-extension/background.js @@ -1,8 +1,8 @@ import "./opportunity-badge.js"; import "./toolbar-badge.js"; -const badgeApi = globalThis.__gittensoryMinerOpportunityBadge; -const toolbarBadgeApi = globalThis.__gittensoryMinerToolbarBadge; +const badgeApi = globalThis.__loopoverMinerOpportunityBadge; +const toolbarBadgeApi = globalThis.__loopoverMinerToolbarBadge; const PING_MESSAGE = "gittensory-miner:ping"; const ISSUE_CONTEXT_MESSAGE = "gittensory-miner:issue-context"; @@ -172,7 +172,7 @@ if (chrome.action && chrome.storage.onChanged) { } if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) { - globalThis.__gittensoryMinerBackgroundInternals = { + globalThis.__loopoverMinerBackgroundInternals = { PING_MESSAGE, ISSUE_CONTEXT_MESSAGE, SYNC_RANKED_CANDIDATES_MESSAGE, diff --git a/apps/loopover-miner-extension/content.js b/apps/loopover-miner-extension/content.js index 00c32e812d..1caea9b73a 100644 --- a/apps/loopover-miner-extension/content.js +++ b/apps/loopover-miner-extension/content.js @@ -1,4 +1,4 @@ -const badgeApi = globalThis.__gittensoryMinerOpportunityBadge; +const badgeApi = globalThis.__loopoverMinerOpportunityBadge; const target = matchGitHubIssueTarget(location.pathname); @@ -69,7 +69,7 @@ function renderOpportunityBadge(container, payload, nowMs = Date.now()) { } if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) { - globalThis.__gittensoryMinerContentInternals = { + globalThis.__loopoverMinerContentInternals = { matchGitHubIssueTarget, findIssueSidebar, renderOpportunityBadge, diff --git a/apps/loopover-miner-extension/opportunity-badge.js b/apps/loopover-miner-extension/opportunity-badge.js index 5fca4fa616..50a8cdb1a9 100644 --- a/apps/loopover-miner-extension/opportunity-badge.js +++ b/apps/loopover-miner-extension/opportunity-badge.js @@ -108,8 +108,8 @@ const opportunityBadgeApi = { renderOpportunityBadgeMarkup, }; -globalThis.__gittensoryMinerOpportunityBadge = opportunityBadgeApi; +globalThis.__loopoverMinerOpportunityBadge = opportunityBadgeApi; if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) { - globalThis.__gittensoryMinerOpportunityBadgeTestExports = opportunityBadgeApi; + globalThis.__loopoverMinerOpportunityBadgeTestExports = opportunityBadgeApi; } diff --git a/apps/loopover-miner-extension/options.js b/apps/loopover-miner-extension/options.js index ff5e55f34a..8051fb37c5 100644 --- a/apps/loopover-miner-extension/options.js +++ b/apps/loopover-miner-extension/options.js @@ -52,7 +52,7 @@ function normalizeMinerUiUrl(text) { } if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) { - globalThis.__gittensoryMinerOptionsInternals = { + globalThis.__loopoverMinerOptionsInternals = { parseWatchedRepos, parseRankedCandidatesJson, removeLegacyDiscoveryIndexUrl, diff --git a/apps/loopover-miner-extension/test/helpers.ts b/apps/loopover-miner-extension/test/helpers.ts index 9a5fa88cb0..290f0493d0 100644 --- a/apps/loopover-miner-extension/test/helpers.ts +++ b/apps/loopover-miner-extension/test/helpers.ts @@ -186,10 +186,10 @@ export async function loadExtensionModules(options: ChromeMockOptions = {}) { return { ...harness, - opportunityExports: globalThis.__gittensoryMinerOpportunityBadgeTestExports as OpportunityBadgeExports, - toolbarApi: globalThis.__gittensoryMinerToolbarBadge as { + opportunityExports: globalThis.__loopoverMinerOpportunityBadgeTestExports as OpportunityBadgeExports, + toolbarApi: globalThis.__loopoverMinerToolbarBadge as { computeToolbarBadge: (rankedCandidates: unknown) => { text: string; backgroundColor: string }; }, - backgroundInternals: globalThis.__gittensoryMinerBackgroundInternals as BackgroundInternals, + backgroundInternals: globalThis.__loopoverMinerBackgroundInternals as BackgroundInternals, }; } diff --git a/apps/loopover-miner-extension/toolbar-badge.js b/apps/loopover-miner-extension/toolbar-badge.js index 557eda81d1..d44b278f8d 100644 --- a/apps/loopover-miner-extension/toolbar-badge.js +++ b/apps/loopover-miner-extension/toolbar-badge.js @@ -32,9 +32,9 @@ export function computeToolbarBadge(rankedCandidates) { } // Expose on a global too — the background service worker reads this the same way it reads -// `__gittensoryMinerOpportunityBadge`, so the extension's VM-based test harness (which cannot evaluate ESM +// `__loopoverMinerOpportunityBadge`, so the extension's VM-based test harness (which cannot evaluate ESM // `import` bindings) can drive it without a module loader. -globalThis.__gittensoryMinerToolbarBadge = { +globalThis.__loopoverMinerToolbarBadge = { computeToolbarBadge, TOOLBAR_BADGE_HAS_DATA_COLOR, TOOLBAR_BADGE_EMPTY_COLOR, diff --git a/test/unit/extension-content.test.ts b/test/unit/extension-content.test.ts index b3db53fa43..e1ab4c7a4f 100644 --- a/test/unit/extension-content.test.ts +++ b/test/unit/extension-content.test.ts @@ -88,7 +88,7 @@ function loadContentInternals() { context.globalThis = context; const vmContext = createContext(context); new Script(contentScript).runInContext(vmContext); - return vmContext.__gittensoryContentInternals as { + return vmContext.__loopoverContentInternals as { matchGitHubPageTarget: ( pathname: string, ) => { kind: "pull_request"; owner: string; repo: string; pullNumber: number } | { kind: "issue"; owner: string; repo: string; issueNumber: number } | null; diff --git a/test/unit/miner-extension-content.test.ts b/test/unit/miner-extension-content.test.ts index 1c75894d83..9935e3122f 100644 --- a/test/unit/miner-extension-content.test.ts +++ b/test/unit/miner-extension-content.test.ts @@ -231,7 +231,7 @@ describe("miner extension opportunity badge", () => { new Script(optionsScript).runInContext(vmContext); await flushPromises(); - const internals = vmContext.__gittensoryMinerOptionsInternals as { MAX_RANKED_CANDIDATES_JSON_BYTES: number }; + const internals = vmContext.__loopoverMinerOptionsInternals as { MAX_RANKED_CANDIDATES_JSON_BYTES: number }; elements["#rankedCandidatesJson"].value = "x".repeat(internals.MAX_RANKED_CANDIDATES_JSON_BYTES + 1); await elements["#settings"].dispatchSubmit(); @@ -487,7 +487,7 @@ function loadBadgeInternals() { context.globalThis = context; const vmContext = createContext(context); new Script(badgeScript).runInContext(vmContext); - return vmContext.__gittensoryMinerOpportunityBadgeTestExports as { + return vmContext.__loopoverMinerOpportunityBadgeTestExports as { lookupRankedOpportunity: (ranked: unknown[], repoFullName: string, issueNumber: number) => Record | null; formatOpportunityBadge: (entry: Record) => { tier: string; score: string; why: string }; formatLastSyncedLabel: (savedAt: unknown, nowMs: number) => string | null; @@ -502,7 +502,7 @@ function loadContentInternals() { const badge = loadBadgeInternals(); const context: Record = { __LOOPOVER_MINER_EXTENSION_TEST__: true, - __gittensoryMinerOpportunityBadge: badge, + __loopoverMinerOpportunityBadge: badge, location: { pathname: "/JSONbored/gittensory/pull/146" }, document: { querySelector: () => null, @@ -514,7 +514,7 @@ function loadContentInternals() { context.globalThis = context; const vmContext = createContext(context); new Script(contentScript).runInContext(vmContext); - return vmContext.__gittensoryMinerContentInternals as { + return vmContext.__loopoverMinerContentInternals as { matchGitHubIssueTarget: ( pathname: string, ) => { kind: "issue"; owner: string; repo: string; issueNumber: number } | null; @@ -550,7 +550,7 @@ function loadBackgroundInternals({ new Script(badgeScript).runInContext(vmContext); const backgroundForTest = backgroundScript.replace(/^import\s+["'][^"']+["'];\s*/gm, ""); new Script(backgroundForTest).runInContext(vmContext); - return vmContext.__gittensoryMinerBackgroundInternals as { + return vmContext.__loopoverMinerBackgroundInternals as { loadIssueOpportunityContext: (message: { owner: string; repo: string; @@ -579,7 +579,7 @@ function loadOptionsInternals() { context.globalThis = context; const vmContext = createContext(context); new Script(optionsScript).runInContext(vmContext); - return vmContext.__gittensoryMinerOptionsInternals as { + return vmContext.__loopoverMinerOptionsInternals as { parseWatchedRepos: (text: string) => string[]; parseRankedCandidatesJson: (text: string) => unknown[]; removeLegacyDiscoveryIndexUrl: () => Promise; diff --git a/test/unit/miner-extension-live-fetch.test.ts b/test/unit/miner-extension-live-fetch.test.ts index bee29bd396..9aec97b78e 100644 --- a/test/unit/miner-extension-live-fetch.test.ts +++ b/test/unit/miner-extension-live-fetch.test.ts @@ -80,7 +80,7 @@ function loadBackgroundWithFakeChrome({ const vmContext = createContext(context); new Script(backgroundScriptForVm()).runInContext(vmContext); - const internals = vmContext.__gittensoryMinerBackgroundInternals as { + const internals = vmContext.__loopoverMinerBackgroundInternals as { SYNC_RANKED_CANDIDATES_MESSAGE: string; DEFAULT_MINER_UI_URL: string; loadMinerUiUrl: () => Promise; diff --git a/test/unit/miner-toolbar-badge.test.ts b/test/unit/miner-toolbar-badge.test.ts index d6875a5c08..8fa12f2651 100644 --- a/test/unit/miner-toolbar-badge.test.ts +++ b/test/unit/miner-toolbar-badge.test.ts @@ -122,7 +122,7 @@ function loadBackground( new Script(opportunityBadgeScript).runInContext(vmContext); new Script(toolbarBadgeScript).runInContext(vmContext); new Script(backgroundScript).runInContext(vmContext); - const internals = vmContext.__gittensoryMinerBackgroundInternals as { + const internals = vmContext.__loopoverMinerBackgroundInternals as { refreshToolbarBadge: () => Promise; }; return {