mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
fix(release): handle large preparation diffs (#113760)
This commit is contained in:
committed by
GitHub
parent
f6e8446e55
commit
be95b78ae6
@@ -1,3 +1,7 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
// Release prepare tests cover shadow planning, cutover commands, and candidate manifests.
|
||||
import { expectDefined } from "@openclaw/normalization-core";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
@@ -5,6 +9,7 @@ import {
|
||||
buildReleasePreparationManifest,
|
||||
createReleasePrepareSteps,
|
||||
parseReleasePrepareArgs,
|
||||
readWorktreeState,
|
||||
runReleasePrepareStep,
|
||||
runReleasePrepareSteps,
|
||||
} from "../../scripts/release-prepare.ts";
|
||||
@@ -159,6 +164,29 @@ describe("release preparation plan", () => {
|
||||
});
|
||||
|
||||
describe("release preparation manifest", () => {
|
||||
it("fingerprints generated diffs larger than Node's default child buffer", () => {
|
||||
const rootDir = mkdtempSync(path.join(tmpdir(), "openclaw-release-prepare-"));
|
||||
try {
|
||||
execFileSync("git", ["init", "-q"], { cwd: rootDir });
|
||||
execFileSync("git", ["config", "user.email", "release-test@openclaw.invalid"], {
|
||||
cwd: rootDir,
|
||||
});
|
||||
execFileSync("git", ["config", "user.name", "OpenClaw Release Test"], { cwd: rootDir });
|
||||
writeFileSync(path.join(rootDir, "package.json"), '{"version":"2026.7.2"}\n');
|
||||
writeFileSync(path.join(rootDir, "generated.txt"), `${"a".repeat(2 * 1024 * 1024)}\n`);
|
||||
execFileSync("git", ["add", "."], { cwd: rootDir });
|
||||
execFileSync("git", ["commit", "-q", "-m", "test fixture"], { cwd: rootDir });
|
||||
writeFileSync(path.join(rootDir, "generated.txt"), `${"b".repeat(2 * 1024 * 1024)}\n`);
|
||||
|
||||
const state = readWorktreeState(rootDir);
|
||||
|
||||
expect(state.changedFiles).toEqual(["generated.txt"]);
|
||||
expect(state.fingerprint).toMatch(/^[0-9a-f]{64}$/u);
|
||||
} finally {
|
||||
rmSync(rootDir, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("binds the plan to the exact source and worktree fingerprint", () => {
|
||||
const steps = runReleasePrepareSteps({
|
||||
cwd: "/repo",
|
||||
|
||||
Reference in New Issue
Block a user