@ihyeon/error-to-test 0.2.8 → 0.4.0
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 +18 -6
- package/README.md +23 -5
- package/dist/cli.js +28 -7
- package/dist/coverage.d.ts +29 -0
- package/dist/coverage.js +134 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/readiness.d.ts +3 -0
- package/dist/readiness.js +4 -1
- package/dist/result-selection.d.ts +6 -0
- package/dist/result-selection.js +60 -1
- package/dist/results.js +15 -5
- package/dist/run-summary.d.ts +16 -1
- package/dist/run-summary.js +70 -8
- package/docs/expansion-research-2026-11-17.md +23 -0
- package/docs/releases.md +19 -1
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -254,13 +254,24 @@ error-to-test readiness ./review-analysis --format json
|
|
|
254
254
|
|
|
255
255
|
저장된 번들의 질문과 검토 상태를 점검하는 기능입니다. 브라우저 실행·계정·준비 데이터·수집 범위를 확인하거나 연결 실행 결과를 읽지는 않습니다. `--top`·`--min-count`·이전 분석 기준으로 제외된 묶음은 선택 TC 건수에 포함되지 않습니다. 검토 확인만으로 미해결 맥락이 사라지지 않으며, 빈 선택도 통과시키지 않습니다. 원본 입력·프로필 바이트 확인은 `verify --input ... --profile ...`로 별도 수행하세요. 번들 경로와 선택적인 `--format text|json`만 받으며 파일을 저장하거나 기존 TC를 승인하지 않습니다.
|
|
256
256
|
|
|
257
|
+
`coverage`는 저장된 번들을 검증한 뒤 **관측된 오류 묶음 전체**를 `unselected`·`blocked`·`review-ready`로 나눠 보여줍니다. 묶음별 선택 TC ID, 간결한 사유 코드와 다음 행동이 포함됩니다. 여러 TC가 연결된 묶음은 모든 TC의 기록된 차단 사유가 없고 검토 확인이 끝나야 `review-ready`입니다.
|
|
258
|
+
|
|
259
|
+
```sh
|
|
260
|
+
error-to-test coverage ./review-analysis
|
|
261
|
+
error-to-test coverage ./review-analysis --format json
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
JSON 스키마는 `error-to-test/coverage-1`입니다. `outside-explicit-group-filter`는 저장된 `--group` 목록 밖임을 정확히 나타냅니다. 그 밖의 미선택은 `not-selected-in-saved-bundle`로 표시합니다. 이전 번들에는 `--top`·`--min-count` 수치가 구조화돼 있지 않아 묶음별 제외 원인을 추측하지 않습니다. 원본 입력의 baseline·group·min-count·top 선택을 검토하고 필요한 묶음을 다시 분석하세요. 차단 사유 코드는 검토 대기·맥락 부족·기록된 질문을 구분하고, 실제 질문은 `readiness`에서 확인합니다. 이 명령은 파일과 연결 실행 결과를 바꾸지 않으며 정상 보고서가 출력되면 미선택·차단 묶음이 있어도 종료 코드 0, 잘못되거나 변경된 번들은 1입니다.
|
|
265
|
+
|
|
266
|
+
분모는 **저장된 입력에서 관측된 묶음**입니다. 서비스 전체 오류·영향 사용자·제품 흐름의 테스트 커버리지나 실행 성공률이 아닙니다. `review-ready`는 실행 준비 기록이며 통과 증거가 아닙니다. API는 `await readCoverage(directory)`와 `renderCoverage(summary)`입니다.
|
|
267
|
+
|
|
257
268
|
Flow QA 설치와 실행 대상 설정은 별도로 필요합니다. 위 `flows/`·`cases/` 구조를 기존 검토 화면에서 읽을 수 있습니다. 분석 명령은 브라우저를 실행하거나 외부 모델에 요청하지 않습니다. TC 통과만으로 원래 오류를 수정 완료 처리하지 않습니다.
|
|
258
269
|
|
|
259
270
|
실행 후 `node bin/error-to-test.mjs link-run .error-to-test/reviewed --report /path/to/qa-report.json`으로 결과를 원래 오류 묶음에 연결할 수 있습니다. suite 해시가 일치해야 하며 전체 실행은 모든 case ID를 포함해야 합니다. 일부 케이스만 실행한 Flow QA 보고서는 `selection.caseIds`가 보고된 케이스와 정확히 일치하고 `selection.totalCases`가 전체 suite 크기와 일치할 때 연결합니다. 알 수 없는·중복된 ID와 선택 선언 없는 누락은 거부합니다. 결과는 `results/<runId>.json`에 저장합니다. 원본 e2e 리포트 대신 Flow QA가 정리한 `report-1`을 사용하세요.
|
|
260
271
|
|
|
261
272
|
선택 실행 결과에는 `selection: { mode: 'selected', totalCases, selectedCaseIds }`를 기록하며 요약의 최신 실행에도 포함합니다. 기존 전체 실행 결과는 계속 읽을 수 있고, 새 선택 실행 결과는 이 버전 이상의 reader가 필요합니다. 이전 reader는 추가 필드를 거부합니다. 최신 실행에서 빠진 케이스는 과거에 통과했어도 `not-run`이며, 미실행을 CI 실패로 처리하려면 `results --fail-on not-run`을 사용하세요.
|
|
262
273
|
|
|
263
|
-
보고서에 실행 대상이 있으면 정제한
|
|
274
|
+
보고서에 필요한 정보가 모두 있는 웹·모바일 실행 대상이 있으면 정제한 `targetName`과 `targetFingerprint`를 저장합니다. fingerprint는 Flow QA와 동일하게 웹 `{ kind: 'web', url }`, 모바일 `{ kind: 'mobile', platform, bundleId, device }`를 이 순서로 직렬화한 SHA-256입니다. 이름이 같아도 대상 정보가 다르면 서로 다른 실행으로 구별합니다. 대상 원본 값은 결과에 복사하지 않고 이름과 사유에서도 제거합니다. 다만 fingerprint는 대상을 아는 사람이 다시 계산해 대조할 수 있는 **안정적인 식별자이며 익명화가 아닙니다**. 이전 reader는 새 필드를 거부합니다. fingerprint가 없는 기존 전체·선택 실행 결과는 계속 읽지만 특정 대상 범위에는 넣지 않습니다. Flow QA가 초기 오류·중단을 빈 웹 URL로 보고하거나, 기기 지정이 없어 차단·중단된 모바일 실행을 빈 device로 보고한 경우에는 정제한 이름만 보존하고 fingerprint를 만들지 않습니다.
|
|
264
275
|
|
|
265
276
|
연결한 결과는 `results`로 오류 묶음별 최신 TC 결과를 모아 볼 수 있습니다.
|
|
266
277
|
|
|
@@ -268,15 +279,16 @@ Flow QA 설치와 실행 대상 설정은 별도로 필요합니다. 위 `flows/
|
|
|
268
279
|
error-to-test results .error-to-test/reviewed
|
|
269
280
|
error-to-test results .error-to-test/reviewed --out ./run-summary.md
|
|
270
281
|
error-to-test results .error-to-test/reviewed --format json --out ./run-summary.json
|
|
282
|
+
error-to-test results .error-to-test/reviewed --target-fingerprint "$TARGET_FINGERPRINT" --fail-on not-run
|
|
271
283
|
```
|
|
272
284
|
|
|
273
|
-
연결된 실행 수, 최신 실행의 상태·시각, TC 상태별 건수와 묶음별 결과·사유를 표시합니다. 통과·실패·flaky·차단·건너뜀·오류를 구분하고, 실행 결과가 없으면 선택된 TC를 `not-run`으로 표시합니다. TC가 선택되지 않은 원본 묶음도 남습니다.
|
|
285
|
+
연결된 실행 수, 최신 실행의 상태·시각, TC 상태별 건수와 묶음별 결과·사유를 표시합니다. 대상별 fingerprint·정제된 이름·실행 수와 범위를 알 수 없는 기존/대상 없는/초기 실패 실행 수도 표시합니다. 먼저 필터 없는 JSON의 `targets[].fingerprint` 또는 Markdown에서 값을 확인하고 `--target-fingerprint`나 API의 `readRunSummary(directory, { targetFingerprint })`에 넣으세요. 64자리 소문자 16진수만 받으며, 해당 fingerprint가 없으면 빈 결과를 통과 처리하지 않고 오류(종료 코드 `1`)를 반환합니다. 대상 범위에서는 `runCount`가 그 대상의 실행 수, `excludedRunCount`가 제외된 전체 실행 수이며 최신 실행·TC 상태도 그 대상만 기준으로 합니다. 범위 밖의 결과 파일도 모두 검증합니다. 통과·실패·flaky·차단·건너뜀·오류를 구분하고, 실행 결과가 없으면 선택된 TC를 `not-run`으로 표시합니다. TC가 선택되지 않은 원본 묶음도 남습니다.
|
|
274
286
|
|
|
275
|
-
보고된 종료 시각이 가장 늦은 실행 하나를 기준으로 합니다. 종료 시각이 같으면 시작 시각, 실행 ID 순으로 결정하며 파일 수정 시각은 사용하지 않습니다. 여러
|
|
287
|
+
보고된 종료 시각이 가장 늦은 실행 하나를 기준으로 합니다. 종료 시각이 같으면 시작 시각, 실행 ID 순으로 결정하며 파일 수정 시각은 사용하지 않습니다. 필터가 없으면 기존처럼 전체 연결 실행 중 최신 하나를 고르고, 대상이 여러 개이거나 fingerprint가 없는 실행이 있으면 경고합니다. 대상 필터를 지정하면 대상 없는 실행과 이름만 저장한 기존 실행은 제외합니다. 여러 실행이나 다른 대상의 통과 결과를 섞지 않습니다. 연결된 실행이 있으면 검토 대기와 미확인 맥락도 표시하며, 결과를 원래 오류의 수정 완료나 실행 승인으로 취급하지 않습니다.
|
|
276
288
|
|
|
277
289
|
출력 전에 번들과 연결 결과의 형식·원본/suite 해시·case/group/event 연결·상태·시각을 검사합니다. 오래된 결과라도 잘못된 JSON이 있으면 실패하며, 기존 산출물과 결과 파일은 수정하지 않습니다. 결과 폴더는 최대 1,000개 항목, 각 JSON은 2 MiB, 전체 결과는 64 MiB까지 지원합니다. 다른 확장자의 부수 파일은 무시하고 잘못된 JSON 이름·심볼릭 링크·일반 파일이 아닌 결과·한도 초과는 거부합니다. `--out`은 번들의 `results` 폴더 밖에 있는 새 파일만 허용합니다.
|
|
278
290
|
|
|
279
|
-
API에서는 `await readRunSummary(directory)`로
|
|
291
|
+
API에서는 `await readRunSummary(directory)`로 전체 요약을 읽고 `renderRunSummary(summary)`로 Markdown을 만듭니다. 대상별 조회는 `await readRunSummary(directory, { targetFingerprint: summary.targets[0].fingerprint })`를 사용합니다. `targets`가 비어 있으면 지정할 수 있는 대상이 없습니다.
|
|
280
292
|
|
|
281
293
|
CI에서는 `results --fail-on`으로 **최신 연결 실행의 TC 상태에 따라 실패 여부**를 정할 수 있습니다.
|
|
282
294
|
|
|
@@ -295,9 +307,9 @@ error-to-test results ./analysis --fail-on failed --fail-on error --fail-on not-
|
|
|
295
307
|
|
|
296
308
|
전체 보고서를 출력하거나 저장한 뒤 0 또는 2를 반환하고 숫자로 된 판정 요약은 stderr에 씁니다. JSON stdout은 기존 `error-to-test/run-summary-1` 형식이며 판정 필드를 추가하지 않습니다. 출력 오류는 판정 요약 없이 코드 1로 처리하고 기존 파일은 보존합니다.
|
|
297
309
|
|
|
298
|
-
최신 실행
|
|
310
|
+
선택한 대상 범위의 최신 실행 하나에 있는 TC 결과만 평가하며 과거 실패나 다른 대상의 결과를 합치거나 실행 전체 상태를 별도 조건으로 삼지 않습니다. 연결 실행이 없으면 선택된 TC는 `not-run`이므로 미실행도 실패시킬 때 이 값을 지정하세요. 지정하지 않은 상태는 실패 조건이 아니지만, 선택된 TC가 없는 결과는 항상 코드 2입니다. 검토 대기와 미해결 맥락은 실행 전 `readiness`로 별도 점검하세요. 정책 통과는 검토 승인·브라우저 실행 증명·원본 오류 수정 완료를 의미하지 않습니다.
|
|
299
311
|
|
|
300
|
-
|
|
312
|
+
`--fail-on`을 생략하면 기존 결과 조회 동작과 종료 코드를 유지합니다. `--fail-on`과 `--target-fingerprint`는 `results` 전용입니다. 요약은 `error-to-test/run-summary-1`을 유지하면서 대상 목록·범위 필드를 추가합니다. API에서는 `readRunSummary(directory, { targetFingerprint })`가 반환한 `counts`로 정책을 적용할 수 있습니다.
|
|
301
313
|
|
|
302
314
|
직접 입력은 문자열, 텍스트 파일, 표준 입력, `error-to-test/manual-1` JSON을 지원합니다. 파일 구조는 [수동 오류 예제](examples/manual.json), 정상 기대 동작과 단계 연결은 [프로필 예제](examples/profile.json)를 참고하세요. 전체 옵션은 `node bin/error-to-test.mjs --help`로 확인할 수 있습니다.
|
|
303
315
|
|
package/README.md
CHANGED
|
@@ -346,6 +346,19 @@ console.log(renderReadiness(summary));
|
|
|
346
346
|
// API calls return a summary; only the CLI assigns readiness exit codes.
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
+
### Audit the saved TC selection scope
|
|
350
|
+
|
|
351
|
+
`coverage` verifies a saved bundle and accounts for **every observed error group**, including groups without a selected TC. It reports `unselected`, `blocked`, or `review-ready` for each group, the selected case IDs, concise reason codes, and a next action. A group with several cases is `review-ready` only if every selected case has no recorded readiness blocker and review was acknowledged.
|
|
352
|
+
|
|
353
|
+
```sh
|
|
354
|
+
error-to-test coverage ./analysis
|
|
355
|
+
error-to-test coverage ./analysis --format json
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
JSON uses `error-to-test/coverage-1`. `outside-explicit-group-filter` is exact when a saved `--group` list excludes the group. Otherwise `not-selected-in-saved-bundle` avoids guessing whether baseline, minimum count, or top-N removed it; inspect those original selection options and reanalyze the original input with the desired `--group`. Blocked reason codes distinguish pending review, missing context, and recorded case questions; run `readiness` for the actual questions. The command reads no linked results, writes no files, and exits `0` when a valid report is printed, even if groups are unselected or blocked. Invalid/stale bundles fail with `1`.
|
|
359
|
+
|
|
360
|
+
The denominator is groups observed in the supplied saved input, **not** production errors, affected users, product flow coverage, or test execution. `review-ready` is a candidate state, not a passing test. Source collection and retention limits still apply. The API is `await readCoverage(directory)` and `renderCoverage(summary)`; it does not change `readiness` or its exit codes.
|
|
361
|
+
|
|
349
362
|
## JavaScript API
|
|
350
363
|
|
|
351
364
|
```js
|
|
@@ -370,7 +383,7 @@ The run's suite hash and reported case IDs must match. Safe case results are sto
|
|
|
370
383
|
|
|
371
384
|
Selected results add `selection: { mode: 'selected', totalCases, selectedCaseIds }` to `error-to-test/results-1` and the latest run in `error-to-test/run-summary-1`. Older full result files remain supported. Use this version or newer to read selected result files; older readers reject the added selection field. Unselected cases are `not-run`, including when a previous full run passed. Use `results --fail-on not-run` when incomplete execution should fail a CI gate.
|
|
372
385
|
|
|
373
|
-
When a report includes a target, its sanitized
|
|
386
|
+
When a report includes a complete supported web or mobile target, the linked result retains its sanitized `targetName` and a `targetFingerprint`. This SHA-256 value matches Flow QA's canonical identity: web `{ kind: 'web', url }` or mobile `{ kind: 'mobile', platform, bundleId, device }`, serialized in that key order. The target name is only a label; two targets with the same name remain distinct when their identities differ. Raw target fields are scrubbed from linked names and reasons rather than copied into results. The fingerprint is a stable identifier, **not anonymization**: someone who knows or guesses a target can calculate and recognize its fingerprint. Earlier readers reject the added field. Older full and selected result files without a fingerprint remain readable, but cannot be assigned to a target scope. Flow QA may also report an early `error` or `interrupted` with an empty web URL, or a `blocked` or `interrupted` mobile run with an empty device; these known fallback reports retain a sanitized name without inventing a fingerprint and remain unscoped.
|
|
374
387
|
|
|
375
388
|
### Summarize linked runs
|
|
376
389
|
|
|
@@ -380,11 +393,12 @@ Read the latest linked run's case outcomes by original error group:
|
|
|
380
393
|
error-to-test results .error-to-test/reviewed
|
|
381
394
|
error-to-test results .error-to-test/reviewed --out ./run-summary.md
|
|
382
395
|
error-to-test results .error-to-test/reviewed --format json --out ./run-summary.json
|
|
396
|
+
error-to-test results .error-to-test/reviewed --target-fingerprint "$TARGET_FINGERPRINT" --fail-on not-run
|
|
383
397
|
```
|
|
384
398
|
|
|
385
|
-
The summary includes the linked run count, latest run ID/status/timestamps and selected-run scope, case totals, and each group's cases and reported reasons. `passed`, `failed`, `flaky`, `blocked`, `skipped`, and `error` remain separate. Without any linked runs, or when a case was omitted from the latest selected run, that case is `not-run`; groups excluded from TC selection are shown without selected cases. An empty selection does not become a passing result.
|
|
399
|
+
The summary includes the linked run count, latest run ID/status/timestamps and selected-run scope, case totals, and each group's cases and reported reasons. It also lists each available target fingerprint, sanitized reported names, run count, and the number of unscoped legacy, targetless, or early fallback runs. Obtain a fingerprint from unfiltered JSON (`targets[].fingerprint`) or Markdown, then pass it to `--target-fingerprint` or `readRunSummary(directory, { targetFingerprint })`. The filter requires exactly 64 lowercase hex characters. An unknown fingerprint is an error (exit `1`), never a passing empty target. In a scoped summary, `runCount` counts only that target's runs, `excludedRunCount` counts all other runs, and the latest run and case counts come only from that target. Every linked file is still validated before filtering. `passed`, `failed`, `flaky`, `blocked`, `skipped`, and `error` remain separate. Without any linked runs, or when a case was omitted from the latest selected run, that case is `not-run`; groups excluded from TC selection are shown without selected cases. An empty selection does not become a passing result.
|
|
386
400
|
|
|
387
|
-
Latest means the greatest reported `finishedAt`, then `startedAt`, then lexical run ID for ties. One whole run supplies all displayed case outcomes; earlier successes are never combined with newer runs to manufacture an all-passing result. When runs are linked, pending review and missing candidate context remain visible. These are supplied report outcomes, not review approval, independent execution proof, or evidence that the source issue is resolved.
|
|
401
|
+
Latest means the greatest reported `finishedAt`, then `startedAt`, then lexical run ID for ties. Without a target filter, latest still means latest across all linked runs; summaries warn when histories contain multiple target fingerprints or runs without one. A target filter excludes unscoped runs, including older name-only files. One whole run supplies all displayed case outcomes; earlier successes are never combined with newer runs to manufacture an all-passing result. When runs are linked, pending review and missing candidate context remain visible. These are supplied report outcomes, not review approval, independent execution proof, or evidence that the source issue is resolved.
|
|
388
402
|
|
|
389
403
|
The bundle and every linked JSON result are checked before output: schema, source/suite hashes, exact case/group/event mappings, statuses, and timestamps must agree. Invalid older runs also fail the request. The reader accepts up to 1,000 directory entries, 2 MiB per result file, and 64 MiB total result bytes. Non-JSON incidental files are ignored; malformed JSON filenames, symlinks, non-regular result files, and limit violations are rejected. `--out` requires a new file outside the bundle's `results` directory and never overwrites existing content. Analysis artifacts and linked results remain unchanged.
|
|
390
404
|
|
|
@@ -396,6 +410,10 @@ import { readRunSummary, renderRunSummary } from '@ihyeon/error-to-test';
|
|
|
396
410
|
const summary = await readRunSummary('./analysis');
|
|
397
411
|
console.log(summary.counts);
|
|
398
412
|
console.log(renderRunSummary(summary));
|
|
413
|
+
if (summary.targets.length) {
|
|
414
|
+
const targetSummary = await readRunSummary('./analysis', { targetFingerprint: summary.targets[0].fingerprint });
|
|
415
|
+
console.log(targetSummary.counts);
|
|
416
|
+
}
|
|
399
417
|
```
|
|
400
418
|
|
|
401
419
|
### Fail CI on selected case outcomes
|
|
@@ -417,9 +435,9 @@ Choose exact values from `failed`, `flaky`, `blocked`, `skipped`, `error`, and `
|
|
|
417
435
|
|
|
418
436
|
The full existing Markdown/JSON report is output or saved before returning `0` or `2`. A numeric gate summary goes to stderr; JSON stdout remains `error-to-test/run-summary-1` without gate fields. Output errors take precedence and produce exit `1` without a gate outcome; existing output files and bundle results are preserved.
|
|
419
437
|
|
|
420
|
-
Only the case outcomes from the one latest linked run are evaluated. Historical failures are not combined with newer results, and the overall run status is not a separate gate condition. Without a linked run, selected cases are `not-run`: include `--fail-on not-run` if unexecuted cases should fail. A status you did not choose does not fail the gate, but an empty selection always does. Use `readiness` separately to check recorded context/review blockers before execution. Passing this policy does not approve cases, prove a browser ran, or resolve source errors.
|
|
438
|
+
Only the case outcomes from the one latest linked run in the chosen scope are evaluated. Historical failures and outcomes from other targets are not combined with newer results, and the overall run status is not a separate gate condition. Without a linked run, selected cases are `not-run`: include `--fail-on not-run` if unexecuted cases should fail. A status you did not choose does not fail the gate, but an empty selection always does. Use `readiness` separately to check recorded context/review blockers before execution. Passing this policy does not approve cases, prove a browser ran, or resolve source errors.
|
|
421
439
|
|
|
422
|
-
Omitting `--fail-on` preserves the existing results behavior and exit codes.
|
|
440
|
+
Omitting `--fail-on` preserves the existing results behavior and exit codes. Both `--fail-on` and `--target-fingerprint` are results-only. The summary keeps `error-to-test/run-summary-1` with additive target inventory and scope fields. API callers can apply their own policy to the `counts` returned by `await readRunSummary(directory, { targetFingerprint })`.
|
|
423
441
|
|
|
424
442
|
## Data handling and checks
|
|
425
443
|
|
package/dist/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ import { redactText } from "./redact.js";
|
|
|
11
11
|
import { linkFlowQaReport } from "./results.js";
|
|
12
12
|
import { readRunSummary, renderRunSummary } from "./run-summary.js";
|
|
13
13
|
import { readReadiness, renderReadiness } from "./readiness.js";
|
|
14
|
+
import { readCoverage, renderCoverage } from "./coverage.js";
|
|
14
15
|
import { refineBundle } from "./refinement.js";
|
|
15
16
|
import { readIssueReport } from "./issue-report.js";
|
|
16
17
|
const help = `Error to Test — local error analysis and regression TC drafts
|
|
@@ -28,8 +29,9 @@ const help = `Error to Test — local error analysis and regression TC drafts
|
|
|
28
29
|
error-to-test refine new-directory --profile updated.json --out refined-directory [--reviewed]
|
|
29
30
|
error-to-test issue new-directory --group GROUP_ID [--out issue.md]
|
|
30
31
|
error-to-test link-run new-directory --report path/to/qa-report.json
|
|
31
|
-
error-to-test results new-directory [--format text|json] [--out summary.md] [--fail-on STATUS ...]
|
|
32
|
+
error-to-test results new-directory [--format text|json] [--out summary.md] [--target-fingerprint SHA256] [--fail-on STATUS ...]
|
|
32
33
|
error-to-test readiness new-directory [--format text|json]
|
|
34
|
+
error-to-test coverage new-directory [--format text|json]
|
|
33
35
|
error-to-test compare BASELINE CURRENT [--format text|json] [--out comparison.md] [--max-new N]
|
|
34
36
|
|
|
35
37
|
Options:
|
|
@@ -38,8 +40,10 @@ Options:
|
|
|
38
40
|
--format auto|json|jsonl|text Analyze input format; JSONL requires explicit selection and one record per line; auto rejects malformed JSON-looking input
|
|
39
41
|
--format text|json Results summary format (default: text Markdown)
|
|
40
42
|
--fail-on STATUS Results gate: failed|flaky|blocked|skipped|error|not-run (repeatable; exit 2 on a match or no selected cases, 1 on error)
|
|
43
|
+
--target-fingerprint SHA256 Scope results and gate to this target's 64-character lowercase SHA-256 fingerprint
|
|
41
44
|
--format text|json Compare format (default: text Markdown)
|
|
42
45
|
--format text|json Readiness format (default: text Markdown; exit 0 ready, 2 blocked/empty, 1 on error)
|
|
46
|
+
--format text|json Observed group coverage format (default: text Markdown; read-only, no gate)
|
|
43
47
|
--profile FILE Confirmed app scenarios and explicit assertions (analyze/verify); existing profile to extend (init-profile)
|
|
44
48
|
--profile FILE Replacement profile for the bundle's previously selected groups (refine; required)
|
|
45
49
|
--baseline DIRECTORY Select only signatures absent from this verified bundle, before --min-count and --top; retain all groups in analysis.json (analyze only)
|
|
@@ -160,7 +164,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
160
164
|
help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string', multiple: true }, error: { type: 'string' }, report: { type: 'string' },
|
|
161
165
|
format: { type: 'string' }, profile: { type: 'string' }, baseline: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
|
|
162
166
|
release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
|
|
163
|
-
top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, 'fail-on': { type: 'string', multiple: true }, out: { type: 'string' }, reviewed: { type: 'boolean' },
|
|
167
|
+
top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, 'fail-on': { type: 'string', multiple: true }, 'target-fingerprint': { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
|
|
164
168
|
reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
|
|
165
169
|
expected: { type: 'string' }, 'expected-source': { type: 'string' },
|
|
166
170
|
} });
|
|
@@ -175,7 +179,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
175
179
|
}
|
|
176
180
|
if (positionals.length === 0) {
|
|
177
181
|
if (Object.keys(values).length)
|
|
178
|
-
throw new Error('A command is required. Use analyze, init-profile, refine, issue, verify, link-run, results, compare, or
|
|
182
|
+
throw new Error('A command is required. Use analyze, init-profile, refine, issue, verify, link-run, results, compare, readiness, or coverage. See --help.');
|
|
179
183
|
process.stdout.write(help);
|
|
180
184
|
return;
|
|
181
185
|
}
|
|
@@ -275,8 +279,8 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
275
279
|
if (command === 'results') {
|
|
276
280
|
if (positionals.length !== 2 || !positionals[1])
|
|
277
281
|
throw new Error('results requires one bundle directory.');
|
|
278
|
-
if (Object.keys(values).some(key => !['format', 'out', 'fail-on', 'help'].includes(key)))
|
|
279
|
-
throw new Error('Unsupported option for results. Use only --format text|json, --out FILE, and --fail-on STATUS.');
|
|
282
|
+
if (Object.keys(values).some(key => !['format', 'out', 'fail-on', 'target-fingerprint', 'help'].includes(key)))
|
|
283
|
+
throw new Error('Unsupported option for results. Use only --format text|json, --out FILE, --target-fingerprint SHA256, and --fail-on STATUS.');
|
|
280
284
|
const format = values.format ?? 'text';
|
|
281
285
|
if (format !== 'text' && format !== 'json')
|
|
282
286
|
throw new Error('results --format must be text or json.');
|
|
@@ -286,7 +290,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
286
290
|
}
|
|
287
291
|
const failOn = requestedStatuses === undefined ? undefined : resultsGateStatuses.filter(status => requestedStatuses.includes(status));
|
|
288
292
|
const bundle = resolve(positionals[1]);
|
|
289
|
-
const summary = await readRunSummary(bundle);
|
|
293
|
+
const summary = await readRunSummary(bundle, { targetFingerprint: values['target-fingerprint'] });
|
|
290
294
|
const content = format === 'json' ? jsonText(summary) : renderRunSummary(summary);
|
|
291
295
|
if (Buffer.byteLength(content) > 64 * 1024 * 1024)
|
|
292
296
|
throw new Error('The results summary exceeds 64 MiB. Narrow the bundle before requesting output.');
|
|
@@ -349,6 +353,21 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
349
353
|
process.exitCode = 2;
|
|
350
354
|
return;
|
|
351
355
|
}
|
|
356
|
+
if (command === 'coverage') {
|
|
357
|
+
if (positionals.length !== 2 || !positionals[1]?.trim())
|
|
358
|
+
throw new Error('coverage requires one bundle directory.');
|
|
359
|
+
if (Object.keys(values).some(key => !['format', 'help'].includes(key)))
|
|
360
|
+
throw new Error('Unsupported option for coverage. Use only --format text|json.');
|
|
361
|
+
const format = values.format ?? 'text';
|
|
362
|
+
if (format !== 'text' && format !== 'json')
|
|
363
|
+
throw new Error('coverage --format must be text or json.');
|
|
364
|
+
const summary = await readCoverage(resolve(positionals[1]));
|
|
365
|
+
const content = format === 'json' ? jsonText(summary) : renderCoverage(summary);
|
|
366
|
+
if (Buffer.byteLength(content) > 64 * 1024 * 1024)
|
|
367
|
+
throw new Error('The coverage summary exceeds 64 MiB. Narrow the bundle before requesting output.');
|
|
368
|
+
await writeGateOutput(content);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
352
371
|
if (command === 'compare') {
|
|
353
372
|
if (positionals.length !== 3 || !positionals[1] || !positionals[2])
|
|
354
373
|
throw new Error('compare requires BASELINE and CURRENT bundle directories.');
|
|
@@ -422,11 +441,13 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
422
441
|
return;
|
|
423
442
|
}
|
|
424
443
|
if (command !== 'analyze' || positionals.length !== 1)
|
|
425
|
-
throw new Error('Use analyze, init-profile, refine, issue, verify, link-run, results, compare, or
|
|
444
|
+
throw new Error('Use analyze, init-profile, refine, issue, verify, link-run, results, compare, readiness, or coverage. See --help.');
|
|
426
445
|
if (values.report)
|
|
427
446
|
throw new Error('--report applies to link-run only.');
|
|
428
447
|
if (values['fail-on'] !== undefined)
|
|
429
448
|
throw new Error('--fail-on applies to results only.');
|
|
449
|
+
if (values['target-fingerprint'] !== undefined)
|
|
450
|
+
throw new Error('--target-fingerprint applies to results only.');
|
|
430
451
|
if (values['max-new'] !== undefined)
|
|
431
452
|
throw new Error('--max-new applies to compare only.');
|
|
432
453
|
if (values.baseline !== undefined && values.baseline.trim() === '')
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type GroupCoverageStatus = 'unselected' | 'blocked' | 'review-ready';
|
|
2
|
+
export type GroupCoverageReason = 'outside-explicit-group-filter' | 'not-selected-in-saved-bundle' | 'review-pending' | 'needs-context' | 'recorded-blockers';
|
|
3
|
+
export interface CoverageSummary {
|
|
4
|
+
schemaVersion: 'error-to-test/coverage-1';
|
|
5
|
+
inputSha256: string;
|
|
6
|
+
analysisSha256: string;
|
|
7
|
+
suiteSha256?: string;
|
|
8
|
+
reviewed: boolean;
|
|
9
|
+
frequency: 'captured-events' | 'submitted-reports';
|
|
10
|
+
counts: {
|
|
11
|
+
observedGroups: number;
|
|
12
|
+
selectedGroups: number;
|
|
13
|
+
unselectedGroups: number;
|
|
14
|
+
blockedGroups: number;
|
|
15
|
+
reviewReadyGroups: number;
|
|
16
|
+
};
|
|
17
|
+
groups: {
|
|
18
|
+
groupId: string;
|
|
19
|
+
suppliedRecords: number;
|
|
20
|
+
status: GroupCoverageStatus;
|
|
21
|
+
caseIds: string[];
|
|
22
|
+
reasons: GroupCoverageReason[];
|
|
23
|
+
nextAction: string;
|
|
24
|
+
}[];
|
|
25
|
+
warnings: string[];
|
|
26
|
+
}
|
|
27
|
+
/** Account for every observed group in one verified, immutable analysis snapshot. */
|
|
28
|
+
export declare function readCoverage(directory: string): Promise<CoverageSummary>;
|
|
29
|
+
export declare function renderCoverage(summary: CoverageSummary): string;
|
package/dist/coverage.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { literal, readVerifiedBundle } from "./artifacts.js";
|
|
2
|
+
import { summarizeReadiness } from "./readiness.js";
|
|
3
|
+
import { record } from "./validation.js";
|
|
4
|
+
const groupIdPattern = /^group-[0-9a-f]{16}$/;
|
|
5
|
+
const caseIdPattern = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/;
|
|
6
|
+
const shaPattern = /^[0-9a-f]{64}$/;
|
|
7
|
+
function sha(value, label) {
|
|
8
|
+
if (typeof value !== 'string' || !shaPattern.test(value))
|
|
9
|
+
throw new Error(`${label} must be a SHA-256 digest.`);
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function groupId(value, label) {
|
|
13
|
+
if (typeof value !== 'string' || !groupIdPattern.test(value))
|
|
14
|
+
throw new Error(`${label} must be a saved group ID.`);
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function suppliedRecords(value, label) {
|
|
18
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1 || value > 10000) {
|
|
19
|
+
throw new Error(`${label} must be a positive supplied-record count within the input limit.`);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function caseId(value, label) {
|
|
24
|
+
if (typeof value !== 'string' || !caseIdPattern.test(value))
|
|
25
|
+
throw new Error(`${label} must be a Flow QA-compatible ID.`);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
function groupCases(readiness) {
|
|
29
|
+
const cases = new Map();
|
|
30
|
+
for (const item of readiness.cases) {
|
|
31
|
+
const list = cases.get(item.groupId) ?? [];
|
|
32
|
+
list.push(item);
|
|
33
|
+
cases.set(item.groupId, list);
|
|
34
|
+
}
|
|
35
|
+
return cases;
|
|
36
|
+
}
|
|
37
|
+
/** Account for every observed group in one verified, immutable analysis snapshot. */
|
|
38
|
+
export async function readCoverage(directory) {
|
|
39
|
+
const snapshot = await readVerifiedBundle(directory);
|
|
40
|
+
const readiness = summarizeReadiness(snapshot);
|
|
41
|
+
const frequency = record(snapshot.analysis.coverage, 'analysis.coverage').frequency;
|
|
42
|
+
if (frequency !== 'captured-events' && frequency !== 'submitted-reports')
|
|
43
|
+
throw new Error('STALE_BUNDLE: Source frequency is invalid.');
|
|
44
|
+
const cases = groupCases(readiness);
|
|
45
|
+
const requested = snapshot.analysis.groupFilter && typeof snapshot.analysis.groupFilter === 'object'
|
|
46
|
+
? snapshot.analysis.groupFilter.groupIds : undefined;
|
|
47
|
+
if (requested !== undefined && (!Array.isArray(requested) || requested.some(value => typeof value !== 'string' || !groupIdPattern.test(value)))) {
|
|
48
|
+
throw new Error('STALE_BUNDLE: Explicit group filter is invalid.');
|
|
49
|
+
}
|
|
50
|
+
const groups = snapshot.analysis.groups.map((raw, index) => {
|
|
51
|
+
const id = groupId(raw.id, `analysis.groups[${index}].id`);
|
|
52
|
+
const selected = cases.get(id) ?? [];
|
|
53
|
+
const status = selected.length === 0 ? 'unselected'
|
|
54
|
+
: selected.every(item => item.state === 'draft' && item.blockers.length === 0 && readiness.reviewed)
|
|
55
|
+
? 'review-ready' : 'blocked';
|
|
56
|
+
const reasons = status === 'unselected'
|
|
57
|
+
? [Array.isArray(requested) && !requested.includes(id) ? 'outside-explicit-group-filter' : 'not-selected-in-saved-bundle']
|
|
58
|
+
: status === 'review-ready' ? [] : [
|
|
59
|
+
...(!readiness.reviewed ? ['review-pending'] : []),
|
|
60
|
+
...(selected.some(item => item.state === 'needs-context') ? ['needs-context'] : []),
|
|
61
|
+
...(selected.some(item => item.blockers.length > 0) ? ['recorded-blockers'] : []),
|
|
62
|
+
];
|
|
63
|
+
const nextAction = status === 'unselected'
|
|
64
|
+
? `Review baseline, --group, --min-count and --top selection; reanalyze the original input with --group ${id} if this observed group needs a TC.`
|
|
65
|
+
: status === 'blocked'
|
|
66
|
+
? 'Run readiness on this bundle; confirm the requirement and setup, resolve recorded case questions in the profile, then regenerate and review the bundle.'
|
|
67
|
+
: 'Run the exported suite in Flow QA and link its normalized report to assess execution outcomes.';
|
|
68
|
+
return { groupId: id, suppliedRecords: suppliedRecords(raw.count, `analysis.groups[${index}].count`),
|
|
69
|
+
status, caseIds: selected.map(item => caseId(item.caseId, 'readiness.caseId')), reasons, nextAction };
|
|
70
|
+
});
|
|
71
|
+
const selectedGroups = groups.filter(group => group.status !== 'unselected').length;
|
|
72
|
+
const blockedGroups = groups.filter(group => group.status === 'blocked').length;
|
|
73
|
+
const reviewReadyGroups = groups.filter(group => group.status === 'review-ready').length;
|
|
74
|
+
return {
|
|
75
|
+
schemaVersion: 'error-to-test/coverage-1',
|
|
76
|
+
inputSha256: sha(readiness.inputSha256, 'readiness.inputSha256'),
|
|
77
|
+
analysisSha256: sha(readiness.analysisSha256, 'readiness.analysisSha256'),
|
|
78
|
+
...(readiness.suiteSha256 ? { suiteSha256: sha(readiness.suiteSha256, 'readiness.suiteSha256') } : {}),
|
|
79
|
+
reviewed: readiness.reviewed,
|
|
80
|
+
frequency,
|
|
81
|
+
counts: { observedGroups: groups.length, selectedGroups, unselectedGroups: groups.length - selectedGroups,
|
|
82
|
+
blockedGroups, reviewReadyGroups },
|
|
83
|
+
groups,
|
|
84
|
+
warnings: [...readiness.warnings,
|
|
85
|
+
'This report counts only groups observed in the saved input. Unselected groups have no TC in this bundle; inspect the original selection filters before reanalyzing.',
|
|
86
|
+
'Review-ready is a recorded candidate state, not browser execution, a passing test, resolved error, or complete source collection.'],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function renderCoverage(summary) {
|
|
90
|
+
if (summary.schemaVersion !== 'error-to-test/coverage-1' || typeof summary.reviewed !== 'boolean')
|
|
91
|
+
throw new Error('Invalid coverage summary.');
|
|
92
|
+
if (summary.frequency !== 'captured-events' && summary.frequency !== 'submitted-reports')
|
|
93
|
+
throw new Error('Invalid source frequency.');
|
|
94
|
+
const { counts } = summary;
|
|
95
|
+
const positive = (value, label) => {
|
|
96
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0 || value > 10000)
|
|
97
|
+
throw new Error(`Invalid ${label}.`);
|
|
98
|
+
return value;
|
|
99
|
+
};
|
|
100
|
+
const observed = positive(counts.observedGroups, 'observedGroups');
|
|
101
|
+
const selected = positive(counts.selectedGroups, 'selectedGroups');
|
|
102
|
+
const unselected = positive(counts.unselectedGroups, 'unselectedGroups');
|
|
103
|
+
const blocked = positive(counts.blockedGroups, 'blockedGroups');
|
|
104
|
+
const ready = positive(counts.reviewReadyGroups, 'reviewReadyGroups');
|
|
105
|
+
if (summary.groups.length !== observed || selected + unselected !== observed || blocked + ready !== selected) {
|
|
106
|
+
throw new Error('Invalid coverage counts.');
|
|
107
|
+
}
|
|
108
|
+
const lines = ['# Error to Test observed group coverage', '',
|
|
109
|
+
`Input SHA-256: ${sha(summary.inputSha256, 'summary.inputSha256')}`,
|
|
110
|
+
`Analysis SHA-256: ${sha(summary.analysisSha256, 'summary.analysisSha256')}`,
|
|
111
|
+
...(summary.suiteSha256 ? [`Suite SHA-256: ${sha(summary.suiteSha256, 'summary.suiteSha256')}`] : []),
|
|
112
|
+
`Supplied record meaning: ${summary.frequency}`,
|
|
113
|
+
`Review acknowledged: ${summary.reviewed ? 'yes' : 'no'}`, '',
|
|
114
|
+
'## Observed group counts', '',
|
|
115
|
+
`- Observed: ${observed}`, `- Selected: ${selected}`, `- Unselected: ${unselected}`,
|
|
116
|
+
`- Blocked: ${blocked}`, `- Review-ready: ${ready}`, '', '## Groups', ''];
|
|
117
|
+
if (!summary.groups.length)
|
|
118
|
+
lines.push('No observed groups.', '');
|
|
119
|
+
const seen = new Set();
|
|
120
|
+
for (const item of summary.groups) {
|
|
121
|
+
const id = groupId(item.groupId, 'summary.groupId');
|
|
122
|
+
if (seen.has(id) || !['unselected', 'blocked', 'review-ready'].includes(item.status))
|
|
123
|
+
throw new Error('Invalid coverage group.');
|
|
124
|
+
seen.add(id);
|
|
125
|
+
if (!Array.isArray(item.caseIds) || item.caseIds.some(value => typeof value !== 'string' || !caseIdPattern.test(value)))
|
|
126
|
+
throw new Error('Invalid coverage case IDs.');
|
|
127
|
+
if (!Array.isArray(item.reasons) || item.reasons.some(reason => !['outside-explicit-group-filter', 'not-selected-in-saved-bundle', 'review-pending', 'needs-context', 'recorded-blockers'].includes(reason))) {
|
|
128
|
+
throw new Error('Invalid coverage reasons.');
|
|
129
|
+
}
|
|
130
|
+
lines.push(`### ${id}`, '', `Status: ${item.status}`, `Supplied records: ${suppliedRecords(item.suppliedRecords, 'summary.suppliedRecords')}`, `Cases: ${item.caseIds.length ? item.caseIds.join(', ') : 'none'}`, `Reasons: ${item.reasons.length ? item.reasons.join(', ') : 'none'}`, 'Next action:', '', literal(item.nextAction), '');
|
|
131
|
+
}
|
|
132
|
+
lines.push('', '## Warnings and limits', '', literal(summary.warnings.join('\n') || 'None'), '');
|
|
133
|
+
return `${lines.join('\n')}\n`;
|
|
134
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export { readIssueReport } from './issue-report.ts';
|
|
|
8
8
|
export { linkFlowQaReport } from './results.ts';
|
|
9
9
|
export { createProfileTemplate, type ProfileTemplateOptions } from './profile-template.ts';
|
|
10
10
|
export { refineBundle } from './refinement.ts';
|
|
11
|
-
export { readRunSummary, renderRunSummary, type RunSummary, type LinkedRunStatus, type LinkedCaseStatus } from './run-summary.ts';
|
|
11
|
+
export { readRunSummary, renderRunSummary, type RunSummary, type ReadRunSummaryOptions, type LinkedRunStatus, type LinkedCaseStatus } from './run-summary.ts';
|
|
12
12
|
export { readReadiness, renderReadiness, type ReadinessSummary } from './readiness.ts';
|
|
13
|
+
export { readCoverage, renderCoverage, type CoverageSummary, type GroupCoverageStatus, type GroupCoverageReason } from './coverage.ts';
|
|
13
14
|
export { compareBundles, renderComparison, type AnalysisComparison, type ComparisonStatus, type ComparisonSide, type ComparisonOccurrence, type ComparisonIssue } from './comparison.ts';
|
|
14
15
|
export type * from './types.ts';
|
package/dist/index.js
CHANGED
|
@@ -10,4 +10,5 @@ export { createProfileTemplate } from "./profile-template.js";
|
|
|
10
10
|
export { refineBundle } from "./refinement.js";
|
|
11
11
|
export { readRunSummary, renderRunSummary } from "./run-summary.js";
|
|
12
12
|
export { readReadiness, renderReadiness } from "./readiness.js";
|
|
13
|
+
export { readCoverage, renderCoverage } from "./coverage.js";
|
|
13
14
|
export { compareBundles, renderComparison } from "./comparison.js";
|
package/dist/readiness.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readVerifiedBundle } from './artifacts.ts';
|
|
1
2
|
export interface ReadinessSummary {
|
|
2
3
|
schemaVersion: 'error-to-test/readiness-1';
|
|
3
4
|
inputSha256: string;
|
|
@@ -24,4 +25,6 @@ export interface ReadinessSummary {
|
|
|
24
25
|
warnings: string[];
|
|
25
26
|
}
|
|
26
27
|
export declare function readReadiness(directory: string): Promise<ReadinessSummary>;
|
|
28
|
+
/** Share one verified snapshot with other read-only reports. */
|
|
29
|
+
export declare function summarizeReadiness({ analysis, provenance, suite, verification }: Awaited<ReturnType<typeof readVerifiedBundle>>): ReadinessSummary;
|
|
27
30
|
export declare function renderReadiness(summary: ReadinessSummary): string;
|
package/dist/readiness.js
CHANGED
|
@@ -31,7 +31,10 @@ function count(value, label) {
|
|
|
31
31
|
return value;
|
|
32
32
|
}
|
|
33
33
|
export async function readReadiness(directory) {
|
|
34
|
-
|
|
34
|
+
return summarizeReadiness(await readVerifiedBundle(directory));
|
|
35
|
+
}
|
|
36
|
+
/** Share one verified snapshot with other read-only reports. */
|
|
37
|
+
export function summarizeReadiness({ analysis, provenance, suite, verification }) {
|
|
35
38
|
const inputSha256 = sha(provenance.inputSha256, 'provenance.inputSha256');
|
|
36
39
|
const analysisSha256 = sha(provenance.analysisSha256, 'provenance.analysisSha256');
|
|
37
40
|
const suiteSha256 = provenance.suiteSha256 === undefined ? undefined : sha(provenance.suiteSha256, 'provenance.suiteSha256');
|
|
@@ -6,4 +6,10 @@ export interface LinkedSelection {
|
|
|
6
6
|
}
|
|
7
7
|
/** Keep a reported label without persisting any URL that may carry sensitive path data. */
|
|
8
8
|
export declare function safeReportedTargetName(value: unknown, label: string): string;
|
|
9
|
+
export declare function validatedTargetFingerprint(value: unknown, label: string): string;
|
|
10
|
+
/** Match Flow QA targetFingerprint's canonical identity and key order exactly. */
|
|
11
|
+
export declare function reportedTargetIdentity(value: unknown, status: string): {
|
|
12
|
+
targetName: string;
|
|
13
|
+
targetFingerprint?: string;
|
|
14
|
+
};
|
|
9
15
|
export declare function validateResultSelection(value: unknown, present: boolean, caseIds: readonly string[], expectedIds: ReadonlySet<string>, source: 'Flow QA report' | 'Linked result'): LinkedSelection | undefined;
|
package/dist/result-selection.js
CHANGED
|
@@ -1,10 +1,69 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import { redactText } from "./redact.js";
|
|
2
|
-
import { text } from "./validation.js";
|
|
3
|
+
import { record, text } from "./validation.js";
|
|
3
4
|
/** Keep a reported label without persisting any URL that may carry sensitive path data. */
|
|
4
5
|
export function safeReportedTargetName(value, label) {
|
|
5
6
|
const name = text(value, label);
|
|
6
7
|
return redactText(name.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s<>"']+|(?<!:)\/\/[^\s<>"']+/gi, '[redacted-url]'));
|
|
7
8
|
}
|
|
9
|
+
const fingerprintPattern = /^[0-9a-f]{64}$/;
|
|
10
|
+
export function validatedTargetFingerprint(value, label) {
|
|
11
|
+
if (typeof value !== 'string' || !fingerprintPattern.test(value)) {
|
|
12
|
+
throw new Error(`${label} must be a lowercase SHA-256 fingerprint (64 hex characters).`);
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
/** Match Flow QA targetFingerprint's canonical identity and key order exactly. */
|
|
17
|
+
export function reportedTargetIdentity(value, status) {
|
|
18
|
+
const target = record(value, 'report.target');
|
|
19
|
+
const kind = target.kind;
|
|
20
|
+
const keys = kind === 'mobile' ? ['name', 'kind', 'platform', 'bundleId', 'device'] : ['name', 'kind', 'url'];
|
|
21
|
+
if ((kind !== undefined && kind !== 'web' && kind !== 'mobile')
|
|
22
|
+
|| Object.keys(target).some(key => !keys.includes(key))) {
|
|
23
|
+
throw new Error('report.target has an unsupported shape or kind.');
|
|
24
|
+
}
|
|
25
|
+
let targetName = text(target.name, 'report.target.name');
|
|
26
|
+
let identity;
|
|
27
|
+
if (kind === 'mobile') {
|
|
28
|
+
if (target.platform !== 'ios' && target.platform !== 'android')
|
|
29
|
+
throw new Error('report.target.platform must be ios or android.');
|
|
30
|
+
const bundleId = text(target.bundleId, 'report.target.bundleId');
|
|
31
|
+
if (target.device === '') {
|
|
32
|
+
if (status !== 'blocked' && status !== 'interrupted')
|
|
33
|
+
throw new Error('report.target.device may be empty only for a blocked or interrupted mobile fallback report.');
|
|
34
|
+
targetName = targetName.replaceAll(bundleId, '[redacted-target]');
|
|
35
|
+
return { targetName: safeReportedTargetName(targetName, 'report.target.name') };
|
|
36
|
+
}
|
|
37
|
+
identity = {
|
|
38
|
+
kind: 'mobile', platform: target.platform,
|
|
39
|
+
bundleId,
|
|
40
|
+
device: text(target.device, 'report.target.device'),
|
|
41
|
+
};
|
|
42
|
+
for (const value of [identity.bundleId, identity.device])
|
|
43
|
+
targetName = targetName.replaceAll(value, '[redacted-target]');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (target.url === '') {
|
|
47
|
+
if (kind !== undefined || (status !== 'error' && status !== 'interrupted')) {
|
|
48
|
+
throw new Error('report.target.url may be empty only for an error or interrupted web fallback report.');
|
|
49
|
+
}
|
|
50
|
+
return { targetName: safeReportedTargetName(targetName, 'report.target.name') };
|
|
51
|
+
}
|
|
52
|
+
const url = text(target.url, 'report.target.url');
|
|
53
|
+
try {
|
|
54
|
+
const parsed = new URL(url);
|
|
55
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
|
|
56
|
+
throw new Error('Unsupported protocol');
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
throw new Error('report.target.url must be an HTTP or HTTPS URL.');
|
|
60
|
+
}
|
|
61
|
+
identity = { kind: 'web', url };
|
|
62
|
+
targetName = targetName.replaceAll(url, '[redacted-url]');
|
|
63
|
+
}
|
|
64
|
+
targetName = safeReportedTargetName(targetName, 'report.target.name');
|
|
65
|
+
return { targetName, targetFingerprint: createHash('sha256').update(JSON.stringify(identity)).digest('hex') };
|
|
66
|
+
}
|
|
8
67
|
export function validateResultSelection(value, present, caseIds, expectedIds, source) {
|
|
9
68
|
if (!present) {
|
|
10
69
|
if (caseIds.length !== expectedIds.size)
|
package/dist/results.js
CHANGED
|
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
|
|
|
3
3
|
import { jsonText, readVerifiedBundle } from "./artifacts.js";
|
|
4
4
|
import { record, text, timestamp } from "./validation.js";
|
|
5
5
|
import { redactText } from "./redact.js";
|
|
6
|
-
import {
|
|
6
|
+
import { reportedTargetIdentity, validateResultSelection } from "./result-selection.js";
|
|
7
7
|
const runStatuses = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
|
|
8
8
|
const caseStatuses = new Set(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']);
|
|
9
9
|
/** Associate a normalized Flow QA report with the exact exported immutable suite. */
|
|
@@ -23,6 +23,11 @@ export async function linkFlowQaReport(directory, rawReport) {
|
|
|
23
23
|
const status = text(report.status, 'report.status');
|
|
24
24
|
if (!runStatuses.has(status))
|
|
25
25
|
throw new Error('Invalid Flow QA run status.');
|
|
26
|
+
const rawTarget = report.target === undefined ? undefined : record(report.target, 'report.target');
|
|
27
|
+
const target = rawTarget === undefined ? undefined : reportedTargetIdentity(rawTarget, status);
|
|
28
|
+
const targetValues = rawTarget === undefined ? [] : rawTarget.kind === 'mobile'
|
|
29
|
+
? [rawTarget.bundleId, rawTarget.device]
|
|
30
|
+
: [rawTarget.url];
|
|
26
31
|
if (!Array.isArray(report.cases) || report.cases.length > 100 || !Array.isArray(provenance.mappings))
|
|
27
32
|
throw new Error('Invalid Flow QA case list.');
|
|
28
33
|
const mappings = provenance.mappings.map((item, index) => record(item, `mappings[${index}]`));
|
|
@@ -39,7 +44,14 @@ export async function linkFlowQaReport(directory, rawReport) {
|
|
|
39
44
|
const caseStatus = text(original.status, 'case.status');
|
|
40
45
|
if (!caseStatuses.has(caseStatus))
|
|
41
46
|
throw new Error('Invalid Flow QA case status.');
|
|
42
|
-
|
|
47
|
+
let reason = original.reason === undefined ? undefined : text(original.reason, 'case.reason');
|
|
48
|
+
if (reason !== undefined) {
|
|
49
|
+
for (const value of targetValues)
|
|
50
|
+
if (value)
|
|
51
|
+
reason = reason.replaceAll(value, '[redacted-target]');
|
|
52
|
+
reason = redactText(reason);
|
|
53
|
+
}
|
|
54
|
+
return { ...mapping, status: caseStatus, ...(reason === undefined ? {} : { reason }) };
|
|
43
55
|
});
|
|
44
56
|
const selection = validateResultSelection(report.selection, Object.hasOwn(report, 'selection'), reportCaseIds, new Set(expected.keys()), 'Flow QA report');
|
|
45
57
|
if (status === 'passed' && cases.some(item => item.status === 'failed' || item.status === 'error'))
|
|
@@ -47,13 +59,11 @@ export async function linkFlowQaReport(directory, rawReport) {
|
|
|
47
59
|
const startedAt = timestamp(report.startedAt, 'report.startedAt'), finishedAt = timestamp(report.finishedAt, 'report.finishedAt');
|
|
48
60
|
if (finishedAt < startedAt)
|
|
49
61
|
throw new Error('The run finished before its start timestamp.');
|
|
50
|
-
const targetName = report.target === undefined ? undefined
|
|
51
|
-
: safeReportedTargetName(record(report.target, 'report.target').name, 'report.target.name');
|
|
52
62
|
const output = {
|
|
53
63
|
schemaVersion: 'error-to-test/results-1', runId,
|
|
54
64
|
inputSha256: provenance.inputSha256, suiteSha256: provenance.suiteSha256,
|
|
55
65
|
startedAt, finishedAt,
|
|
56
|
-
status, ...(
|
|
66
|
+
status, ...(target === undefined ? {} : target),
|
|
57
67
|
...(selection === undefined ? {} : { selection }), cases,
|
|
58
68
|
note: 'These results cover the specified assertions. No source issue was automatically closed.',
|
|
59
69
|
};
|
package/dist/run-summary.d.ts
CHANGED
|
@@ -7,12 +7,24 @@ export interface RunSummary {
|
|
|
7
7
|
inputSha256: string;
|
|
8
8
|
suiteSha256?: string;
|
|
9
9
|
runCount: number;
|
|
10
|
+
/** Present only when a target fingerprint was requested. Counts and latestRun then use that target alone. */
|
|
11
|
+
selectedTargetFingerprint?: string;
|
|
12
|
+
/** Number of linked runs excluded from the selected target scope. */
|
|
13
|
+
excludedRunCount?: number;
|
|
14
|
+
/** Linked runs with no fingerprint, including legacy files with only targetName. */
|
|
15
|
+
unscopedRunCount: number;
|
|
16
|
+
targets: {
|
|
17
|
+
fingerprint: string;
|
|
18
|
+
names: string[];
|
|
19
|
+
runCount: number;
|
|
20
|
+
}[];
|
|
10
21
|
latestRun?: {
|
|
11
22
|
runId: string;
|
|
12
23
|
status: LinkedRunStatus;
|
|
13
24
|
startedAt: string;
|
|
14
25
|
finishedAt: string;
|
|
15
26
|
targetName?: string;
|
|
27
|
+
targetFingerprint?: string;
|
|
16
28
|
selection?: LinkedSelection;
|
|
17
29
|
};
|
|
18
30
|
counts: Record<DisplayCaseStatus, number>;
|
|
@@ -29,6 +41,9 @@ export interface RunSummary {
|
|
|
29
41
|
}[];
|
|
30
42
|
warnings: string[];
|
|
31
43
|
}
|
|
32
|
-
export
|
|
44
|
+
export interface ReadRunSummaryOptions {
|
|
45
|
+
targetFingerprint?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function readRunSummary(directory: string, options?: ReadRunSummaryOptions): Promise<RunSummary>;
|
|
33
48
|
export declare function renderRunSummary(summary: RunSummary): string;
|
|
34
49
|
export {};
|
package/dist/run-summary.js
CHANGED
|
@@ -4,7 +4,7 @@ import { join, resolve } from 'node:path';
|
|
|
4
4
|
import { literal, readVerifiedBundle } from "./artifacts.js";
|
|
5
5
|
import { redactText } from "./redact.js";
|
|
6
6
|
import { record, text, timestamp } from "./validation.js";
|
|
7
|
-
import { safeReportedTargetName, validateResultSelection } from "./result-selection.js";
|
|
7
|
+
import { safeReportedTargetName, validatedTargetFingerprint, validateResultSelection } from "./result-selection.js";
|
|
8
8
|
const runStatuses = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
|
|
9
9
|
const caseStatuses = new Set(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']);
|
|
10
10
|
const countStatuses = ['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error', 'not-run'];
|
|
@@ -82,7 +82,7 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
82
82
|
catch {
|
|
83
83
|
throw new Error(`Linked result ${name} is not a valid JSON object.`);
|
|
84
84
|
}
|
|
85
|
-
exactKeys(raw, ['schemaVersion', 'runId', 'inputSha256', 'suiteSha256', 'startedAt', 'finishedAt', 'status', 'cases', 'note'], ['targetName', 'selection'], `Linked result ${name}`);
|
|
85
|
+
exactKeys(raw, ['schemaVersion', 'runId', 'inputSha256', 'suiteSha256', 'startedAt', 'finishedAt', 'status', 'cases', 'note'], ['targetName', 'targetFingerprint', 'selection'], `Linked result ${name}`);
|
|
86
86
|
if (raw.schemaVersion !== 'error-to-test/results-1')
|
|
87
87
|
throw new Error(`Linked result ${name} uses an unsupported schema.`);
|
|
88
88
|
const runId = text(raw.runId, `${name}.runId`);
|
|
@@ -100,6 +100,8 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
100
100
|
throw new Error(`Linked result ${name} finished before it started.`);
|
|
101
101
|
text(raw.note, `${name}.note`);
|
|
102
102
|
const targetName = raw.targetName === undefined ? undefined : safeReportedTargetName(raw.targetName, `${name}.targetName`);
|
|
103
|
+
const targetFingerprint = raw.targetFingerprint === undefined ? undefined
|
|
104
|
+
: validatedTargetFingerprint(raw.targetFingerprint, `${name}.targetFingerprint`);
|
|
103
105
|
if (!Array.isArray(raw.cases) || raw.cases.length > expected.size)
|
|
104
106
|
throw new Error(`Linked result ${name} has an invalid case list.`);
|
|
105
107
|
const seen = new Set();
|
|
@@ -126,7 +128,9 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
126
128
|
throw new Error(`Linked result ${name} contradicts its case results.`);
|
|
127
129
|
}
|
|
128
130
|
return { runId, status: status, startedAt, finishedAt,
|
|
129
|
-
...(targetName === undefined ? {} : { targetName }),
|
|
131
|
+
...(targetName === undefined ? {} : { targetName }),
|
|
132
|
+
...(targetFingerprint === undefined ? {} : { targetFingerprint }),
|
|
133
|
+
...(selection === undefined ? {} : { selection }), cases };
|
|
130
134
|
}
|
|
131
135
|
function later(a, b) {
|
|
132
136
|
if (a.finishedAt !== b.finishedAt)
|
|
@@ -140,7 +144,13 @@ function nonnegativeCount(value, label) {
|
|
|
140
144
|
throw new Error(`${label} must be a non-negative integer.`);
|
|
141
145
|
return value;
|
|
142
146
|
}
|
|
143
|
-
export async function readRunSummary(directory) {
|
|
147
|
+
export async function readRunSummary(directory, options = {}) {
|
|
148
|
+
if (options === null || typeof options !== 'object' || Array.isArray(options)
|
|
149
|
+
|| Object.keys(options).some(key => key !== 'targetFingerprint')) {
|
|
150
|
+
throw new Error('readRunSummary options support only targetFingerprint.');
|
|
151
|
+
}
|
|
152
|
+
const selectedTargetFingerprint = options.targetFingerprint === undefined ? undefined
|
|
153
|
+
: validatedTargetFingerprint(options.targetFingerprint, 'targetFingerprint');
|
|
144
154
|
const root = resolve(directory);
|
|
145
155
|
const { analysis, provenance, verification } = await readVerifiedBundle(root);
|
|
146
156
|
const inputSha256 = sha256(provenance.inputSha256, 'provenance.inputSha256');
|
|
@@ -180,7 +190,10 @@ export async function readRunSummary(directory) {
|
|
|
180
190
|
if (error.code !== 'ENOENT')
|
|
181
191
|
throw error;
|
|
182
192
|
}
|
|
193
|
+
let totalRunCount = 0;
|
|
183
194
|
let runCount = 0;
|
|
195
|
+
let unscopedRunCount = 0;
|
|
196
|
+
const targets = new Map();
|
|
184
197
|
let latest;
|
|
185
198
|
if (resultsInfo) {
|
|
186
199
|
if (!resultsInfo.isDirectory() || resultsInfo.isSymbolicLink())
|
|
@@ -209,14 +222,32 @@ export async function readRunSummary(directory) {
|
|
|
209
222
|
if (totalBytes > maxTotalBytes)
|
|
210
223
|
throw new Error('Linked results exceed 64 MiB in total.');
|
|
211
224
|
const run = parseResult(content, name, inputSha256, suiteSha256, expected);
|
|
212
|
-
|
|
213
|
-
if (
|
|
214
|
-
|
|
225
|
+
totalRunCount++;
|
|
226
|
+
if (run.targetFingerprint === undefined)
|
|
227
|
+
unscopedRunCount++;
|
|
228
|
+
else {
|
|
229
|
+
let target = targets.get(run.targetFingerprint);
|
|
230
|
+
if (!target) {
|
|
231
|
+
target = { fingerprint: run.targetFingerprint, names: new Set(), runCount: 0 };
|
|
232
|
+
targets.set(run.targetFingerprint, target);
|
|
233
|
+
}
|
|
234
|
+
target.runCount++;
|
|
235
|
+
if (run.targetName !== undefined)
|
|
236
|
+
target.names.add(run.targetName);
|
|
237
|
+
}
|
|
238
|
+
if (selectedTargetFingerprint === undefined || run.targetFingerprint === selectedTargetFingerprint) {
|
|
239
|
+
runCount++;
|
|
240
|
+
if (!latest || later(run, latest))
|
|
241
|
+
latest = run;
|
|
242
|
+
}
|
|
215
243
|
}
|
|
216
244
|
const after = await lstat(resultsRoot);
|
|
217
245
|
if (!after.isDirectory() || after.isSymbolicLink() || !sameFile(resultsInfo, after))
|
|
218
246
|
throw new Error('Results directory changed while reading.');
|
|
219
247
|
}
|
|
248
|
+
if (selectedTargetFingerprint !== undefined && !targets.has(selectedTargetFingerprint)) {
|
|
249
|
+
throw new Error('No linked runs match the requested target fingerprint. Inspect the unfiltered results inventory.');
|
|
250
|
+
}
|
|
220
251
|
const latestCases = new Map(latest?.cases.map(item => [item.caseId, item]) ?? []);
|
|
221
252
|
const counts = Object.fromEntries(countStatuses.map(status => [status, 0]));
|
|
222
253
|
for (const mapping of mappings) {
|
|
@@ -229,6 +260,15 @@ export async function readRunSummary(directory) {
|
|
|
229
260
|
});
|
|
230
261
|
}
|
|
231
262
|
const warnings = ['Counts are the latest reported case outcomes, not proof that any source issue is resolved.'];
|
|
263
|
+
if (selectedTargetFingerprint === undefined && targets.size > 1) {
|
|
264
|
+
warnings.push(`This history contains ${targets.size} target fingerprints. Unfiltered counts use only the latest run across all targets; select a target fingerprint for target-specific counts.`);
|
|
265
|
+
}
|
|
266
|
+
if (unscopedRunCount > 0) {
|
|
267
|
+
warnings.push(`${unscopedRunCount} linked run(s) have no target fingerprint and cannot be assigned to a target scope (including legacy results).`);
|
|
268
|
+
}
|
|
269
|
+
if (selectedTargetFingerprint !== undefined && totalRunCount > runCount) {
|
|
270
|
+
warnings.push(`The selected target scope excludes ${totalRunCount - runCount} linked run(s), including ${unscopedRunCount} unscoped run(s).`);
|
|
271
|
+
}
|
|
232
272
|
if (latest?.selection)
|
|
233
273
|
warnings.push(`Latest linked run selected ${latest.selection.selectedCaseIds.length} of ${latest.selection.totalCases} exported cases. Unselected cases are not-run even if an earlier run reported outcomes for them.`);
|
|
234
274
|
if (analysis.warnings !== undefined)
|
|
@@ -249,8 +289,13 @@ export async function readRunSummary(directory) {
|
|
|
249
289
|
return {
|
|
250
290
|
schemaVersion: 'error-to-test/run-summary-1', inputSha256,
|
|
251
291
|
...(suiteSha256 === undefined ? {} : { suiteSha256 }), runCount,
|
|
292
|
+
...(selectedTargetFingerprint === undefined ? {} : { selectedTargetFingerprint, excludedRunCount: totalRunCount - runCount }),
|
|
293
|
+
unscopedRunCount,
|
|
294
|
+
targets: [...targets.values()].sort((a, b) => a.fingerprint.localeCompare(b.fingerprint))
|
|
295
|
+
.map(target => ({ fingerprint: target.fingerprint, names: [...target.names].sort(), runCount: target.runCount })),
|
|
252
296
|
...(latest === undefined ? {} : { latestRun: { runId: latest.runId, status: latest.status, startedAt: latest.startedAt, finishedAt: latest.finishedAt,
|
|
253
297
|
...(latest.targetName === undefined ? {} : { targetName: latest.targetName }),
|
|
298
|
+
...(latest.targetFingerprint === undefined ? {} : { targetFingerprint: latest.targetFingerprint }),
|
|
254
299
|
...(latest.selection === undefined ? {} : { selection: latest.selection }) } }),
|
|
255
300
|
counts, groups, warnings,
|
|
256
301
|
};
|
|
@@ -259,7 +304,22 @@ export function renderRunSummary(summary) {
|
|
|
259
304
|
const lines = ['# Linked run summary', '', `Input SHA-256: ${sha256(summary.inputSha256, 'summary.inputSha256')}`];
|
|
260
305
|
if (summary.suiteSha256 !== undefined)
|
|
261
306
|
lines.push(`Suite SHA-256: ${sha256(summary.suiteSha256, 'summary.suiteSha256')}`);
|
|
262
|
-
|
|
307
|
+
if (summary.selectedTargetFingerprint !== undefined) {
|
|
308
|
+
lines.push(`Selected target fingerprint: ${validatedTargetFingerprint(summary.selectedTargetFingerprint, 'summary.selectedTargetFingerprint')}`, `Excluded linked runs: ${nonnegativeCount(summary.excludedRunCount, 'summary.excludedRunCount')}`);
|
|
309
|
+
}
|
|
310
|
+
lines.push(`Linked runs: ${nonnegativeCount(summary.runCount, 'summary.runCount')}`, `Unscoped linked runs: ${nonnegativeCount(summary.unscopedRunCount, 'summary.unscopedRunCount')}`, '');
|
|
311
|
+
lines.push('## Available targets', '');
|
|
312
|
+
if (!Array.isArray(summary.targets) || !summary.targets.length)
|
|
313
|
+
lines.push('No fingerprinted targets were found.', '');
|
|
314
|
+
else {
|
|
315
|
+
for (const target of summary.targets) {
|
|
316
|
+
lines.push(`Fingerprint: ${validatedTargetFingerprint(target.fingerprint, 'summary.targets.fingerprint')}`, `Linked runs: ${nonnegativeCount(target.runCount, 'summary.targets.runCount')}`, '');
|
|
317
|
+
if (!Array.isArray(target.names))
|
|
318
|
+
throw new Error('summary.targets.names must be an array.');
|
|
319
|
+
if (target.names.length)
|
|
320
|
+
lines.push('Reported names:', '', literal(target.names.map(name => safeReportedTargetName(name, 'summary.targets.names')).join('\n')), '');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
263
323
|
if (summary.latestRun) {
|
|
264
324
|
const run = summary.latestRun;
|
|
265
325
|
if (!uuidPattern.test(run.runId) || !runStatuses.has(run.status))
|
|
@@ -267,6 +327,8 @@ export function renderRunSummary(summary) {
|
|
|
267
327
|
lines.push('## Latest linked run', '', `Run ID: ${run.runId}`, `Reported status: ${run.status}`, `Started: ${timestamp(run.startedAt, 'summary.latestRun.startedAt')}`, `Finished: ${timestamp(run.finishedAt, 'summary.latestRun.finishedAt')}`, '');
|
|
268
328
|
if (run.targetName)
|
|
269
329
|
lines.push('Reported target name:', '', literal(safeReportedTargetName(run.targetName, 'summary.latestRun.targetName')), '');
|
|
330
|
+
if (run.targetFingerprint)
|
|
331
|
+
lines.push(`Target fingerprint: ${validatedTargetFingerprint(run.targetFingerprint, 'summary.latestRun.targetFingerprint')}`, '');
|
|
270
332
|
if (run.selection)
|
|
271
333
|
lines.push(`Selected cases: ${run.selection.selectedCaseIds.length} of ${run.selection.totalCases} exported cases`, '');
|
|
272
334
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Expansion research — observed error group coverage
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-17. Scope: `@ihyeon/error-to-test` after v0.3.0. This is a design decision for a local change, not a claim about production use.
|
|
4
|
+
|
|
5
|
+
## Evidence
|
|
6
|
+
|
|
7
|
+
- `src/analysis.ts` retains every observed error group but selects candidates only after optional baseline, explicit group, minimum count, and top-N filters. `report.md` lists all groups, yet the exported suite contains only selected candidates.
|
|
8
|
+
- `src/readiness.ts` verifies the bundle and reports readiness for selected cases. It includes the total group count, but cannot identify which groups have no selected TC or how many observed groups remain outside the suite. A `ready` result can therefore be read without noticing a deliberately narrow selection. The README documents that selection limits exist, but a machine-readable audit of the actual saved scope is absent.
|
|
9
|
+
- `gh issue list -R hyeonse-swing/error-to-test --state open` returned no open issues on 2026-11-17. This need comes from the current source and usage path rather than an issue request.
|
|
10
|
+
- The [ISTQB Foundation syllabus, §1.4.4](https://www.istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf) describes traceability between test basis, cases, results, and defects as useful for evaluating coverage. Here, observed error groups are only a local source set; they do not represent all defects or all user flows.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
Add a read-only `coverage` command and `readCoverage` API for a verified saved bundle. It will list every observed group by stable ID with its supplied-record count and source frequency (`captured-events` or `submitted-reports`), selected candidate IDs, and one of `unselected`, `blocked`, or `review-ready`. Counts will state how many *observed groups* fall in each category. A group with multiple candidates is `review-ready` only when every selected case passes the existing readiness check; `review-ready` does not imply that a browser ran. The report will include source hashes and collection warnings, and expose no raw error message or target URL. This leaves existing `readiness` output and exit semantics unchanged.
|
|
15
|
+
|
|
16
|
+
The report cannot reconstruct a precise filter reason from old bundles because `top` and `minCount` values are not saved as structured fields. It will name unselected groups and direct users to the original analysis/selection options rather than guess a reason. No percentage will be labelled test coverage or user coverage.
|
|
17
|
+
|
|
18
|
+
## Acceptance checks
|
|
19
|
+
|
|
20
|
+
1. A reviewed bundle with selected and unselected groups accounts for every observed group, and a group with mixed candidate blockers stays `blocked`.
|
|
21
|
+
2. An empty suite reports all observed groups as `unselected`; no group is called `review-ready` just because review was acknowledged.
|
|
22
|
+
3. Mutated artifacts, mismatched mappings, and malformed group metadata fail before a coverage report is returned. The command is read-only and preserves existing output files.
|
|
23
|
+
4. API and CLI JSON/Markdown results agree; package build and installed CLI smoke pass. Existing analyze, readiness, and results behavior stays unchanged.
|
package/docs/releases.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Package: `@ihyeon/error-to-test` · Repository: [hyeonse-swing/error-to-test](https://github.com/hyeonse-swing/error-to-test) · Workflow: `.github/workflows/ci.yml`.
|
|
4
4
|
|
|
5
|
+
## 0.4.0 — observed error group coverage
|
|
6
|
+
|
|
7
|
+
`coverage` and the `readCoverage(directory)` API account for every group observed in a verified saved input, including groups excluded from TC selection by a baseline, explicit group filter, minimum count, or top-N limit. The read-only `error-to-test/coverage-1` report separates `unselected`, `blocked`, and `review-ready` groups, preserves source hashes and source-frequency meaning, and gives reason codes and next actions without copying raw error messages or question text. Only an explicit `--group` exclusion can be named precisely from old saved metadata; other unselected groups remain `not-selected-in-saved-bundle`. A group with multiple selected candidates is review-ready only if every case has no recorded blocker and review was acknowledged. Review readiness is not browser execution, a passing assertion, or production coverage. Existing `readiness` and results contracts and exit codes are unchanged.
|
|
8
|
+
|
|
9
|
+
The fresh installed-package ecosystem check pins Browser Error Log 0.2.12 and Flow QA 0.9.0; `BROWSER_ERROR_LOG_RELEASE_VERSION=X.Y.Z` allows a deliberate exact SDK compatibility check against a later patch. It checks that a manual SDK call returns the same event ID that the local fixture receives, then verifies coverage of pending, reviewed, and top-one selected snapshots. The SDK return ID is evidence of queue admission only; collector receipt is checked separately in this fixture. The check continues to use a local Chromium fixture and no model or customer service.
|
|
10
|
+
|
|
11
|
+
Local checks on 2026-11-17: the final 0.4.0 candidate passed `npm run check` (type checking, build, 206 tests) and fresh installed-package `npm run check:package`. The installed-package ecosystem candidate passed 10 checks using the public SDK 0.2.12 and the Flow QA 0.9.0 tarball whose integrity matches the public release. Remote release and fully public consumer results are verified separately.
|
|
12
|
+
|
|
13
|
+
## 0.3.0 — target-scoped linked results
|
|
14
|
+
|
|
15
|
+
Linked Flow QA results now retain an optional SHA-256 `targetFingerprint` calculated from Flow QA's exact canonical web or mobile target identity. Target names are sanitized labels; two targets can use the same name. Raw target fields are scrubbed from linked names and reasons. A fingerprint is a stable, guessable identifier rather than anonymization. The linker validates the target kind and required fields before writing. Flow QA's early error/interrupted report with an empty web URL, and blocked/interrupted mobile report with an empty device, remain linkable with a sanitized name but no invented fingerprint; other incomplete target/status combinations are rejected.
|
|
16
|
+
|
|
17
|
+
`results --target-fingerprint SHA256` and `readRunSummary(directory, { targetFingerprint })` select one target's latest run and case counts, including `--fail-on` decisions. Unfiltered results still use the latest run across all targets. Summaries list fingerprinted targets, their sanitized names and run counts, and the number of unscoped runs; scoped summaries also report excluded runs. Legacy full and partial files, targetless reports, and early fallback reports without a fingerprint remain readable but cannot join a target scope. Unknown fingerprints fail rather than producing a passing gate. Every linked file is validated before scope selection, including older and nonselected files. New additive fields keep the `error-to-test/results-1` and `error-to-test/run-summary-1` schema labels; older readers reject new linked files that contain the fingerprint.
|
|
18
|
+
|
|
19
|
+
The ecosystem smoke also exercises same-name distinct target URLs and a real Flow QA unresolved-target error. To include the standalone SQLite collector, set `BROWSER_ERROR_LOG_MICRO_DIRECTORY` to a built or extracted micro-server directory containing `server.mjs` and `export.mjs`; the smoke stores captured SDK events, stops the collector, verifies a read-only export, and analyzes that export through the installed CLI.
|
|
20
|
+
|
|
21
|
+
Local checks on 2026-11-16: `npm run check` passed type checking, build, and 203 tests; `npm run check:package` passed the isolated package consumer smoke.
|
|
22
|
+
|
|
5
23
|
## 0.2.8
|
|
6
24
|
|
|
7
25
|
Restores compatibility with Browser Error Log resource events across input, CLI, profiles, comparisons and refinement, and with Flow QA selected-run reports. Valid v1 network status values (0..599) are preserved; values below 100 are described as unavailable HTTP status rather than a response.
|
|
@@ -20,7 +38,7 @@ This minor release sets both package manifests to `0.2.0` before verification. T
|
|
|
20
38
|
|
|
21
39
|
## Automatic publication
|
|
22
40
|
|
|
23
|
-
Pull requests and main pushes verify the package on Ubuntu and macOS. An additional Ubuntu job installs the current tarball with
|
|
41
|
+
Pull requests and main pushes verify the package on Ubuntu and macOS. An additional Ubuntu job installs the current tarball with pinned Browser Error Log 0.2.12 and Flow QA 0.9.0, then checks the complete capture/analyze/run/link loop in Chromium. Both jobs must pass before a main push prepares an immutable release source:
|
|
24
42
|
|
|
25
43
|
- The first publication uses the manifest version (`0.1.0`). A new npm package needs one authenticated bootstrap publication before its Trusted Publisher can be configured.
|
|
26
44
|
- Changes to `src/`, `bin/`, `examples/`, `LICENSE`, `package.json`, `package-lock.json`, or `tsconfig.json` automatically increase patch when the manifest still matches npm latest. The workflow commits the version change as `github-actions[bot]` and publishes that exact commit in the same run.
|
package/package.json
CHANGED