refactor(panel): unify settings and bridge contracts, prune dead code, and rename trajectory metrics

- Share settings normalization and window-bridge protocol contracts across frontend and backend
- Encapsulate trajectory cache accessors inside config.mjs and validate bundle imports/syntax before writing
- Remove dead selectors, unused symbols, duplicate re-export imports, and unmounted account tab instantiation
- Rename speed-metrics.mjs to trajectory-metrics.mjs and audit-fixes.test.mjs to cross-module-regressions.test.mjs
This commit is contained in:
fish
2026-11-17 20:00:50 +09:00
parent dba3473494
commit 1ff1c128a8
34 changed files with 802 additions and 676 deletions
+7 -3
View File
@@ -4,7 +4,7 @@ import { pathToFileURL } from 'node:url';
import vm from 'node:vm';
import { randomUUID } from 'node:crypto';
import { isDeepStrictEqual } from 'node:util';
import * as metrics from '../speed-metrics.mjs';
import * as metrics from '../trajectory-metrics.mjs';
import { stripModuleSyntax } from '../scripts/build-bundle.mjs';
const REAL_CATALOG_RAW = JSON.parse(
@@ -20,6 +20,8 @@ const BACKEND_MODULE_FILES = [
'../backend/context-windows.mjs',
'../backend/account-oauth.mjs',
'../backend/account-switch.mjs',
'../shared/settings-normalization.mjs',
'../shared/window-bridge-protocol.mjs',
'../backend/settings-schema.mjs',
'../backend/config.mjs',
'../backend/cli-sqlite-reader.mjs',
@@ -69,6 +71,7 @@ export function backendHarness({
execFileImpl=null,
sourceText=null,
clock=null,
timerApi={ setTimeout, clearTimeout },
metricsImplementation=metrics,
}={}) {
const mainUrl = pluginRootPath ? `file://${pluginRootPath}/sidecars/panel/main.mjs` : 'file:///test/sidecars/panel/main.mjs';
@@ -76,7 +79,7 @@ export function backendHarness({
const source = stripEsmSyntax(sourceText ?? loadCombinedBackendSource(), mainUrl);
const state={calls:[],errors:[],saves:[],settings,trajectories,summaries,transcripts,transcriptMtimeMs:1,userStatus,quotaSummary,localCatalog,remoteCatalog,pluginManifest,hasGitDir,gitConfigText,deepStats,deepStatsMtimeMs:1};
const ctx={
...metricsImplementation, URL, AbortSignal, Buffer, TextDecoder, setTimeout, clearTimeout, isDeepStrictEqual, randomUUID,
...metricsImplementation, URL, AbortSignal, Buffer, TextDecoder, ...timerApi, isDeepStrictEqual, randomUUID,
...(clock ? { Date: class extends Date {
constructor(...args) { super(...(args.length ? args : [clock()])); }
static now() { return clock(); }
@@ -155,6 +158,7 @@ export function backendHarness({
}
},
writeTrajectoryCacheFile:(p,data)=>{
if (state.cacheWriteError) throw state.cacheWriteError;
state.saves.push({path:p,data:JSON.parse(JSON.stringify(data))});
},
homedir:()=>'/test-home',dirname:path.dirname,join:path.join,basename:path.basename,delimiter:path.delimiter,pathToFileURL,fileURLToPath:()=>mainPath,
@@ -179,6 +183,6 @@ export function backendHarness({
return {ok:true,json:async()=>data};
},
};
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,executeTelemetryAction,computeStepCost,resolveModelInfo,resolvePricingAt,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,getPricingPhaseEpoch,detectCustomGitForkRepo,persistTrajectoryCacheIfNeeded,flushTrajectoryCacheNow,cacheState,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction,executeModelContextWindowAction,executeResetSettingsAction,executeRebuildCacheAction,clearRuntimeCaches,normalizeTopbarCapsuleSlots,normalizeHoverModules,normalizeOverviewModules,normalizeOverviewMetrics,normalizeStepTableColumns,normalizeStepTokenComboFormat,parseStepTokenComboSegments,normalizeModelDisplayMode,normalizePopoverWidthMode,normalizePopoverWidth,normalizeStandalonePort,setStandalonePortListener,parseAnnotationPbtxtTitle,readLocalSummarySnapshot,readLocalSqliteTrajectory,computeSqliteWalSig,buildCliStatusSnapshot,buildCliStatusLineCommand,isManagedCliStatusLineCommand,applyCliStatusLineToSettingsObject,cliDisplayWidth,parseCliModelAndEffort,formatCliStatusLineCapsule};',ctx);
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,executeTelemetryAction,computeStepCost,resolveModelInfo,resolvePricingAt,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,getPricingPhaseEpoch,detectCustomGitForkRepo,persistTrajectoryCacheIfNeeded,flushTrajectoryCacheNow,getCachedTrajectory,listCachedTrajectoryEntries,hasPendingTrajectoryCacheSave,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction,executeModelContextWindowAction,executeResetSettingsAction,executeRebuildCacheAction,clearRuntimeCaches,normalizeTopbarCapsuleSlots,normalizeHoverModules,normalizeOverviewModules,normalizeOverviewMetrics,normalizeStepTableColumns,normalizeStepTokenComboFormat,parseStepTokenComboSegments,normalizeModelDisplayMode,normalizePopoverWidthMode,normalizePopoverWidth,normalizeStandalonePort,setStandalonePortListener,parseAnnotationPbtxtTitle,readLocalSummarySnapshot,readLocalSqliteTrajectory,computeSqliteWalSig,buildCliStatusSnapshot,buildCliStatusLineCommand,isManagedCliStatusLineCommand,applyCliStatusLineToSettingsObject,cliDisplayWidth,parseCliModelAndEffort,formatCliStatusLineCapsule};',ctx);
return {...ctx.api,state};
}
+101 -4
View File
@@ -666,7 +666,7 @@ test('cached incomplete timing is refreshed once without invalidating completed
...structuredClone(raw.trajectory.steps[0]),
status: 'CORTEX_STEP_STATUS_CLEARED',
};
const { extractModelSteps } = await import('../speed-metrics.mjs');
const { extractModelSteps } = await import('../trajectory-metrics.mjs');
const [completed] = extractModelSteps(raw.trajectory.steps, raw.trajectory.generatorMetadata);
const [incomplete] = extractModelSteps([{ ...incompleteStep, status: 'CORTEX_STEP_STATUS_GENERATING' }]);
const cacheEntry = (step) => ({
@@ -743,6 +743,39 @@ test('display step revisions omit only matching rows and invalidate on timing ch
assert.equal((await get()).activeConversation.recentSteps[0].tokPerSec, 60);
});
test('telemetry reuses display rows only for a matching revision', async (t) => {
const { fetchTelemetry, telemetryStore } = await import('../src/store/telemetryStore.js');
const previousTelemetry = telemetryStore.getState().telemetry;
t.after(() => telemetryStore.setState({ telemetry: previousTelemetry }));
const recentSteps = [{ stepIndex: 1, tokPerSec: 20 }];
const agentSteps = [{ stepIndex: 2, tokPerSec: 40 }];
let response = {
stepRevision: 'test-revision',
activeConversation: { recentSteps, agents: [{ recentSteps: agentSteps }] },
};
const revisions = [];
t.mock.method(globalThis, 'fetch', async (url) => {
revisions.push(new URL(url, 'http://localhost').searchParams.get('stepRevision'));
return { ok: true, json: async () => structuredClone(response) };
});
assert.equal((await fetchTelemetry()).stepRevision, 'test-revision');
response = {
stepsUnchanged: true,
stepRevision: 'test-revision',
activeConversation: { agents: [{}] },
};
const refreshed = await fetchTelemetry();
assert.equal(revisions[1], 'test-revision');
assert.deepEqual(refreshed.activeConversation.recentSteps, recentSteps);
assert.deepEqual(refreshed.activeConversation.agents[0].recentSteps, agentSteps);
const telemetryBeforeMismatch = telemetryStore.getState().telemetry;
response.stepRevision = 'unknown-revision';
assert.equal(await fetchTelemetry(), null);
assert.equal(telemetryStore.getState().telemetry, telemetryBeforeMismatch);
});
test('simultaneous ranges share the trajectory scan while keeping their own totals', async () => {
const h = backendHarness({
trajectories: { live: raw },
@@ -759,7 +792,7 @@ test('simultaneous ranges share the trajectory scan while keeping their own tota
});
test('cached usage follows rolling boundaries and reprices unchanged steps', async () => {
const { extractModelSteps } = await import('../speed-metrics.mjs');
const { extractModelSteps } = await import('../trajectory-metrics.mjs');
const [step] = extractModelSteps(raw.trajectory.steps, raw.trajectory.generatorMetadata);
const modelKey = 'test-metered-model';
let now = Date.parse('2026-03-08T07:00:00Z');
@@ -806,7 +839,6 @@ test('cached usage follows rolling boundaries and reprices unchanged steps', asy
test('modelBreakdown exposes avgTtftSec, cacheHitPct, and subagent scoped breakdowns + fit math helpers', async () => {
const {
computeLinearFit,
computeLoessFit,
computePublicationFit,
getStepModelGroupKey,
toChronologicalSteps,
@@ -840,7 +872,11 @@ test('modelBreakdown exposes avgTtftSec, cacheHitPct, and subagent scoped breakd
// Warmup cache curve stays clamped within [0, 100]
const cacheSeries = [0, 90, 92, 93, 94, 95, 95];
const loessCache = computeLoessFit(cacheSeries, { minVal: 0, maxVal: 100 });
const loessCache = computePublicationFit(
cacheSeries.map((_, index) => index),
cacheSeries,
{ minVal: 0, maxVal: 100 }
).sampleFits;
assert.equal(loessCache.length, cacheSeries.length);
assert.ok(
loessCache.every((v) => v >= 0 && v <= 100),
@@ -956,6 +992,67 @@ test('modelBreakdown exposes avgTtftSec, cacheHitPct, and subagent scoped breakd
assert.equal(aggMb.length, 2);
});
test('saving preferences sends the same legacy values normalized by the backend', async (t) => {
const { saveSettingsPatch, stopAsyncTelemetryLoop, telemetryStore } =
await import('../src/store/telemetryStore.js');
const h = backendHarness({ settings: { themeAccent: 'blue' } });
let savedSettings = JSON.parse(JSON.stringify(h.loadSettings()));
const previousTelemetry = telemetryStore.getState().telemetry;
t.after(() => {
stopAsyncTelemetryLoop();
telemetryStore.setState({ telemetry: previousTelemetry });
});
telemetryStore.setState({ telemetry: { settings: savedSettings } });
const patches = [];
let failSave = false;
t.mock.method(globalThis, 'fetch', async (path, options) => {
if (options.method === 'POST') {
assert.equal(path, '/api/settings');
const patch = JSON.parse(options.body);
patches.push(patch);
for (const [key, value] of Object.entries(patch)) {
assert.deepEqual(telemetryStore.getState().telemetry.settings[key], value);
}
if (failSave) {
return { ok: false, json: async () => ({ error: 'Failed to persist settings' }) };
}
const result = h.executeSettingsAction(patch);
savedSettings = JSON.parse(result.body);
return { ok: result.ok, json: async () => savedSettings };
}
assert.match(path, /^\/api\/telemetry\?/);
return { ok: true, json: async () => ({ settings: savedSettings }) };
});
await saveSettingsPatch({
windowMountMode: 'sidebar_only',
topbarCapsuleSlots: ['step_cost', 'cost', 'none'],
overviewMetrics: ['cost', 'tps'],
weeklyLimitMode: 'tokens',
});
assert.deepEqual(patches[0], {
windowMountMode: 'sidebar',
enableWindowOverlay: false,
topbarCapsuleSlots: ['cost'],
overviewMetrics: ['step_cost', 'tps'],
weeklyLimitMode: 'custom_tokens',
});
assert.deepEqual(telemetryStore.getState().telemetry.settings, savedSettings);
assert.equal(savedSettings.themeAccent, 'blue');
await saveSettingsPatch({ topbarCapsuleSlots: [], weeklyLimitMode: 'cost' });
assert.deepEqual(patches[1], {
topbarCapsuleSlots: ['context'],
weeklyLimitMode: 'custom_cost',
});
const telemetryBeforeFailure = telemetryStore.getState().telemetry;
failSave = true;
await assert.rejects(saveSettingsPatch({ windowMountMode: 'composer' }), /Failed to persist/);
assert.equal(telemetryStore.getState().telemetry, telemetryBeforeFailure);
});
test('preferences schema defaults match pre-refactor UI, migrate legacy none slots, and support reset & cache rebuild', async () => {
// 1. Default schema matches pre-refactor out-of-box UI 100%
const hDefault = backendHarness({});
@@ -1,20 +1,22 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import vm from 'node:vm';
import { backendHarness } from './backend-harness.mjs';
import {
extractContextBreakdown,
extractModelSteps,
normalizeCachedStep,
} from '../speed-metrics.mjs';
} from '../trajectory-metrics.mjs';
import {
formatCountdown,
formatUsd,
speedReasonText,
} from '../src/core/formatters.js';
import { createReactiveStore } from '../src/core/reactive.js';
import { stripModuleSyntax } from '../scripts/build-bundle.mjs';
import { buildBundle, stripModuleSyntax } from '../scripts/build-bundle.mjs';
const nowMs = Date.now();
const nowIso = new Date(nowMs - 5_000).toISOString();
@@ -425,6 +427,31 @@ test('BUG-20 & BUG-24: reactive store microtask deduplication, stripModuleSyntax
assert.ok(appBundle.trimEnd().endsWith('})();'));
});
test('bundle validation rejects incompatible imports and duplicate bindings before touching output', (t) => {
const tempDir = fs.mkdtempSync(fileURLToPath(new URL('./.bundle-test-', import.meta.url)));
t.after(() => fs.rmSync(tempDir, { recursive: true, force: true }));
for (const dir of ['src', 'shared']) {
fs.cpSync(new URL(`../${dir}/`, import.meta.url), join(tempDir, dir), { recursive: true });
}
const outputs = ['app.js', 'styles.css', 'index.html'];
for (const file of outputs) fs.writeFileSync(join(tempDir, file), file);
const iconSource = join(tempDir, 'src', 'icons', 'svgRegistry.js');
const original = fs.readFileSync(iconSource, 'utf8');
for (const [prefix, error] of [
["import { SVG_NS /* comment */ as ns } from './SvgIcon.js';", /svgRegistry\.js.*without aliases/],
["import { SVG_NS } from './SvgIcon.js';", /svgRegistry\.js.*SvgIcon\.js.*earlier in jsOrder/],
["import './missing.js';", /svgRegistry\.js.*missing\.js.*earlier in jsOrder/],
['const SVG_NS = "duplicate";', /Identifier 'SVG_NS' has already been declared/],
]) {
fs.writeFileSync(iconSource, `${prefix}\n${original}`);
assert.throws(() => buildBundle(tempDir), error);
for (const file of outputs) {
assert.equal(fs.readFileSync(join(tempDir, file), 'utf8'), file);
}
}
});
test('Compaction liveActivity: detects in-progress & completed CHECKPOINT over pre-compaction tool operations across RPC and transcript.jsonl', async () => {
const convId = '4432b724-3e1e-4421-a375-c6855a7b7b37';
+3 -2
View File
@@ -2,7 +2,8 @@ import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import vm from 'node:vm';
import { extractModelSteps, normalizeCachedStep, MODEL_IDENTITY_VERSION } from '../speed-metrics.mjs';
import { normalizeClientWindowMountMode } from '../src/store/telemetryStore.js';
import { extractModelSteps, normalizeCachedStep, MODEL_IDENTITY_VERSION } from '../trajectory-metrics.mjs';
import {
formatUsd,
mergeModelsByDisplayName,
@@ -195,7 +196,7 @@ test('custom cost budget cannot claim a complete remaining percentage when price
test('frontend considers a model-only correction a real telemetry update', () => {
const source = fs.readFileSync(new URL('../src/store/telemetryStore.js',import.meta.url),'utf8');
const fn = source.slice(source.indexOf('function isEquivalentTelemetry'),source.indexOf('export async function fetchTelemetry'));
const ctx = {}; vm.runInNewContext(fn+'\nglobalThis.compare=isEquivalentTelemetry;',ctx);
const ctx = { normalizeClientWindowMountMode }; vm.runInNewContext(fn+'\nglobalThis.compare=isEquivalentTelemetry;',ctx);
const a={activeConversation:{recentSteps:[{modelKey:'unknown',modelShort:'模型未知',costUsd:null}]}};
const b=structuredClone(a); b.activeConversation.recentSteps[0].modelShort='new-model';
assert.equal(ctx.compare(a,b),false); assert.equal(ctx.compare(a,structuredClone(a)),true);
+2 -1
View File
@@ -2,6 +2,7 @@ import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import vm from 'node:vm';
import { normalizeClientWindowMountMode } from '../src/store/telemetryStore.js';
import { backendHarness } from './backend-harness.mjs';
const FLASH = 'MODEL_PLACEHOLDER_M318';
@@ -290,7 +291,7 @@ test('telemetryStore isEquivalentTelemetry detects quota changes in non-active p
source.indexOf('function isEquivalentTelemetry'),
source.indexOf('export async function fetchTelemetry')
);
const ctx = {};
const ctx = { normalizeClientWindowMountMode };
vm.runInNewContext(fn + '\nglobalThis.compare=isEquivalentTelemetry;', ctx);
const a = {
+1 -1
View File
@@ -1,6 +1,6 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {extractContextBreakdown, extractLiveActivity, extractModelSteps, normalizeCachedStep, speedMetric, summarizeSpeed, summarizeTtft} from '../speed-metrics.mjs';
import {extractContextBreakdown, extractLiveActivity, extractModelSteps, normalizeCachedStep, speedMetric, summarizeSpeed, summarizeTtft} from '../trajectory-metrics.mjs';
function sample({total=12,ttft='2s',stream='10s',output=1100,thinking=100,response=1000,
thinkingDuration='4s',tools=false,text=true,status='CORTEX_STEP_STATUS_DONE'}={}) {
@@ -653,12 +653,26 @@ test('Hybrid SQLite+WAL mode skips trajectory RPCs for local DBs, falls back to
test('persistTrajectoryCacheIfNeeded throttles RUNNING disk writes to 30s and flushes immediately on IDLE or cache rebuild', () => {
let now = 1_000_000;
const h = backendHarness({ clock: () => now });
const scheduled = new Map();
const h = backendHarness({
cache: { live: { title: 'Cached session', steps: [] } },
clock: () => now,
timerApi: {
setTimeout(_callback, delay) {
const id = Symbol();
scheduled.set(id, delay);
return id;
},
clearTimeout(id) {
scheduled.delete(id);
},
},
});
// 1st save (lastSavedAtMs === 0) flushes immediately even while running
h.persistTrajectoryCacheIfNeeded({ hasRunningSessions: true, allowThrottleInTest: true });
assert.equal(h.state.saves.length, 1);
assert.equal(h.cacheState.needsSave, false);
assert.equal(h.hasPendingTrajectoryCacheSave(), false);
// Subsequent saves within 30s window while RUNNING are throttled in memory
now += 2_000;
@@ -666,22 +680,31 @@ test('persistTrajectoryCacheIfNeeded throttles RUNNING disk writes to 30s and fl
now += 2_000;
h.persistTrajectoryCacheIfNeeded({ hasRunningSessions: true, allowThrottleInTest: true });
assert.equal(h.state.saves.length, 1, '2s polling during RUNNING must not rewrite disk every tick');
assert.equal(h.cacheState.needsSave, true);
assert.ok(h.cacheState.flushTimer !== null);
assert.equal(h.hasPendingTrajectoryCacheSave(), true);
assert.deepEqual([...scheduled.values()], [28_000]);
// Transitioning to IDLE flushes immediately and clears pending timer
now += 2_000;
h.persistTrajectoryCacheIfNeeded({ hasRunningSessions: false, allowThrottleInTest: true });
assert.equal(h.state.saves.length, 2, 'transition to IDLE flushes immediately');
assert.equal(h.cacheState.needsSave, false);
assert.equal(h.cacheState.flushTimer, null);
assert.equal(h.hasPendingTrajectoryCacheSave(), false);
assert.equal(scheduled.size, 0);
// Re-arming throttle then calling executeRebuildCacheAction cancels timer cleanly
now += 2_000;
h.persistTrajectoryCacheIfNeeded({ hasRunningSessions: true, allowThrottleInTest: true });
assert.ok(h.cacheState.flushTimer !== null);
assert.equal(scheduled.size, 1);
h.state.cacheWriteError = new Error('Disk unavailable');
assert.equal(h.executeRebuildCacheAction().status, 500);
assert.equal(h.getCachedTrajectory('live').title, 'Cached session');
assert.equal(h.hasPendingTrajectoryCacheSave(), true);
assert.equal(scheduled.size, 1);
h.state.cacheWriteError = null;
const rebuildRes = h.executeRebuildCacheAction();
assert.equal(rebuildRes.ok, true);
assert.equal(h.cacheState.flushTimer, null);
assert.equal(h.cacheState.needsSave, false);
assert.equal(scheduled.size, 0);
assert.equal(h.hasPendingTrajectoryCacheSave(), false);
assert.equal(h.listCachedTrajectoryEntries().length, 0);
assert.deepEqual(h.state.saves.at(-1).data, {});
});
+13 -4
View File
@@ -330,11 +330,12 @@ test('CDP multi-window sync injects, skips healthy windows, hot-upgrades on vers
const msg = JSON.parse(raw);
if (msg.method === 'Runtime.evaluate') {
const expr = msg.params.expression;
if (expr.includes('__AGUsageMonitorBridge =')) {
const ctx = windowContexts.get(this.targetId);
const previousBridge = ctx.__AGUsageMonitorBridge;
const value = vm.runInContext(expr, ctx);
if (ctx.__AGUsageMonitorBridge && ctx.__AGUsageMonitorBridge !== previousBridge) {
injectEvalCount += 1;
}
const ctx = windowContexts.get(this.targetId);
const value = vm.runInContext(expr, ctx);
Promise.resolve(value).then((result) =>
this._emit('message', {
data: JSON.stringify({ id: msg.id, result: { result: { value: result } } }),
@@ -734,6 +735,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
let liveSubagentPollActive = false;
const fetchedUrls = [];
const fetchedHeaders = [];
const createdForms = [];
const docListeners = new Map();
const winListeners = new Map();
@@ -743,7 +745,11 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
hidden: false,
documentElement: docRoot,
body,
createElement: (tag) => new MockNode(tag),
createElement: (tag) => {
const node = new MockNode(tag);
if (tag === 'form') createdForms.push(node);
return node;
},
createElementNS: (_ns, tag) => new MockNode(tag),
createTextNode: (txt) => {
const t = new MockNode('#text');
@@ -2702,6 +2708,9 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
'Hover legend updates strictly in-place without DOM node replacement or appendChild'
);
assert.equal(createdForms.some((form) => form.className.includes('settings-account-form')), false);
assert.equal(fetchedUrls.some((url) => url.includes('/api/accounts')), false);
// Verify in-place bridge port rotation preserves exact DOM host nodes without remount
fetchShouldFail = false;
assert.equal(ov.updateBridge({ port: 51234, token: 'rotated-token-456' }), true);