refactor: trim qa matrix helper exports

This commit is contained in:
Peter Steinberger
2026-05-01 17:58:16 +01:00
parent 198549147e
commit ccd188a8b7
16 changed files with 96 additions and 122 deletions

View File

@@ -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;
}

View File

@@ -4,7 +4,7 @@ export type QaReportCheck = {
details?: string;
};
export type QaReportScenario = {
type QaReportScenario = {
name: string;
status: "pass" | "fail" | "skip";
details?: string;

View File

@@ -352,7 +352,7 @@ function getMatrixQaScenarioRestartReadyTimeoutMs(scenario: { timeoutMs: number
return scenario.timeoutMs;
}
export type MatrixQaRunResult = {
type MatrixQaRunResult = {
observedEventsPath: string;
outputDir: string;
reportPath: string;

View File

@@ -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<MatrixQ
topology?: MatrixQaTopologySpec;
};
export type MatrixQaProfile =
type MatrixQaProfile =
| "all"
| "e2ee-cli"
| "e2ee-deep"
@@ -131,7 +131,7 @@ export const MATRIX_QA_DRIVER_DM_SHARED_ROOM_KEY = "driver-dm-shared";
export const MATRIX_QA_E2EE_ROOM_KEY = "e2ee";
export const MATRIX_QA_E2EE_VERIFICATION_DM_ROOM_KEY = "e2ee-verification-dm";
export const MATRIX_QA_HOMESERVER_ROOM_KEY = "homeserver";
export const MATRIX_QA_MAIN_ROOM_KEY = "main";
const MATRIX_QA_MAIN_ROOM_KEY = "main";
export const MATRIX_QA_MEDIA_ROOM_KEY = "media";
export const MATRIX_QA_MEMBERSHIP_ROOM_KEY = "membership";
export const MATRIX_QA_RESTART_ROOM_KEY = "restart";

View File

@@ -1,6 +1,6 @@
export const MATRIX_QA_IMAGE_ATTACHMENT_FILENAME = "red-top-blue-bottom.png";
export type MatrixQaMediaTypeCoverageCase = {
type MatrixQaMediaTypeCoverageCase = {
contentType: string;
createBuffer: () => Buffer;
expectedAttachmentKind: "audio" | "file" | "image" | "video";

View File

@@ -60,7 +60,7 @@ export type MatrixQaScenarioContext = {
waitGatewayAccountReady?: (accountId: string, opts?: { timeoutMs?: number }) => Promise<void>;
};
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<typeof createMatrixQaScenarioClient>;
type MatrixQaScenarioClient = ReturnType<typeof createMatrixQaScenarioClient>;
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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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<T>(load: () => Promise<T>) {
};
}
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;

View File

@@ -1,4 +1,4 @@
export type LiveTransportStandardScenarioId =
type LiveTransportStandardScenarioId =
| "canary"
| "mention-gating"
| "allowlist-block"
@@ -16,60 +16,59 @@ export type LiveTransportScenarioDefinition<TId extends string = string> = {
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[] =
[

View File

@@ -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;
}) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<string, string>;
status: number;

View File

@@ -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<void>;
stopCommand: string;

View File

@@ -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;