@ihyeon/flow-qa 0.10.5 → 0.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +4 -0
- package/README.md +4 -0
- package/dist/src/cli.js +76 -3
- package/dist/src/report.js +2 -1
- package/dist/src/ui/public/app.js +28 -5
- package/dist/src/ui/public/i18n.js +5 -0
- package/dist/src/ui/server.js +15 -10
- package/docs/ui.md +2 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -76,6 +76,10 @@ CLI에서는 `flow-qa run cases/task-flow.json --target demo --case TC-001 --cas
|
|
|
76
76
|
|
|
77
77
|
준비한 케이스 정의·대상·선택 케이스 그대로 실행하면 새 보고서에 원본 실행 ID가 남습니다. 상세 보고서에서 원본을 열거나 두 결과를 바로 비교할 수 있습니다. 이 조건을 변경해 실행하면 독립 실행으로 저장합니다. 원본 보고서가 삭제돼도 새 보고서는 읽을 수 있으며 원본이 없다는 상태를 표시합니다.
|
|
78
78
|
|
|
79
|
+
원본 보고서의 **이 실행의 재실행 찾기**를 누르면 저장된 전체 기록에서 직접 연결된 재실행을 찾습니다. 오래된 결과는 **더 불러오기**로 열고, **전체 실행 보기**로 연결 조건을 해제할 수 있습니다.
|
|
80
|
+
|
|
81
|
+
CLI에서는 `flow-qa reruns .flowqa/runs/<원본-실행-ID> --workspace my-qa --lang ko`로 원본에서 직접 시작한 재실행의 상태와 저장 폴더를 찾습니다. 목록에 나온 폴더는 같은 `--workspace`의 `flow-qa report`에 넘기거나 원본 폴더와 함께 `flow-qa compare`에 넘길 수 있습니다. 불완전한 기록은 목록에서 제외합니다.
|
|
82
|
+
|
|
79
83
|
`0.8.0`부터 **상세 보고서**에서 케이스·오류 내용을 검색하고 상태별로 좁히거나 **실패·오류만** 볼 수 있습니다. **시도 2회 이상만 보기**(0.8.7)를 켜면 여러 번 시도한 케이스만 표시합니다. 표시 건수와 보고서 전체 케이스 수를 구분하며, Markdown·JSON 다운로드와 실패·오류 재실행 준비는 보고서 전체 범위를 유지합니다. 필터에 맞는 ID만 화면 순서대로 저장하려면 **표시된 케이스 ID 다운로드**(0.8.6)를 선택하세요. 자세한 동작은 [보고서 케이스 탐색](docs/ui.md#explore-cases-in-a-report)을 참고하세요.
|
|
80
84
|
|
|
81
85
|
## 실행 결과 비교
|
package/README.md
CHANGED
|
@@ -76,6 +76,10 @@ From `0.5.0`, open a detailed report and choose **Prepare failed/error cases** t
|
|
|
76
76
|
|
|
77
77
|
When the saved suite, target, and selected cases still match that preparation, the new report records the original run ID. Open or compare the original from the detailed report. If you change those inputs, the new result is saved as an independent run. An unavailable original is identified without hiding the new report.
|
|
78
78
|
|
|
79
|
+
From an original report, **Find reruns of this run** shows directly linked runs across the full saved history. Use **Load more** for older matches or **Show all runs** to clear the relation.
|
|
80
|
+
|
|
81
|
+
In the CLI, `flow-qa reruns .flowqa/runs/<original-run-id> --workspace my-qa` lists direct reruns with their status and saved directory. Pass a listed directory to `flow-qa report` or compare it with the original using `flow-qa compare` and the same `--workspace`. The command checks the saved reports and skips incomplete entries.
|
|
82
|
+
|
|
79
83
|
From `0.8.0`, **Detailed report** supports case/error-text search, status filters, and **Failed/error only**. Use **At least 2 attempts** (0.8.7) to see only cases with multiple recorded attempts. Counts distinguish displayed matches from all recorded cases. Markdown/JSON downloads and failed/error preparation retain the full report scope. To save just the filtered IDs in the displayed order, choose **Download visible case IDs** (0.8.6). See [report case exploration](docs/ui.md#explore-cases-in-a-report).
|
|
80
84
|
|
|
81
85
|
## Compare recorded runs
|
package/dist/src/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { constants } from 'node:fs';
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
-
import { readFile, writeFile, mkdir, access, stat } from 'node:fs/promises';
|
|
4
|
-
import { resolve, dirname, basename } from 'node:path';
|
|
3
|
+
import { readFile, writeFile, mkdir, access, stat, lstat, readdir, realpath, open } from 'node:fs/promises';
|
|
4
|
+
import { resolve, dirname, basename, join } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { parseArgs } from 'node:util';
|
|
7
7
|
import { localeFromEnv, localized, localizeProductMessage } from "./i18n.js";
|
|
@@ -11,7 +11,7 @@ import { buildPlanningPrompt, planFlow } from "./planner.js";
|
|
|
11
11
|
import { compileSuite } from "./compiler.js";
|
|
12
12
|
import { CaseSelectionError, isReportSelectionValid, selectCases } from "./case-selection.js";
|
|
13
13
|
import { runSuite } from "./engine.js";
|
|
14
|
-
import { renderSavedMarkdown } from "./report.js";
|
|
14
|
+
import { MAX_SAVED_REPORT_BYTES, RUN_ID, parseArchivedReportEnvelope, renderSavedMarkdown } from "./report.js";
|
|
15
15
|
import { registrationTarget, sameReportTarget, targetLabel } from "./targets.js";
|
|
16
16
|
import { compareCaseSteps } from "./step-comparison.js";
|
|
17
17
|
import { createAgentHandoff, reviewAgentHandoff } from "./agent-handoff.js";
|
|
@@ -38,6 +38,7 @@ Usage: flow-qa <command> [arguments] [options]
|
|
|
38
38
|
agent-review <handoff-dir> <result.json>
|
|
39
39
|
Check agent-supplied findings and evidence references
|
|
40
40
|
report <run-directory> View a saved QA report
|
|
41
|
+
reruns <run-directory> List runs prepared from a saved report
|
|
41
42
|
compare <run-a> <run-b> Compare case results and authored steps
|
|
42
43
|
ui [--demo] [--port 4310] Start the local QA UI
|
|
43
44
|
browser install [--with-deps] Install this package's Playwright Chromium
|
|
@@ -69,6 +70,7 @@ Local example: flow-qa ui --demo
|
|
|
69
70
|
agent-review <handoff-dir> <result.json>
|
|
70
71
|
에이전트 관찰 결과와 증거 파일 참조 검사
|
|
71
72
|
report <run-directory> 저장된 QA 리포트 보기
|
|
73
|
+
reruns <run-directory> 저장된 리포트에서 시작한 재실행 찾기
|
|
72
74
|
compare <run-a> <run-b> 케이스 결과와 원본 단계 비교
|
|
73
75
|
ui [--demo] [--port 4310] 로컬 QA 화면 실행
|
|
74
76
|
browser install [--with-deps] 패키지의 Playwright Chromium 설치
|
|
@@ -335,6 +337,77 @@ export async function main(args) {
|
|
|
335
337
|
console.log(content.replace(/\u001b/g, ''));
|
|
336
338
|
return;
|
|
337
339
|
}
|
|
340
|
+
if (command === 'reruns') {
|
|
341
|
+
if (second)
|
|
342
|
+
throw new Error(localized(locale, 'reruns accepts one run directory.', 'reruns에는 실행 폴더 하나만 지정하세요.'));
|
|
343
|
+
const canonicalWorkspace = await realpath(workspace);
|
|
344
|
+
let root = canonicalWorkspace;
|
|
345
|
+
for (const part of ['.flowqa', 'runs']) {
|
|
346
|
+
root = join(root, part);
|
|
347
|
+
const info = await lstat(root);
|
|
348
|
+
if (!info.isDirectory() || info.isSymbolicLink() || await realpath(root) !== root) {
|
|
349
|
+
throw new Error(localized(locale, 'Invalid workspace run path.', '작업 공간의 실행 경로가 유효하지 않습니다.'));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const selectedDir = resolve(workspace, required(arg, localized(locale, 'Run directory', '실행 폴더'), locale));
|
|
353
|
+
const originalId = basename(selectedDir);
|
|
354
|
+
const selectedInfo = await lstat(selectedDir);
|
|
355
|
+
if (!RUN_ID.test(originalId) || selectedInfo.isSymbolicLink() ||
|
|
356
|
+
await realpath(selectedDir) !== join(root, originalId)) {
|
|
357
|
+
throw new Error(localized(locale, 'Choose a saved run in this workspace.', '이 작업 공간에 저장된 실행을 선택하세요.'));
|
|
358
|
+
}
|
|
359
|
+
const readReport = async (id) => {
|
|
360
|
+
const dir = join(root, id);
|
|
361
|
+
const dirInfo = await lstat(dir);
|
|
362
|
+
if (!dirInfo.isDirectory() || dirInfo.isSymbolicLink() || await realpath(dir) !== dir)
|
|
363
|
+
return undefined;
|
|
364
|
+
const file = join(dir, 'qa-report.json');
|
|
365
|
+
const fileInfo = await lstat(file);
|
|
366
|
+
if (!fileInfo.isFile() || fileInfo.isSymbolicLink() || fileInfo.size > MAX_SAVED_REPORT_BYTES ||
|
|
367
|
+
await realpath(file) !== file)
|
|
368
|
+
return undefined;
|
|
369
|
+
const handle = await open(file, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
370
|
+
let contents;
|
|
371
|
+
try {
|
|
372
|
+
const opened = await handle.stat();
|
|
373
|
+
if (!opened.isFile() || opened.size > MAX_SAVED_REPORT_BYTES)
|
|
374
|
+
return undefined;
|
|
375
|
+
contents = await handle.readFile('utf8');
|
|
376
|
+
}
|
|
377
|
+
finally {
|
|
378
|
+
await handle.close();
|
|
379
|
+
}
|
|
380
|
+
const report = parseArchivedReportEnvelope(JSON.parse(contents));
|
|
381
|
+
return report?.runId === id ? report : undefined;
|
|
382
|
+
};
|
|
383
|
+
let original;
|
|
384
|
+
try {
|
|
385
|
+
original = await readReport(originalId);
|
|
386
|
+
}
|
|
387
|
+
catch { /* Invalid saved run. */ }
|
|
388
|
+
if (!original)
|
|
389
|
+
throw new Error(localized(locale, 'This is not a valid saved run.', '유효한 저장 실행이 아닙니다.'));
|
|
390
|
+
const matches = [];
|
|
391
|
+
for (const id of await readdir(root)) {
|
|
392
|
+
if (!RUN_ID.test(id) || id === originalId)
|
|
393
|
+
continue;
|
|
394
|
+
try {
|
|
395
|
+
const report = await readReport(id);
|
|
396
|
+
if (report?.parentRunId !== originalId)
|
|
397
|
+
continue;
|
|
398
|
+
matches.push({ id, status: report.status, mtime: (await lstat(join(root, id))).mtimeMs });
|
|
399
|
+
}
|
|
400
|
+
catch { /* Incomplete or unsafe saved run. */ }
|
|
401
|
+
}
|
|
402
|
+
matches.sort((a, b) => b.mtime - a.mtime || a.id.localeCompare(b.id));
|
|
403
|
+
if (!matches.length) {
|
|
404
|
+
console.log(localized(locale, 'No runs were prepared from this report.', '이 리포트에서 시작한 재실행이 없습니다.'));
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
for (const item of matches)
|
|
408
|
+
console.log(`${item.status}\t.flowqa/runs/${item.id}`);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
338
411
|
if (command === 'compare') {
|
|
339
412
|
const load = async (dir) => {
|
|
340
413
|
const data = JSON.parse(await readFile(resolve(workspace, required(dir, localized(locale, 'Run directory', '실행 폴더'), locale), 'qa-report.json'), 'utf8'));
|
package/dist/src/report.js
CHANGED
|
@@ -6,7 +6,8 @@ import { isReportSelectionValid } from "./case-selection.js";
|
|
|
6
6
|
import { localized, localizeProductMessage } from "./i18n.js";
|
|
7
7
|
import { idSchema } from "./schema.js";
|
|
8
8
|
import { targetLabel } from "./targets.js";
|
|
9
|
-
const RUN_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
9
|
+
export const RUN_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
10
|
+
export const MAX_SAVED_REPORT_BYTES = 2 * 1024 * 1024;
|
|
10
11
|
const archiveEnvelopeSchema = z.object({
|
|
11
12
|
schemaVersion: z.literal('flow-qa/report-1'), runId: z.string().regex(RUN_ID), suiteId: idSchema,
|
|
12
13
|
parentRunId: z.string().regex(RUN_ID).optional(),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const t = i18n.t;
|
|
6
6
|
const names = { scenario: 'nav.scenario', library: 'nav.library', history: 'nav.history', settings: 'nav.settings' };
|
|
7
7
|
const defaultReportFilter = () => ({ search: '', status: 'all', sort: 'recorded', repeatedOnly: false });
|
|
8
|
-
const app = { state: null, connected: false, displayTargets: [], draft: null, selectedCaseIds: new Set(), script: '', neutralScript: '', scriptRevision: 0, savedFile: '', savedHash: '', origin: 'none', sourceFlow: '', boundSource: null, stale: false, dirty: false, busy: false, planning: false, planRequest: 0, stopping: false, report: null, reportParent: null, reportMarkdown: '', selectedRun: '', reportFilter: defaultReportFilter(), rerunOrigin: null, rerunTargetMismatch: false, navigationVersion: 0, comparison: null, comparisonRequest: 0, comparisonBusy: false, comparisonStatus: 'comparison.selectBoth', comparisonPins: { baseline: null, current: null }, comparisonSelectionGeneration: 0, comparisonValidation: null, history: { runs: [], nextCursor: null, pagesLoaded: 0, loaded: false, loading: false, request: 0, debounce: null, kind: null, error: null, updatesAvailable: false, pendingRecentUpdate: false }, view: 'scenario' };
|
|
8
|
+
const app = { state: null, connected: false, displayTargets: [], draft: null, selectedCaseIds: new Set(), script: '', neutralScript: '', scriptRevision: 0, savedFile: '', savedHash: '', origin: 'none', sourceFlow: '', boundSource: null, stale: false, dirty: false, busy: false, planning: false, planRequest: 0, stopping: false, report: null, reportParent: null, reportMarkdown: '', selectedRun: '', reportFilter: defaultReportFilter(), rerunOrigin: null, rerunTargetMismatch: false, navigationVersion: 0, comparison: null, comparisonRequest: 0, comparisonBusy: false, comparisonStatus: 'comparison.selectBoth', comparisonPins: { baseline: null, current: null }, comparisonSelectionGeneration: 0, comparisonValidation: null, history: { runs: [], nextCursor: null, pagesLoaded: 0, loaded: false, loading: false, request: 0, debounce: null, kind: null, error: null, updatesAvailable: false, pendingRecentUpdate: false, parentRunId: '' }, view: 'scenario' };
|
|
9
9
|
|
|
10
10
|
function el(tag, className, value) {
|
|
11
11
|
const node = document.createElement(tag);
|
|
@@ -303,23 +303,33 @@
|
|
|
303
303
|
const button = el('button', 'button', t('app.load')); button.type = 'button'; button.addEventListener('click', () => loadSuite(suite.file)); row.append(copy, button); host.append(row);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
function historyFilters() { return { query: $('history-search').value.trim(), status: $('history-status-filter').value }; }
|
|
306
|
+
function historyFilters() { return { query: $('history-search').value.trim(), status: $('history-status-filter').value, parentRunId: app.history.parentRunId }; }
|
|
307
307
|
function renderHistory() {
|
|
308
308
|
const history = app.history;
|
|
309
309
|
const host = $('history-list'); replace(host);
|
|
310
310
|
host.setAttribute('aria-busy', String(history.loading));
|
|
311
311
|
if (!history.runs.length) {
|
|
312
|
-
const { query, status } = historyFilters();
|
|
312
|
+
const { query, status, parentRunId } = historyFilters();
|
|
313
313
|
const key = history.loading ? 'history.loading' : history.error && !history.loaded ? 'history.loadError'
|
|
314
|
-
:
|
|
314
|
+
: parentRunId && status ? 'history.noRerunsWithStatus'
|
|
315
|
+
: parentRunId ? 'history.noReruns' : query ? 'app.historyNoSearchMatches' : status ? 'app.historyNoStatusMatches'
|
|
315
316
|
: app.state?.active ? 'app.historyActiveEmpty' : 'app.historyEmpty';
|
|
316
317
|
host.append(el('p', 'empty', t(key)));
|
|
317
318
|
}
|
|
319
|
+
if (history.parentRunId) {
|
|
320
|
+
const relation = el('div', 'actions');
|
|
321
|
+
relation.append(el('p', 'hint', t('history.relatedTo', { runId: history.parentRunId })));
|
|
322
|
+
const clear = el('button', 'button quiet', t('history.showAllRuns'));
|
|
323
|
+
clear.type = 'button'; clear.dataset.action = 'clear-related-runs';
|
|
324
|
+
clear.addEventListener('click', () => { history.parentRunId = ''; refreshHistory(); });
|
|
325
|
+
relation.append(clear); host.prepend(relation);
|
|
326
|
+
}
|
|
318
327
|
const pair = comparisonPair();
|
|
319
328
|
for (const run of history.runs) {
|
|
320
329
|
const row = el('div', 'list-row history-run-row'); row.dataset.runId = run.runId;
|
|
321
330
|
const copy = el('div'); copy.append(el('strong', '', `${run.suiteId} · ${i18n.status(run.status)}`), el('small', '', t('app.runMeta', { date: formatDate(run.startedAt), target: targetDisplay(run.target), passed: run.passedCount ?? 0, total: run.caseCount ?? 0, id: run.runId })));
|
|
322
331
|
const scope = selectionScope(run.selection); if (scope) copy.append(el('small', 'selection-scope', scope));
|
|
332
|
+
if (run.parentRunId) copy.append(el('small', 'hint', t('history.parentRun', { runId: run.parentRunId })));
|
|
323
333
|
const actions = el('div', 'run-row-actions');
|
|
324
334
|
const button = el('button', 'button', t('app.viewReport')); button.type = 'button'; button.dataset.action = 'view-report'; button.disabled = run.status === 'running' || run.status === 'stopping'; button.addEventListener('click', () => loadReport(run.runId)); actions.append(button);
|
|
325
335
|
for (const [role, label] of [['baseline', 'comparison.useBaseline'], ['current', 'comparison.useCurrent']]) {
|
|
@@ -347,6 +357,7 @@
|
|
|
347
357
|
const history = app.history;
|
|
348
358
|
const append = cursor !== null;
|
|
349
359
|
const params = new URLSearchParams({ query: filters.query, status: filters.status, limit: '50' });
|
|
360
|
+
if (filters.parentRunId) params.set('parentRunId', filters.parentRunId);
|
|
350
361
|
if (append) params.set('cursor', cursor);
|
|
351
362
|
try {
|
|
352
363
|
const result = await api(`/api/runs?${params}`);
|
|
@@ -398,6 +409,14 @@
|
|
|
398
409
|
renderHistory();
|
|
399
410
|
void fetchHistoryPage(request, historyFilters(), history.nextCursor);
|
|
400
411
|
}
|
|
412
|
+
function showRelatedRuns(runId) {
|
|
413
|
+
app.history.parentRunId = runId;
|
|
414
|
+
$('history-search').value = '';
|
|
415
|
+
$('history-status-filter').value = '';
|
|
416
|
+
view('history');
|
|
417
|
+
refreshHistory();
|
|
418
|
+
$('history-list').scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
419
|
+
}
|
|
401
420
|
function recentRunsChanged() {
|
|
402
421
|
const history = app.history;
|
|
403
422
|
if (history.loading) { history.pendingRecentUpdate = true; return; }
|
|
@@ -915,6 +934,10 @@
|
|
|
915
934
|
}
|
|
916
935
|
host.append(parent);
|
|
917
936
|
}
|
|
937
|
+
const related = el('button', 'button quiet', t('history.findReruns'));
|
|
938
|
+
related.type = 'button'; related.dataset.action = 'find-reruns';
|
|
939
|
+
related.addEventListener('click', () => showRelatedRuns(report.runId));
|
|
940
|
+
host.append(related);
|
|
918
941
|
if (report.usage) host.append(el('p', 'hint', t('app.usage', { tokens: report.usage.modelTokens ?? t('app.unavailable'), cost: typeof report.usage.estimatedCostUsd === 'number' ? `$${report.usage.estimatedCostUsd.toFixed(4)}` : t('app.unavailable') })));
|
|
919
942
|
if (report.errors?.length) host.append(el('p', 'report-errors', report.errors.join('\n')));
|
|
920
943
|
const caseList = el('div'); caseList.id = 'report-case-list'; host.append(caseList);
|
|
@@ -954,7 +977,7 @@
|
|
|
954
977
|
window.addEventListener('beforeunload', warnBeforeUnload);
|
|
955
978
|
document.querySelectorAll('[data-view]').forEach((button) => button.addEventListener('click', () => view(button.dataset.view)));
|
|
956
979
|
$('library-search').addEventListener('input', renderLibrary);
|
|
957
|
-
$('history-search').addEventListener('input', () => refreshHistory(150));
|
|
980
|
+
$('history-search').addEventListener('input', () => { app.history.parentRunId = ''; refreshHistory(150); });
|
|
958
981
|
$('history-status-filter').addEventListener('change', () => refreshHistory());
|
|
959
982
|
$('history-refresh').addEventListener('click', () => refreshHistory());
|
|
960
983
|
$('history-load-more').addEventListener('click', loadMoreHistory);
|
|
@@ -99,6 +99,11 @@
|
|
|
99
99
|
'history.loadError': ['Could not load run history. Try Refresh history.', '실행 기록을 불러오지 못했습니다. 실행 기록 새로고침을 눌러 다시 시도하세요.'],
|
|
100
100
|
'history.loadMoreError': ['Could not load more runs. Retry loading more.', '실행 기록을 더 불러오지 못했습니다. 다시 시도하세요.'],
|
|
101
101
|
'history.updatesAvailable': ['Recent runs changed. Refresh history to update this list.', '최근 실행 기록이 변경됐습니다. 실행 기록을 새로고침해 목록을 갱신하세요.'],
|
|
102
|
+
'history.findReruns': ['Find reruns of this run', '이 실행의 재실행 찾기'],
|
|
103
|
+
'history.relatedTo': ['Reruns of {runId}', '실행 {runId}의 재실행'],
|
|
104
|
+
'history.noReruns': ['No linked reruns match these filters.', '조건에 맞는 연결된 재실행이 없습니다.'],
|
|
105
|
+
'history.noRerunsWithStatus': ['No linked reruns have this status. Choose another status or All statuses.', '이 상태에 해당하는 연결된 재실행이 없습니다. 다른 상태나 전체 상태를 선택하세요.'],
|
|
106
|
+
'history.showAllRuns': ['Show all runs', '전체 실행 보기'],
|
|
102
107
|
'comparison.title': ['Compare two runs', '실행 2건 비교'],
|
|
103
108
|
'comparison.help': ['Select a baseline and current run from history or the lists below. Inspect detailed reports for evidence.', '실행 기록이나 아래 목록에서 기준 실행과 현재 실행을 선택하세요. 증거는 상세 보고서에서 확인하세요.'],
|
|
104
109
|
'comparison.baseline': ['Baseline run', '기준 실행'],
|
package/dist/src/ui/server.js
CHANGED
|
@@ -20,7 +20,7 @@ import { runSuite } from "../engine.js";
|
|
|
20
20
|
import { localeFromAcceptLanguage, localizeProductMessage } from "../i18n.js";
|
|
21
21
|
import { EvidenceError, readEvidence } from "./evidence.js";
|
|
22
22
|
import { buildPlanningPrompt, planFlow, PlannerError } from "../planner.js";
|
|
23
|
-
import { parseArchivedReportEnvelope, renderSavedMarkdown } from "../report.js";
|
|
23
|
+
import { MAX_SAVED_REPORT_BYTES, RUN_ID, parseArchivedReportEnvelope, renderSavedMarkdown } from "../report.js";
|
|
24
24
|
import { compareReports, ComparisonError, renderComparisonMarkdown } from "../run-comparison.js";
|
|
25
25
|
import { configSchema, idSchema, modelSchema, suiteSchema, targetSchema } from "../schema.js";
|
|
26
26
|
import { registrationTarget, targetFingerprint } from "../targets.js";
|
|
@@ -29,12 +29,11 @@ const MAX_BODY = 256 * 1024;
|
|
|
29
29
|
const MAX_FLOW = 128 * 1024;
|
|
30
30
|
const MAX_CONFIG = 256 * 1024;
|
|
31
31
|
const MAX_SUITE = 512 * 1024;
|
|
32
|
-
const MAX_REPORT =
|
|
32
|
+
const MAX_REPORT = MAX_SAVED_REPORT_BYTES;
|
|
33
33
|
const MAX_STATIC = 4 * 1024 * 1024;
|
|
34
34
|
const PLAN_TIMEOUT_MS = 65_000;
|
|
35
35
|
const CLOSE_WAIT_MS = 10_000;
|
|
36
36
|
const BROWSER_INSTALL_COMMAND = 'flow-qa browser install';
|
|
37
|
-
const RUN_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
38
37
|
const RUN_STATUSES = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
|
|
39
38
|
const RUN_HISTORY_LIMIT = 50;
|
|
40
39
|
const RUN_CURSOR_MAX_LENGTH = 512;
|
|
@@ -79,8 +78,8 @@ class HTTPError extends Error {
|
|
|
79
78
|
}
|
|
80
79
|
function invalid(message = 'Invalid input.') { throw new HTTPError(400, message); }
|
|
81
80
|
function notFound() { throw new HTTPError(404, 'The requested item was not found.'); }
|
|
82
|
-
function runFilterHash(query, status) {
|
|
83
|
-
return sha256(JSON.stringify([query, status]));
|
|
81
|
+
function runFilterHash(query, status, parentRunId) {
|
|
82
|
+
return sha256(JSON.stringify(parentRunId ? [query, status, parentRunId] : [query, status]));
|
|
84
83
|
}
|
|
85
84
|
// The cursor is independent of page size, so clients may change limit between pages.
|
|
86
85
|
function encodeRunCursor(candidate, filterHash) {
|
|
@@ -489,15 +488,18 @@ export async function startUIServer(options) {
|
|
|
489
488
|
return { runId: item.runId, suiteId: item.suiteId, status: item.status, startedAt: item.startedAt,
|
|
490
489
|
finishedAt: item.finishedAt, caseCount: item.cases.length,
|
|
491
490
|
passedCount: item.cases.filter((entry) => entry.status === 'passed' || entry.status === 'flaky').length,
|
|
492
|
-
target: item.target, ...(item.selection ? { selection: item.selection } : {})
|
|
491
|
+
target: item.target, ...(item.selection ? { selection: item.selection } : {}),
|
|
492
|
+
...(item.parentRunId ? { parentRunId: item.parentRunId } : {}) };
|
|
493
493
|
}
|
|
494
|
-
async function runSummaries(limit, query = '', status = '', after) {
|
|
494
|
+
async function runSummaries(limit, query = '', status = '', after, parentRunId = '') {
|
|
495
495
|
const history = [];
|
|
496
496
|
for (const candidate of await runCandidates()) {
|
|
497
497
|
if (after && (candidate.mtime > after.mtime || (candidate.mtime === after.mtime && candidate.id <= after.id)))
|
|
498
498
|
continue;
|
|
499
499
|
try {
|
|
500
500
|
const { report: item } = await report(candidate.id, false);
|
|
501
|
+
if (parentRunId && item.parentRunId !== parentRunId)
|
|
502
|
+
continue;
|
|
501
503
|
if (status && item.status !== status)
|
|
502
504
|
continue;
|
|
503
505
|
if (query && ![item.suiteId, item.runId, item.target.name].some((field) => field.toLowerCase().includes(query)))
|
|
@@ -560,7 +562,7 @@ export async function startUIServer(options) {
|
|
|
560
562
|
return;
|
|
561
563
|
}
|
|
562
564
|
if (url.pathname === '/api/runs') {
|
|
563
|
-
for (const key of ['query', 'status', 'limit', 'cursor']) {
|
|
565
|
+
for (const key of ['query', 'status', 'limit', 'cursor', 'parentRunId']) {
|
|
564
566
|
if (url.searchParams.getAll(key).length > 1)
|
|
565
567
|
invalid();
|
|
566
568
|
}
|
|
@@ -571,14 +573,17 @@ export async function startUIServer(options) {
|
|
|
571
573
|
const status = url.searchParams.get('status') ?? '';
|
|
572
574
|
if (status && !RUN_STATUSES.has(status))
|
|
573
575
|
invalid('Invalid run status.');
|
|
576
|
+
const parentRunId = url.searchParams.get('parentRunId') ?? '';
|
|
577
|
+
if (parentRunId && !RUN_ID.test(parentRunId))
|
|
578
|
+
invalid('Invalid parent run ID.');
|
|
574
579
|
const rawLimit = url.searchParams.get('limit');
|
|
575
580
|
if (rawLimit !== null && !/^(?:[1-9]|[1-4][0-9]|50)$/.test(rawLimit))
|
|
576
581
|
invalid('Invalid run limit.');
|
|
577
582
|
const limit = rawLimit === null ? RUN_HISTORY_LIMIT : Number(rawLimit);
|
|
578
|
-
const filterHash = runFilterHash(normalizedQuery, status);
|
|
583
|
+
const filterHash = runFilterHash(normalizedQuery, status, parentRunId);
|
|
579
584
|
const rawCursor = url.searchParams.get('cursor');
|
|
580
585
|
const after = rawCursor === null ? undefined : decodeRunCursor(rawCursor, filterHash);
|
|
581
|
-
const rows = await runSummaries(limit + 1, normalizedQuery, status, after);
|
|
586
|
+
const rows = await runSummaries(limit + 1, normalizedQuery, status, after, parentRunId);
|
|
582
587
|
const runs = rows.slice(0, limit);
|
|
583
588
|
sendJSON(response, 200, { runs: runs.map(({ summary }) => summary),
|
|
584
589
|
nextCursor: rows.length > limit ? encodeRunCursor(runs.at(-1).candidate, filterHash) : null });
|
package/docs/ui.md
CHANGED
|
@@ -72,6 +72,8 @@ From version `0.2.6`, **Case library** filters saved suites as you type in **Sea
|
|
|
72
72
|
|
|
73
73
|
**Run history → Search runs** matches part of a suite ID, run ID, or target name. Matching ignores letter case and surrounding whitespace, and supports Korean target names. Search combines with **Run status**; clear the search to return to the selected status. From `0.6.0`, search covers all valid saved reports, including older records. Target URLs and individual case content are not searched. Queries are limited to 200 characters.
|
|
74
74
|
|
|
75
|
+
**Find reruns of this run** in a detailed report opens Run history filtered by the exact original run ID recorded in each child. The list can be paginated and narrowed by status. **Show all runs** clears the relation, and typing in Search runs switches back to the ordinary text search.
|
|
76
|
+
|
|
75
77
|
Results load 50 at a time, newest first by run-directory modification time, with run ID as a stable tie-breaker. **Load more** appends older matches. The displayed count describes loaded matches, not a global total. End-of-results, loading, and retry guidance distinguish an empty result from an unavailable request. A failed page request preserves loaded rows so you can retry.
|
|
76
78
|
|
|
77
79
|
Changing search or status restarts at the first page. The query, status, and loaded pages stay through navigation and language changes, and reset on page reload. The open report, its downloads, and scenario draft stay intact. A delayed response from an older query cannot replace newer results. Older reports support the same report downloads and failed/error-case preparation.
|