fix(javascript): retain worker storage and projection failures

This commit is contained in:
morluto
2026-10-24 02:56:52 +08:00
parent 88e378063d
commit 5f21aeeeb3
5 changed files with 209 additions and 22 deletions
@@ -539,7 +539,7 @@ export class JavaScriptAnalysisWorker {
this.#runtime.retainForCleanup();
const error = this.#cleanupError(message(cause));
this.#runtime.bindCleanupFailure(error);
return err({
result = err({
javascript,
module,
projection,
@@ -1037,6 +1037,19 @@ export class JavaScriptAnalysisWorker {
response: Extract<JavaScriptWorkerMessage, { kind: "failure" }>,
phase: string,
): AnalysisError {
if (response.reason === "io")
return new ProviderAdapterError(PROVIDER, OPERATION, {
capturedOutput: this.#captured(),
userMessage: `Owned JavaScript worker storage failed for ${path} during ${phase}. Retained observations and cleanup status are reported separately.`,
remediationAction:
"Check the availability and permissions of REA's private temporary storage, correct the reported I/O failure, and retry. Changing the selected source is not required by this storage failure.",
diagnostics: {
source_path: path,
phase,
worker_failure_reason: response.reason,
message: response.message,
},
});
if (response.reason === "resource") {
const reported = response.limits;
const limits = { ...this.#limits(), ...reported };