fix(build): stamp runtime postbuild artifacts

This commit is contained in:
Peter Steinberger
2026-04-28 07:56:00 +01:00
parent 3256cf4fc7
commit acea3f2465
28 changed files with 410 additions and 96 deletions

View File

@@ -1,9 +1,17 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import {
hasGatewayReadyLog,
isIgnoredDistRuntimeWatchPath,
shouldRefreshBuildStampForRestoredArtifacts,
writeBuildAndRuntimePostBuildStamps,
} from "../../scripts/check-gateway-watch-regression.mjs";
import {
BUILD_STAMP_FILE,
RUNTIME_POSTBUILD_STAMP_FILE,
} from "../../scripts/lib/local-build-metadata-paths.mjs";
describe("check-gateway-watch-regression", () => {
it("ignores top-level dist-runtime extension dependency repairs", () => {
@@ -50,4 +58,22 @@ describe("check-gateway-watch-regression", () => {
}),
).toBe(false);
});
it("refreshes runtime postbuild stamps after build stamps", () => {
const rootDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-gateway-watch-stamps-"));
try {
fs.mkdirSync(path.join(rootDir, ".git"), { recursive: true });
writeBuildAndRuntimePostBuildStamps({ cwd: rootDir });
const buildStampPath = path.join(rootDir, "dist", BUILD_STAMP_FILE);
const runtimeStampPath = path.join(rootDir, "dist", RUNTIME_POSTBUILD_STAMP_FILE);
expect(fs.existsSync(buildStampPath)).toBe(true);
expect(fs.existsSync(runtimeStampPath)).toBe(true);
expect(fs.statSync(runtimeStampPath).mtimeMs).toBeGreaterThanOrEqual(
fs.statSync(buildStampPath).mtimeMs,
);
} finally {
fs.rmSync(rootDir, { recursive: true, force: true });
}
});
});