@ihyeon/flow-qa 0.12.0 → 0.12.1

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 CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  사용자 플로우를 검토 가능한 테스트 케이스로 바꾸고, 실제 브라우저 실행 결과를 증거가 연결된 QA 리포트로 남기는 로컬 도구입니다. 플로우의 기대 결과가 모호하면 추측해 통과시키지 않고 질문과 차단 상태로 남깁니다.
8
8
 
9
+ Flow QA는 대상 URL만으로 단독 사용할 수 있으며, 다른 `@ihyeon` 패키지들과 함께 연계해 쓰는 구성은 [@ihyeon QA Suite 호환 허브](https://qa.hyeonse.dev/?lang=ko)에서 확인할 수 있습니다.
10
+
9
11
  CLI와 `127.0.0.1` 전용 웹 UI를 제공합니다. UI는 영어로 시작하며 상단 언어 전환에서 한국어를 선택할 수 있습니다. 선택은 이 브라우저에 저장됩니다. 테스트 대상의 URL과 화면 계약을 사용하며 앱 소스 또는 데이터베이스 접근은 필수가 아닙니다. 설치 없이 구조를 보려면 [아키텍처](https://github.com/hyeonse-swing/flow-qa/blob/main/docs/architecture.md)와 [UI 안내](https://github.com/hyeonse-swing/flow-qa/blob/main/docs/ui.md)를 참고하세요.
10
12
 
11
13
  ![로컬 데모 화면](https://raw.githubusercontent.com/hyeonse-swing/flow-qa/main/docs/media/flow-qa-demo.png)
package/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  Flow QA turns a user flow into reviewable test cases, runs them in a real browser, and ties the results to evidence in a QA report. When an expected outcome is unclear, it keeps the question visible and blocks that case instead of guessing.
8
8
 
9
+ Flow QA works standalone on any target URL; when pairing it with other `@ihyeon` packages, see the [@ihyeon QA Suite compatibility hub](https://qa.hyeonse.dev/).
10
+
9
11
  Flow QA is available as a CLI and a web UI bound to `127.0.0.1`. Provide a target URL and describe the screen behavior; access to the application's source code or database is optional. The UI starts in English. Use the language switch in the top bar for Korean; the choice is saved in this browser. See the [architecture](https://github.com/hyeonse-swing/flow-qa/blob/main/docs/architecture.md) and [UI guide](https://github.com/hyeonse-swing/flow-qa/blob/main/docs/ui.md) for the details.
10
12
 
11
13
  ![Flow QA local demo](https://raw.githubusercontent.com/hyeonse-swing/flow-qa/main/docs/media/flow-qa-demo.png)
@@ -38,10 +38,14 @@ const BROWSER_INSTALL_COMMAND = 'flow-qa browser install';
38
38
  const RUN_STATUSES = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
39
39
  const RUN_HISTORY_LIMIT = 50;
40
40
  const RUN_CURSOR_MAX_LENGTH = 512;
41
- const runCursorSchema = z.object({
41
+ const legacyRunCursor = z.object({
42
42
  version: z.literal(1), mtime: z.number().finite().nonnegative(), id: z.string().regex(RUN_ID),
43
43
  filterHash: z.string().regex(/^[0-9a-f]{64}$/),
44
44
  }).strict();
45
+ const runCursorSchema = z.discriminatedUnion('version', [legacyRunCursor, z.object({
46
+ version: z.literal(2), finished: z.number().finite(), started: z.number().finite(), id: z.string().regex(RUN_ID),
47
+ filterHash: z.string().regex(/^[0-9a-f]{64}$/),
48
+ }).strict()]);
45
49
  const FILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,159}$/;
46
50
  const MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
47
51
  const PUBLIC_DIR = path.join(MODULE_DIR, 'public');
@@ -84,7 +88,7 @@ function runFilterHash(query, status, parentRunId) {
84
88
  }
85
89
  // The cursor is independent of page size, so clients may change limit between pages.
86
90
  function encodeRunCursor(candidate, filterHash) {
87
- return Buffer.from(JSON.stringify({ version: 1, mtime: candidate.mtime, id: candidate.id, filterHash })).toString('base64url');
91
+ return Buffer.from(JSON.stringify({ version: 2, ...candidate, filterHash })).toString('base64url');
88
92
  }
89
93
  function decodeRunCursor(value, filterHash) {
90
94
  if (value.length === 0 || value.length > RUN_CURSOR_MAX_LENGTH || !/^[A-Za-z0-9_-]+$/.test(value))
@@ -96,12 +100,21 @@ function decodeRunCursor(value, filterHash) {
96
100
  const parsed = runCursorSchema.safeParse(JSON.parse(bytes.toString('utf8')));
97
101
  if (!parsed.success || parsed.data.filterHash !== filterHash)
98
102
  invalid('Invalid run cursor.');
99
- return { id: parsed.data.id, mtime: parsed.data.mtime };
103
+ return parsed.data;
100
104
  }
101
105
  catch {
102
106
  return invalid('Invalid run cursor.');
103
107
  }
104
108
  }
109
+ function compareRunCandidates(a, b) {
110
+ return b.finished - a.finished || b.started - a.started || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
111
+ }
112
+ function runSortKey(summary) {
113
+ const startTime = Date.parse(summary.startedAt);
114
+ const finishTime = Date.parse(summary.finishedAt);
115
+ const started = Number.isFinite(startTime) ? startTime : Number.MIN_SAFE_INTEGER;
116
+ return { id: summary.runId, started, finished: Number.isFinite(finishTime) ? finishTime : started };
117
+ }
105
118
  const SCHEMA_FIELDS = new Set([
106
119
  'suite', 'schemaVersion', 'id', 'title', 'source', 'file', 'sha256', 'requirements', 'cases',
107
120
  'requirementIds', 'preconditions', 'questions', 'steps', 'type', 'path', 'instruction',
@@ -416,14 +429,18 @@ export async function startUIServer(options) {
416
429
  }
417
430
  async function report(runId, includeMarkdown, locale = 'en') {
418
431
  const dir = await runDirectory(runId);
419
- const raw = parseArchivedReportEnvelope(jsonObject(await readRegular(dir, 'qa-report.json', MAX_REPORT)));
420
- if (!raw || raw.runId !== runId)
421
- notFound();
432
+ const raw = await readRunReport(dir, runId);
422
433
  let markdown = includeMarkdown ? await readRegular(dir, 'qa-report.md', MAX_REPORT) : undefined;
423
434
  if (markdown !== undefined)
424
435
  markdown = renderSavedMarkdown(raw, markdown, locale);
425
436
  return { report: raw, ...(markdown === undefined ? {} : { markdown }) };
426
437
  }
438
+ async function readRunReport(dir, runId) {
439
+ const raw = parseArchivedReportEnvelope(jsonObject(await readRegular(dir, 'qa-report.json', MAX_REPORT)));
440
+ if (!raw || raw.runId !== runId)
441
+ notFound();
442
+ return raw;
443
+ }
427
444
  async function preparedRerun(runId) {
428
445
  const { report: previous } = await report(runId, false);
429
446
  const matches = (await suites()).filter((item) => item.id === previous.suiteId);
@@ -457,23 +474,6 @@ export async function startUIServer(options) {
457
474
  throw new HTTPError(409, error.message);
458
475
  }
459
476
  }
460
- async function runCandidates() {
461
- const root = await directory(['.flowqa', 'runs']);
462
- if (!root)
463
- return [];
464
- const candidates = [];
465
- for (const id of await readdir(root)) {
466
- if (!RUN_ID.test(id))
467
- continue;
468
- try {
469
- const info = await lstat(path.join(root, id));
470
- if (info.isDirectory() && !info.isSymbolicLink())
471
- candidates.push({ id, mtime: info.mtimeMs });
472
- }
473
- catch { /* incomplete run */ }
474
- }
475
- return candidates.sort((a, b) => b.mtime - a.mtime || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
476
- }
477
477
  function runSummary(item) {
478
478
  return { runId: item.runId, suiteId: item.suiteId, status: item.status, startedAt: item.startedAt,
479
479
  finishedAt: item.finishedAt, caseCount: item.cases.length,
@@ -481,26 +481,41 @@ export async function startUIServer(options) {
481
481
  target: item.target, ...(item.selection ? { selection: item.selection } : {}),
482
482
  ...(item.parentRunId ? { parentRunId: item.parentRunId } : {}) };
483
483
  }
484
+ const summaryCache = new Map();
484
485
  async function runSummaries(limit, query = '', status = '', after, parentRunId = '') {
486
+ const root = await directory(['.flowqa', 'runs']);
485
487
  const history = [];
486
- for (const candidate of await runCandidates()) {
487
- if (after && (candidate.mtime > after.mtime || (candidate.mtime === after.mtime && candidate.id <= after.id)))
488
- continue;
488
+ const ids = new Set(root ? (await readdir(root)).filter(id => RUN_ID.test(id)) : []);
489
+ for (const id of summaryCache.keys())
490
+ if (!ids.has(id))
491
+ summaryCache.delete(id);
492
+ for (const id of ids) {
489
493
  try {
490
- const { report: item } = await report(candidate.id, false);
491
- if (parentRunId && item.parentRunId !== parentRunId)
494
+ const dir = await runDirectory(id);
495
+ const info = await lstat(path.join(dir, 'qa-report.json'));
496
+ if (!info.isFile() || info.size > MAX_REPORT)
497
+ continue;
498
+ const fingerprint = [info.dev, info.ino, info.size, info.mtimeMs, info.ctimeMs].join(':');
499
+ const cached = summaryCache.get(id);
500
+ const summary = cached?.fingerprint === fingerprint ? cached.summary : runSummary(await readRunReport(dir, id));
501
+ summaryCache.set(id, { fingerprint, summary });
502
+ if (parentRunId && summary.parentRunId !== parentRunId)
492
503
  continue;
493
- if (status && item.status !== status)
504
+ if (status && summary.status !== status)
494
505
  continue;
495
- if (query && ![item.suiteId, item.runId, item.target.name].some((field) => field.toLowerCase().includes(query)))
506
+ if (query && ![summary.suiteId, summary.runId, summary.target.name].some(field => field.toLowerCase().includes(query)))
496
507
  continue;
497
- history.push({ candidate, summary: runSummary(item) });
498
- if (history.length === limit)
499
- break;
508
+ history.push({ candidate: runSortKey(summary), summary });
509
+ }
510
+ catch {
511
+ summaryCache.delete(id);
500
512
  }
501
- catch { /* incomplete or unsafe run */ }
502
513
  }
503
- return history;
514
+ const anchor = after?.version === 1 ? history.find(row => row.candidate.id === after.id)?.candidate : after;
515
+ if (after && !anchor)
516
+ invalid('Invalid run cursor.');
517
+ history.sort((a, b) => compareRunCandidates(a.candidate, b.candidate));
518
+ return (anchor ? history.filter(row => compareRunCandidates(row.candidate, anchor) > 0) : history).slice(0, limit);
504
519
  }
505
520
  function modelState(model) {
506
521
  if (!model)
package/docs/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases and verification
2
2
 
3
+ ## 0.12.1 — keep run history stable when an archive changes
4
+
5
+ The local UI orders saved runs by the report's recorded finish time and start time. Adding a note or copying an archive leaves the order and pagination unchanged. Undated reports remain available at the end of the list.
6
+
3
7
  ## 0.12.0 — preview failed cases and order reruns by execution time
4
8
 
5
9
  `flow-qa rerun <saved-run> --dry-run` verifies the saved suite and target, then prints the target name and the failed or errored case IDs. The preview makes no target requests and writes no reports. `reruns` orders children by recorded finish time, start time and run ID. Undated legacy reports remain in the list.
package/docs/ui.md CHANGED
@@ -74,7 +74,7 @@ From version `0.2.6`, **Case library** filters saved suites as you type in **Sea
74
74
 
75
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
76
 
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.
77
+ Results load 50 at a time, newest first by the report's recorded finish time, then start time and run ID. Reports without a finish time use the start time. Older reports without either timestamp appear last and remain available. Adding a note or copying a run directory leaves the order unchanged. **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.
78
78
 
79
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.
80
80
 
package/llms.txt CHANGED
@@ -7,3 +7,4 @@
7
7
  - [External agent handoff](docs/agent-handoff.md): Bundle contract and result-review limits.
8
8
  - [CLI and overview](README.md): Setup, commands, and result interpretation.
9
9
  - [한국어 안내](README.ko.md): Korean overview.
10
+ - [@ihyeon QA Suite compatibility hub](https://qa.hyeonse.dev/): standalone usage and optional package pairing across all six `@ihyeon` npm packages.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihyeon/flow-qa",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "license": "MIT",
5
5
  "author": "Hyeonse Im",
6
6
  "repository": {