Skip to content

The agent that grows with you

fmt(js): `npm run fix` on merge (#95924)

hermes-seaeye[bot]77001a6be76f
diff --git a/apps/desktop/electron/remote-lifecycle.test.ts b/apps/desktop/electron/remote-lifecycle.test.ts
index 56897775c51..d22557c887e 100644
--- a/apps/desktop/electron/remote-lifecycle.test.ts
+++ b/apps/desktop/electron/remote-lifecycle.test.ts
@@ -287,38 +287,40 @@ test('readLockfile classifies existing-but-foreign lockfiles as skew, never null
// (a) foreign-schema lockfile (fork build wrote a different shape)
const foreign = await readLockfile(fakeSsh([[/cat/, 'not json at all']]), OWNERSHIP_ID)
assert.equal(isLockfileSkew(foreign), true)
+
// (b) truncated lockfile (partial write / corruption)
- const truncated = await readLockfile(
- fakeSsh([[/cat/, JSON.stringify(ownedLock()).slice(0, 40)]]),
- OWNERSHIP_ID
- )
+ const truncated = await readLockfile(fakeSsh([[/cat/, JSON.stringify(ownedLock()).slice(0, 40)]]), OWNERSHIP_ID)
+
assert.equal(isLockfileSkew(truncated), true)
+
// (c) future schemaVersion (newer build owns this remote)
const future = await readLockfile(
fakeSsh([[/cat/, JSON.stringify(ownedLock({ schemaVersion: LOCKFILE_SCHEMA_VERSION + 1 }))]]),
OWNERSHIP_ID
)
+
assert.equal(isLockfileSkew(future), true)
// unknown schema number entirely
const unknown = await readLockfile(fakeSsh([[/cat/, JSON.stringify({ schemaVersion: 999 })]]), OWNERSHIP_ID)
assert.equal(isLockfileSkew(unknown), true)
+
// missing ownershipId / foreign ownership
const foreignOwner = await readLockfile(
fakeSsh([[/cat/, JSON.stringify(ownedLock({ ownershipId: undefined }))]]),
OWNERSHIP_ID
)
+
assert.equal(isLockfileSkew(foreignOwner), true)
+
// every skew carries a diagnosable reason and is never a valid lock
for (const skew of [foreign, truncated, future, unknown, foreignOwner]) {
assert.equal(typeof (skew as any).reason, 'string')
assert.notEqual(skew, null)
}
+
// a valid lock and a missing lockfile are NOT skew
assert.equal(isLockfileSkew(await readLockfile(fakeSsh([[/cat/, '']]), OWNERSHIP_ID)), false)
- assert.equal(
- isLockfileSkew(await readLockfile(fakeSsh([[/cat/, JSON.stringify(ownedLock())]]), OWNERSHIP_ID)),
- false
- )
+ assert.equal(isLockfileSkew(await readLockfile(fakeSsh([[/cat/, JSON.stringify(ownedLock())]]), OWNERSHIP_ID)), false)
})
// #95532: on skew the reap pass must FAIL CLOSED — no kill, no lockfile
@@ -344,7 +346,10 @@ test('connect() fails closed on lockfile schema/ownership skew: skips reap, touc
(error: any) => error.kind === 'remote-lockfile-skew',
`${label}: connect must refuse with remote-lockfile-skew`
)
- assert.ok(!ssh.calls.some(c => /(^|[^-\d])kill -?9? ?\d/.test(c) && !/kill -0/.test(c)), `${label}: must not kill any pid`)
+ assert.ok(
+ !ssh.calls.some(c => /(^|[^-\d])kill -?9? ?\d/.test(c) && !/kill -0/.test(c)),
+ `${label}: must not kill any pid`
+ )
assert.ok(!ssh.calls.some(c => /rm -f/.test(c)), `${label}: must not remove any remote file`)
assert.ok(!ssh.calls.some(c => /setsid|nohup/.test(c)), `${label}: must not spawn on top of foreign state`)
assert.ok(!ssh.calls.some(c => /printf '%s' '.*schemaVersion/.test(c)), `${label}: must not overwrite the lockfile`)
diff --git a/apps/desktop/electron/remote-lifecycle.ts b/apps/desktop/electron/remote-lifecycle.ts
index 1df60c7a668..e1098bdbdec 100644
--- a/apps/desktop/electron/remote-lifecycle.ts
+++ b/apps/desktop/electron/remote-lifecycle.ts
@@ -861,13 +861,17 @@ async function connect(deps) {
// or is corrupt. FAIL CLOSED: no reap, no removal, no overwrite, no spawn
// on top of foreign live state — reaping here is how live tunnels die.
const lpath = lockfilePath(ownershipId)
- log(`lockfile schema/ownership skew (${lock.reason}) at ${lpath} — failing closed: skipping reap, leaving remote state untouched`)
+ log(
+ `lockfile schema/ownership skew (${lock.reason}) at ${lpath} — failing closed: skipping reap, leaving remote state untouched`
+ )
+
const error: any = new Error(
`The remote ownership record ${lpath} does not match this Hermes Desktop build (${lock.reason}). ` +
'It was probably written by a different or modified desktop build sharing this remote, or the file is corrupt. ' +
'Refusing to reap or overwrite it — that could kill a live SSH backend owned by another build. ' +
'If nothing else uses this remote, delete that file on the remote host and reconnect.'
)
+
error.kind = 'remote-lockfile-skew'
throw error
}
diff --git a/apps/desktop/electron/renderer-load-error-page.test.ts b/apps/desktop/electron/renderer-load-error-page.test.ts
index 1883523565c..903fb10b55a 100644
--- a/apps/desktop/electron/renderer-load-error-page.test.ts
+++ b/apps/desktop/electron/renderer-load-error-page.test.ts
@@ -70,6 +70,7 @@ test('error page renders without any details', () => {
test('loadRendererLoadErrorPage loads a data: URL and swallows loadURL rejections', async () => {
const loads: string[] = []
+
const win = {
loadURL: async (url: string) => {
loads.push(url)
diff --git a/apps/desktop/electron/renderer-load-error-page.ts b/apps/desktop/electron/renderer-load-error-page.ts
index 0007138c9eb..772b68d6ac3 100644
--- a/apps/desktop/electron/renderer-load-error-page.ts
+++ b/apps/desktop/electron/renderer-load-error-page.ts
@@ -101,6 +101,7 @@ function missingAssetsList(missingAssets?: string[]): string {
export function buildRendererLoadErrorPage(details: RendererLoadErrorDetails = {}): string {
const code =
details.errorCode === undefined || details.errorCode === null ? '' : ` (${escapeHtml(details.errorCode)})`
+
const title = 'Hermes couldn\u2019t start the desktop UI'
const description = escapeHtml(details.errorDescription || 'The desktop renderer failed to load.')
const url = details.url ? `<p><code>${escapeHtml(details.url)}</code></p>` : ''
diff --git a/apps/desktop/electron/window-renderer-lifecycle.test.ts b/apps/desktop/electron/window-renderer-lifecycle.test.ts
index 85a7b93b5ed..9203cdb2fa7 100644
--- a/apps/desktop/electron/window-renderer-lifecycle.test.ts
+++ b/apps/desktop/electron/window-renderer-lifecycle.test.ts
@@ -446,6 +446,7 @@ test('shouldReloadAfterFailedLoad surfaces a visible error once the budget is ex
test('installWindowRendererLifecycle auto-reloads main-frame load failures when enabled', async () => {
const win = makeFakeWindow()
+
const { logs, options } = makeOptions(win, 'main', {
reloadOnFailedLoad: true,
reloadWindowMs: 60_000,
@@ -503,6 +504,7 @@ test('installWindowRendererLifecycle surfaces the error page after the reload bu
test('load-failure reloads share the crash-loop budget with render-process-gone', async () => {
const win = makeFakeWindow()
+
const { options } = makeOptions(win, 'main', {
reloadOnFailedLoad: true,
reloadWindowMs: 60_000,
@@ -525,6 +527,7 @@ test('load-failure reloads share the crash-loop budget with render-process-gone'
test('ERR_ABORTED does not consume the load-failure budget', async () => {
const win = makeFakeWindow()
+
const { options } = makeOptions(win, 'main', {
reloadOnFailedLoad: true,
reloadWindowMs: 60_000,