mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 17:59:08 +00:00
fix: preserve capture configuration failures
This commit is contained in:
1 parent
86fb3e757d
commit
44bbd13b55
2 files changed
+33
No files matched your search
@@ -17,6 +17,7 @@ import {
|
||||
AnalysisOutputError,
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import { ConfigurationError } from "../domain/configurationErrors.js";
|
||||
import { createEvidence, type Evidence } from "../domain/evidence.js";
|
||||
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
|
||||
import { analysisInputErrorFromIssues } from "../domain/inputIssueProjection.js";
|
||||
@@ -323,6 +324,16 @@ const captureReadFailure = (
|
||||
"Capture read and file-handle close both failed",
|
||||
{ cause },
|
||||
);
|
||||
if (cause instanceof ConfigurationError) {
|
||||
if (closeFailure === undefined) return cause;
|
||||
return new ConfigurationError(cause.message, {
|
||||
cause: causeWithClose,
|
||||
settings: cause.settings,
|
||||
...(cause.remediationAction === undefined
|
||||
? {}
|
||||
: { remediationAction: cause.remediationAction }),
|
||||
});
|
||||
}
|
||||
const code =
|
||||
cause instanceof Error && "code" in cause ? String(cause.code) : "";
|
||||
if (code === "EACCES" || code === "EPERM")
|
||||
|
||||
@@ -1498,3 +1498,25 @@ it.each(["basename", "directory"])(
|
||||
).toEqual(result.scripts);
|
||||
},
|
||||
);
|
||||
|
||||
it("retains invalid Windows ChangeTime configuration at the capture read boundary", async () => {
|
||||
const { input, resources } = await setup();
|
||||
const platform = Object.getOwnPropertyDescriptor(process, "platform")!;
|
||||
const previous = process.env.REA_WINDOWS_CHANGE_TIME_DRIFT_MS;
|
||||
try {
|
||||
Object.defineProperty(process, "platform", { value: "win32" });
|
||||
process.env.REA_WINDOWS_CHANGE_TIME_DRIFT_MS = "invalid";
|
||||
const result = await exportWebScripts(input, resources);
|
||||
expect(result.ok).toBe(false);
|
||||
if (result.ok) throw new Error("Expected configuration refusal");
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "configuration_invalid",
|
||||
details: { settings: [{ setting: "REA_WINDOWS_CHANGE_TIME_DRIFT_MS" }] },
|
||||
});
|
||||
} finally {
|
||||
Object.defineProperty(process, "platform", platform);
|
||||
if (previous === undefined)
|
||||
delete process.env.REA_WINDOWS_CHANGE_TIME_DRIFT_MS;
|
||||
else process.env.REA_WINDOWS_CHANGE_TIME_DRIFT_MS = previous;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user