- test(e2e): add playwright harness and test stack - test(e2e): add core flow - fix(ui): preserve same-origin browser form submissions - fix(ui): offer reload inside stale edit dialogs - test(e2e): add persona session and accessibility suites - test(e2e): preserve per-run artifacts and clean pulled images - test(e2e): verify import and audit state across navigation - test(e2e): tighten verification helpers and persona checks - test(e2e): bound response body reads of the browser observer - test: recover review compatibility assertions - test: stabilize audit and user flow assertions
78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
// Copyright (C) 2026 Bryan Joshua Pedini
|
|
|
|
export interface CliRecord {
|
|
at: string;
|
|
container: string;
|
|
args: string[];
|
|
stdinBytes: number;
|
|
exitCode: number | null;
|
|
durationMs: number;
|
|
stdout: string;
|
|
stderr: string;
|
|
}
|
|
|
|
export interface HttpRecord {
|
|
at: string;
|
|
client: 'api' | 'browser';
|
|
actor: string;
|
|
method: string;
|
|
url: string;
|
|
requestHeaders: Record<string, string>;
|
|
requestBodyBytes: number;
|
|
status: number;
|
|
responseHeaders: Record<string, string>;
|
|
bodyPreview: string;
|
|
durationMs: number;
|
|
}
|
|
|
|
export interface DigRecord {
|
|
at: string;
|
|
args: string[];
|
|
output: string;
|
|
}
|
|
|
|
const MAX_TEXT = 8 * 1024;
|
|
const MAX_RECORDS = 3000;
|
|
|
|
export function clip(s: string, max = MAX_TEXT): string {
|
|
return s.length <= max ? s : `${s.slice(0, max)}...[${s.length - max} more characters]`;
|
|
}
|
|
|
|
function push<T>(list: T[], item: T): void {
|
|
if (list.length >= MAX_RECORDS) list.shift();
|
|
list.push(item);
|
|
}
|
|
|
|
export class Recorder {
|
|
readonly cli: CliRecord[] = [];
|
|
readonly http: HttpRecord[] = [];
|
|
readonly dig: DigRecord[] = [];
|
|
readonly notes: string[] = [];
|
|
readonly fuzzCases: unknown[] = [];
|
|
|
|
addCli(r: Omit<CliRecord, 'at'>): void {
|
|
push(this.cli, { at: new Date().toISOString(), ...r, stdout: clip(r.stdout), stderr: clip(r.stderr) });
|
|
}
|
|
|
|
addHttp(r: Omit<HttpRecord, 'at'>): void {
|
|
push(this.http, { at: new Date().toISOString(), ...r, bodyPreview: clip(r.bodyPreview, 2048) });
|
|
}
|
|
|
|
addDig(args: string[], output: string): void {
|
|
push(this.dig, { at: new Date().toISOString(), args, output: clip(output, 4096) });
|
|
}
|
|
|
|
note(text: string): void {
|
|
push(this.notes, `${new Date().toISOString()} ${text}`);
|
|
}
|
|
|
|
clear(): void {
|
|
this.cli.length = 0;
|
|
this.http.length = 0;
|
|
this.dig.length = 0;
|
|
this.notes.length = 0;
|
|
this.fuzzCases.length = 0;
|
|
}
|
|
}
|