mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-30 04:53:40 +00:00
Summary: - This replacement branch preserves compatible session auth profile overrides during `sessions.patch` model ch ... d/cross-provider regression coverage, and updates related doctor/Mantis test assertions plus the changelog. - Reproducibility: yes. by source inspection: current main’s `sessions.patch` model branch calls `applyModelOv ... d helper clears auth fields unless preservation is requested. I did not run tests in this read-only review. Automerge notes: - PR branch already contained follow-up commit before automerge: test(mantis): align telegram proof evidence comment - PR branch already contained follow-up commit before automerge: fix(sessions): preserve provider auth aliases - PR branch already contained follow-up commit before automerge: fix(sessions): guard unprefixed auth overrides - PR branch already contained follow-up commit before automerge: fix(doctor): preserve params prototype semantics - PR branch already contained follow-up commit before automerge: fix(sessions): preserve compatible auth overrides Validation: - ClawSweeper review passed for head64a07393d5. - Required merge gates passed before the squash merge. Prepared head SHA:64a07393d5Review: https://github.com/openclaw/openclaw/pull/85014#issuecomment-4510194125 Co-authored-by: Andy Ye <35905412+TurboTheTurtle@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
117 lines
4.5 KiB
TypeScript
117 lines
4.5 KiB
TypeScript
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 { writeTelegramDesktopProofEvidence } from "../../scripts/mantis/build-telegram-desktop-proof-evidence.mjs";
|
|
import {
|
|
loadEvidenceManifest,
|
|
renderEvidenceComment,
|
|
} 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 makeLane(name: string) {
|
|
const repo = mkdtempSync(path.join(tmpdir(), `mantis-telegram-${name}-repo-`));
|
|
tempDirs.push(repo);
|
|
const outputDir = path.join(repo, ".artifacts", "qa-e2e", name);
|
|
mkdirSync(outputDir, { recursive: true });
|
|
const gif = path.join(outputDir, "telegram-user-crabbox-session-motion-telegram-window.gif");
|
|
const mp4 = path.join(outputDir, "telegram-user-crabbox-session-motion-telegram-window.mp4");
|
|
const screenshot = path.join(outputDir, "telegram-user-crabbox-session.png");
|
|
const report = path.join(outputDir, "telegram-user-crabbox-session-report.md");
|
|
writeFileSync(gif, `${name} gif`);
|
|
writeFileSync(mp4, `${name} mp4`);
|
|
writeFileSync(screenshot, `${name} png`);
|
|
writeFileSync(report, `${name} report`);
|
|
writeFileSync(
|
|
path.join(outputDir, "telegram-user-crabbox-session-summary.json"),
|
|
JSON.stringify({
|
|
artifacts: {
|
|
previewGifCropped: path.relative(repo, gif),
|
|
screenshot: path.relative(repo, screenshot),
|
|
trimmedVideoCropped: path.relative(repo, mp4),
|
|
},
|
|
report: path.relative(repo, report),
|
|
status: "pass",
|
|
}),
|
|
);
|
|
return { outputDir, repo };
|
|
}
|
|
|
|
describe("scripts/mantis/build-telegram-desktop-proof-evidence", () => {
|
|
it("builds paired native Telegram Desktop GIF evidence for PR comments", () => {
|
|
const baseline = makeLane("baseline");
|
|
const candidate = makeLane("candidate");
|
|
const outputDir = mkdtempSync(path.join(tmpdir(), "mantis-telegram-proof-"));
|
|
tempDirs.push(outputDir);
|
|
|
|
const result = writeTelegramDesktopProofEvidence([
|
|
"--output-dir",
|
|
outputDir,
|
|
"--baseline-repo-root",
|
|
baseline.repo,
|
|
"--baseline-output-dir",
|
|
baseline.outputDir,
|
|
"--baseline-ref",
|
|
"main",
|
|
"--baseline-sha",
|
|
"aaa",
|
|
"--candidate-repo-root",
|
|
candidate.repo,
|
|
"--candidate-output-dir",
|
|
candidate.outputDir,
|
|
"--candidate-ref",
|
|
"refs/pull/1/head",
|
|
"--candidate-sha",
|
|
"bbb",
|
|
"--scenario-label",
|
|
"telegram-desktop-proof",
|
|
]);
|
|
|
|
expect(
|
|
readFileSync(path.join(outputDir, "baseline", "telegram-desktop-proof.gif"), "utf8"),
|
|
).toBe("baseline gif");
|
|
const manifest = loadEvidenceManifest(result.manifestPath);
|
|
expect(manifest.comparison.pass).toBe(true);
|
|
expect(manifest.artifacts.map((artifact) => artifact.targetPath)).toContain(
|
|
"candidate/telegram-desktop-proof.gif",
|
|
);
|
|
const artifactUrl = "https://github.com/openclaw/openclaw/actions/runs/1/artifacts/2";
|
|
const body = renderEvidenceComment({
|
|
artifactUrl,
|
|
manifest,
|
|
marker: "<!-- mantis-telegram-desktop-proof -->",
|
|
rawBase: "https://qa.openclaw.ai/mantis/telegram-desktop/pr-1/run-1",
|
|
requestSource: "workflow_dispatch",
|
|
runUrl: "https://github.com/openclaw/openclaw/actions/runs/1",
|
|
treeUrl: "https://qa.openclaw.ai/mantis/telegram-desktop/pr-1/run-1/index.json",
|
|
});
|
|
|
|
expect(body).toContain("<!-- mantis-telegram-desktop-proof -->");
|
|
expect(body).toContain("## Mantis Telegram Desktop Proof");
|
|
expect(body).toContain("- Baseline: `pass` at `aaa`, expected baseline visual proof captured");
|
|
expect(body).toContain(
|
|
"- Candidate: `pass` at `bbb`, expected candidate visual proof captured",
|
|
);
|
|
expect(body).toContain(`- Artifact: ${artifactUrl}`);
|
|
expect(body).toContain('<table width="100%">');
|
|
expect(body).toContain(
|
|
'<img src="https://qa.openclaw.ai/mantis/telegram-desktop/pr-1/run-1/baseline/telegram-desktop-proof.gif" width="100%"',
|
|
);
|
|
expect(body).toContain(
|
|
'<img src="https://qa.openclaw.ai/mantis/telegram-desktop/pr-1/run-1/candidate/telegram-desktop-proof.gif" width="100%"',
|
|
);
|
|
expect(body).toContain(
|
|
"Raw QA files: https://qa.openclaw.ai/mantis/telegram-desktop/pr-1/run-1/index.json",
|
|
);
|
|
expect(body).not.toContain("undefined/");
|
|
expect(body).not.toContain("| Main | This PR |");
|
|
});
|
|
});
|