fix(plugin): harden kubernetes fast upload edges

This commit is contained in:
Dotta
2026-05-13 13:51:12 -05:00
committed by Chris Farhood
parent 713fb6eb4e
commit 40e8638aa3
4 changed files with 46 additions and 1 deletions
@@ -102,6 +102,10 @@ export async function execInPod(
stderr: stderrData,
});
};
const endOutputStreams = () => {
if (!stdoutStream.writableEnded) stdoutStream.end();
if (!stderrStream.writableEnded) stderrStream.end();
};
stdoutStream.on("end", () => {
stdoutEnded = true;
@@ -126,6 +130,7 @@ export async function execInPod(
// status.status is "Success" | "Failure"
if (status.status === "Success") {
pendingResult = { exitCode: 0, timedOut: false };
endOutputStreams();
tryFinish();
return;
}
@@ -140,6 +145,7 @@ export async function execInPod(
? Number(exitCodeCause.message)
: 1;
pendingResult = { exitCode, timedOut: false };
endOutputStreams();
tryFinish();
},
);
@@ -54,7 +54,16 @@ export class FastUploadInterceptor {
return { action: "passthrough", reason: "init dir/target mismatch" };
}
this.buffers.set(`${targetPath}.paperclip-upload.b64`, {
const tempPath = `${targetPath}.paperclip-upload.b64`;
if (this.buffers.has(tempPath)) {
this.buffers.delete(tempPath);
return {
action: "error",
message: `Fast upload already in progress for ${targetPath}; retry the upload from the beginning.`,
};
}
this.buffers.set(tempPath, {
targetPath,
chunks: [],
totalBase64Chars: 0,