Files
moltbot/test/scripts/run-additional-boundary-checks.test.ts
Peter Steinberger f9c0dc2d2b fix(feishu): fall back from missing thread replies (#80306)
Summary:
- The branch adds an opt-in Feishu top-level group-send fallback for withdrawn or missing normal quoted thread replies, plus regression coverage, a changelog entry, and CI/lint typing and baseline refreshes.
- Reproducibility: yes. at source level. Current main hard-errors withdrawn/not-found Feishu reply targets when `replyInThread` is true, and the existing regression test asserts that no top-level create fallback occurs.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(feishu): fall back from missing thread replies
- PR branch already contained follow-up commit before automerge: fix(clawsweeper): address review for automerge-openclaw-openclaw-8030…
- PR branch already contained follow-up commit before automerge: fix(clawsweeper): reconcile automerge-openclaw-openclaw-80306 with ma…
- PR branch already contained follow-up commit before automerge: fix(ci): satisfy stricter lint and test types
- PR branch already contained follow-up commit before automerge: fix(ci): align Node 24 test typing

Validation:
- ClawSweeper review passed for head 93146f9d13.
- Required merge gates passed before the squash merge.

Prepared head SHA: 93146f9d13
Review: https://github.com/openclaw/openclaw/pull/80306#issuecomment-4415604729

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
2026-05-10 16:41:51 +00:00

97 lines
3.0 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
BOUNDARY_CHECKS,
formatCommand,
parseShardSpec,
resolveConcurrency,
runChecks,
selectChecksForShard,
} from "../../scripts/run-additional-boundary-checks.mjs";
function createOutputBuffer() {
const chunks: string[] = [];
return {
output: {
write(chunk: string) {
chunks.push(chunk);
return true;
},
},
text: () => chunks.join(""),
};
}
describe("run-additional-boundary-checks", () => {
it("runs prompt snapshot drift checks in CI", () => {
expect(BOUNDARY_CHECKS).toContainEqual({
label: "prompt:snapshots:check",
command: "pnpm",
args: ["prompt:snapshots:check"],
});
});
it("normalizes concurrency input", () => {
expect(resolveConcurrency("6")).toBe(6);
expect(resolveConcurrency("0")).toBe(4);
expect(resolveConcurrency("nope", 2)).toBe(2);
});
it("formats command display text", () => {
expect(formatCommand({ command: "pnpm", args: ["run", "lint:core"] })).toBe(
"pnpm run lint:core",
);
});
it("parses and applies CI shard specs", () => {
expect(parseShardSpec("2/4")).toEqual({ count: 4, index: 1, label: "2/4" });
expect(selectChecksForShard(BOUNDARY_CHECKS, "1/4")).toEqual(
BOUNDARY_CHECKS.filter((_check, index) => index % 4 === 0),
);
const shardedLabels = [1, 2, 3, 4].flatMap((index) =>
selectChecksForShard(BOUNDARY_CHECKS, `${index}/4`).map((check) => check.label),
);
expect(shardedLabels.toSorted((a, b) => a.localeCompare(b))).toEqual(
BOUNDARY_CHECKS.map((check) => check.label).toSorted((a, b) => a.localeCompare(b)),
);
expect(new Set(shardedLabels).size).toBe(BOUNDARY_CHECKS.length);
expect(() => parseShardSpec("5/4")).toThrow("Invalid shard spec");
});
it("keeps the raw HTTP/2 import guard in source boundary checks", () => {
expect(BOUNDARY_CHECKS).toContainEqual({
label: "lint:tmp:no-raw-http2-imports",
command: "pnpm",
args: ["run", "lint:tmp:no-raw-http2-imports"],
});
});
it("buffers grouped output and reports aggregate failures", async () => {
const buffer = createOutputBuffer();
const failures = await runChecks(
[
{
label: "passes",
command: process.execPath,
args: ["-e", "console.log('ok-out')"],
},
{
label: "fails",
command: process.execPath,
args: ["-e", "console.error('bad-out'); process.exit(7)"],
},
],
{ concurrency: 2, output: buffer.output },
);
const text = buffer.text();
expect(failures).toBe(1);
expect(text).toContain("::group::passes");
expect(text).toContain("ok-out");
expect(text).toContain("[ok] passes in ");
expect(text).toContain("::group::fails");
expect(text).toContain("bad-out");
expect(text).toContain("::error title=fails failed::fails failed (exit 7)");
expect(text).toContain("Additional boundary check timings:");
});
});