Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
282 lines
8.8 KiB
TypeScript
282 lines
8.8 KiB
TypeScript
// Mantis Build Telegram Evidence tests cover mantis build telegram evidence script behavior.
|
|
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import path from "node:path";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import {
|
|
buildTelegramEvidenceManifest,
|
|
renderTelegramEvidenceHtml,
|
|
writeTelegramEvidence,
|
|
} from "../../scripts/mantis/build-telegram-evidence.mjs";
|
|
import { loadEvidenceManifest } from "../../scripts/mantis/publish-pr-evidence.mjs";
|
|
|
|
const tempDirs: string[] = [];
|
|
|
|
afterEach(() => {
|
|
for (const dir of tempDirs.splice(0)) {
|
|
rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
});
|
|
|
|
function makeTelegramOutput({ includeReport = true, summary = {} } = {}) {
|
|
const dir = mkdtempSync(path.join(tmpdir(), "mantis-telegram-evidence-test-"));
|
|
tempDirs.push(dir);
|
|
mkdirSync(dir, { recursive: true });
|
|
writeFileSync(
|
|
path.join(dir, "qa-evidence.json"),
|
|
JSON.stringify({
|
|
kind: "openclaw.qa.evidence-summary",
|
|
schemaVersion: 2,
|
|
generatedAt: "2026-05-10T00:00:05.000Z",
|
|
entries: [
|
|
{
|
|
test: {
|
|
kind: "live-transport-check",
|
|
id: "telegram-status-command",
|
|
title: "Telegram status command reply",
|
|
},
|
|
coverage: [],
|
|
execution: {
|
|
runner: "host",
|
|
environment: {
|
|
ref: null,
|
|
os: "darwin",
|
|
nodeVersion: "v24.0.0",
|
|
},
|
|
provider: {
|
|
id: "openai",
|
|
live: true,
|
|
model: { name: "gpt-5.5", ref: "openai/gpt-5.5" },
|
|
auth: "live-frontier",
|
|
},
|
|
channel: {
|
|
id: "telegram",
|
|
live: true,
|
|
driver: "native",
|
|
},
|
|
packageSource: { kind: "source-checkout" },
|
|
artifacts: [],
|
|
},
|
|
result: {
|
|
status: "pass",
|
|
timing: { rttMs: 1234 },
|
|
},
|
|
},
|
|
],
|
|
...summary,
|
|
}),
|
|
);
|
|
writeFileSync(
|
|
path.join(dir, "telegram-qa-observed-messages.json"),
|
|
JSON.stringify([
|
|
{
|
|
scenarioId: "telegram-status-command",
|
|
scenarioTitle: "Telegram status command reply",
|
|
senderIsBot: true,
|
|
text: "<status ok>",
|
|
inlineButtons: ["Open"],
|
|
mediaKinds: [],
|
|
},
|
|
]),
|
|
);
|
|
if (includeReport) {
|
|
writeFileSync(path.join(dir, "telegram-qa-report.md"), "# Telegram QA\n\npass\n");
|
|
}
|
|
return dir;
|
|
}
|
|
|
|
function makeLegacyTelegramOutput() {
|
|
const dir = mkdtempSync(path.join(tmpdir(), "mantis-telegram-evidence-test-"));
|
|
tempDirs.push(dir);
|
|
mkdirSync(dir, { recursive: true });
|
|
writeFileSync(
|
|
path.join(dir, "telegram-qa-summary.json"),
|
|
JSON.stringify({
|
|
credentials: { source: "convex" },
|
|
counts: { total: 1, passed: 1, failed: 0 },
|
|
scenarios: [
|
|
{
|
|
id: "telegram-status-command",
|
|
title: "Telegram status command reply",
|
|
status: "pass",
|
|
details: "Observed expected status response.",
|
|
},
|
|
],
|
|
}),
|
|
);
|
|
writeFileSync(path.join(dir, "telegram-qa-observed-messages.json"), JSON.stringify([]));
|
|
writeFileSync(path.join(dir, "telegram-qa-report.md"), "# Telegram QA\n\npass\n");
|
|
return dir;
|
|
}
|
|
|
|
describe("scripts/mantis/build-telegram-evidence", () => {
|
|
it("renders redacted Telegram observed messages as a transcript HTML page", () => {
|
|
const html = renderTelegramEvidenceHtml({
|
|
summary: {
|
|
entries: [
|
|
{
|
|
test: {
|
|
id: "telegram-status-command",
|
|
title: "Telegram status command reply",
|
|
},
|
|
execution: {
|
|
provider: { auth: "live-frontier" },
|
|
},
|
|
result: {
|
|
status: "pass",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
observedMessages: [
|
|
{
|
|
senderIsBot: true,
|
|
scenarioId: "telegram-status-command",
|
|
text: "<hello>",
|
|
inlineButtons: ["Approve"],
|
|
mediaKinds: [],
|
|
},
|
|
],
|
|
});
|
|
|
|
expect(html).toContain("Mantis Telegram Live Evidence");
|
|
expect(html).toContain("<hello>");
|
|
expect(html).toContain("status: pass");
|
|
expect(html).not.toContain("<hello>");
|
|
});
|
|
|
|
it("writes a Mantis manifest with optional Crabbox GIF and video artifacts", () => {
|
|
const dir = makeTelegramOutput();
|
|
const result = writeTelegramEvidence([
|
|
"--output-dir",
|
|
dir,
|
|
"--candidate-ref",
|
|
"refs/pull/1/head",
|
|
"--candidate-sha",
|
|
"abc123",
|
|
"--scenario-label",
|
|
"telegram-status-command",
|
|
]);
|
|
|
|
expect(readFileSync(result.transcriptPath, "utf8")).toContain("Telegram status command reply");
|
|
const manifest = loadEvidenceManifest(result.manifestPath);
|
|
expect(manifest.comparison.pass).toBe(true);
|
|
expect(manifest.comparison.candidate.sha).toBe("abc123");
|
|
expect(manifest.artifacts.map((artifact) => artifact.targetPath)).toEqual([
|
|
"summary.json",
|
|
"telegram-live-transcript.html",
|
|
"report.md",
|
|
"mantis-evidence.json",
|
|
]);
|
|
expect(result.manifest.artifacts.some((artifact) => artifact.kind === "motionPreview")).toBe(
|
|
true,
|
|
);
|
|
});
|
|
|
|
it("does not require observed-message artifacts for current evidence summaries", () => {
|
|
const dir = makeTelegramOutput();
|
|
rmSync(path.join(dir, "telegram-qa-observed-messages.json"), { force: true });
|
|
|
|
const result = writeTelegramEvidence(["--output-dir", dir]);
|
|
|
|
expect(readFileSync(result.transcriptPath, "utf8")).toContain(
|
|
"No observed Telegram messages were recorded.",
|
|
);
|
|
const targetPaths = result.manifest.artifacts.map((artifact) => artifact.targetPath);
|
|
expect(targetPaths).toContain("summary.json");
|
|
expect(targetPaths).toContain("telegram-live-transcript.html");
|
|
expect(targetPaths).toContain("report.md");
|
|
expect(targetPaths).not.toContain("observed-messages.json");
|
|
});
|
|
|
|
it("ignores stale observed-message files beside current evidence summaries", () => {
|
|
const dir = makeTelegramOutput();
|
|
|
|
const result = writeTelegramEvidence(["--output-dir", dir]);
|
|
|
|
expect(readFileSync(result.transcriptPath, "utf8")).toContain(
|
|
"No observed Telegram messages were recorded.",
|
|
);
|
|
expect(result.manifest.artifacts.map((artifact) => artifact.targetPath)).not.toContain(
|
|
"observed-messages.json",
|
|
);
|
|
});
|
|
|
|
it("renders historical Telegram summaries when evidence summaries are absent", () => {
|
|
const dir = makeLegacyTelegramOutput();
|
|
|
|
const result = writeTelegramEvidence(["--output-dir", dir]);
|
|
|
|
expect(readFileSync(result.transcriptPath, "utf8")).toContain("Telegram status command reply");
|
|
expect(result.manifest.comparison.pass).toBe(true);
|
|
expect(
|
|
result.manifest.artifacts.find((artifact) => artifact.targetPath === "summary.json"),
|
|
).toMatchObject({ path: "telegram-qa-summary.json" });
|
|
expect(result.manifest.artifacts.map((artifact) => artifact.targetPath)).toContain(
|
|
"observed-messages.json",
|
|
);
|
|
});
|
|
|
|
it("does not fabricate a required report artifact for passing Telegram summaries", () => {
|
|
const dir = makeTelegramOutput({ includeReport: false });
|
|
|
|
expect(() => writeTelegramEvidence(["--output-dir", dir])).toThrow(
|
|
"Missing Telegram QA report for passing summary",
|
|
);
|
|
});
|
|
|
|
it("keeps a placeholder report for failing Telegram summaries", () => {
|
|
const dir = makeTelegramOutput({
|
|
includeReport: false,
|
|
summary: {
|
|
entries: [
|
|
{
|
|
test: {
|
|
id: "telegram-status-command",
|
|
title: "Telegram status command reply",
|
|
},
|
|
execution: {
|
|
provider: { auth: "live-frontier" },
|
|
},
|
|
result: {
|
|
status: "fail",
|
|
failure: { reason: "Timed out." },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
const result = writeTelegramEvidence(["--output-dir", dir]);
|
|
|
|
expect(result.manifest.comparison.pass).toBe(false);
|
|
expect(readFileSync(path.join(dir, "telegram-qa-report.md"), "utf8")).toContain(
|
|
"Telegram QA report was unavailable",
|
|
);
|
|
expect(loadEvidenceManifest(result.manifestPath).comparison.pass).toBe(false);
|
|
});
|
|
|
|
it("marks the comparison failed when any Telegram scenario fails", () => {
|
|
const manifest = buildTelegramEvidenceManifest({
|
|
candidateRef: "main",
|
|
candidateSha: "abc123",
|
|
scenarioLabel: "telegram-live",
|
|
summary: {
|
|
entries: [
|
|
{
|
|
test: { id: "telegram-canary" },
|
|
result: { status: "pass" },
|
|
},
|
|
{
|
|
test: { id: "telegram-status-command" },
|
|
result: { status: "fail" },
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
expect(manifest.comparison.pass).toBe(false);
|
|
expect(manifest.comparison.candidate.status).toBe("fail");
|
|
});
|
|
});
|