fix(qa-slack): preserve failure debug artifacts

This commit is contained in:
Vincent Koc
2026-05-26 11:09:42 +01:00
parent f1ceed94db
commit 4ebc13abe1
2 changed files with 35 additions and 6 deletions

View File

@@ -253,6 +253,22 @@ describe("Slack live QA runtime helpers", () => {
);
});
it("preserves sanitized gateway debug artifacts on scenario failure", async () => {
const cleanupIssues: string[] = [];
const stop = vi.fn(async () => {});
await testing.preserveSlackGatewayDebugArtifacts({
cleanupIssues,
gatewayDebugDirPath: ".artifacts/qa-e2e/slack-live-test/gateway-debug",
gatewayHarness: { stop } as never,
});
expect(stop).toHaveBeenCalledWith({
preserveToDir: ".artifacts/qa-e2e/slack-live-test/gateway-debug",
});
expect(cleanupIssues).toEqual([]);
});
it("redacts approval artifact content and Slack metadata in summary-shaped results", () => {
expect(
testing.toSlackQaScenarioArtifactResults({

View File

@@ -119,6 +119,8 @@ type SlackQaScenarioDefinition = LiveTransportScenarioDefinition<SlackQaScenario
configOverrides?: SlackQaConfigOverrides;
};
type SlackQaGatewayHarness = Awaited<ReturnType<typeof startQaLiveLaneGateway>>;
type SlackAuthIdentity = {
botId?: string;
teamId?: string;
@@ -1718,6 +1720,16 @@ function renderSlackQaMarkdown(params: {
return lines.join("\n");
}
async function preserveSlackGatewayDebugArtifacts(params: {
cleanupIssues: string[];
gatewayDebugDirPath: string;
gatewayHarness: SlackQaGatewayHarness;
}) {
await params.gatewayHarness.stop({ preserveToDir: params.gatewayDebugDirPath }).catch((error) => {
appendLiveLaneIssue(params.cleanupIssues, "gateway debug preservation failed", error);
});
}
export async function runSlackQaLive(params: {
alternateModel?: string;
credentialRole?: string;
@@ -1789,7 +1801,7 @@ export async function runSlackQaLive(params: {
for (const scenario of scenarios) {
let scenarioAttempt = 1;
while (true) {
let gatewayHarness: Awaited<ReturnType<typeof startQaLiveLaneGateway>> | undefined;
let gatewayHarness: SlackQaGatewayHarness | undefined;
try {
assertLeaseHealthy();
gatewayHarness = await startQaLiveLaneGateway({
@@ -1971,11 +1983,11 @@ export async function runSlackQaLive(params: {
});
preservedGatewayDebugArtifacts = true;
if (gatewayHarness) {
await gatewayHarness
.stop({ keepTemp: true, preserveToDir: gatewayDebugDirPath })
.catch((stopError) => {
appendLiveLaneIssue(cleanupIssues, "gateway debug preservation failed", stopError);
});
await preserveSlackGatewayDebugArtifacts({
cleanupIssues,
gatewayDebugDirPath,
gatewayHarness,
});
}
break;
} finally {
@@ -2114,6 +2126,7 @@ export const testing = {
findScenario,
isSlackChannelReadyForQa,
parseSlackQaCredentialPayload,
preserveSlackGatewayDebugArtifacts,
resolveSlackChannelReadySince,
resolveSlackApprovalCheckpointConfig,
resolveApprovalDecision,