mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 11:55:47 -06:00
fix(qa): exceed Slack table aggregate limit in fallback probe (#116447)
This commit is contained in:
@@ -8,7 +8,10 @@ import {
|
||||
|
||||
function buildSlackInvalidBlocksTableRow(index: number) {
|
||||
const rowId = String(index).padStart(3, "0");
|
||||
return [`row-${rowId}`, `value-${rowId}`] as const;
|
||||
// Cross both independently documented native-table limits. Slack has
|
||||
// accepted the over-row-limit shape alone, so the probe also exceeds the
|
||||
// 10,000-character aggregate cell contract.
|
||||
return [`row-${rowId}`, `value-${rowId}-${"x".repeat(96)}`] as const;
|
||||
}
|
||||
|
||||
export function buildSlackInvalidBlocksTableProbe() {
|
||||
@@ -32,8 +35,13 @@ export function buildSlackInvalidBlocksTableProbe() {
|
||||
SLACK_QA_INVALID_TABLE_HEADERS.join("\t"),
|
||||
...dataRows.map((row) => row.join("\t")),
|
||||
].join("\n");
|
||||
const cellCharacterCount = [...SLACK_QA_INVALID_TABLE_HEADERS, ...dataRows.flat()].reduce(
|
||||
(total, value) => total + Array.from(value).length,
|
||||
0,
|
||||
);
|
||||
return {
|
||||
block,
|
||||
cellCharacterCount,
|
||||
dataRowCount: dataRows.length,
|
||||
fallbackText,
|
||||
firstRowText: buildSlackInvalidBlocksTableRow(1).join("\t"),
|
||||
|
||||
@@ -1001,13 +1001,15 @@ describe("Slack live QA runtime helpers", () => {
|
||||
{ type: "raw_text", text: "Row" },
|
||||
{ type: "raw_text", text: "Value" },
|
||||
]);
|
||||
expect(probe.firstRowText).toBe("row-001\tvalue-001");
|
||||
expect(probe.finalRowText).toBe("row-101\tvalue-101");
|
||||
expect(probe.cellCharacterCount).toBeGreaterThan(10_000);
|
||||
expect(probe.firstRowText).toMatch(/^row-001\tvalue-001-x{96}$/u);
|
||||
expect(probe.finalRowText).toMatch(/^row-101\tvalue-101-x{96}$/u);
|
||||
expect(probe.fallbackText.split("\n")).toContain(probe.firstRowText);
|
||||
expect(probe.fallbackText.split("\n")).toContain(probe.finalRowText);
|
||||
});
|
||||
|
||||
it("proves the public Slack send path stores one complete formatting-disabled fallback", async () => {
|
||||
const probe = testing.buildSlackInvalidBlocksTableProbe();
|
||||
const invalidBlocksError = Object.assign(new Error("An API error occurred: invalid_blocks"), {
|
||||
code: "slack_webapi_platform_error",
|
||||
data: { error: "invalid_blocks", ok: false },
|
||||
@@ -1068,8 +1070,8 @@ describe("Slack live QA runtime helpers", () => {
|
||||
expect(fallbackRequest).toMatchObject({ mrkdwn: false });
|
||||
const fallbackText = typeof fallbackRequest?.text === "string" ? fallbackRequest.text : "";
|
||||
expect(fallbackText).toBe(nativeRequest?.text);
|
||||
expect(fallbackText.split("\n")).toContain("row-001\tvalue-001");
|
||||
expect(fallbackText.split("\n")).toContain("row-101\tvalue-101");
|
||||
expect(fallbackText.split("\n")).toContain(probe.firstRowText);
|
||||
expect(fallbackText.split("\n")).toContain(probe.finalRowText);
|
||||
expect(result.message).toMatchObject({
|
||||
text: fallbackText,
|
||||
ts: "2.000000",
|
||||
|
||||
Reference in New Issue
Block a user