优化
This commit is contained in:
@@ -16,6 +16,21 @@ const AVAILABLE_MODULES = new Set([...CONFIGURED_MODULES, ...OPTIONAL_MODULES])
|
||||
const A0_LOCATION_PAGE_SIZE = 200
|
||||
const A0_MAX_LOCATION_MUTATIONS = 8
|
||||
|
||||
export function transportFailureDetails(error) {
|
||||
const causes = []
|
||||
const visited = new Set()
|
||||
const symbol = value => typeof value === 'string' && /^[A-Za-z][A-Za-z0-9_]{0,79}$/.test(value) ? value : null
|
||||
function visit(value) {
|
||||
if (!value || typeof value !== 'object' || visited.has(value) || causes.length >= 6) return
|
||||
visited.add(value)
|
||||
causes.push({ name: symbol(value.name), code: symbol(value.code), syscall: symbol(value.syscall) })
|
||||
visit(value.cause)
|
||||
if (Array.isArray(value.errors)) for (const nested of value.errors) visit(nested)
|
||||
}
|
||||
visit(error)
|
||||
return { causes }
|
||||
}
|
||||
|
||||
export function planA0LocationIsolation(locations, requiredSlots = 1,
|
||||
maxMutations = A0_MAX_LOCATION_MUTATIONS) {
|
||||
const slots = Math.max(1, Number.isInteger(Number(requiredSlots)) ? Number(requiredSlots) : 1)
|
||||
@@ -643,7 +658,7 @@ export class AcceptanceRun {
|
||||
await new Promise((resolve) => setTimeout(resolve, attempt * 250))
|
||||
continue
|
||||
}
|
||||
return { method, path, http: 0, body: null, raw: error instanceof Error ? error.message : String(error), requestId: null, traceId: null }
|
||||
return { method, path, http: 0, body: null, raw: error instanceof Error ? error.message : String(error), requestId: null, traceId: null, transportError: transportFailureDetails(error) }
|
||||
}
|
||||
}
|
||||
throw new Error('unreachable request attempt state')
|
||||
@@ -675,7 +690,7 @@ export class AcceptanceRun {
|
||||
requestId: payload?.requestId || response.headers.get('x-request-id'),
|
||||
traceId: payload?.traceId || response.headers.get('x-trace-id') }
|
||||
} catch (error) {
|
||||
return { method, path, http: 0, body: null, raw: error instanceof Error ? error.message : String(error), requestId: null, traceId: null }
|
||||
return { method, path, http: 0, body: null, raw: error instanceof Error ? error.message : String(error), requestId: null, traceId: null, transportError: transportFailureDetails(error) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,6 +733,7 @@ export class AcceptanceRun {
|
||||
code: response?.body?.code === undefined ? null : String(response.body.code),
|
||||
message: response?.body?.message || response?.raw || null,
|
||||
requestId: response?.requestId || null, traceId: response?.traceId || null,
|
||||
...(response?.transportError ? { transportError: response.transportError } : {}),
|
||||
evidence, checkedAt: new Date().toISOString(),
|
||||
}
|
||||
this.steps.push(step)
|
||||
|
||||
Reference in New Issue
Block a user