Files
openclaw/extensions/qa-lab/src/reply-failure.test.ts
Peter Steinberger 6dc77a37d9 refactor(agents): render failover user copy from one reason-keyed module (#121717)
* refactor(agents): centralize failover user copy

* refactor(agents): route failure callers through user copy

* refactor(qa): carry typed reply failure markers

* refactor(agents): keep failover copy import-light

* refactor(agents): pass structured failure copy context

* refactor(agents): isolate copy rendering from runtime state

* refactor(agents): separate copy rendering from sanitization

* refactor(agents): keep failover copy internals private

* fix(qa-channel): type failure markers on bus sends

* style(agents): brace failover copy conditions

* test(qa-lab): avoid map spread in failure cases

* chore(plugin-sdk): refresh failover closure hashes

* fix(agents): preserve generic runner fallback

* fix(qa): preserve text-only failure markers

* test(qa): type failure delivery fixture
2026-08-10 16:43:51 -07:00

46 lines
1.6 KiB
TypeScript

// Qa Lab tests cover typed reply failure markers and independent leak detection.
import { describe, expect, it } from "vitest";
import { extractQaFailureReplyText, extractQaVisibleReplyLeakText } from "./reply-failure.js";
describe("extractQaFailureReplyText", () => {
it("returns undefined for normal assistant replies", () => {
expect(
extractQaFailureReplyText({
text: "Yes, precious. The build is green and a little cursed.",
}),
).toBe(undefined);
});
it("classifies marked failures without depending on copy wording", () => {
const text = "Any future user-facing failure wording can go here.";
expect(extractQaFailureReplyText({ text, isError: true })).toBe(text);
});
it("does not classify legacy failure-looking copy without the marker", () => {
expect(
extractQaFailureReplyText({
text: "⚠️ Something went wrong while processing your request.",
}),
).toBeUndefined();
});
it("classifies leaked harness coordination chatter independently", () => {
const text = "checking thread context; then post a tight progress reply here.";
expect(extractQaFailureReplyText({ text })).toContain("checking thread context");
});
});
describe("extractQaVisibleReplyLeakText", () => {
it("returns undefined for normal visible replies", () => {
expect(extractQaVisibleReplyLeakText("QA_LEAK_OK")).toBe(undefined);
});
it("detects coordination-nudge leak text", () => {
expect(
extractQaVisibleReplyLeakText(
"thread context thin; posting a coordination nudge, not inventing status.",
),
).toContain("thread context thin");
});
});