mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
refactor(process): build provider captured output through one owner (#11330)
* refactor(process): build provider captured output through one owner * fix(process): report only declared diagnostics on successful provider results
This commit is contained in:
1 parent
264dcd5fee
commit
0d35ea065d
25 files changed
+198
-147
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { capturedProviderOutput } from "../process/capturedProviderOutput.js";
|
||||
import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js";
|
||||
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
|
||||
import {
|
||||
@@ -41,15 +42,6 @@ import {
|
||||
type ProviderFailureDialect,
|
||||
} from "../providers/classifyProviderFailure.js";
|
||||
|
||||
/** Preserve diagnostics independently of worker exit and private-root cleanup. */
|
||||
export const capturedSqliteOutput = (
|
||||
snapshot: ProviderProcessSnapshot,
|
||||
): AnalysisCapturedOutput => ({
|
||||
stdout: snapshot.stdout.text,
|
||||
stderr: snapshot.stderr.text,
|
||||
truncated: snapshot.diagnosticTruncated === true,
|
||||
});
|
||||
|
||||
/** Keep typed cleanup history and one canonical output owner, including after resolution. */
|
||||
export const createSqliteCleanupError = (
|
||||
resources: readonly string[],
|
||||
@@ -193,7 +185,7 @@ export const sqliteDatabaseDialect = (
|
||||
failure_kind: cause.reason,
|
||||
exit_code: cause.snapshot.exitCode ?? null,
|
||||
signal: cause.snapshot.signal ?? null,
|
||||
captured_output: { ...capturedSqliteOutput(cause.snapshot) },
|
||||
captured_output: { ...capturedProviderOutput(cause.snapshot) },
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
@@ -209,7 +201,9 @@ const ownedCommandFailure = (
|
||||
): AnalysisError | undefined => {
|
||||
const operation = "inspect_sqlite_database";
|
||||
const capturedOutput =
|
||||
cause.snapshot === null ? undefined : capturedSqliteOutput(cause.snapshot);
|
||||
cause.snapshot === null
|
||||
? undefined
|
||||
: capturedProviderOutput(cause.snapshot);
|
||||
const optionsWithoutCause =
|
||||
capturedOutput === undefined ? {} : { capturedOutput };
|
||||
const options = { cause, ...optionsWithoutCause };
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { capturedProviderOutput } from "../process/capturedProviderOutput.js";
|
||||
import { safeParseUtf8Json } from "../domain/safeJson.js";
|
||||
import {
|
||||
bindArtifactFileCleanup,
|
||||
@@ -41,7 +42,6 @@ import type {
|
||||
ProviderProcessSupervisor,
|
||||
ProviderProcessStopResult,
|
||||
} from "../process/ProviderProcess.js";
|
||||
import { capturedSqliteOutput } from "./SqliteDatabaseFailures.js";
|
||||
import {
|
||||
SQLITE_DATABASE_LIMITS,
|
||||
SQLITE_INSPECTION_REASONS,
|
||||
@@ -254,7 +254,7 @@ export const executeSqliteDatabaseWorker = async (request: {
|
||||
: { retainCleanup: request.retainCleanup }),
|
||||
},
|
||||
);
|
||||
const capturedOutput = capturedSqliteOutput(execution);
|
||||
const capturedOutput = capturedProviderOutput(execution);
|
||||
request.captured(capturedOutput);
|
||||
let reply: z.output<typeof replySchema>;
|
||||
let finalization: AnalysisError | undefined;
|
||||
|
||||
Reference in new issue
Block a user