fix(qa): retain Slack presentation history

This commit is contained in:
Dallin Romney
2026-08-21 10:07:20 -07:00
parent 781ded80d6
commit bc0cfeba6c
2 changed files with 39 additions and 30 deletions
@@ -26,6 +26,10 @@ import {
} from "./slack-live.contracts.js";
import { buildSlackInvalidBlocksTableProbe } from "./slack-live.invalid-blocks.js";
// Isolated Slack flows share one live QA channel. Presentation sends precede
// their final markers, so retain enough history to survive concurrent traffic.
const SLACK_QA_CHANNEL_HISTORY_LIMIT = 200;
export async function getSlackIdentity(token: string): Promise<SlackAuthIdentity> {
const client = createSlackWebClient(token, { timeout: SLACK_QA_WEB_API_TIMEOUT_MS });
const auth = slackAuthTestSchema.parse(await client.auth.test());
@@ -70,7 +74,7 @@ export async function listSlackMessages(params: {
await params.client.conversations.history({
channel: params.channelId,
inclusive: true,
limit: 50,
limit: SLACK_QA_CHANNEL_HISTORY_LIMIT,
oldest: params.oldestTs,
}),
);
@@ -993,38 +993,43 @@ describe("Slack live QA runtime helpers", () => {
throw new Error("missing Slack chart scenario verifier");
}
const accessibleText = renderExpectedSlackChartAccessibleText(summaryText);
const history = vi.fn(async () => ({
messages: [
{
blocks: [
{
type: "data_visualization",
title: "QA latency trend",
chart: {
type: "line",
series: [
const history = vi.fn(async (request: { limit: number }) => ({
// Shared-channel concurrency can push the earlier chart beyond the old
// 50-message observation window before the final marker arrives.
messages:
request.limit >= 200
? [
{
blocks: [
{
name: "Latency",
data: [
{ label: "P50", value: 120 },
{ label: "P95", value: 240 },
],
type: "data_visualization",
title: "QA latency trend",
chart: {
type: "line",
series: [
{
name: "Latency",
data: [
{ label: "P50", value: 120 },
{ label: "P95", value: 240 },
],
},
],
axis_config: {
categories: ["P50", "P95"],
x_label: "Percentile",
y_label: "Milliseconds",
},
},
},
],
axis_config: {
categories: ["P50", "P95"],
x_label: "Percentile",
y_label: "Milliseconds",
},
// Slack history flattens the top-level accessibility newlines on readback.
text: accessibleText.replace(/\s+/gu, " "),
ts: "2.000000",
user: "U999999999",
},
},
],
// Slack history flattens the top-level accessibility newlines on readback.
text: accessibleText.replace(/\s+/gu, " "),
ts: "2.000000",
user: "U999999999",
},
],
]
: [],
}));
await expect(
@@ -1041,7 +1046,7 @@ describe("Slack live QA runtime helpers", () => {
expect(history).toHaveBeenCalledWith({
channel: "C123456789",
inclusive: true,
limit: 50,
limit: 200,
oldest: "1.000000",
});
});