mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 14:56:32 +00:00
fix(sqlite): preserve completed member facts on acquisition failure
This commit is contained in:
1 parent
e813c4c344
commit
669e617eec
4 files changed
+284
-102
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
} from "../domain/analysisErrorProjection.js";
|
||||
import {
|
||||
AnalysisError,
|
||||
primaryAnalysisError,
|
||||
type AnalysisCapturedOutput,
|
||||
type AnalysisErrorOptions,
|
||||
} from "../domain/analysisErrorBase.js";
|
||||
@@ -34,6 +35,7 @@ import {
|
||||
MAX_SQLITE_WORKER_TIMEOUT_MS,
|
||||
} from "../domain/sqlite/sqliteDatabase.js";
|
||||
import { SQLITE_DATABASE_LIMITS } from "./SqliteDatabaseLimits.js";
|
||||
import { SqliteSnapshotAcquisitionFailure } from "./SqliteDatabaseSnapshot.js";
|
||||
|
||||
/** Preserve diagnostics independently of worker exit and private-root cleanup. */
|
||||
export const capturedSqliteOutput = (
|
||||
@@ -91,6 +93,26 @@ export const sqliteDatabaseFailure = (
|
||||
workerTimeoutMs = DEFAULT_SQLITE_WORKER_TIMEOUT_MS,
|
||||
): AnalysisError => {
|
||||
const operation = "inspect_sqlite_database";
|
||||
if (cause instanceof SqliteSnapshotAcquisitionFailure) {
|
||||
const failure = sqliteDatabaseFailure(
|
||||
cause.operationCause,
|
||||
path,
|
||||
phase,
|
||||
signal,
|
||||
workerTimeoutMs,
|
||||
);
|
||||
const diagnostics = {
|
||||
snapshot_acquisition: {
|
||||
consistency: "unverified",
|
||||
members: cause.completedMembers.map((member) => ({ ...member })),
|
||||
},
|
||||
};
|
||||
failure.retainDiagnostics(diagnostics);
|
||||
// Keep the facts on the semantic error after its cleanup envelope resolves.
|
||||
const primary = primaryAnalysisError(failure);
|
||||
if (primary !== failure) primary.retainDiagnostics(diagnostics);
|
||||
return failure;
|
||||
}
|
||||
if (cause instanceof AnalysisError) return cause;
|
||||
if (cause instanceof ArtifactReaderFailure) {
|
||||
if (cause.cleanup !== undefined) {
|
||||
|
||||
Reference in new issue
Block a user