chore: remove acceptance debug channels from the P2 operator path

This commit is contained in:
2026-08-11 20:04:04 +02:00
parent 7aaffe6e68
commit de5de36f9a
4 changed files with 3 additions and 29 deletions
+2 -18
View File
@@ -149,17 +149,8 @@ export async function runWorkspaceMaintenanceCli(
const result = failureResult(command, (() => {
try { return JSON.parse(io.stdin).workspaceId ?? ""; } catch { return ""; }
})(), failureCode);
if (process.env.P2_CHILD_DEBUG === "1") {
const detail = String((error as Error).message ?? "").replace(/[\r\n]+/g, " ").slice(0, 2048);
result.warnings = detail.length > 0 ? [detail] : undefined;
}
io.writeStdout(boundedJson(result));
if (process.env.P2_CHILD_DEBUG === "1") {
const detail = String((error as Error).message ?? "").replace(/[\r\n]+/g, " ").slice(0, 2048);
io.writeStderr(`workspace maintenance failed: ${detail}\n`);
} else {
io.writeStderr(sanitizeStderr(error));
}
io.writeStderr(sanitizeStderr(error));
const message = String((error as Error).message ?? "");
const requestError = error instanceof SyntaxError
|| message === "invalid request"
@@ -275,14 +266,7 @@ function createProductionService(): WorkspacePreprocessingService {
let stderr = "";
child.stdout?.on("data", (chunk: Buffer) => { stdout += chunk.toString("utf8"); });
child.stderr?.on("data", (chunk: Buffer) => { stderr += chunk.toString("utf8"); });
child.on("close", (code) => {
const capped = { exitCode: code ?? 0, stdout, stderr: stderr.slice(0, 64 * 1024) };
if (process.env.P2_CHILD_DEBUG === "1" && (code ?? 0) !== 0) {
capped.stdout = stdout.slice(0, 4096);
capped.stderr = stderr.slice(0, 4096);
}
resolve(capped);
});
child.on("close", (code) => resolve({ exitCode: code ?? 0, stdout, stderr: stderr.slice(0, 64 * 1024) }));
child.on("error", (error) => resolve({ exitCode: 1, stdout, stderr: String(error.message).slice(0, 4096) }));
});
} finally {
@@ -430,13 +430,7 @@ export class WorkspacePreprocessingService {
private async runJsonStage(runtime: ActiveRuntime, argv: string[]): Promise<Record<string, unknown>> {
const result = await this.deps.runChild({ argv, configPath: runtime.configLease.path });
if (result.exitCode !== 0) {
if (process.env.P2_CHILD_DEBUG === "1") {
const detail = `${result.stderr ?? ""}${result.stdout ?? ""}`.replace(/[\r\n]+/g, " ").slice(0, 2048);
throw new Error(`workspace child failed: ${detail}`);
}
throw new Error("workspace child failed");
}
if (result.exitCode !== 0) throw new Error("workspace child failed");
return JSON.parse(result.stdout) as Record<string, unknown>;
}