fix(artifacts): retain read cleanup ownership through CLI and MCP shutdown
Keep failed stable-read handles and WABT runtime roots under retryable resource scopes. Preserve cancellation causes and primary errors, close the same service instances bound to MCP tools, and consolidate CLI operation/cleanup projection. Validation: fast typecheck and lint, cached runtime build, docs checks, SDK schema validation, focused service and real-file cleanup tests, CLI cleanup regressions, and MCP lifecycle/shutdown workflows. Provider process fixtures simulate engine output; real WABT and Linux EVM execution are not established by this pass.
This commit is contained in:
@@ -3,10 +3,10 @@ import { WEB_NETWORK_CAPTURE_FORMATS } from "../domain/webNetworkCapture.js";
|
||||
import { createWebNetworkCaptureService } from "../composition/webNetworkCaptures.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import type { Logger } from "pino";
|
||||
import type { CliInstance } from "./types.js";
|
||||
import { withCommandCancellation } from "./commandCancellation.js";
|
||||
import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
|
||||
|
||||
/** Expose offline historical capture inspection with the same selection contract as MCP. */
|
||||
export const registerWebNetworkCaptureCommands = (
|
||||
@@ -42,20 +42,24 @@ export const registerWebNetworkCaptureCommands = (
|
||||
logger,
|
||||
CLI_COMMANDS.inspectWebNetworkCapture,
|
||||
async () => {
|
||||
const result = await service.inspect(
|
||||
{
|
||||
capture_path: args.capturePath,
|
||||
format: args.format,
|
||||
sensitive_values: options.sensitiveValue,
|
||||
...(options.record === undefined
|
||||
? {}
|
||||
: { record_ordinals: options.record }),
|
||||
},
|
||||
{ signal },
|
||||
return finishAnalysisCommand(
|
||||
() =>
|
||||
service.inspect(
|
||||
{
|
||||
capture_path: args.capturePath,
|
||||
format: args.format,
|
||||
sensitive_values: options.sensitiveValue,
|
||||
...(options.record === undefined
|
||||
? {}
|
||||
: { record_ordinals: options.record }),
|
||||
},
|
||||
{ signal },
|
||||
),
|
||||
service,
|
||||
"web-network-capture",
|
||||
"inspect_web_network_capture",
|
||||
"Web network capture resources",
|
||||
);
|
||||
return result.ok
|
||||
? result.value
|
||||
: projectAnalysisError(result.error);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user