Skip to content

Commit 95f7777

Browse files
authored
test(qa): cover support export and stability (#118956)
1 parent 14fe739 commit 95f7777

6 files changed

Lines changed: 742 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
title: Gateway stability runtime and bundle
2+
3+
scenario:
4+
id: gateway-stability-runtime
5+
surface: observability
6+
category: observability.diagnostic-collection
7+
coverage:
8+
primary:
9+
- observability.bounded-in-process-stability-recorder
10+
- observability.openclaw-gateway-stability
11+
- observability.openclaw-gateway-stability-bundle
12+
objective: Prove the live Gateway stability RPC, bounded recorder, persisted bundle filtering, and export-from-bundle CLI paths as one operator workflow.
13+
successCriteria:
14+
- A real child CLI reads the live Gateway diagnostics.stability RPC through authenticated WebSocket transport.
15+
- The in-process recorder retains only its fixed capacity and reports dropped records after sustained diagnostic load.
16+
- The CLI reads and filters the newest persisted stability bundle without retaining private event identifiers.
17+
- Export-from-bundle writes a shareable zip containing the sanitized stability snapshot.
18+
docsRefs:
19+
- docs/gateway/diagnostics.md
20+
- docs/cli/gateway.md
21+
- docs/gateway/protocol.md
22+
- docs/concepts/qa-e2e-automation.md
23+
codeRefs:
24+
- src/cli/gateway-cli/register.ts
25+
- src/gateway/server-methods/diagnostics.ts
26+
- src/logging/diagnostic-stability.ts
27+
- src/logging/diagnostic-stability-bundle.ts
28+
- test/e2e/qa-lab/runtime/gateway-stability-runtime.ts
29+
- test/e2e/qa-lab/runtime/gateway-stability-runtime.test.ts
30+
execution:
31+
kind: script
32+
path: test/e2e/qa-lab/runtime/gateway-stability-runtime.ts
33+
summary: Exercise live stability RPC, bounded retention, persisted bundle filtering, and support export through the real child CLI.
34+
args:
35+
- --artifact-base
36+
- ${outputDir}
37+
timeoutMs: 240000
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
title: Gateway support diagnostics export
2+
3+
scenario:
4+
id: gateway-support-export
5+
surface: observability
6+
category: observability.diagnostic-collection
7+
coverage:
8+
primary:
9+
- cli.diagnostics-export
10+
- cli.support-safe-redaction
11+
- observability.openclaw-gateway-diagnostics-export
12+
- observability.support-zip-redaction
13+
- observability.support-zip-artifact-safety
14+
objective: Prove the real Gateway diagnostics CLI writes a private, payload-free support zip with bounded log collection and sanitized runtime snapshots.
15+
successCriteria:
16+
- A real child CLI exports diagnostics while connected to an isolated live Gateway.
17+
- The JSON result reports the requested zip path, nonzero size, and a payload-free privacy manifest.
18+
- The zip contains sanitized config, logs, status, health, diagnostics, and summary entries without Gateway or hook credentials.
19+
- The artifact uses private file permissions and every archive entry stays inside the zip root.
20+
docsRefs:
21+
- docs/gateway/diagnostics.md
22+
- docs/cli/gateway.md
23+
- docs/concepts/qa-e2e-automation.md
24+
codeRefs:
25+
- src/cli/gateway-cli/register.ts
26+
- src/logging/diagnostic-support-export.ts
27+
- src/logging/diagnostic-support-bundle.ts
28+
- test/e2e/qa-lab/runtime/gateway-support-export-runtime.ts
29+
- test/e2e/qa-lab/runtime/gateway-support-export-runtime.test.ts
30+
execution:
31+
kind: script
32+
path: test/e2e/qa-lab/runtime/gateway-support-export-runtime.ts
33+
summary: Run the real child CLI against a live isolated Gateway and inspect the resulting support zip privacy and artifact-safety contract.
34+
args:
35+
- --artifact-base
36+
- ${outputDir}
37+
timeoutMs: 240000
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import fs from "node:fs/promises";
2+
import path from "node:path";
3+
import { afterEach, describe, expect, it } from "vitest";
4+
import { useAutoCleanupTempDirTracker } from "../../../helpers/temp-dir.js";
5+
import { runGatewayStabilityRuntime } from "./gateway-stability-runtime.js";
6+
7+
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
8+
9+
describe("gateway stability runtime evidence", () => {
10+
it(
11+
"proves live RPC, bounded retention, bundle filtering, and export",
12+
{ timeout: 240_000 },
13+
async () => {
14+
const artifactBase = tempDirs.make("gateway-stability-runtime-");
15+
const evidence = await runGatewayStabilityRuntime({
16+
artifactBase,
17+
repoRoot: process.cwd(),
18+
});
19+
20+
const result = evidence.entries[0]?.result;
21+
expect(result?.status, result?.failure?.reason).toBe("pass");
22+
const summary = JSON.parse(
23+
await fs.readFile(path.join(artifactBase, "gateway-stability-summary.json"), "utf8"),
24+
) as {
25+
liveRpcCapacity: number;
26+
retainedCount: number;
27+
droppedCount: number;
28+
filteredEvents: number;
29+
bundleReason: string;
30+
supportBytes: number;
31+
};
32+
expect(summary.liveRpcCapacity).toBe(1000);
33+
expect(summary.retainedCount).toBe(1000);
34+
expect(summary.droppedCount).toBeGreaterThan(0);
35+
expect(summary.filteredEvents).toBe(3);
36+
expect(summary.bundleReason).toBe("qa_gateway_stability");
37+
expect(summary.supportBytes).toBeGreaterThan(0);
38+
},
39+
);
40+
});

0 commit comments

Comments
 (0)