Merge pull request #8428 from deepseek-harness/turtle/clean-empty-catch-69cac4a2ccee
fix: retire the legacy empty-catch baseline
This commit is contained in:
commit
843fc0fa24
93 files changed
+413
-599
No files matched your search
@@ -143,9 +143,7 @@ function createProfileLifecycleFixture(): ProfileLifecycleFixture {
|
||||
writeFileSync(join(profileDir, 'cordis.patch.yml'), '[]\n')
|
||||
const linkTarget = join(profileDir, 'node_modules', 'dsh-lifecycle-bundle')
|
||||
mkdirSync(join(profileDir, 'node_modules'), { recursive: true })
|
||||
try {
|
||||
rmSync(linkTarget, { recursive: true, force: true })
|
||||
} catch { /* fresh dir */ }
|
||||
rmSync(linkTarget, { recursive: true, force: true })
|
||||
// Copy-free: a package.json redirecting via a relative main is enough for require.resolve.
|
||||
mkdirSync(linkTarget, { recursive: true })
|
||||
for (const file of ['package.json', 'cordis.patch.yml', 'plugin.mjs']) {
|
||||
|
||||
@@ -142,14 +142,15 @@ export function Welcome({ api }: { api: WelcomeApi }) {
|
||||
if (cancelling || attemptRef.current === null) return
|
||||
setCancelling(true)
|
||||
const current = ++revision.current
|
||||
let state: AccountView | undefined
|
||||
try {
|
||||
const state = await api.cancelSignIn(attemptRef.current.id)
|
||||
if (mounted.current && revision.current === current) showAccount(state)
|
||||
} catch {
|
||||
state = await api.cancelSignIn(attemptRef.current.id)
|
||||
} catch (_cancelFailed) {
|
||||
// The current attempt remains visible so cancellation can be retried.
|
||||
} finally {
|
||||
if (mounted.current) setCancelling(false)
|
||||
}
|
||||
if (state !== undefined && mounted.current && revision.current === current) showAccount(state)
|
||||
}
|
||||
async function copyLink() {
|
||||
const current = attemptRef.current
|
||||
|
||||
@@ -15,17 +15,18 @@ if (process.isMainFrame && location.origin === allowedOrigin) {
|
||||
try { listener(value) } catch (error) { console.error('Platform locale listener failed', error) }
|
||||
}
|
||||
})
|
||||
let value: unknown
|
||||
try {
|
||||
const value: unknown = ipcRenderer.sendSync(PLATFORM_IPC.bootstrap)
|
||||
if (typeof value === 'object' && value !== null && 'token' in value && 'origin' in value
|
||||
&& typeof value.token === 'string' && value.token.length > 0 && value.origin === location.origin
|
||||
&& 'locale' in value && (value.locale === 'en_US' || value.locale === 'zh_CN')) {
|
||||
token = value.token
|
||||
locale = value.locale
|
||||
}
|
||||
} catch {
|
||||
value = ipcRenderer.sendSync(PLATFORM_IPC.bootstrap)
|
||||
} catch (_bootstrapFailed) {
|
||||
// Initialization failure retains embedded mode so Platform cannot use browser credentials.
|
||||
}
|
||||
if (typeof value === 'object' && value !== null && 'token' in value && 'origin' in value
|
||||
&& typeof value.token === 'string' && value.token.length > 0 && value.origin === location.origin
|
||||
&& 'locale' in value && (value.locale === 'en_US' || value.locale === 'zh_CN')) {
|
||||
token = value.token
|
||||
locale = value.locale
|
||||
}
|
||||
contextBridge.exposeInMainWorld('dsh', {
|
||||
protocolVersion: 1,
|
||||
displayMode: 'embedded',
|
||||
|
||||
@@ -264,8 +264,8 @@ async function withScrollWorld(
|
||||
runFailure = error
|
||||
try {
|
||||
await saveFailureShot(world.page, options.failureShot)
|
||||
} catch {
|
||||
// Best-effort evidence must never prevent cleanup of the owned world.
|
||||
} catch (_failureShotFailed) {
|
||||
// A missing screenshot loses evidence only; cleanup of the owned world and the rethrown run failure still follow.
|
||||
}
|
||||
}
|
||||
let cleanupFailure: unknown
|
||||
|
||||
@@ -419,8 +419,8 @@ export async function saveFailureShot(page: Page, name: string): Promise<void> {
|
||||
mkdirSync(dir, { recursive: true })
|
||||
try {
|
||||
await page.screenshot({ path: `${dir}/${name}.png`, fullPage: true })
|
||||
} catch {
|
||||
// Best-effort evidence: a dead page/browser at failure time must not mask the real assertion error.
|
||||
} catch (_screenshotFailed) {
|
||||
// Screenshot evidence is optional: a dead page/browser at failure time must not mask the real assertion error.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ async function closeRemoteStreamIterator<Item>(
|
||||
): Promise<void> {
|
||||
try {
|
||||
await iterator.return?.()
|
||||
} catch {
|
||||
} catch (_iteratorReturnFailed) {
|
||||
// The disposed logical stream has no remaining consumer for cancellation failures.
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ class FeedService extends TypertRemoteService {
|
||||
async *swallow(signal: AbortSignal): RemoteStream<string, string> {
|
||||
try {
|
||||
for await (const item of this.invocation().uplink<string>()) yield item
|
||||
} catch {
|
||||
} catch (_uplinkFailed) {
|
||||
// The fixture keeps yielding after the rejected item on purpose.
|
||||
}
|
||||
yield 'swallowed'
|
||||
|
||||
@@ -174,7 +174,7 @@ class SessionFeed {
|
||||
assertNever(frame)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
} catch (_streamEnded) {
|
||||
// A terminal stream failure or the Host's end: followers end quietly
|
||||
// below, and the metadata they hold stays the last known.
|
||||
} finally {
|
||||
|
||||
@@ -918,7 +918,7 @@ export function installFailLoud(
|
||||
timer = setTimeout(resolve, FAIL_LOUD_RELEASE_TIMEOUT_MS)
|
||||
}),
|
||||
])
|
||||
} catch {
|
||||
} catch (_releaseFailed) {
|
||||
// The terminal release failed; the fatal exit below is the outcome that
|
||||
// matters, and no reporter runs after it.
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export const REGISTRY_URL = /^https?:\/\/\S+$/
|
||||
export function normalizeRegistry(url: string): string {
|
||||
let parsed: URL | undefined
|
||||
try { parsed = new URL(url) }
|
||||
catch { /* named below: only an http(s) URL is a registry */ }
|
||||
catch (_invalidUrl) { /* `parsed` stays undefined and the check below throws the registry error */ }
|
||||
if (parsed === undefined || (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')) {
|
||||
throw new Error(`a registry must be an http(s) URL: ${url}`)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ function fixture(child: string, descendant: string) {
|
||||
writeFileSync(stopFile, '')
|
||||
if (existsSync(pidFile)) {
|
||||
const pid = Number(readFileSync(pidFile, 'utf8'))
|
||||
try { process.kill(pid, 'SIGKILL') } catch { /* the descendant exited with its own timer */ }
|
||||
try { process.kill(pid, 'SIGKILL') } catch (_alreadyExited) { /* The descendant exited on its own timer, so there is nothing left to kill. */ }
|
||||
await awaitGone(pid)
|
||||
}
|
||||
rmSync(home, { recursive: true, force: true })
|
||||
@@ -150,7 +150,7 @@ it('waits for a run recorded by an exited operation before starting its own', as
|
||||
stdio: 'ignore',
|
||||
})
|
||||
onTestFinished(async () => {
|
||||
try { orphan.kill('SIGKILL') } catch { /* the recorded run already exited */ }
|
||||
try { orphan.kill('SIGKILL') } catch (_alreadyExited) { /* The recorded run already exited, so there is nothing left to kill. */ }
|
||||
await awaitGone(orphan.pid as number)
|
||||
})
|
||||
const dir = join(context.home, 'profiles', 'test')
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import { createHash } from 'node:crypto'
|
||||
import { addAbortListener } from 'node:events'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { existsSync, type Dirent } from 'node:fs'
|
||||
import { mkdir, mkdtemp, readdir, rename, rm, stat, utimes } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import { execa } from 'execa'
|
||||
@@ -392,17 +392,14 @@ export class RepositoryCache {
|
||||
const now = Date.now()
|
||||
const entries: { path: string; size: number; used: number }[] = []
|
||||
for (const entry of await readdir(this.options.dir, { withFileTypes: true })) {
|
||||
const path = join(this.options.dir, entry.name)
|
||||
let measured: { path: string; size: number; used: number } | undefined
|
||||
try {
|
||||
const used = (await stat(path)).mtimeMs
|
||||
if (entry.name.startsWith(STAGING_PREFIX)) {
|
||||
if (now - used > this.options.timeoutMs) await rm(path, { recursive: true, force: true })
|
||||
} else if (entry.isDirectory()) {
|
||||
entries.push({ path, size: await sizeOf(path), used })
|
||||
}
|
||||
} catch (_removed) {
|
||||
// Another operation deleted the directory while it was measured; it no longer counts.
|
||||
measured = await this.measure(join(this.options.dir, entry.name), entry, now)
|
||||
} catch (_unmeasurable) {
|
||||
// Usually another operation deleted the entry while it was measured. An entry that cannot be measured or
|
||||
// removed stays out of this pass, which leaves it on disk for the next eviction to retry.
|
||||
}
|
||||
if (measured !== undefined) entries.push(measured)
|
||||
}
|
||||
let total = entries.reduce((sum, entry) => sum + entry.size, 0)
|
||||
// The repository in use goes last: it is deleted only when it alone exceeds the cache, after its operation ends.
|
||||
@@ -414,6 +411,19 @@ export class RepositoryCache {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Measure one cache entry for eviction, deleting a staging directory older than the Git deadline.
|
||||
* @returns the repository's size and last use, or `undefined` for a staging directory or a non-directory.
|
||||
*/
|
||||
private async measure(path: string, entry: Dirent, now: number): Promise<{ path: string; size: number; used: number } | undefined> {
|
||||
const used = (await stat(path)).mtimeMs
|
||||
if (entry.name.startsWith(STAGING_PREFIX)) {
|
||||
if (now - used > this.options.timeoutMs) await rm(path, { recursive: true, force: true })
|
||||
return undefined
|
||||
}
|
||||
return entry.isDirectory() ? { path, size: await sizeOf(path), used } : undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* The regular files directly below a tree path, or the file at a path, with their blob ids; listing reads only trees,
|
||||
* so it fetches no file contents.
|
||||
|
||||
@@ -469,7 +469,7 @@ function buildComboSourceMap(
|
||||
if (sourceMap !== undefined) {
|
||||
try {
|
||||
section = comboSectionMap(resource, sourceMap)
|
||||
} catch {
|
||||
} catch (_malformedSourceMap) {
|
||||
// An invalid authored source URL is a malformed map, so the generated
|
||||
// bundle remains debuggable through the same identity fallback.
|
||||
}
|
||||
@@ -974,15 +974,16 @@ export class ClientModuleRegistry extends Service {
|
||||
while (true) {
|
||||
const candidate = join(dir, 'package.json')
|
||||
if (existsSync(candidate)) {
|
||||
let name: unknown
|
||||
try {
|
||||
const name = (JSON.parse(readFileSync(candidate, 'utf8')) as { name?: unknown }).name
|
||||
if (typeof name === 'string' && (expectedPackageName === undefined || name === expectedPackageName)) {
|
||||
return { path: candidate, packageName: name }
|
||||
}
|
||||
} catch {
|
||||
name = (JSON.parse(readFileSync(candidate, 'utf8')) as { name?: unknown }).name
|
||||
} catch (_unreadableManifest) {
|
||||
// An unreadable or malformed intermediate manifest cannot own the
|
||||
// module; keep walking toward the declaring package root.
|
||||
}
|
||||
if (typeof name === 'string' && (expectedPackageName === undefined || name === expectedPackageName)) {
|
||||
return { path: candidate, packageName: name }
|
||||
}
|
||||
}
|
||||
const parent = dirname(dir)
|
||||
if (parent === dir) break
|
||||
|
||||
@@ -239,7 +239,7 @@ export function defineStore<T, A extends ActionsDecl<T>>(
|
||||
if (persistKey === undefined || typeof localStorage === 'undefined') return
|
||||
try {
|
||||
localStorage.removeItem(persistKey)
|
||||
} catch {
|
||||
} catch (_storageUnavailable) {
|
||||
// Storage failures (private mode, quota teardown races) only skip
|
||||
// cleanup — the same non-fatal contract as attachPersistence.
|
||||
}
|
||||
|
||||
@@ -99,17 +99,19 @@ export class OpenInAppController {
|
||||
|
||||
private async run(): Promise<void> {
|
||||
let apps: readonly string[] = []
|
||||
let payload: OpenInAppAppsPayload | undefined
|
||||
try {
|
||||
const response = await this.fetcher(OPEN_IN_APP_APPS_ROUTE, {
|
||||
headers: { accept: 'application/json' },
|
||||
})
|
||||
if (response.ok) {
|
||||
const payload = await response.json() as OpenInAppAppsPayload
|
||||
if (Array.isArray(payload.apps)) apps = payload.apps.filter(id => typeof id === 'string')
|
||||
}
|
||||
} catch (_error) {
|
||||
// An unreachable Host supplies no directory openers in menus or controls.
|
||||
payload = await this.readAppsPayload()
|
||||
} catch (_appsUnavailable) {
|
||||
// An unreachable Host or an unreadable reply supplies no directory openers in menus or controls.
|
||||
}
|
||||
if (Array.isArray(payload?.apps)) apps = payload.apps.filter(id => typeof id === 'string')
|
||||
this.apps.set(apps)
|
||||
}
|
||||
|
||||
/** The Host's opener payload, or `undefined` for a non-OK reply; rejects when the Host or its reply is unreadable. */
|
||||
private async readAppsPayload(): Promise<OpenInAppAppsPayload | undefined> {
|
||||
const response = await this.fetcher(OPEN_IN_APP_APPS_ROUTE, { headers: { accept: 'application/json' } })
|
||||
return response.ok ? await response.json() as OpenInAppAppsPayload : undefined
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export class OpenInAppPathController {
|
||||
let ok = false
|
||||
try {
|
||||
ok = (await this.remote.session.openWorkspacePath(request)).ok
|
||||
} catch {
|
||||
} catch (_hostUnreachable) {
|
||||
// Swallows carrier rejections: a Host that cannot be reached failed the
|
||||
// gesture like a Host that refused it, and the control announces that.
|
||||
}
|
||||
@@ -173,14 +173,13 @@ export class OpenInAppPathController {
|
||||
}
|
||||
|
||||
private async run(): Promise<void> {
|
||||
let available = false
|
||||
let result: RemoteResult<boolean> | undefined
|
||||
try {
|
||||
const result = await this.remote.session.canOpenWorkspacePath()
|
||||
available = result.ok && result.value
|
||||
} catch {
|
||||
result = await this.remote.session.canOpenWorkspacePath()
|
||||
} catch (_hostUnreachable) {
|
||||
// Swallows carrier rejections: an unreachable Host reads as no desktop,
|
||||
// so the preview shows no path control rather than a broken one.
|
||||
}
|
||||
this.desktop.set(available)
|
||||
this.desktop.set(result?.ok === true && result.value)
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export function rememberTimeZone(recent: readonly string[], zone: string): reado
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(next))
|
||||
} catch {
|
||||
} catch (_storageUnavailable) {
|
||||
// A private or full browser store must not block editing the rule.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function parseBrowserAddress(input: string, applicationOrigin?: string):
|
||||
if (applicationOrigin !== undefined && applicationOrigin !== 'null') {
|
||||
try {
|
||||
if (url.origin === new URL(applicationOrigin).origin) return { ok: false, reason: 'application-origin' }
|
||||
} catch {
|
||||
} catch (_invalidApplicationOrigin) {
|
||||
// An unavailable application origin cannot grant access to a target.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,21 @@ export class SidebarTabInventory {
|
||||
|
||||
/** Read saved layouts once before the root service is published. */
|
||||
constructor() {
|
||||
let keys: readonly (string | null)[] = []
|
||||
try {
|
||||
if (typeof localStorage === 'undefined') return
|
||||
const keys = Array.from({ length: localStorage.length }, (_, index) => localStorage.key(index))
|
||||
for (const key of keys) {
|
||||
if (key === null || !key.startsWith(`${sidebarPersistence}.`)) continue
|
||||
const sessionId = key.slice(sidebarPersistence.length + 1) as SessionId
|
||||
const saved = readSidebarLayout(sessionId)
|
||||
if (saved !== undefined) this.sessions.set(sessionId, Object.values(saved.layout.tabs).map(tab => ({
|
||||
sessionId, tabId: tab.id, kind: tab.kind, contentId: tab.contentId,
|
||||
})))
|
||||
}
|
||||
this.publish()
|
||||
} catch (_storageUnavailable) { /* Adopted in-memory layouts still publish their open tabs. */ }
|
||||
keys = typeof localStorage === 'undefined' ? [] : Array.from({ length: localStorage.length }, (_, index) => localStorage.key(index))
|
||||
} catch (_storageUnavailable) {
|
||||
// Inaccessible storage holds no saved layouts; adopted in-memory layouts still publish their open tabs.
|
||||
}
|
||||
for (const key of keys) {
|
||||
if (key === null || !key.startsWith(`${sidebarPersistence}.`)) continue
|
||||
const sessionId = key.slice(sidebarPersistence.length + 1) as SessionId
|
||||
const saved = readSidebarLayout(sessionId)
|
||||
if (saved !== undefined) this.sessions.set(sessionId, Object.values(saved.layout.tabs).map(tab => ({
|
||||
sessionId, tabId: tab.id, kind: tab.kind, contentId: tab.contentId,
|
||||
})))
|
||||
}
|
||||
this.publish()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,16 +27,17 @@ function firstLine(text: string): string {
|
||||
|
||||
/** Skill names are the only call argument the compact row presents. */
|
||||
function skillName(argsRaw: string, callId: string): string {
|
||||
let parsed: unknown
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(argsRaw)
|
||||
if (typeof parsed === 'object' && parsed !== null) {
|
||||
const name = (parsed as Record<string, unknown>).name
|
||||
if (typeof name === 'string' && name !== '') return firstLine(name)
|
||||
}
|
||||
} catch {
|
||||
parsed = JSON.parse(argsRaw)
|
||||
} catch (_truncatedArgs) {
|
||||
// Streaming can expose a truncated JSON prefix; its first line is still
|
||||
// more useful than replacing the call with an unrelated catalog lookup.
|
||||
}
|
||||
if (typeof parsed === 'object' && parsed !== null) {
|
||||
const name = (parsed as Record<string, unknown>).name
|
||||
if (typeof name === 'string' && name !== '') return firstLine(name)
|
||||
}
|
||||
return argsRaw === '' ? callId : firstLine(argsRaw)
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ async function workspace(): Promise<string> {
|
||||
await writeFile(join(root, 'node_modules', 'ignored-package', 'index.js'), 'ignored')
|
||||
try {
|
||||
await symlink(join(root, 'src', 'tui.spec.ts'), join(root, 'linked-test.ts'))
|
||||
} catch {
|
||||
} catch (_symlinkDenied) {
|
||||
// Windows may deny symlink creation without Developer Mode; the product
|
||||
// still skips every non-file/non-directory Dirent on platforms that expose one.
|
||||
}
|
||||
|
||||
@@ -757,7 +757,7 @@ export class DeepSeekAccount extends TypertRemoteService {
|
||||
signal.throwIfAborted()
|
||||
if (result.data.user != null) {
|
||||
try { attempt.initialProfile = { token: result.data.token, value: { status: 'ready', value: profile(result.data.user) } } }
|
||||
catch {
|
||||
catch (_invalidUser) {
|
||||
// Invalid optional user data falls back to current without discarding a valid authorization.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,10 @@ export async function revokeAccount(origin: string, token: string, policy: Logou
|
||||
try {
|
||||
await logoutAccount(origin, token,
|
||||
AbortSignal.any([signal, AbortSignal.timeout(policy.requestTimeoutMs)]), headers)
|
||||
return
|
||||
} catch {
|
||||
} catch (_revokeFailed) {
|
||||
// HTTP, business, and transport failures consume one attempt without restoring credentials.
|
||||
continue
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -295,9 +295,9 @@ export class SessionPanel {
|
||||
}
|
||||
let missing: ForgeMissingWorktree | null = null
|
||||
try {
|
||||
const state = this.worktreeStates.stateOf(this.session)
|
||||
missing = await missingWorktree(this.ctx, this.config, this.session, state, directory, this.lifetime.signal)
|
||||
} catch (_error) {
|
||||
missing = await missingWorktree(
|
||||
this.ctx, this.config, this.session, this.worktreeStates.stateOf(this.session), directory, this.lifetime.signal)
|
||||
} catch (_worktreeUnreadable) {
|
||||
// Without an answer from the filesystem or Git the panel offers no restoration.
|
||||
}
|
||||
if (this.lifetime.signal.aborted || this.current.directory !== directory) return
|
||||
|
||||
@@ -101,7 +101,7 @@ export class ClientInspectorSource extends InspectorSourceConnection {
|
||||
if (!isJsonValue(frame) || jsonByteLength(frame) > this.bootstrap.maxFrameBytes) return
|
||||
try {
|
||||
socket.send(JSON.stringify(frame))
|
||||
} catch {
|
||||
} catch (_closingSocket) {
|
||||
// The socket close path resets this generation's Runtime and Console state.
|
||||
}
|
||||
}, url => this.sourceCatalog?.scriptKeyForUrl(url))
|
||||
|
||||
@@ -140,9 +140,8 @@ export class ClientConsoleObserver {
|
||||
queueMicrotask(() => {
|
||||
for (const sessionId of [...this.sessions]) {
|
||||
try {
|
||||
const event = this.runtime.consoleEvent(sessionId, type, values, timestamp, stackTrace)
|
||||
if (event !== undefined) this.sink(sessionId, event)
|
||||
} catch {
|
||||
this.deliver(sessionId, this.runtime.consoleEvent(sessionId, type, values, timestamp, stackTrace))
|
||||
} catch (_observationFailed) {
|
||||
// Console observation must not affect the page's original console call.
|
||||
}
|
||||
}
|
||||
@@ -155,14 +154,17 @@ export class ClientConsoleObserver {
|
||||
queueMicrotask(() => {
|
||||
for (const sessionId of [...this.sessions]) {
|
||||
try {
|
||||
const event = this.runtime.exceptionEvent(sessionId, error, timestamp, stackTrace)
|
||||
if (event !== undefined) this.sink(sessionId, event)
|
||||
} catch {
|
||||
this.deliver(sessionId, this.runtime.exceptionEvent(sessionId, error, timestamp, stackTrace))
|
||||
} catch (_observationFailed) {
|
||||
// Exception observation must not affect browser error dispatch.
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private deliver(sessionId: ClientRuntimeSessionId, event: RuntimeConsoleBackendEvent<ClientRemoteObjectHandle> | undefined): void {
|
||||
if (event !== undefined) this.sink(sessionId, event)
|
||||
}
|
||||
}
|
||||
|
||||
function addGlobalListener(type: string, listener: EventListener): void {
|
||||
|
||||
@@ -67,19 +67,20 @@ export class ClientRealmSource {
|
||||
|
||||
function sessionClientSourceId(): InspectorSourceDescriptor['sourceId'] {
|
||||
const generated = generatedClientSourceId()
|
||||
let stored: string | null = null
|
||||
try {
|
||||
const stored = sessionStorage.getItem(CLIENT_SOURCE_STORAGE_KEY)
|
||||
if (stored !== null) {
|
||||
try {
|
||||
return inspectorId<'InspectorSourceId'>(stored, 'sourceId')
|
||||
} catch {
|
||||
// Invalid page-owned storage is replaced with a fresh protocol identity below.
|
||||
}
|
||||
}
|
||||
sessionStorage.setItem(CLIENT_SOURCE_STORAGE_KEY, generated)
|
||||
} catch {
|
||||
stored = sessionStorage.getItem(CLIENT_SOURCE_STORAGE_KEY)
|
||||
} catch (_storageUnavailable) {
|
||||
// Disabled or unavailable session storage limits identity to this page lifetime.
|
||||
}
|
||||
if (stored !== null) {
|
||||
try {
|
||||
return inspectorId<'InspectorSourceId'>(stored, 'sourceId')
|
||||
} catch (_invalidStoredId) {
|
||||
// Invalid page-owned storage is replaced with a fresh protocol identity below.
|
||||
}
|
||||
}
|
||||
persistClientSourceId(generated)
|
||||
return generated
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ function generatedClientSourceId(): InspectorSourceDescriptor['sourceId'] {
|
||||
function persistClientSourceId(sourceId: InspectorSourceDescriptor['sourceId']): void {
|
||||
try {
|
||||
sessionStorage.setItem(CLIENT_SOURCE_STORAGE_KEY, sourceId)
|
||||
} catch {
|
||||
} catch (_storageUnavailable) {
|
||||
// Disabled or unavailable session storage limits identity to this page lifetime.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ export class InspectorSourceRegistry {
|
||||
for (const listener of [...this.statusListeners]) {
|
||||
try {
|
||||
listener()
|
||||
} catch {
|
||||
} catch (_observerFailed) {
|
||||
// A diagnostic observer is isolated from source admission and later observers.
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ export class InspectorSourceRegistry {
|
||||
for (const listener of [...this.eventListeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_consumerFailed) {
|
||||
// A protocol consumer is isolated from source admission and sibling consumers.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ export class ClientRuntimeRouter {
|
||||
generation: target.source.generation,
|
||||
sessionId,
|
||||
})
|
||||
} catch {
|
||||
} catch (_sourceClosed) {
|
||||
// Source removal also disables Console observation in the Client.
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ export class ClientRuntimeRouter {
|
||||
if (subscription.target !== target || subscription.sessionId !== frame.sessionId) continue
|
||||
try {
|
||||
subscription.listener(frame.event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One DevTools Console session cannot disrupt sibling sessions.
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@ export class ClientRuntimeRouter {
|
||||
sessionId,
|
||||
requestId,
|
||||
})
|
||||
} catch {
|
||||
} catch (_sourceClosed) {
|
||||
// Cancellation settlement does not depend on delivery to a source that may be closing.
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ export class ClientRuntimeRouter {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One CDP session cannot disrupt context delivery to another session.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function sendClientSessionClosed(
|
||||
): void {
|
||||
try {
|
||||
sources.send(source, frame)
|
||||
} catch {
|
||||
} catch (_sourceClosed) {
|
||||
// Source removal already invalidates every session owned by this generation.
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ export class CordisDomBackend {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(change)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One closed CDP connection cannot prevent sibling sessions from receiving the document mutation.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ export class InspectorRealmSessionSet {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One CDP domain cannot prevent sibling domains from observing realm lifecycle.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ export class CordisTreeStore implements InspectorRecordConsumer {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One query adapter cannot prevent later repository observers from updating.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export class NetworkStore implements InspectorRecordConsumer {
|
||||
if (!this.topics.has(record.topic)) continue
|
||||
try {
|
||||
this.ingest(source, record)
|
||||
} catch {
|
||||
} catch (_malformedRecord) {
|
||||
// A malformed domain payload loses only that observation; later records remain independently useful.
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ export class NetworkStore implements InspectorRecordConsumer {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One presentation adapter cannot interrupt repository ingestion or sibling consumers.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ export class InspectorQueryPeer {
|
||||
this.close()
|
||||
try {
|
||||
this.transport.close(code, reason.slice(0, 123))
|
||||
} catch {
|
||||
} catch (_transportUnusable) {
|
||||
// The carrier is already unusable; query state has reached quiescence.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ export class InspectorRealmRegistry {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One DevTools connection cannot disrupt realm delivery to sibling connections.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class HostInspectorSession {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(rewritten)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One domain subscriber cannot starve notifications for sibling domains.
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ export class HostInspectorSession {
|
||||
this.connected = false
|
||||
try {
|
||||
this.session.disconnect()
|
||||
} catch {
|
||||
} catch (_alreadyDisconnected) {
|
||||
// The underlying inspector session is already disconnected.
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ export class HostNotificationChannel<Event> {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(event)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One notification consumer cannot prevent delivery to its siblings.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class HostSourceBackend implements SourceBackend {
|
||||
for (const listener of [...this.listeners]) {
|
||||
try {
|
||||
listener(descriptor)
|
||||
} catch {
|
||||
} catch (_listenerFailed) {
|
||||
// One source consumer cannot prevent delivery to sibling consumers.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,29 +204,33 @@ export function useShareEdit({
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
const load = async (): Promise<void> => {
|
||||
let listed
|
||||
try {
|
||||
const listed = await shares.list()
|
||||
if (cancelled || !listed.ok) return
|
||||
const existing = listed.value.shares.find(share =>
|
||||
share.sessionId === sessionId || share.sessionIds.includes(sessionId))
|
||||
if (existing !== undefined) {
|
||||
onLink(existing.link)
|
||||
setConfirmedAccess(readAccess(existing.access))
|
||||
// The editable record belongs to one share: the first sight of that share adopts it, and
|
||||
// every later poll leaves the owner's own unsaved picks alone.
|
||||
if (permissionShare.current !== existing.shareId) {
|
||||
setSaveNotice('')
|
||||
setSaveError('')
|
||||
adoptShare(existing)
|
||||
/* v8 ignore start -- polling adoption is covered by the first-adoption path. */
|
||||
} else if (!unsaved.current) {
|
||||
// The owner holds nothing unconfirmed, so this panel follows the host's record: a change
|
||||
// made in Share management shows here instead of two panels stating different values.
|
||||
adoptShare(existing)
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
listed = await shares.list()
|
||||
} catch (_pollFailed) {
|
||||
// The dialog keeps the last known list when polling fails.
|
||||
return
|
||||
}
|
||||
if (cancelled || !listed.ok) return
|
||||
const existing = listed.value.shares.find(share =>
|
||||
share.sessionId === sessionId || share.sessionIds.includes(sessionId))
|
||||
if (existing !== undefined) {
|
||||
onLink(existing.link)
|
||||
setConfirmedAccess(readAccess(existing.access))
|
||||
// The editable record belongs to one share: the first sight of that share adopts it, and
|
||||
// every later poll leaves the owner's own unsaved picks alone.
|
||||
if (permissionShare.current !== existing.shareId) {
|
||||
setSaveNotice('')
|
||||
setSaveError('')
|
||||
adoptShare(existing)
|
||||
/* v8 ignore start -- polling adoption is covered by the first-adoption path. */
|
||||
} else if (!unsaved.current) {
|
||||
// The owner holds nothing unconfirmed, so this panel follows the host's record: a change
|
||||
// made in Share management shows here instead of two panels stating different values.
|
||||
adoptShare(existing)
|
||||
}
|
||||
} catch { /* The dialog keeps the last known list when polling fails. */ }
|
||||
/* v8 ignore stop */
|
||||
}
|
||||
}
|
||||
void load()
|
||||
const timer = setInterval(() => { void load() }, 3000)
|
||||
@@ -241,10 +245,14 @@ export function useShareEdit({
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
const load = async (): Promise<void> => {
|
||||
let offeredNow
|
||||
try {
|
||||
const offeredNow = await shares.capabilities()
|
||||
if (!cancelled && offeredNow.ok) setOffered(readOfferedPlugins(offeredNow.value.capabilities))
|
||||
} catch { /* A host that cannot answer offers nothing; the section stays hidden. */ }
|
||||
offeredNow = await shares.capabilities()
|
||||
} catch (_hostUnanswered) {
|
||||
// A host that cannot answer offers nothing; the section stays hidden.
|
||||
return
|
||||
}
|
||||
if (!cancelled && offeredNow.ok) setOffered(readOfferedPlugins(offeredNow.value.capabilities))
|
||||
}
|
||||
void load()
|
||||
return () => { cancelled = true }
|
||||
|
||||
@@ -258,7 +258,7 @@ export function hostOwnerLogin(
|
||||
async cancel(state) {
|
||||
try {
|
||||
await post(CANCEL_ROUTE, { state })
|
||||
} catch {
|
||||
} catch (_cancelFailed) {
|
||||
// A transaction left behind expires on its own; this page has nothing else to do about it.
|
||||
}
|
||||
},
|
||||
@@ -308,7 +308,7 @@ export function beginOwnerLogin(options: {
|
||||
const close = (): void => {
|
||||
try {
|
||||
popup.close()
|
||||
} catch {
|
||||
} catch (_windowGone) {
|
||||
// A window already gone needs no closing.
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ export function beginOwnerLogin(options: {
|
||||
// The sign-in page closes on this acknowledgement instead of navigating the opener away.
|
||||
try {
|
||||
popup.postMessage({ type: OWNER_LOGIN_ACK_TYPE, state: code.state }, minted.messageOrigin)
|
||||
} catch {
|
||||
} catch (_windowUnreachable) {
|
||||
// A window that cannot be answered closes itself; the host still redeems this code.
|
||||
}
|
||||
report('verifying')
|
||||
|
||||
@@ -148,14 +148,18 @@ export function useShareRelayAddress(options: ShareRelayAddressOptions): ShareRe
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
const load = async (): Promise<void> => {
|
||||
let current
|
||||
try {
|
||||
const current = await shares.relay()
|
||||
if (cancelled || !current.ok) return
|
||||
setRelayState({
|
||||
...(current.value.override === undefined ? {} : { override: current.value.override }),
|
||||
...(current.value.effective === undefined ? {} : { effective: current.value.effective }),
|
||||
})
|
||||
} catch { /* Keep the host-provided default when the read fails. */ }
|
||||
current = await shares.relay()
|
||||
} catch (_readFailed) {
|
||||
// Keep the host-provided default when the read fails.
|
||||
return
|
||||
}
|
||||
if (cancelled || !current.ok) return
|
||||
setRelayState({
|
||||
...(current.value.override === undefined ? {} : { override: current.value.override }),
|
||||
...(current.value.effective === undefined ? {} : { effective: current.value.effective }),
|
||||
})
|
||||
}
|
||||
void load()
|
||||
return () => { cancelled = true }
|
||||
|
||||
@@ -67,12 +67,13 @@ export function packageRoot(
|
||||
const directory = join(searchPath, packageName)
|
||||
const manifestPath = join(directory, 'package.json')
|
||||
if (!existsSync(manifestPath)) continue
|
||||
let name: unknown
|
||||
try {
|
||||
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: unknown }
|
||||
if (manifest.name === packageName) return directory
|
||||
} catch {
|
||||
name = (JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: unknown }).name
|
||||
} catch (_unreadableManifest) {
|
||||
// A candidate whose manifest cannot be read is not this package; keep searching.
|
||||
}
|
||||
if (name === packageName) return directory
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
@@ -87,13 +88,13 @@ export function readTitles(root: string): Readonly<Record<string, string>> | und
|
||||
for (const language of TITLE_LANGUAGES) {
|
||||
const path = join(root, 'locale', `${language}.json`)
|
||||
if (!existsSync(path)) continue
|
||||
let title: unknown
|
||||
try {
|
||||
const locale = JSON.parse(readFileSync(path, 'utf8')) as { meta?: { title?: unknown } }
|
||||
const title = locale.meta?.title
|
||||
if (typeof title === 'string' && title !== '') titles[language] = title
|
||||
} catch {
|
||||
title = (JSON.parse(readFileSync(path, 'utf8')) as { meta?: { title?: unknown } }).meta?.title
|
||||
} catch (_unreadableLocale) {
|
||||
// One unreadable locale file does not hide the package's other names.
|
||||
}
|
||||
if (typeof title === 'string' && title !== '') titles[language] = title
|
||||
}
|
||||
return Object.keys(titles).length === 0 ? undefined : titles
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ export function createTunnelSupervision(deps: TunnelSupervisionDeps): TunnelSupe
|
||||
pendingRemovalWait = PENDING_REMOVAL_RETRY_MS
|
||||
try {
|
||||
await deps.persistOwnerState()
|
||||
} catch {
|
||||
} catch (_persistFailed) {
|
||||
// The rows are gone from this host; the file still names them until its next write succeeds.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,12 +210,12 @@ export function createViewerDispatch(input: ViewerDispatchDeps): ViewerDispatch
|
||||
// by the same setup every agent creation runs through. Preparing the source Session through the owner's
|
||||
// own service is what makes that happen; the state is read back afterwards, and a host that still has
|
||||
// no usable layer refuses rather than driving the Session unconstrained.
|
||||
let prepared = false
|
||||
let prepared = deps.prepareSource !== undefined
|
||||
try {
|
||||
await deps.prepareSource?.(source)
|
||||
prepared = deps.prepareSource !== undefined
|
||||
} catch {
|
||||
} catch (_preparationFailed) {
|
||||
// An unsuccessful preparation changes nothing: the refusal below is the answer either way.
|
||||
prepared = false
|
||||
}
|
||||
const refusedDuringPreparation = lifecycle.shareRefusal(shareId, actor)
|
||||
if (refusedDuringPreparation !== undefined) return refusedDuringPreparation
|
||||
|
||||
@@ -195,7 +195,7 @@ export const inject = ['llm']
|
||||
export function apply(ctx) {
|
||||
// Loaded marker: proves the loader activated this plugin, independently of any model call.
|
||||
if (process.env.BASE_LLM_LOADED) {
|
||||
try { writeFileSync(process.env.BASE_LLM_LOADED, 'loaded\n') } catch {}
|
||||
try { writeFileSync(process.env.BASE_LLM_LOADED, 'loaded\n') } catch (_markerWriteFailed) { /* A spec that reads no marker loses nothing; one that reads it fails on the missing file. */ }
|
||||
}
|
||||
ctx.llm.registerAdapter(['deepseek-official'], new BaseFixtureAdapter())
|
||||
}
|
||||
@@ -1010,6 +1010,24 @@ describe('Liveshare dialog stored-record branches', () => {
|
||||
expect(screen.getByRole('button', { name: 'Save changes' })).toBeDefined()
|
||||
})
|
||||
|
||||
it('keeps its create form when the list read fails', async () => {
|
||||
await showControlled({ overrides: { list: async () => { throw new Error('host unreachable') } } })
|
||||
|
||||
expect(screen.queryByRole('textbox', { name: 'Share link' })).toBeNull()
|
||||
expect(screen.getByRole('button', { name: 'Create share' })).toBeDefined()
|
||||
expect(screen.queryByRole('alert')).toBeNull()
|
||||
})
|
||||
|
||||
it('hides the endpoint control when the offer read fails', async () => {
|
||||
await showControlled({
|
||||
rows: [existing],
|
||||
overrides: { capabilities: async () => { throw new Error('host unreachable') } },
|
||||
})
|
||||
|
||||
expect(screen.queryByRole('tablist', { name: 'Plugin endpoints' })).toBeNull()
|
||||
expect(screen.getByRole('button', { name: 'Save changes' })).toBeDefined()
|
||||
})
|
||||
|
||||
it('states an identity it could not read and retries it on request', async () => {
|
||||
const identity = vi.fn(async () => { throw new Error('identity lost') })
|
||||
await showControlled({ overrides: { identity } })
|
||||
|
||||
@@ -101,7 +101,7 @@ export function createGitHubWebhookHandler(
|
||||
let verified = false
|
||||
try {
|
||||
verified = await new Webhooks({ secret: credential.value }).verify(body, signature)
|
||||
} catch {
|
||||
} catch (_verificationFailed) {
|
||||
// Octokit verification errors carry no response detail safe or useful to the sender.
|
||||
}
|
||||
if (!verified) throw new WebhookHttpError(401, 'invalid webhook signature')
|
||||
|
||||
@@ -482,7 +482,7 @@ export class WorkerTunnel {
|
||||
const abort: AbortFrame = { t: 'abort', id }
|
||||
try {
|
||||
this.worker.postMessage(abort)
|
||||
} catch {
|
||||
} catch (_workerUnreachable) {
|
||||
// The operation is already locally terminal; worker failure is reported by its owning path.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ export class TunnelServer {
|
||||
// Forbidden header names throw on a guarded Headers instance.
|
||||
try {
|
||||
headers.set(key, value)
|
||||
} catch {
|
||||
} catch (_forbiddenHeader) {
|
||||
// The fetch handler reads no forbidden header; the route lane owns those.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ function discover(): string[] {
|
||||
for (const candidate of candidates) {
|
||||
try {
|
||||
if (statSync(candidate).isFile()) found.push(candidate)
|
||||
} catch {
|
||||
} catch (_noBundle) {
|
||||
// No bundle for this package: it may not build a runtime artifact.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ const delay = (ms = 0): Promise<void> => new Promise((resolve) => { setTimeout(r
|
||||
const als = new AsyncLocalStorage<string>()
|
||||
try {
|
||||
als.run('thrower', () => { throw new Error('sync failure') })
|
||||
} catch { /* expected */ }
|
||||
} catch (_syncFailure) { /* The callback throws on purpose; the check below reads the store after it. */ }
|
||||
check('boundary closes after sync throw', als.getStore(), undefined)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ beforeAll(async () => {
|
||||
await symlink(join(root, 'gone'), join(root, 'broken'), 'junction')
|
||||
try {
|
||||
await symlink(join(root, 'notes.txt'), join(root, 'file-link'))
|
||||
} catch {
|
||||
} catch (_fileSymlinkDenied) {
|
||||
// Windows denies unprivileged file symlinks; the file-link row only
|
||||
// feeds the POSIX lanes' coverage of the symlink-to-file arm, and every
|
||||
// assertion below expects it to be filtered out anyway.
|
||||
|
||||
@@ -39,14 +39,15 @@ async function extractBundleIconPng(
|
||||
const plistJson = await output(
|
||||
'plutil', ['-convert', 'json', '-o', '-', join(bundlePath, 'Contents', 'Info.plist')], timeoutMs, internals)
|
||||
if (plistJson !== null) {
|
||||
let declared: unknown
|
||||
try {
|
||||
const declared: unknown = (JSON.parse(plistJson) as { CFBundleIconFile?: unknown }).CFBundleIconFile
|
||||
if (typeof declared === 'string' && declared !== '') {
|
||||
iconFile = declared.endsWith('.icns') ? declared : `${declared}.icns`
|
||||
}
|
||||
} catch {
|
||||
declared = (JSON.parse(plistJson) as { CFBundleIconFile?: unknown }).CFBundleIconFile
|
||||
} catch (_malformedPlist) {
|
||||
// Swallows malformed plutil JSON: the Resources scan below still applies.
|
||||
}
|
||||
if (typeof declared === 'string' && declared !== '') {
|
||||
iconFile = declared.endsWith('.icns') ? declared : `${declared}.icns`
|
||||
}
|
||||
}
|
||||
if (iconFile === null) {
|
||||
try {
|
||||
|
||||
@@ -414,7 +414,7 @@ export async function findDesktopEntry(
|
||||
const path = join(dataDir, 'applications', `${desktopId}.desktop`)
|
||||
try {
|
||||
return parseDesktopEntry(await readFile(path, 'utf8'))
|
||||
} catch {
|
||||
} catch (_entryUnreadable) {
|
||||
// Swallows ENOENT/EACCES: try the next data directory.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,9 +87,9 @@ export function getOrCreateAnonymousUserId(options: AnonymousUserIdOptions = {})
|
||||
if (id === undefined) {
|
||||
try {
|
||||
writeFileSync(file, `${created}\n`, 'utf8')
|
||||
} catch {
|
||||
// Best-effort persistence: keep the fresh id in memory even when the
|
||||
// home is unwritable, so this run still reports a consistent id.
|
||||
} catch (_homeUnwritable) {
|
||||
// An unwritable home only loses persistence: the fresh id stays in
|
||||
// memory, so this run still reports a consistent id.
|
||||
}
|
||||
id = created
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ export class DeepSeekFileStore {
|
||||
if (!committed.accepted) {
|
||||
try {
|
||||
await client.delete(candidate.fileId, signal)
|
||||
} catch {
|
||||
} catch (_duplicateDeleteFailed) {
|
||||
// The winning mapping is durable. A failed duplicate cleanup affects quota only and is retried by recovery.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ export class DeepSeekFilesClient {
|
||||
let parsed: unknown
|
||||
try {
|
||||
parsed = await response.json()
|
||||
} catch {
|
||||
} catch (_nonJsonErrorBody) {
|
||||
// A status remains sufficient to report the provider failure.
|
||||
}
|
||||
const { message, detail } = providerErrorDetail(parsed)
|
||||
|
||||
@@ -45,13 +45,14 @@ interface PiAiReplayState {
|
||||
|
||||
/** Parse tool-call argument JSON; tolerate model malformations with {}. */
|
||||
function parseArguments(raw: string): ToolCall['arguments'] {
|
||||
let parsed: unknown
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(raw)
|
||||
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
||||
return parsed as ToolCall['arguments']
|
||||
}
|
||||
} catch {
|
||||
// fall through
|
||||
parsed = JSON.parse(raw)
|
||||
} catch (_malformedArguments) {
|
||||
// Malformed model JSON leaves `parsed` undefined, which replays as `{}` below.
|
||||
}
|
||||
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
||||
return parsed as ToolCall['arguments']
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
@@ -93,12 +93,13 @@ function failureSnapshot(value: unknown): LlmFailure | undefined {
|
||||
|
||||
/** Read an SDK error message without letting an accessor replace the primary failure. */
|
||||
function errorMessage(error: Error): string {
|
||||
let message: unknown
|
||||
try {
|
||||
const message: unknown = error.message
|
||||
if (typeof message === 'string' && message.length > 0) return message
|
||||
message = error.message
|
||||
} catch (_sdkMessageGetter) {
|
||||
// The fallback below preserves a serializable failure beside the original Error.
|
||||
}
|
||||
if (typeof message === 'string' && message.length > 0) return message
|
||||
return 'LLM adapter failed'
|
||||
}
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ export class LspInstance {
|
||||
const shutdownDeadline = deadline(undefined, this.spec.shutdownTimeoutMs, 'LSP_SHUTDOWN')
|
||||
try {
|
||||
await this.gracefulShutdown(shutdownDeadline.signal)
|
||||
} catch {
|
||||
} catch (_gracefulShutdownFailed) {
|
||||
// Graceful shutdown failed or timed out; managed-range cleanup below remains authoritative.
|
||||
} finally {
|
||||
shutdownDeadline[Symbol.dispose]()
|
||||
|
||||
@@ -349,7 +349,7 @@ export class SqliteSessionQueryEngine extends SessionQueryEngine {
|
||||
if (this._ready !== undefined) {
|
||||
try {
|
||||
await this._ready
|
||||
} catch {
|
||||
} catch (_openFailed) {
|
||||
// Opening already closed a partially-created handle; disposal only waits.
|
||||
}
|
||||
}
|
||||
@@ -473,7 +473,7 @@ export class SqliteSessionQueryEngine extends SessionQueryEngine {
|
||||
/* v8 ignore next 5 -- ROLLBACK failure requires a SQLite double fault; the original failure remains actionable. */
|
||||
try {
|
||||
db.exec('ROLLBACK')
|
||||
} catch {
|
||||
} catch (_rollbackFailed) {
|
||||
// The original SQLite failure remains the actionable cause.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function readColdSessionLog(
|
||||
} catch (error: unknown) {
|
||||
try {
|
||||
await handle.close()
|
||||
} catch {
|
||||
} catch (_closeAfterReadFailed) {
|
||||
// The read failure is the actionable cause; a close failure on the same broken handle adds nothing.
|
||||
}
|
||||
throw error
|
||||
|
||||
@@ -809,7 +809,7 @@ async function removeCommittedTemporary(
|
||||
): Promise<void> {
|
||||
try {
|
||||
await internals.fs.rm(path)
|
||||
} catch {
|
||||
} catch (_redundantStageRemoveFailed) {
|
||||
// The validated target owns the committed bytes; a redundant link cannot turn success into failure.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1374,7 +1374,7 @@ class JsonlSessionPersistence extends SessionPersistence {
|
||||
// append. Swallow only the rm failure; nothing else of consequence runs here.
|
||||
try {
|
||||
await rm(tmp, { force: true })
|
||||
} catch {
|
||||
} catch (_redundantTempRemoveFailed) {
|
||||
/* v8 ignore next -- redundant temp link; publish already durable, rm failure is an unreachable IO edge */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,13 +117,15 @@ async function tornFrame(plaintext: string, accepts: (decoded: string) => boolea
|
||||
for (const end of candidateEnds) {
|
||||
const candidate = frame.subarray(0, end)
|
||||
if (scanZstdFrames(candidate).tornStart !== 0) continue
|
||||
let decoded: string
|
||||
try {
|
||||
const decoded = (await decompressZstdPrefix(candidate)).toString('utf8')
|
||||
if (accepts(decoded)) return candidate
|
||||
} catch {
|
||||
decoded = (await decompressZstdPrefix(candidate)).toString('utf8')
|
||||
} catch (_undecodableCut) {
|
||||
// Some early cuts precede the first decodable block; keep searching for
|
||||
// a cut that exercises partial-plaintext recovery.
|
||||
continue
|
||||
}
|
||||
if (accepts(decoded)) return candidate
|
||||
}
|
||||
throw new Error('test fixture could not produce the requested torn Zstandard frame')
|
||||
}
|
||||
|
||||
@@ -332,8 +332,8 @@ export class LocalBashExecutor extends ShellExecutor {
|
||||
let detail = 'unprintable provider failure'
|
||||
try {
|
||||
detail = String(error)
|
||||
} catch {
|
||||
// Provider-owned rejection values cannot make ShellProcess.done reject.
|
||||
} catch (_unprintableRejection) {
|
||||
// A rejection value whose coercion throws keeps the fallback detail, so ShellProcess.done still settles.
|
||||
}
|
||||
providerFailure = { error, note: `subprocess failed before reporting an outcome: ${detail}` }
|
||||
this.onProcessDone(proc, providerFailure.note, true, error)
|
||||
|
||||
@@ -376,8 +376,8 @@ export class PwshLocalExecutor extends ShellExecutor {
|
||||
let detail = 'unprintable provider failure'
|
||||
try {
|
||||
detail = String(error)
|
||||
} catch {
|
||||
// Provider-owned rejection values cannot make ShellProcess.done reject.
|
||||
} catch (_unprintableRejection) {
|
||||
// A rejection value whose coercion throws keeps the fallback detail, so ShellProcess.done still settles.
|
||||
}
|
||||
providerFailure = { error, note: `subprocess failed before reporting an outcome: ${detail}` }
|
||||
this.onProcessDone(proc, providerFailure.note, true, error)
|
||||
|
||||
@@ -619,7 +619,7 @@ async function settleWatcherOpening(opening: Promise<void> | undefined): Promise
|
||||
if (opening === undefined) return
|
||||
try {
|
||||
await opening
|
||||
} catch {
|
||||
} catch (_watchStartupFailed) {
|
||||
// Watch startup already logged the underlying failure; teardown only contains it.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -853,7 +853,7 @@ function throwIfAborted(signal: AbortSignal | undefined): void {
|
||||
function toError(error: unknown): Error {
|
||||
try {
|
||||
if (error instanceof Error) return error
|
||||
} catch {
|
||||
} catch (_instanceofTrap) {
|
||||
// A hostile proxy may throw during instanceof; fall through to the total renderer.
|
||||
}
|
||||
return new Error(errorMessage(error))
|
||||
|
||||
@@ -37,7 +37,7 @@ export type WarnFn = (message: string) => void
|
||||
function warnSafely(warn: WarnFn, message: string): void {
|
||||
try {
|
||||
warn(message)
|
||||
} catch {
|
||||
} catch (_warnSinkFailed) {
|
||||
// Warning sinks are observational callbacks; cleanup must remain best-effort
|
||||
// even when a logger implementation throws.
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ function toError(value: unknown): Error {
|
||||
function reportFailure(spec: AcpRunSpec, error: unknown): void {
|
||||
try {
|
||||
spec.onError?.(toError(error), 'error')
|
||||
} catch {
|
||||
} catch (_diagnosticSinkFailed) {
|
||||
// Host diagnostic logging cannot replace the child failure.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ export async function startClaudeCodeRun(
|
||||
const reportFailure = (error: Error): void => {
|
||||
try {
|
||||
spec.onError?.(error, 'error')
|
||||
} catch {
|
||||
} catch (_diagnosticSinkFailed) {
|
||||
// Host diagnostic logging cannot replace the product failure.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ export async function disposeCodexChild(
|
||||
)
|
||||
try {
|
||||
child.stdin?.end()
|
||||
} catch {
|
||||
} catch (_stdinAlreadyClosed) {
|
||||
// A concurrently closed stdin does not change range ownership below.
|
||||
}
|
||||
child.terminate()
|
||||
@@ -259,7 +259,7 @@ export async function startCodexRun(
|
||||
// Synchronous fd forwarding preserves byte order without owning a
|
||||
// backpressure queue. A slow host sink can block this event-loop turn.
|
||||
writeFileSync(process.stderr.fd, bytes)
|
||||
} catch {
|
||||
} catch (_hostStderrWriteFailed) {
|
||||
// Host stderr is an observation sink, not a child-run failure authority.
|
||||
}
|
||||
}
|
||||
@@ -401,11 +401,8 @@ export async function startCodexRun(
|
||||
&& !runAbort.signal.aborted
|
||||
) {
|
||||
try {
|
||||
const exited = await child.waitForExit(
|
||||
AbortSignal.timeout(Math.ceil(spec.disposeGraceMs)),
|
||||
)
|
||||
if (exited) await child.done
|
||||
} catch {
|
||||
if (await child.waitForExit(AbortSignal.timeout(Math.ceil(spec.disposeGraceMs)))) await child.done
|
||||
} catch (_exitObservationFailed) {
|
||||
// The wire failure remains authoritative when exit observation fails.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ function resolveConfiguredFile(field: string, value: string): string {
|
||||
const path = resolve(value)
|
||||
try {
|
||||
if (statSync(path).isFile()) return path
|
||||
} catch {
|
||||
} catch (_unreadablePath) {
|
||||
// The diagnostic below owns missing, inaccessible, and non-file paths uniformly.
|
||||
}
|
||||
throw new TypeError(`subagent-dsh-sdk ${field} must name an existing file: ${path}`)
|
||||
|
||||
@@ -192,7 +192,7 @@ function toError(value: unknown): Error {
|
||||
function reportFailure(spec: SdkRunSpec, error: unknown): void {
|
||||
try {
|
||||
spec.onError?.(toError(error), 'error')
|
||||
} catch {
|
||||
} catch (_diagnosticSinkFailed) {
|
||||
// Host diagnostic logging cannot replace the child failure.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export async function settleRunResult(parts: RunResultSettlement): Promise<Subag
|
||||
// Flatten post-publication transport failures while preserving diagnostics.
|
||||
try {
|
||||
parts.onError?.(toError(error), 'error')
|
||||
} catch {
|
||||
} catch (_diagnosticSinkFailed) {
|
||||
// The diagnostic sink cannot reject the run result.
|
||||
}
|
||||
const collected = parts.collectDiagnostic?.()
|
||||
|
||||
@@ -182,15 +182,15 @@ export class LocalSubprocessRuntime extends SubprocessRuntime {
|
||||
const candidates = absolute ? [command] : this.executableCandidates(command, environment)
|
||||
for (const candidate of candidates) {
|
||||
signal?.throwIfAborted()
|
||||
let executable = false
|
||||
try {
|
||||
const info = await stat(candidate)
|
||||
if (!info.isFile()) continue
|
||||
await access(candidate, constants.X_OK)
|
||||
signal?.throwIfAborted()
|
||||
return candidate
|
||||
} catch {
|
||||
// Try the next PATH candidate; the final miss receives one stable error.
|
||||
executable = await isExecutableFile(candidate)
|
||||
} catch (_unusableCandidate) {
|
||||
// A missing or inaccessible candidate leaves the next PATH candidate to try;
|
||||
// the final miss receives one stable error.
|
||||
}
|
||||
signal?.throwIfAborted()
|
||||
if (executable) return candidate
|
||||
}
|
||||
signal?.throwIfAborted()
|
||||
throw new SubprocessExecutableNotFoundError(absolute
|
||||
@@ -376,6 +376,13 @@ export class LocalSubprocessRuntime extends SubprocessRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether `path` is a regular file the current user may execute; rejects when `path` cannot be inspected. */
|
||||
async function isExecutableFile(path: string): Promise<boolean> {
|
||||
if (!(await stat(path)).isFile()) return false
|
||||
await access(path, constants.X_OK)
|
||||
return true
|
||||
}
|
||||
|
||||
/** Read a Windows environment key using the platform's case-insensitive semantics. */
|
||||
function environmentValue(env: NodeJS.ProcessEnv, name: 'PATH' | 'PATHEXT'): string | undefined {
|
||||
const exact = env[name]
|
||||
|
||||
@@ -350,9 +350,13 @@ class SystemdScopeOwner implements BoundProcessOwner {
|
||||
|
||||
terminateForHostExit(): void {
|
||||
if (this.stopped) return
|
||||
try {
|
||||
if (this.direct.running()) this.direct.signal('SIGKILL')
|
||||
} catch { /* Continue with the native owner. */ }
|
||||
if (this.direct.running()) {
|
||||
try {
|
||||
this.direct.signal('SIGKILL')
|
||||
} catch (_directSignalFailed) {
|
||||
// Host exit cannot report one range; the scope kill below remains the next attempt.
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.runSync(this.systemctl, [
|
||||
'--user',
|
||||
@@ -361,7 +365,7 @@ class SystemdScopeOwner implements BoundProcessOwner {
|
||||
'--signal=SIGKILL',
|
||||
this.unit,
|
||||
], { env: managerEnvironment(), stdio: 'ignore', timeout: SYSTEMCTL_TIMEOUT_MS })
|
||||
} catch {
|
||||
} catch (_scopeKillFailed) {
|
||||
// Host exit cannot report one range; the runtime continues with the rest.
|
||||
}
|
||||
}
|
||||
@@ -403,7 +407,7 @@ class SystemdScopeOwner implements BoundProcessOwner {
|
||||
stdio: 'ignore',
|
||||
timeout: SYSTEMCTL_TIMEOUT_MS,
|
||||
})
|
||||
} catch {
|
||||
} catch (_scopeStopFailed) {
|
||||
// The range is already empty; a failed cleanup leaves only the transient unit.
|
||||
}
|
||||
}
|
||||
@@ -593,7 +597,7 @@ function directOutcome(
|
||||
export function signalLinuxDirectProcess(pid: number, send: () => boolean): boolean {
|
||||
try {
|
||||
if (send()) return true
|
||||
} catch { /* A failed signal still permits an independent absence observation. */ }
|
||||
} catch (_signalFailed) { /* A failed signal still permits an independent absence observation. */ }
|
||||
try {
|
||||
process.kill(pid, 0)
|
||||
return false
|
||||
@@ -606,7 +610,7 @@ function signalChildGroup(child: ReturnType<typeof spawn>, signal: 'SIGTERM' | '
|
||||
let groupSignalled = false
|
||||
try {
|
||||
groupSignalled = process.kill(-(child.pid as number), signal)
|
||||
} catch { /* A missing or inaccessible group still permits a direct-process attempt. */ }
|
||||
} catch (_groupSignalFailed) { /* A missing or inaccessible group still permits a direct-process attempt. */ }
|
||||
if (groupSignalled && signal === 'SIGTERM') return true
|
||||
// Group success can reflect another member; joining direct exit requires its own SIGKILL submission.
|
||||
// ChildProcess.kill can emit an error that settles directOutcome before the real exit.
|
||||
|
||||
@@ -52,7 +52,7 @@ function privateSpillDir(): string {
|
||||
/* v8 ignore next 4 -- exit listeners run after the coverage dump; removal is verified by the CI /tmp residue measurement. */
|
||||
process.once('exit', () => {
|
||||
if (defaultSpillDir === undefined) return
|
||||
try { rmdirSync(defaultSpillDir) } catch { /* best-effort: ENOENT/ENOTEMPTY/EBUSY/EPERM must not change the exit code. */ }
|
||||
try { rmdirSync(defaultSpillDir) } catch (_spillDirKept) { /* ENOENT, ENOTEMPTY, EBUSY, or EPERM keeps the directory; exit continues. */ }
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -244,7 +244,7 @@ export class OutputCollector {
|
||||
if (file !== undefined) {
|
||||
try {
|
||||
unlinkSync(file)
|
||||
} catch {
|
||||
} catch (_spillUnlinkFailed) {
|
||||
// A failed unlink leaves at most maxSpillBytes behind, never an unbounded file.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,20 +262,25 @@ export function deserializeRunnerError(serialized: SerializedRunnerError): Error
|
||||
*/
|
||||
export function cleanupLinuxLaunchFiles(files: LinuxLaunchFiles): void {
|
||||
try {
|
||||
if (lstatSync(files.directory).isSymbolicLink()) {
|
||||
unlinkSync(files.directory)
|
||||
return
|
||||
}
|
||||
for (const path of [
|
||||
files.requestPath,
|
||||
files.startupErrorPath,
|
||||
]) {
|
||||
try { unlinkSync(path) } catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
|
||||
}
|
||||
}
|
||||
rmdirSync(files.directory)
|
||||
} catch {
|
||||
removeLinuxLaunchFiles(files)
|
||||
} catch (_residueRetained) {
|
||||
// Crash residue remains private and no later spawn reuses this directory.
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove the private launch directory and its known files; throws on the first failed removal. */
|
||||
function removeLinuxLaunchFiles(files: LinuxLaunchFiles): void {
|
||||
if (lstatSync(files.directory).isSymbolicLink()) {
|
||||
unlinkSync(files.directory)
|
||||
return
|
||||
}
|
||||
for (const path of [
|
||||
files.requestPath,
|
||||
files.startupErrorPath,
|
||||
]) {
|
||||
try { unlinkSync(path) } catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
|
||||
}
|
||||
}
|
||||
rmdirSync(files.directory)
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import {
|
||||
writeLinuxStartupError,
|
||||
} from './runner-protocol.ts'
|
||||
import type {
|
||||
LinuxLaunchFiles,
|
||||
LinuxLaunchRequest,
|
||||
SerializedRunnerError,
|
||||
WindowsRunnerResult,
|
||||
@@ -398,9 +397,8 @@ class WindowsJobRunner {
|
||||
if (!this.resultStarted) {
|
||||
this.resultStarted = true
|
||||
try {
|
||||
await sendMessage(this.host, { type: 'error', error: serializeRunnerError(error) })
|
||||
this.resultDelivered = true
|
||||
} catch {
|
||||
await this.deliverRunnerError(error)
|
||||
} catch (_parentDisconnected) {
|
||||
// The disconnected parent observes runner infrastructure failure.
|
||||
}
|
||||
}
|
||||
@@ -408,18 +406,36 @@ class WindowsJobRunner {
|
||||
this.finish(127)
|
||||
}
|
||||
|
||||
/** Send `error` as the runner result and record its delivery; rejects when the parent is gone. */
|
||||
private async deliverRunnerError(error: unknown): Promise<void> {
|
||||
await sendMessage(this.host, { type: 'error', error: serializeRunnerError(error) })
|
||||
this.resultDelivered = true
|
||||
}
|
||||
|
||||
private releaseOwnedJob(): void {
|
||||
if (this.pollTimer !== undefined) clearInterval(this.pollTimer)
|
||||
this.pollTimer = undefined
|
||||
const api = this.api
|
||||
if (api === undefined) return
|
||||
if (this.jobHandle !== undefined) {
|
||||
try { this.internals.terminateJob(api, this.jobHandle, 1) } catch { /* Continue to kill-on-close. */ }
|
||||
try { this.internals.closeHandleChecked(api, this.jobHandle, 'ordinary process Job cleanup') } catch { /* Best effort after failure. */ }
|
||||
try {
|
||||
this.internals.terminateJob(api, this.jobHandle, 1)
|
||||
} catch (_jobTerminateFailed) {
|
||||
// Closing the Job handle below still kills its processes on close.
|
||||
}
|
||||
try {
|
||||
this.internals.closeHandleChecked(api, this.jobHandle, 'ordinary process Job cleanup')
|
||||
} catch (_handleCloseFailed) {
|
||||
// Every caller finishes the runner next, and runner exit releases the handle.
|
||||
}
|
||||
this.jobHandle = undefined
|
||||
}
|
||||
if (this.processHandle !== undefined) {
|
||||
try { this.internals.closeHandleChecked(api, this.processHandle, 'ordinary direct process cleanup') } catch { /* Best effort after failure. */ }
|
||||
try {
|
||||
this.internals.closeHandleChecked(api, this.processHandle, 'ordinary direct process cleanup')
|
||||
} catch (_handleCloseFailed) {
|
||||
// Every caller finishes the runner next, and runner exit releases the handle.
|
||||
}
|
||||
this.processHandle = undefined
|
||||
}
|
||||
}
|
||||
@@ -471,16 +487,19 @@ export async function reportSpawnRunnerFailure(
|
||||
host: RunnerHost = process,
|
||||
): Promise<void> {
|
||||
if (selection === WINDOWS_RUNNER_SELECTION) {
|
||||
try { await sendMessage(host, { type: 'error', error: serializeRunnerError(error) }) } catch { /* No transport remains. */ }
|
||||
try {
|
||||
await sendMessage(host, { type: 'error', error: serializeRunnerError(error) })
|
||||
} catch (_parentDisconnected) {
|
||||
// No IPC transport remains; the parent observes exit code 127.
|
||||
}
|
||||
host.exitCode = 127
|
||||
if (host.connected) host.disconnect()
|
||||
return
|
||||
}
|
||||
if (selection !== undefined) {
|
||||
try {
|
||||
const files: LinuxLaunchFiles = linuxLaunchFilesFromLocator(selection)
|
||||
writeLinuxStartupError(files, { type: 'error', error: serializeRunnerError(error) })
|
||||
} catch {
|
||||
writeLinuxStartupError(linuxLaunchFilesFromLocator(selection), { type: 'error', error: serializeRunnerError(error) })
|
||||
} catch (_startupErrorUnwritable) {
|
||||
// The parent will report an unconsumed request or missing runner result.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ export function killGroup(pid: number | undefined, sig: NodeJS.Signals): void {
|
||||
if (pid === undefined) return
|
||||
try {
|
||||
process.kill(-pid, sig)
|
||||
} catch {
|
||||
// Swallow: see contract above.
|
||||
} catch (_groupSignalFailed) {
|
||||
// The group may already have exited before delivery (ESRCH); see the contract above.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ function signalTree(
|
||||
(EPERM-style), which POSIX CI cannot stage; the swallow keeps teardown idempotent. */
|
||||
try {
|
||||
child.kill(sig)
|
||||
} catch {
|
||||
} catch (_childAlreadyExited) {
|
||||
// The direct child already exited; teardown remains idempotent.
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
@@ -169,7 +169,7 @@ export function validateSubprocessSpec(spec: SubprocessSpawnSpec): void {
|
||||
let reason = 'aborted'
|
||||
try {
|
||||
reason = String(spec.signal.reason ?? reason)
|
||||
} catch {
|
||||
} catch (_reasonNotStringifiable) {
|
||||
// Arbitrary caller-owned reasons cannot escape the stable Error boundary.
|
||||
}
|
||||
// Named as a cancellation so the tool registry classifies it as the caller's abort.
|
||||
|
||||
@@ -122,7 +122,7 @@ class WindowsJobOwner implements BoundProcessOwner {
|
||||
}
|
||||
|
||||
terminateForHostExit(): void {
|
||||
try { this.runner.kill('SIGKILL') } catch { /* Host exit continues with other live runners. */ }
|
||||
try { this.runner.kill('SIGKILL') } catch (_runnerKillFailed) { /* Host exit continues with other live runners. */ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,13 @@ function directSpawnFailure(argv: readonly string[]): Promise<SpawnFailure> {
|
||||
async function waitForPid(path: string): Promise<number> {
|
||||
const deadline = Date.now() + 5_000
|
||||
while (Date.now() < deadline) {
|
||||
let pid = Number.NaN
|
||||
try {
|
||||
const pid = Number(readFileSync(path, 'utf8').trim())
|
||||
if (Number.isSafeInteger(pid) && pid > 0) return pid
|
||||
} catch {
|
||||
pid = Number(readFileSync(path, 'utf8').trim())
|
||||
} catch (_pidFileMissing) {
|
||||
// The target has not written the file yet.
|
||||
}
|
||||
if (Number.isSafeInteger(pid) && pid > 0) return pid
|
||||
await new Promise(resolve => setTimeout(resolve, 20))
|
||||
}
|
||||
throw new Error(`pid file ${path} was not written`)
|
||||
@@ -187,7 +188,7 @@ describe.skipIf(literalArgv === undefined)('Linux user-systemd native containmen
|
||||
handle.terminate()
|
||||
await Promise.allSettled([handle.done, handle.waitForExit()])
|
||||
if (descendant !== undefined) {
|
||||
try { process.kill(descendant, 'SIGKILL') } catch { /* already contained */ }
|
||||
try { process.kill(descendant, 'SIGKILL') } catch (_descendantGone) { /* Containment already killed the descendant. */ }
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -290,7 +291,7 @@ while :; do sleep 60; done
|
||||
} finally {
|
||||
if (handle !== undefined) await handle.terminate().catch(() => {})
|
||||
if (descendant !== undefined) {
|
||||
try { process.kill(descendant, 'SIGKILL') } catch { /* already contained */ }
|
||||
try { process.kill(descendant, 'SIGKILL') } catch (_descendantGone) { /* Containment already killed the descendant. */ }
|
||||
}
|
||||
await fiber.dispose()
|
||||
}
|
||||
|
||||
@@ -29,12 +29,13 @@ function spec(argv: string[], graceMs = 100, env?: NodeJS.ProcessEnv): Subproces
|
||||
async function waitForPid(path: string): Promise<number> {
|
||||
const deadline = Date.now() + 5_000
|
||||
while (Date.now() < deadline) {
|
||||
let pid = Number.NaN
|
||||
try {
|
||||
const pid = Number(readFileSync(path, 'utf8').trim())
|
||||
if (Number.isSafeInteger(pid) && pid > 0) return pid
|
||||
} catch {
|
||||
pid = Number(readFileSync(path, 'utf8').trim())
|
||||
} catch (_pidFileMissing) {
|
||||
// Target has not written its descendant pid yet.
|
||||
}
|
||||
if (Number.isSafeInteger(pid) && pid > 0) return pid
|
||||
await new Promise(resolve => setTimeout(resolve, 20))
|
||||
}
|
||||
throw new Error(`pid file ${path} was not written`)
|
||||
|
||||
@@ -192,12 +192,13 @@ async function finish(running: SubprocessHandle) {
|
||||
async function waitForPidFile(path: string, timeoutMs = 5_000): Promise<number> {
|
||||
const deadline = Date.now() + timeoutMs
|
||||
while (Date.now() < deadline) {
|
||||
let pid = Number.NaN
|
||||
try {
|
||||
const pid = Number(readFileSync(path, 'utf8').trim())
|
||||
if (Number.isSafeInteger(pid) && pid > 0) return pid
|
||||
} catch {
|
||||
pid = Number(readFileSync(path, 'utf8').trim())
|
||||
} catch (_pidFileMissing) {
|
||||
// The child shell has not written the pid file yet.
|
||||
}
|
||||
if (Number.isSafeInteger(pid) && pid > 0) return pid
|
||||
await new Promise(resolve => setTimeout(resolve, 20))
|
||||
}
|
||||
throw new Error(`pid file ${path} was not written after ${timeoutMs}ms`)
|
||||
@@ -323,7 +324,7 @@ describe('spawnSubprocess', () => {
|
||||
killSpy.mockRestore()
|
||||
try {
|
||||
process.kill(helper, 'SIGKILL')
|
||||
} catch {
|
||||
} catch (_helperGone) {
|
||||
// taskkill already took the helper down on Windows.
|
||||
}
|
||||
await waitGone(helper)
|
||||
@@ -862,7 +863,7 @@ describe('windows tree semantics (injected platform)', () => {
|
||||
killed.push(pid)
|
||||
try {
|
||||
process.kill(pid, 'SIGKILL')
|
||||
} catch {
|
||||
} catch (_childGone) {
|
||||
// Already gone — matches taskkill's tolerated not-found status.
|
||||
}
|
||||
},
|
||||
@@ -883,7 +884,7 @@ describe('windows tree semantics (injected platform)', () => {
|
||||
// Simulate the forced tree termination taskkill performs.
|
||||
try {
|
||||
process.kill(pid, 'SIGKILL')
|
||||
} catch {
|
||||
} catch (_childGone) {
|
||||
// Already gone — matches taskkill's tolerated not-found status.
|
||||
}
|
||||
},
|
||||
@@ -1296,7 +1297,7 @@ describe('coverage seams', () => {
|
||||
expect(Date.now() - started).toBeGreaterThanOrEqual(90)
|
||||
try {
|
||||
process.kill(helper, 'SIGKILL')
|
||||
} catch {
|
||||
} catch (_helperGone) {
|
||||
// Already gone; the drain bound is the point under test.
|
||||
}
|
||||
await waitGone(helper)
|
||||
@@ -1393,8 +1394,8 @@ describe('coverage seams 2', () => {
|
||||
killedPid = pid
|
||||
try {
|
||||
process.kill(pid, 'SIGKILL')
|
||||
} catch {
|
||||
// Already gone.
|
||||
} catch (_childGone) {
|
||||
// The child already exited; taskkill tolerates a missing process the same way.
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -282,7 +282,7 @@ export class TestClient {
|
||||
} catch (error) {
|
||||
try {
|
||||
await settle(() => ctx.fiber.dispose())
|
||||
} catch {
|
||||
} catch (_disposeAfterBootFailed) {
|
||||
// The boot failure is the error to report; a half-built tree failing to dispose adds nothing to it.
|
||||
} finally {
|
||||
restore()
|
||||
|
||||
@@ -1,283 +1 @@
|
||||
{
|
||||
"apps/cli/tests/built-bin.e2e.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"apps/desktop/src/client/WelcomePage.tsx": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"apps/desktop/src/preload-platform-account.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"apps/web/tests/chat-scroll-contract.e2e.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"apps/web/tests/support.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/api/gateway/src/client/remote-stream.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/api/gateway/tests/gateway-stream.host.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/api/workspace-files/src/client/change-feed.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/boot/app-boot/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/boot/plugin-manager/src/registry.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/boot/plugin-manager/tests/operations-process.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/boot/plugin-market/src/repository-cache.ts": {
|
||||
"3d8f6e3468aecc6e006ee3e5f20a5c6c5277316636c8849756fc6d710e9d907b": 1
|
||||
},
|
||||
"packages/client/modules/src/index.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/store/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-open-in-app/src/client/controller.ts": {
|
||||
"ea86beefffc83e1b3c38c7961e9dd8faf194c917ab229aac53c7716cb5b36687": 1
|
||||
},
|
||||
"packages/client/ui-open-in-app/src/client/open-path.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-schedule/src/client/recent-time-zones.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-sidebar-browser/src/client/browser/url.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-sidebar-right/src/client/tab-inventory.ts": {
|
||||
"ee22b9dbd07fc0b76f0464bf59386efb6925dab82c4539a2772b909b944ee33c": 1
|
||||
},
|
||||
"packages/client/ui-skill/src/client/SkillRow.tsx": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/context/file-reference-local/tests/search.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/credentials/deepseek-account/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/credentials/deepseek-account/src/logout.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/experimental/client-ui-forge/src/panel.ts": {
|
||||
"ea86beefffc83e1b3c38c7961e9dd8faf194c917ab229aac53c7716cb5b36687": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/client/bridge/transport.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/client/cdp/console.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/client/inspection/realm.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/bridge/hub.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/bridge/runtime-rpc.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 4
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/bridge/session.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/cdp/domains/dom/model.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/cdp/realm-sessions.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/cordis-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/network-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/query-router.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/realm-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/realms/host/bridge.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 3
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/realms/host/sources.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/liveshare/src/client/owner-login.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 3
|
||||
},
|
||||
"packages/experimental/liveshare/src/client/share-relay-address.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/experimental/liveshare/src/client/ShareEditPanel.tsx": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2
|
||||
},
|
||||
"packages/experimental/liveshare/src/host/shareable-catalog.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2
|
||||
},
|
||||
"packages/experimental/liveshare/src/host/tunnel-supervision.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/liveshare/src/host/viewer-dispatch.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/experimental/liveshare/tests/fixtures/base-llm.mjs": {
|
||||
"8b2766548472fe722af04dc7c95b06d303bb164fd12fbec87a07ea6eaae7146a": 1
|
||||
},
|
||||
"packages/experimental/webhook-github/src/handler.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/src/client/client.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/src/transport/tunnel.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/tests/compile/transform-corpus-check.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/tests/polyfill/als-shim.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/host/directory-picker-browse/tests/service.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/host/open-in-app/src/icons.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/host/open-in-app/src/resolver.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/identity/anonymous-user-id/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/llm/llm-deepseek/src/file-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/llm/llm-deepseek/src/files-api.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/llm/llm-pi-ai/src/replay.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/llm/llm/src/adapter-failure.ts": {
|
||||
"19186deef10a7178489ddf20fcaf6688a0baf38bf6d9933cb78fe65023f3280f": 1
|
||||
},
|
||||
"packages/lsp/lsp-stdio/src/instance.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session-query/session-query-sqlite/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/session-query/session-query/src/cold-read.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session/session-persistence-jsonl/src/generation.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session/session-persistence-jsonl/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session/session-persistence-jsonl/tests/zstd.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/shell/bash-local/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/shell/pwsh-local/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/skill/skill-filesystem/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/skill/skill/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/spill/spill-local/src/cleanup.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-acp/src/run.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-claude-code/src/run.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-codex/src/run.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/subagent/subagent-dsh-sdk/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-dsh-sdk/src/run.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent/src/out-of-process.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/index.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/linux-scope.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 5
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/output.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/runner-protocol.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/spawn-runner.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 4
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/spawn.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 3
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/windows-job.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/tests/native-containment.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/subprocess/subprocess-local/tests/native-windows.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/tests/spawn.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 5
|
||||
},
|
||||
"packages/test-support/client-runtime/src/assembly/test-client.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"scripts/gen-session-format-catalog.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"scripts/run-gates.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"scripts/slot-walk.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"vitest.e2e.config.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"vitest.web.config.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
}
|
||||
}
|
||||
{}
|
||||
@@ -245,7 +245,7 @@ function main(): void {
|
||||
const target = resolve(root, OUT)
|
||||
if (process.argv.includes('--check')) {
|
||||
let current = ''
|
||||
try { current = readFileSync(target, 'utf8') } catch { /* missing is stale */ }
|
||||
try { current = readFileSync(target, 'utf8') } catch (_catalogUnreadable) { /* A missing or unreadable catalog compares unequal and reports stale. */ }
|
||||
if (current !== output) {
|
||||
console.error(`gen-session-format-catalog: ${OUT} is stale; run pnpm run gen-session-format-catalog`)
|
||||
process.exitCode = 1
|
||||
|
||||
+26
-21
@@ -1258,7 +1258,7 @@ export async function runGate(gate: Gate, signal?: AbortSignal): Promise<GateRes
|
||||
for (const descendantPid of descendants) {
|
||||
try {
|
||||
process.kill(descendantPid, signalToSend)
|
||||
} catch {
|
||||
} catch (_descendantExited) {
|
||||
// The descendant exited between the enumeration and the signal.
|
||||
}
|
||||
}
|
||||
@@ -1498,6 +1498,28 @@ function processAlive(pid: number): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the parsed `/proc/<pid>/stat` fields of every process listed in `/proc`.
|
||||
* @returns one row per process still present when its stat file is read.
|
||||
* @throws when `/proc` cannot be listed.
|
||||
*/
|
||||
function procStatRows(): { pid: number; fields: { state: string; ppid: number; pgrp: number } }[] {
|
||||
const rows: { pid: number; fields: { state: string; ppid: number; pgrp: number } }[] = []
|
||||
for (const entry of readdirSync('/proc')) {
|
||||
if (!/^\d+$/.test(entry)) continue
|
||||
let stat: string
|
||||
try {
|
||||
stat = readFileSync(`/proc/${entry}/stat`, 'utf8')
|
||||
} catch (_exitedMidScan) {
|
||||
// The process exited mid-scan; it is neither a live member nor a descendant.
|
||||
continue
|
||||
}
|
||||
const fields = procStatFields(stat)
|
||||
if (fields !== undefined) rows.push({ pid: Number(entry), fields })
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether any member of the child's POSIX process group is still executing.
|
||||
* Zombie entries (state `Z`) do not count: they are dead records awaiting
|
||||
@@ -1517,16 +1539,7 @@ function groupAlive(pid: number | undefined): boolean {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
for (const entry of readdirSync('/proc')) {
|
||||
if (!/^\d+$/.test(entry)) continue
|
||||
try {
|
||||
const parsed = procStatFields(readFileSync(`/proc/${entry}/stat`, 'utf8'))
|
||||
if (parsed !== undefined && parsed.pgrp === pid && parsed.state !== 'Z') return true
|
||||
} catch {
|
||||
// The process exited mid-scan; it is not a live member.
|
||||
}
|
||||
}
|
||||
return false
|
||||
return procStatRows().some(({ fields }) => fields.pgrp === pid && fields.state !== 'Z')
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
@@ -1554,17 +1567,9 @@ function groupAlive(pid: number | undefined): boolean {
|
||||
function descendantPids(root: number): number[] {
|
||||
if (root <= 0) return []
|
||||
if (process.platform === 'linux') {
|
||||
const rows: Array<[number, number]> = []
|
||||
let rows: Array<[number, number]>
|
||||
try {
|
||||
for (const entry of readdirSync('/proc')) {
|
||||
if (!/^\d+$/.test(entry)) continue
|
||||
try {
|
||||
const parsed = procStatFields(readFileSync(`/proc/${entry}/stat`, 'utf8'))
|
||||
if (parsed !== undefined) rows.push([Number(entry), parsed.ppid])
|
||||
} catch {
|
||||
// The process exited mid-scan; skip it.
|
||||
}
|
||||
}
|
||||
rows = procStatRows().map(({ pid, fields }) => [pid, fields.ppid])
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -316,14 +316,15 @@ function packageNameOf(scanRoot: string, rel: string, cache: Map<string, string>
|
||||
while (dir.length > scanRoot.length) {
|
||||
const cached = cache.get(dir)
|
||||
if (cached !== undefined) return cached
|
||||
let manifest: { name?: unknown } | null | undefined
|
||||
try {
|
||||
const manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { name?: unknown }
|
||||
if (typeof manifest.name === 'string') {
|
||||
cache.set(dir, manifest.name)
|
||||
return manifest.name
|
||||
}
|
||||
} catch {
|
||||
// No manifest at this level: keep walking up to the owning package root.
|
||||
manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { name?: unknown } | null
|
||||
} catch (_noManifest) {
|
||||
// No readable manifest at this level: keep walking up to the owning package root.
|
||||
}
|
||||
if (typeof manifest?.name === 'string') {
|
||||
cache.set(dir, manifest.name)
|
||||
return manifest.name
|
||||
}
|
||||
dir = dirname(dir)
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import { standardDecoratorPlugin, vitestExecArgv } from './vitest.shared.ts'
|
||||
try {
|
||||
// Node >= 21.7 native; throws when the file does not exist.
|
||||
process.loadEnvFile(new URL('.env', import.meta.url).pathname)
|
||||
} catch {
|
||||
// No .env — fine, the environment may already carry the variables.
|
||||
} catch (_missingEnvFile) {
|
||||
// Without a root .env, tests read credentials from the process environment.
|
||||
}
|
||||
|
||||
const DEFAULT_E2E_MAX_WORKERS = 4
|
||||
|
||||
@@ -9,8 +9,8 @@ import { standardDecoratorPlugin, vitestExecArgv } from './vitest.shared.ts'
|
||||
try {
|
||||
// Node >= 21.7 native; throws when the file does not exist.
|
||||
process.loadEnvFile(new URL('.env', import.meta.url).pathname)
|
||||
} catch {
|
||||
// No .env — fine, the environment may already carry the variables.
|
||||
} catch (_missingEnvFile) {
|
||||
// Without a root .env, tests read credentials from the process environment.
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
Reference in new issue
Block a user