From ccd188a8b7e5073125795dfdfdccc9089aa21922 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 17:58:16 +0100 Subject: [PATCH] refactor: trim qa matrix helper exports --- extensions/qa-matrix/src/docker-runtime.ts | 2 +- extensions/qa-matrix/src/report.ts | 2 +- .../qa-matrix/src/runners/contract/runtime.ts | 2 +- .../src/runners/contract/scenario-catalog.ts | 6 +- .../contract/scenario-media-fixtures.ts | 2 +- .../contract/scenario-runtime-shared.ts | 6 +- .../src/runners/contract/scenario-runtime.ts | 3 +- .../src/runners/contract/scenarios.ts | 28 +----- .../src/shared/live-transport-cli.ts | 6 +- .../src/shared/live-transport-scenarios.ts | 99 +++++++++---------- extensions/qa-matrix/src/substrate/client.ts | 8 +- extensions/qa-matrix/src/substrate/config.ts | 36 +++---- extensions/qa-matrix/src/substrate/events.ts | 6 +- .../qa-matrix/src/substrate/fault-proxy.ts | 4 +- .../src/substrate/harness.runtime.ts | 4 +- .../qa-matrix/src/substrate/topology.ts | 4 +- 16 files changed, 96 insertions(+), 122 deletions(-) diff --git a/extensions/qa-matrix/src/docker-runtime.ts b/extensions/qa-matrix/src/docker-runtime.ts index 5e75c3f1863..f434a5b8839 100644 --- a/extensions/qa-matrix/src/docker-runtime.ts +++ b/extensions/qa-matrix/src/docker-runtime.ts @@ -28,7 +28,7 @@ export async function fetchHealthUrl(url: string): Promise<{ ok: boolean }> { } } -export function describeError(error: unknown) { +function describeError(error: unknown) { if (error instanceof Error) { return error.message; } diff --git a/extensions/qa-matrix/src/report.ts b/extensions/qa-matrix/src/report.ts index f0d9b8c0704..3f4fde56441 100644 --- a/extensions/qa-matrix/src/report.ts +++ b/extensions/qa-matrix/src/report.ts @@ -4,7 +4,7 @@ export type QaReportCheck = { details?: string; }; -export type QaReportScenario = { +type QaReportScenario = { name: string; status: "pass" | "fail" | "skip"; details?: string; diff --git a/extensions/qa-matrix/src/runners/contract/runtime.ts b/extensions/qa-matrix/src/runners/contract/runtime.ts index 3427861468f..0ba8ac3e2db 100644 --- a/extensions/qa-matrix/src/runners/contract/runtime.ts +++ b/extensions/qa-matrix/src/runners/contract/runtime.ts @@ -352,7 +352,7 @@ function getMatrixQaScenarioRestartReadyTimeoutMs(scenario: { timeoutMs: number return scenario.timeoutMs; } -export type MatrixQaRunResult = { +type MatrixQaRunResult = { observedEventsPath: string; outputDir: string; reportPath: string; diff --git a/extensions/qa-matrix/src/runners/contract/scenario-catalog.ts b/extensions/qa-matrix/src/runners/contract/scenario-catalog.ts index 827d43a5769..fc2aa36b51a 100644 --- a/extensions/qa-matrix/src/runners/contract/scenario-catalog.ts +++ b/extensions/qa-matrix/src/runners/contract/scenario-catalog.ts @@ -12,7 +12,7 @@ import { type MatrixQaTopologySpec, } from "../../substrate/topology.js"; -export type MatrixQaScenarioId = +type MatrixQaScenarioId = | "matrix-thread-follow-up" | "matrix-thread-root-preservation" | "matrix-thread-nested-reply-shape" @@ -115,7 +115,7 @@ export type MatrixQaScenarioDefinition = LiveTransportScenarioDefinition Buffer; expectedAttachmentKind: "audio" | "file" | "image" | "video"; diff --git a/extensions/qa-matrix/src/runners/contract/scenario-runtime-shared.ts b/extensions/qa-matrix/src/runners/contract/scenario-runtime-shared.ts index ddc11c109fc..743928181d2 100644 --- a/extensions/qa-matrix/src/runners/contract/scenario-runtime-shared.ts +++ b/extensions/qa-matrix/src/runners/contract/scenario-runtime-shared.ts @@ -60,7 +60,7 @@ export type MatrixQaScenarioContext = { waitGatewayAccountReady?: (accountId: string, opts?: { timeoutMs?: number }) => Promise; }; -export const NO_REPLY_WINDOW_MS = 8_000; +const NO_REPLY_WINDOW_MS = 8_000; const NO_REPLY_WINDOW_ENV = "OPENCLAW_QA_MATRIX_NO_REPLY_WINDOW_MS"; export function resolveMatrixQaNoReplyWindowMs(timeoutMs: number) { @@ -340,7 +340,7 @@ export function advanceMatrixQaActorCursor(params: { writeMatrixQaSyncCursor(params.syncState, params.actorId, params.nextSince ?? params.startSince); } -export type MatrixQaScenarioClient = ReturnType; +type MatrixQaScenarioClient = ReturnType; export async function assertNoSutReplyWindow(params: { actorId: MatrixQaActorId; @@ -446,7 +446,7 @@ export async function runConfigurableTopLevelScenario(params: { }; } -export async function runTopLevelMentionScenario(params: { +async function runTopLevelMentionScenario(params: { accessToken: string; actorId: MatrixQaActorId; baseUrl: string; diff --git a/extensions/qa-matrix/src/runners/contract/scenario-runtime.ts b/extensions/qa-matrix/src/runners/contract/scenario-runtime.ts index 5ea4249b800..1dedd3f516d 100644 --- a/extensions/qa-matrix/src/runners/contract/scenario-runtime.ts +++ b/extensions/qa-matrix/src/runners/contract/scenario-runtime.ts @@ -123,7 +123,6 @@ import { runTopologyScopedTopLevelScenario, writeMatrixQaSyncCursor, type MatrixQaScenarioContext, - type MatrixQaSyncState, } from "./scenario-runtime-shared.js"; import type { MatrixQaScenarioExecution } from "./scenario-types.js"; @@ -135,7 +134,7 @@ export { runMatrixQaCanary, writeMatrixQaSyncCursor, }; -export type { MatrixQaScenarioContext, MatrixQaSyncState }; +export type { MatrixQaScenarioContext }; async function runDriverTopologyScopedScenario(params: { context: MatrixQaScenarioContext; diff --git a/extensions/qa-matrix/src/runners/contract/scenarios.ts b/extensions/qa-matrix/src/runners/contract/scenarios.ts index 0bc076ebefc..acd0246daa3 100644 --- a/extensions/qa-matrix/src/runners/contract/scenarios.ts +++ b/extensions/qa-matrix/src/runners/contract/scenarios.ts @@ -13,9 +13,6 @@ import { buildMatrixQaTopologyForScenarios, findMatrixQaScenarios, resolveMatrixQaScenarioRoomId, - type MatrixQaScenarioDefinition, - type MatrixQaScenarioId, - type MatrixQaProfile, __matrixQaProfileTesting, } from "./scenario-catalog.js"; import { @@ -27,39 +24,20 @@ import { runMatrixQaScenario, writeMatrixQaSyncCursor, type MatrixQaScenarioContext, - type MatrixQaSyncState, } from "./scenario-runtime.js"; -import type { - MatrixQaCanaryArtifact, - MatrixQaReplyArtifact, - MatrixQaScenarioArtifacts, - MatrixQaScenarioExecution, -} from "./scenario-types.js"; +import type { MatrixQaCanaryArtifact, MatrixQaScenarioArtifacts } from "./scenario-types.js"; -export type { MatrixQaScenarioDefinition, MatrixQaScenarioId }; export { - MATRIX_QA_PROFILE_NAMES, MATRIX_QA_SCENARIOS, - MATRIX_QA_STANDARD_SCENARIO_IDS, - buildMatrixReplyArtifact, buildMatrixReplyDetails, - buildMatrixQaE2eeScenarioRoomKey, buildMatrixQaTopologyForScenarios, - buildMentionPrompt, findMatrixQaScenarios, - resolveMatrixQaScenarioRoomId, runMatrixQaCanary, runMatrixQaScenario, }; -export type { MatrixQaProfile }; -export type { - MatrixQaCanaryArtifact, - MatrixQaReplyArtifact, - MatrixQaScenarioArtifacts, - MatrixQaScenarioExecution, -}; +export type { MatrixQaCanaryArtifact, MatrixQaScenarioArtifacts }; -export type { MatrixQaScenarioContext, MatrixQaSyncState }; +export type { MatrixQaScenarioContext }; export const __testing = { MATRIX_QA_BOT_DM_ROOM_KEY, diff --git a/extensions/qa-matrix/src/shared/live-transport-cli.ts b/extensions/qa-matrix/src/shared/live-transport-cli.ts index 1e6fa97e78a..59ce1f4d3e0 100644 --- a/extensions/qa-matrix/src/shared/live-transport-cli.ts +++ b/extensions/qa-matrix/src/shared/live-transport-cli.ts @@ -37,7 +37,7 @@ export type LiveTransportQaCliRegistration = { register(qa: Command): void; }; -export type LiveTransportQaCredentialCliOptions = { +type LiveTransportQaCredentialCliOptions = { sourceDescription?: string; roleDescription?: string; }; @@ -50,7 +50,7 @@ export function createLazyCliRuntimeLoader(load: () => Promise) { }; } -export function mapLiveTransportQaCommanderOptions( +function mapLiveTransportQaCommanderOptions( opts: LiveTransportQaCommanderOptions, ): LiveTransportQaCommandOptions { return { @@ -69,7 +69,7 @@ export function mapLiveTransportQaCommanderOptions( }; } -export function registerLiveTransportQaCli(params: { +function registerLiveTransportQaCli(params: { qa: Command; commandName: string; credentialOptions?: LiveTransportQaCredentialCliOptions; diff --git a/extensions/qa-matrix/src/shared/live-transport-scenarios.ts b/extensions/qa-matrix/src/shared/live-transport-scenarios.ts index 535bcc3de53..88bf702b121 100644 --- a/extensions/qa-matrix/src/shared/live-transport-scenarios.ts +++ b/extensions/qa-matrix/src/shared/live-transport-scenarios.ts @@ -1,4 +1,4 @@ -export type LiveTransportStandardScenarioId = +type LiveTransportStandardScenarioId = | "canary" | "mention-gating" | "allowlist-block" @@ -16,60 +16,59 @@ export type LiveTransportScenarioDefinition = { title: string; }; -export type LiveTransportStandardScenarioDefinition = { +type LiveTransportStandardScenarioDefinition = { description: string; id: LiveTransportStandardScenarioId; title: string; }; -export const LIVE_TRANSPORT_STANDARD_SCENARIOS: readonly LiveTransportStandardScenarioDefinition[] = - [ - { - id: "canary", - title: "Transport canary", - description: "The lane can trigger one known-good reply on the real transport.", - }, - { - id: "mention-gating", - title: "Mention gating", - description: "Messages without the required mention do not trigger a reply.", - }, - { - id: "allowlist-block", - title: "Sender allowlist block", - description: "Non-allowlisted senders do not trigger a reply.", - }, - { - id: "top-level-reply-shape", - title: "Top-level reply shape", - description: "Top-level replies stay top-level when the lane is configured that way.", - }, - { - id: "restart-resume", - title: "Restart resume", - description: "The lane still responds after a gateway restart.", - }, - { - id: "thread-follow-up", - title: "Thread follow-up", - description: "Threaded prompts receive threaded replies with the expected relation metadata.", - }, - { - id: "thread-isolation", - title: "Thread isolation", - description: "Fresh top-level prompts stay out of prior threads.", - }, - { - id: "reaction-observation", - title: "Reaction observation", - description: "Reaction events are observed and normalized correctly.", - }, - { - id: "help-command", - title: "Help command", - description: "The transport-specific help command path replies successfully.", - }, - ] as const; +const LIVE_TRANSPORT_STANDARD_SCENARIOS: readonly LiveTransportStandardScenarioDefinition[] = [ + { + id: "canary", + title: "Transport canary", + description: "The lane can trigger one known-good reply on the real transport.", + }, + { + id: "mention-gating", + title: "Mention gating", + description: "Messages without the required mention do not trigger a reply.", + }, + { + id: "allowlist-block", + title: "Sender allowlist block", + description: "Non-allowlisted senders do not trigger a reply.", + }, + { + id: "top-level-reply-shape", + title: "Top-level reply shape", + description: "Top-level replies stay top-level when the lane is configured that way.", + }, + { + id: "restart-resume", + title: "Restart resume", + description: "The lane still responds after a gateway restart.", + }, + { + id: "thread-follow-up", + title: "Thread follow-up", + description: "Threaded prompts receive threaded replies with the expected relation metadata.", + }, + { + id: "thread-isolation", + title: "Thread isolation", + description: "Fresh top-level prompts stay out of prior threads.", + }, + { + id: "reaction-observation", + title: "Reaction observation", + description: "Reaction events are observed and normalized correctly.", + }, + { + id: "help-command", + title: "Help command", + description: "The transport-specific help command path replies successfully.", + }, +] as const; export const LIVE_TRANSPORT_BASELINE_STANDARD_SCENARIO_IDS: readonly LiveTransportStandardScenarioId[] = [ diff --git a/extensions/qa-matrix/src/substrate/client.ts b/extensions/qa-matrix/src/substrate/client.ts index e3f8380f5fd..f18498cc9ad 100644 --- a/extensions/qa-matrix/src/substrate/client.ts +++ b/extensions/qa-matrix/src/substrate/client.ts @@ -9,7 +9,6 @@ import { waitForMatrixQaRoomEvent, waitForOptionalMatrixQaRoomEvent, type MatrixQaRoomObserver, - type MatrixQaRoomEventWaitResult, } from "./sync.js"; import { findMatrixQaProvisionedRoom, @@ -19,8 +18,7 @@ import { type MatrixQaTopologySpec, } from "./topology.js"; -export type { MatrixQaObservedEvent } from "./events.js"; -export type { MatrixQaRoomEventWaitResult, MatrixQaRoomObserver } from "./sync.js"; +export type { MatrixQaRoomObserver } from "./sync.js"; type MatrixQaAuthStage = "m.login.dummy" | "m.login.registration_token"; @@ -92,7 +90,7 @@ type MatrixQaUiaaResponse = { session?: string; }; -export type MatrixQaRegisteredAccount = { +type MatrixQaRegisteredAccount = { accessToken: string; deviceId?: string; localpart: string; @@ -353,7 +351,7 @@ async function uploadMatrixQaContent(params: { return contentUri; } -export function resolveNextRegistrationAuth(params: { +function resolveNextRegistrationAuth(params: { registrationToken: string; response: MatrixQaUiaaResponse; }) { diff --git a/extensions/qa-matrix/src/substrate/config.ts b/extensions/qa-matrix/src/substrate/config.ts index 512fe6bc4b0..ce02b969e70 100644 --- a/extensions/qa-matrix/src/substrate/config.ts +++ b/extensions/qa-matrix/src/substrate/config.ts @@ -1,26 +1,26 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types"; import type { MatrixQaProvisionedTopology } from "./topology.js"; -export type MatrixQaReplyToMode = "off" | "first" | "all" | "batched"; -export type MatrixQaThreadRepliesMode = "off" | "inbound" | "always"; -export type MatrixQaDmPolicy = "allowlist" | "disabled" | "open" | "pairing"; -export type MatrixQaGroupPolicy = "allowlist" | "disabled" | "open"; -export type MatrixQaAutoJoinMode = "allowlist" | "always" | "off"; -export type MatrixQaStreamingMode = "off" | "partial" | "quiet"; -export type MatrixQaActorRole = "driver" | "observer" | "sut"; -export type MatrixQaChunkMode = "length" | "newline"; -export type MatrixQaExecApprovalTarget = "both" | "channel" | "dm"; -export type MatrixQaExecApprovalsEnabled = boolean | "auto"; -export type MatrixQaAllowBotsMode = boolean | "mentions"; +type MatrixQaReplyToMode = "off" | "first" | "all" | "batched"; +type MatrixQaThreadRepliesMode = "off" | "inbound" | "always"; +type MatrixQaDmPolicy = "allowlist" | "disabled" | "open" | "pairing"; +type MatrixQaGroupPolicy = "allowlist" | "disabled" | "open"; +type MatrixQaAutoJoinMode = "allowlist" | "always" | "off"; +type MatrixQaStreamingMode = "off" | "partial" | "quiet"; +type MatrixQaActorRole = "driver" | "observer" | "sut"; +type MatrixQaChunkMode = "length" | "newline"; +type MatrixQaExecApprovalTarget = "both" | "channel" | "dm"; +type MatrixQaExecApprovalsEnabled = boolean | "auto"; +type MatrixQaAllowBotsMode = boolean | "mentions"; -export type MatrixQaStreamingConfig = { +type MatrixQaStreamingConfig = { mode?: MatrixQaStreamingMode; preview?: { toolProgress?: boolean; }; }; -export type MatrixQaAgentDefaultsOverrides = { +type MatrixQaAgentDefaultsOverrides = { blockStreamingChunk?: { breakPreference?: "newline" | "paragraph" | "sentence"; maxChars?: number; @@ -33,19 +33,19 @@ export type MatrixQaAgentDefaultsOverrides = { }; }; -export type MatrixQaToolConfigOverrides = { +type MatrixQaToolConfigOverrides = { allow?: string[]; deny?: string[]; }; -export type MatrixQaGroupConfigOverrides = { +type MatrixQaGroupConfigOverrides = { allowBots?: MatrixQaAllowBotsMode; enabled?: boolean; requireMention?: boolean; tools?: MatrixQaToolConfigOverrides; }; -export type MatrixQaDmConfigOverrides = { +type MatrixQaDmConfigOverrides = { allowFrom?: string[]; enabled?: boolean; policy?: MatrixQaDmPolicy; @@ -53,7 +53,7 @@ export type MatrixQaDmConfigOverrides = { threadReplies?: MatrixQaThreadRepliesMode; }; -export type MatrixQaThreadBindingsConfigOverrides = { +type MatrixQaThreadBindingsConfigOverrides = { enabled?: boolean; idleHours?: number; maxAgeHours?: number; @@ -61,7 +61,7 @@ export type MatrixQaThreadBindingsConfigOverrides = { spawnSubagentSessions?: boolean; }; -export type MatrixQaExecApprovalsConfigOverrides = { +type MatrixQaExecApprovalsConfigOverrides = { agentFilter?: string[]; approvers?: string[]; enabled?: MatrixQaExecApprovalsEnabled; diff --git a/extensions/qa-matrix/src/substrate/events.ts b/extensions/qa-matrix/src/substrate/events.ts index 3769cf1e492..037c5625bdb 100644 --- a/extensions/qa-matrix/src/substrate/events.ts +++ b/extensions/qa-matrix/src/substrate/events.ts @@ -7,7 +7,7 @@ export type MatrixQaRoomEvent = { type?: string; }; -export type MatrixQaObservedEventKind = +type MatrixQaObservedEventKind = | "membership" | "message" | "notice" @@ -15,13 +15,13 @@ export type MatrixQaObservedEventKind = | "reaction" | "room-event"; -export type MatrixQaObservedEventAttachment = { +type MatrixQaObservedEventAttachment = { caption?: string; filename?: string; kind: "audio" | "file" | "image" | "sticker" | "video"; }; -export type MatrixQaObservedApproval = { +type MatrixQaObservedApproval = { agentId?: string; allowedDecisions?: string[]; commandTextPreview?: string; diff --git a/extensions/qa-matrix/src/substrate/fault-proxy.ts b/extensions/qa-matrix/src/substrate/fault-proxy.ts index 5e1218a207f..646230ddb3e 100644 --- a/extensions/qa-matrix/src/substrate/fault-proxy.ts +++ b/extensions/qa-matrix/src/substrate/fault-proxy.ts @@ -18,7 +18,7 @@ const HOP_BY_HOP_HEADERS = new Set([ "upgrade", ]); -export type MatrixQaFaultProxyRequest = { +type MatrixQaFaultProxyRequest = { bearerToken?: string; headers: IncomingHttpHeaders; method: string; @@ -26,7 +26,7 @@ export type MatrixQaFaultProxyRequest = { search: string; }; -export type MatrixQaFaultProxyResponse = { +type MatrixQaFaultProxyResponse = { body?: unknown; headers?: Record; status: number; diff --git a/extensions/qa-matrix/src/substrate/harness.runtime.ts b/extensions/qa-matrix/src/substrate/harness.runtime.ts index 995a3714054..5e87e751893 100644 --- a/extensions/qa-matrix/src/substrate/harness.runtime.ts +++ b/extensions/qa-matrix/src/substrate/harness.runtime.ts @@ -28,7 +28,7 @@ type MatrixQaHarnessManifest = { dataDir: string; }; -export type MatrixQaHarnessFiles = { +type MatrixQaHarnessFiles = { outputDir: string; composeFile: string; manifestPath: string; @@ -38,7 +38,7 @@ export type MatrixQaHarnessFiles = { registrationToken: string; }; -export type MatrixQaHarness = MatrixQaHarnessFiles & { +type MatrixQaHarness = MatrixQaHarnessFiles & { baseUrl: string; restartService(): Promise; stopCommand: string; diff --git a/extensions/qa-matrix/src/substrate/topology.ts b/extensions/qa-matrix/src/substrate/topology.ts index 5865e2ec899..020f62de6b8 100644 --- a/extensions/qa-matrix/src/substrate/topology.ts +++ b/extensions/qa-matrix/src/substrate/topology.ts @@ -1,6 +1,6 @@ export type MatrixQaParticipantRole = "driver" | "observer" | "sut"; -export type MatrixQaRoomKind = "dm" | "group"; +type MatrixQaRoomKind = "dm" | "group"; export type MatrixQaTopologyRoomSpec = { encrypted?: boolean; @@ -16,7 +16,7 @@ export type MatrixQaTopologySpec = { rooms: MatrixQaTopologyRoomSpec[]; }; -export type MatrixQaProvisionedRoom = { +type MatrixQaProvisionedRoom = { encrypted?: boolean; key: string; kind: MatrixQaRoomKind;