@ihyeon/error-to-test 0.2.6 → 0.2.8
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 +27 -3
- package/README.md +39 -4
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +1 -1
- package/dist/candidates.js +7 -3
- package/dist/cli.js +36 -5
- package/dist/comparison.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/input.js +3 -3
- package/dist/issue-report.d.ts +2 -0
- package/dist/issue-report.js +165 -0
- package/dist/refinement.js +2 -2
- package/dist/result-selection.d.ts +9 -0
- package/dist/result-selection.js +40 -0
- package/dist/results.js +8 -3
- package/dist/run-summary.d.ts +3 -0
- package/dist/run-summary.js +17 -7
- package/dist/types.d.ts +1 -1
- package/docs/releases.md +13 -2
- package/package.json +2 -1
package/README.ko.md
CHANGED
|
@@ -36,6 +36,8 @@ node bin/error-to-test.mjs analyze --input examples/errors.json --profile exampl
|
|
|
36
36
|
|
|
37
37
|
결과는 `analysis.json`, `report.md`, `flows/error-to-test.md`, `cases/error-to-test.json`, `provenance.json`입니다. 선택된 TC 후보가 없으면 suite를 만들지 않습니다. 출력 폴더는 매번 새 경로를 지정해야 합니다.
|
|
38
38
|
|
|
39
|
+
Browser Error Log v1의 현재 이벤트 타입을 모두 지원하며, 0.2.0부터 추가된 `resource` 오류도 JSON·JSONL·프로필·비교·프로필 보완에 사용할 수 있습니다. 리소스 오류를 HTTP 오류로 바꾸거나 응답 상태·재현 동작을 추측하지 않습니다. 리소스 context와 breadcrumbs는 테스트 단계로 변환하지 않습니다. 자체 수집기의 네트워크 상태 `0`도 알 수 없는/불투명 상태로 보존하며 실제 HTTP 응답 코드로 취급하지 않습니다.
|
|
40
|
+
|
|
39
41
|
`--min-count N`으로 입력에 N건 이상 있는 오류 묶음만 TC 후보로 만들 수 있습니다. 범위는 1~10,000이며 기본값은 1입니다. 중복 제거·날짜 필터 적용 후 건수를 기준으로 고르고, `--top`은 그중 순위가 높은 묶음 수를 제한합니다. 기준 미만의 묶음도 `analysis.json`과 `report.md`에 남으며, 제외가 발생하면 보고서에 선택 기준을 표시합니다. 이 건수는 입력에 포함된 수집 이벤트·제출 보고서 수입니다.
|
|
40
42
|
|
|
41
43
|
```sh
|
|
@@ -150,7 +152,23 @@ error-to-test init-profile ./selected-tcs --out ./selected-profile.json
|
|
|
150
152
|
|
|
151
153
|
지정한 묶음과 `--baseline`의 교집합에 기존 순위대로 `--min-count`, `--top`을 적용합니다. ID를 입력한 순서로 우선순위가 바뀌지 않습니다. 알려진 ID라도 이 조건 때문에 TC가 생성되지 않을 수 있으며, 선택된 TC가 없으면 suite 없는 정상 번들을 만들고 `readiness`는 `empty`와 종료 코드 2를 반환합니다. 한 묶음에 여러 프로필 규칙이 적용되면 기존처럼 여러 TC를 생성할 수 있습니다.
|
|
152
154
|
|
|
153
|
-
전체 오류 묶음·원본 해시·수집 범위는 보존합니다. 요청한 ID는 정렬·중복 제거해 `analysis.groupFilter.groupIds`에 기록하고 분석 해시로 보호하며, 보고서에도 선택 범위를 남깁니다. 비교와 이전 분석 기준의 건수는 전체 묶음을 계속 사용합니다. 맥락 질문과 검토 조건도 유지합니다. `--group`을 생략하면 기존 선택
|
|
155
|
+
전체 오류 묶음·원본 해시·수집 범위는 보존합니다. 요청한 ID는 정렬·중복 제거해 `analysis.groupFilter.groupIds`에 기록하고 분석 해시로 보호하며, 보고서에도 선택 범위를 남깁니다. 비교와 이전 분석 기준의 건수는 전체 묶음을 계속 사용합니다. 맥락 질문과 검토 조건도 유지합니다. `--group`을 생략하면 기존 선택 방식입니다. `issue` 명령에서도 `--group`으로 기존 묶음 하나를 지정할 수 있으며, 이 경우 TC 선택을 변경하지 않고 공유용 보고서만 만듭니다. API는 `analyzeErrors(content, { groupIds: [groupId] })`와 `analyzeWithBaseline()`의 같은 옵션입니다. 비어 있지 않은 최대 100개 항목 배열을 받으며 입력 배열을 변경하지 않습니다.
|
|
156
|
+
|
|
157
|
+
오류 하나를 공유하거나 이슈에 붙여 넣을 때는 **`issue`로 묶음별 Markdown 보고서**를 뽑을 수 있습니다.
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
# 예시 ID를 report.md나 analysis.json에 있는 실제 묶음 ID로 바꾸세요.
|
|
161
|
+
error-to-test issue ./analysis --group group-0123456789abcdef --out ./issue.md
|
|
162
|
+
error-to-test issue ./analysis --group group-0123456789abcdef
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
검증된 번들에서 해당 오류 상세·대표 스택·연결 TC의 재현 방법·기대 결과·질문을 발췌합니다. TC 생성에서 제외된 묶음도 내보낼 수 있으며, 이 경우 선택된 TC가 없다고 표시합니다. `--group`은 정확히 하나만 받으며 잘못되거나 존재하지 않는 ID는 파일 생성 전에 거부합니다.
|
|
166
|
+
|
|
167
|
+
원본 입력·분석·보고서 해시와 존재하는 프로필·suite 해시를 남겨 어느 검증된 번들에서 나온 내용인지 추적할 수 있습니다. 수집 범위와 경고는 **원본 번들 전체 기준**이며 해당 오류의 발생률이나 완전한 수집을 뜻하지 않습니다. 다른 묶음의 오류 내용과 전역 선택 정보는 포함하지 않으며, 로그 안에 제목처럼 보이는 문장이 있어도 Markdown 코드 구역을 구분해 발췌합니다.
|
|
168
|
+
|
|
169
|
+
저장된 검토 자료를 내보내는 기능입니다. TC 생성·승인·연결 결과 조회·테스트 실행·원격 이슈 등록·수정 완료 처리는 하지 않습니다. 원본 입력 바이트 재확인은 `verify --input ...`, 실행 차단 사유 확인은 `readiness`로 별도 수행하세요.
|
|
170
|
+
|
|
171
|
+
기본 출력은 stdout이고 `--out`은 경로 별칭을 포함한 원본 번들 전체 바깥의 새 파일만 허용합니다. 파일은 권한 0600으로 만들며 기존 파일과 산출물을 보존합니다. 번들 경로·묶음 ID 하나·선택적인 `--out`만 받습니다. 성공은 종료 코드 0, 변경된 번들·지원하지 않는 저장 보고서 구조·출력 오류는 코드 1입니다. API는 `await readIssueReport(directory, groupId)`이며 검증된 동일 스냅샷에서 Markdown 문자열을 반환하고 파일 저장이나 외부 전송은 하지 않습니다.
|
|
154
172
|
|
|
155
173
|
`report.md` 상단에서 TC 초안 수와 추가 정보가 필요한 TC 수를 확인할 수 있습니다. 초안도 실행 전에 검토해야 합니다. 오류 묶음·수집 건수와 함께 대표 로그의 오류·React 컴포넌트 스택, 재현 방법·사전 조건·테스트 단계·부족한 정보도 표시합니다. 같은 스택은 한 번만 표시하며, 전체 로그의 모든 스택을 나열하지는 않습니다. 재현 단계와 정상 기대 결과, 명시적인 assertion이 없으면 질문이 있는 TC를 생성합니다. 직접 입력한 보고서에는 실제 발생 시각·사용자 수를 만들어 넣지 않습니다. 수집 건수도 실제 발생률을 뜻하지 않으며, 원본 내보내기의 일부 데이터 표시를 유지합니다.
|
|
156
174
|
|
|
@@ -238,7 +256,11 @@ error-to-test readiness ./review-analysis --format json
|
|
|
238
256
|
|
|
239
257
|
Flow QA 설치와 실행 대상 설정은 별도로 필요합니다. 위 `flows/`·`cases/` 구조를 기존 검토 화면에서 읽을 수 있습니다. 분석 명령은 브라우저를 실행하거나 외부 모델에 요청하지 않습니다. TC 통과만으로 원래 오류를 수정 완료 처리하지 않습니다.
|
|
240
258
|
|
|
241
|
-
실행 후 `node bin/error-to-test.mjs link-run .error-to-test/reviewed --report /path/to/qa-report.json`으로 결과를 원래 오류 묶음에 연결할 수 있습니다. suite
|
|
259
|
+
실행 후 `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
|
+
|
|
261
|
+
선택 실행 결과에는 `selection: { mode: 'selected', totalCases, selectedCaseIds }`를 기록하며 요약의 최신 실행에도 포함합니다. 기존 전체 실행 결과는 계속 읽을 수 있고, 새 선택 실행 결과는 이 버전 이상의 reader가 필요합니다. 이전 reader는 추가 필드를 거부합니다. 최신 실행에서 빠진 케이스는 과거에 통과했어도 `not-run`이며, 미실행을 CI 실패로 처리하려면 `results --fail-on not-run`을 사용하세요.
|
|
262
|
+
|
|
263
|
+
보고서에 실행 대상이 있으면 정제한 이름을 `targetName`으로 저장해 최신 실행 요약에 표시합니다. 대상 URL·기기 식별값은 복사하지 않습니다. 대상 이름은 고유 식별자가 아니므로 같은 이름을 다른 환경에 재사용하면 구별할 수 없습니다. 이전 reader는 이 추가 필드도 거부하며, 이름이 없는 기존 결과 파일은 계속 읽을 수 있습니다. 최신 실행은 연결된 전체 실행 중에서 고르므로 대상별 이력이 필요하면 번들을 분리하세요.
|
|
242
264
|
|
|
243
265
|
연결한 결과는 `results`로 오류 묶음별 최신 TC 결과를 모아 볼 수 있습니다.
|
|
244
266
|
|
|
@@ -281,4 +303,6 @@ error-to-test results ./analysis --fail-on failed --fail-on error --fail-on not-
|
|
|
281
303
|
|
|
282
304
|
알려진 자격증명·이메일·URL 인증/쿼리 정보는 결과에서 정제합니다. 민감정보가 포함된 실행 단계나 기대 결과는 변경해 통과시키지 않고 질문으로 남깁니다. 모든 개인정보를 제거한다고 보장하지 않으므로 실제 업무 데이터를 입력하기 전에는 별도로 정제하세요. 비공개 오류는 셸 기록에 남는 인자 대신 파일·표준 입력을 사용하세요.
|
|
283
305
|
|
|
284
|
-
검증은 `npm run check`, `npm run check:package`입니다.
|
|
306
|
+
검증은 `npm run check`, `npm run check:package`입니다. `npm run smoke:ecosystem`은 현재 소스의 tarball과 공개 Browser Error Log 0.2.10·Flow QA 0.8.8을 새 환경에 설치합니다. Chromium에서 실제 JavaScript·resource 오류 수집, 검토 전 차단, 수정 전 실패·수정 후 통과, 선택 실행 재연결과 미실행 게이트, 설치된 UI·디자인 시스템 연결을 검사합니다. CI 릴리스도 이 검사를 통과해야 합니다. 결과는 `output/ecosystem/verification.json`에 기록하며 운영 서비스·실제 로그인·모델을 호출하지 않습니다.
|
|
307
|
+
|
|
308
|
+
로컬 소스 조합은 `FLOW_QA_SOURCE=/path/to/flow-qa BROWSER_ERROR_SOURCE=/path/to/browser-error-log npm run smoke:flowqa`로 별도 검사할 수 있습니다. 자세한 입력 계약과 제한은 [영문 문서](README.md)에 있습니다.
|
package/README.md
CHANGED
|
@@ -59,6 +59,8 @@ Textual expected behavior alone does not establish a runnable assertion. Supply
|
|
|
59
59
|
|
|
60
60
|
Accepts Browser Error Log v1 `{schemaVersion: 1, partial?: boolean, events: [...]}` exports or arrays of full v1 events. Files are limited to 10 MiB and 10,000 records. Identity duplicates are removed; conflicting payloads with the same project/event ID are rejected. `--from`/`--to` require timezone-qualified ISO timestamps. Undated manual reports are excluded when a date filter is requested.
|
|
61
61
|
|
|
62
|
+
All current v1 event types are supported, including `resource` failures from Browser Error Log 0.2.0 and later. Resource events remain distinct from HTTP/network events; their presence does not establish a response status or an executable reproduction. Resource-specific context and breadcrumbs are not converted into test steps. Custom v1 network records may use status `0` (unknown/opaque), which is preserved without treating it as an HTTP response code.
|
|
63
|
+
|
|
62
64
|
Grouping is deterministic and separates project, environment, release, runtime, page path, error message/name, and source location or HTTP method/path/status. Similar messages do not establish the same root cause. Counts mean **captured events** or **submitted reports**, not actual occurrence rates or affected users. Collection retention is unknown; imported `partial` status is preserved. TC selection defaults to the first 100 ranked groups; all groups remain in the analysis. More than 100 generated cases must be narrowed with `--top` or a smaller profile.
|
|
63
65
|
|
|
64
66
|
Use `--min-count N` (1..10,000; default 1) to generate TCs only for groups with at least N supplied records after deduplication and date filtering. `--top` then limits the remaining ranked groups. Groups below the threshold remain in `analysis.json` and `report.md`; the report explains any exclusions. If no groups qualify, no suite is generated.
|
|
@@ -187,10 +189,36 @@ Repeat `--group` up to 100 times. Each ID must have the exact `group-` plus 16 l
|
|
|
187
189
|
|
|
188
190
|
Requested groups are intersected with any `--baseline` selection, then `--min-count` and `--top` apply in the original ranked order. Argument order does not change priority. A known group can still be excluded by these conditions; zero selected cases creates a valid bundle without a suite, and `readiness` reports `empty` with exit `2`. A selected group may produce several profile-based TCs as before.
|
|
189
191
|
|
|
190
|
-
The complete observed groups, input hashes, and source coverage remain in the new bundle. `analysis.groupFilter.groupIds` stores the sorted, deduplicated requested IDs, covered by the analysis hash, and the report records the scope. Comparison and baseline counts continue to use all observed groups. Missing-context and review questions still block execution. Omitting `--group` keeps the existing selection behavior
|
|
192
|
+
The complete observed groups, input hashes, and source coverage remain in the new bundle. `analysis.groupFilter.groupIds` stores the sorted, deduplicated requested IDs, covered by the analysis hash, and the report records the scope. Comparison and baseline counts continue to use all observed groups. Missing-context and review questions still block execution. Omitting `--group` keeps the existing selection behavior. The `issue` command also uses `--group` to identify one saved group for a report, without changing TC selection.
|
|
191
193
|
|
|
192
194
|
The API accepts `analyzeErrors(content, { groupIds: [groupId], top: 10 })` and the same option in `analyzeWithBaseline()`. `groupIds` must be a nonempty array of at most 100 entries; it is not mutated.
|
|
193
195
|
|
|
196
|
+
### Export one error group for an issue
|
|
197
|
+
|
|
198
|
+
`issue` creates a local Markdown report for one exact group from a verified bundle:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
# Replace the example ID with an actual ID from report.md or analysis.json.
|
|
202
|
+
error-to-test issue ./analysis --group group-0123456789abcdef --out ./issue.md
|
|
203
|
+
error-to-test issue ./analysis --group group-0123456789abcdef
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The report includes the saved error details, representative stacks, and any selected TC candidates with their reproduction, expected behavior, and questions. Groups excluded from TC generation can also be exported; they are explicitly marked as having no selected TC candidates. Exactly one `--group` is required, and malformed or unknown IDs are rejected without generating a file.
|
|
207
|
+
|
|
208
|
+
The original input/analysis/report hashes and available profile/suite hashes identify the verified snapshot. Source coverage and warnings describe the **whole original bundle**, not a per-group rate or complete collection. Only the requested group's detail section is copied; other groups' error contents and the original global selection sections are not included. Markdown fences are respected, so heading-like text inside captured logs cannot split the excerpt.
|
|
209
|
+
|
|
210
|
+
This exports saved review material. It does not generate or approve cases, read linked results, execute tests, file a remote issue, or resolve an error. Original input bytes are not rechecked; use `verify --input ...` when originals are available. Use `readiness` to inspect current recorded execution blockers in the exported suite.
|
|
211
|
+
|
|
212
|
+
Output defaults to stdout. `--out` writes an exclusive mode-0600 new file outside the entire source bundle, including path aliases; existing files and source artifacts are preserved. `issue` accepts only a bundle directory, one `--group`, and optional `--out`. Changed bundles, unsupported saved report layouts, and output errors exit `1`; successful export exits `0`.
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
import { readIssueReport } from '@ihyeon/error-to-test';
|
|
216
|
+
|
|
217
|
+
const markdown = await readIssueReport('./analysis', groupId);
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The API returns Markdown from one verified snapshot and does not write files or send content anywhere.
|
|
221
|
+
|
|
194
222
|
## Confirm the intended behavior
|
|
195
223
|
|
|
196
224
|
See [examples/profile.json](examples/profile.json). Profiles use `schemaVersion: "error-to-test/profile-1"`, a name, and up to 100 scenarios. Each scenario has a unique ID, title, at least one match predicate, a requirement, its `expectedSource`, and explicit steps. Set `setupConfirmed: true` only after confirming how preconditions are established. Preconditions are descriptions; this package does not prepare accounts or data.
|
|
@@ -338,7 +366,11 @@ After a Flow QA run, associate its normalized report with the exact exported sui
|
|
|
338
366
|
node bin/error-to-test.mjs link-run .error-to-test/reviewed --report /path/to/qa-report.json
|
|
339
367
|
```
|
|
340
368
|
|
|
341
|
-
The run's suite hash and
|
|
369
|
+
The run's suite hash and reported case IDs must match. Safe case results are stored under `results/<runId>.json`, linked to their source groups/events. Full reports must account for every exported case. Flow QA selected runs are accepted only when their explicit `selection.caseIds` exactly matches the reported cases and `selection.totalCases` matches the full exported suite. Unknown, duplicate, or undeclared missing cases are rejected; existing results are never overwritten. A raw e2e report is not accepted. Failed, blocked, and passed results remain distinct; no issue is automatically marked fixed.
|
|
370
|
+
|
|
371
|
+
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
|
+
|
|
373
|
+
When a report includes a target, its sanitized name is retained as optional `targetName` and displayed in the latest-run summary. Target URLs and device identifiers are not copied. The name is a reported label, not a unique target identity: reusing one name for different environments does not establish they are equivalent. Older readers also reject the new target field; older files without it remain readable. Latest-run selection still considers all linked runs; use separate bundles when target-specific histories are required.
|
|
342
374
|
|
|
343
375
|
### Summarize linked runs
|
|
344
376
|
|
|
@@ -350,7 +382,7 @@ error-to-test results .error-to-test/reviewed --out ./run-summary.md
|
|
|
350
382
|
error-to-test results .error-to-test/reviewed --format json --out ./run-summary.json
|
|
351
383
|
```
|
|
352
384
|
|
|
353
|
-
The summary includes the linked run count, latest run ID/status/timestamps, case totals, and each group's cases and reported reasons. `passed`, `failed`, `flaky`, `blocked`, `skipped`, and `error` remain separate. Without any linked runs, selected
|
|
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.
|
|
354
386
|
|
|
355
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.
|
|
356
388
|
|
|
@@ -396,7 +428,10 @@ Known credential assignments, bearer/recognized token formats, email addresses,
|
|
|
396
428
|
```sh
|
|
397
429
|
npm run check
|
|
398
430
|
npm run check:package
|
|
431
|
+
npm run smoke:ecosystem
|
|
399
432
|
FLOW_QA_SOURCE=/path/to/flow-qa BROWSER_ERROR_SOURCE=/path/to/browser-error-log npm run smoke:flowqa
|
|
400
433
|
```
|
|
401
434
|
|
|
402
|
-
|
|
435
|
+
`smoke:ecosystem` installs the current built tarball alongside published Browser Error Log 0.2.10 and Flow QA 0.8.8 in a fresh temporary consumer. It checks real JavaScript/resource capture, partial export preservation, the review gate, failures before fixture repair and passes after it, selected-run linkage and the not-run gate, and installed UI/design-system assets. CI requires this check before release preparation. Evidence is written to `output/ecosystem/verification.json`. Set `ERROR_TO_TEST_RELEASE_VERSION=X.Y.Z` to test that exact registry release instead of the local tarball. The script installs Chromium and only runs a controlled local fixture, without production access, login, or model calls.
|
|
436
|
+
|
|
437
|
+
The optional `smoke:flowqa` uses local Browser Error Log and Flow QA sources in a controlled Chromium demo. It additionally preserves an unresolved case and checks stale-source rejection. It requires their local source/dependencies and an installed Chromium browser.
|
package/dist/artifacts.d.ts
CHANGED
package/dist/artifacts.js
CHANGED
|
@@ -186,7 +186,7 @@ export async function readVerifiedBundle(directory, options = {}) {
|
|
|
186
186
|
}
|
|
187
187
|
if (options.profile !== undefined && hash(options.profile) !== provenance.profileSha256)
|
|
188
188
|
throw new Error('STALE_BUNDLE: Profile changed since analysis.');
|
|
189
|
-
return { analysis, provenance, ...(verifiedSuite === undefined ? {} : { suite: verifiedSuite }), verification: { suite: suiteExists, reviewed: provenance.reviewed, sourceChecked: options.input !== undefined } };
|
|
189
|
+
return { analysis, provenance, report, ...(verifiedSuite === undefined ? {} : { suite: verifiedSuite }), verification: { suite: suiteExists, reviewed: provenance.reviewed, sourceChecked: options.input !== undefined } };
|
|
190
190
|
}
|
|
191
191
|
export async function verifyBundle(directory, options = {}) {
|
|
192
192
|
return (await readVerifiedBundle(directory, options)).verification;
|
package/dist/candidates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hash, optionalText, parseWebSteps, record, strings, text } from "./validation.js";
|
|
2
2
|
import { pagePath, redactText, safeUrl } from "./redact.js";
|
|
3
3
|
const idPattern = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/;
|
|
4
|
-
const eventTypes = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual']);
|
|
4
|
+
const eventTypes = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual']);
|
|
5
5
|
const runtimes = new Set(['browser', 'webview-ios', 'webview-android', 'unknown']);
|
|
6
6
|
function identifier(value, label) {
|
|
7
7
|
const result = text(value, label);
|
|
@@ -130,8 +130,12 @@ function safeFacts(group) {
|
|
|
130
130
|
if (group.pagePath)
|
|
131
131
|
facts.push(`Observed page path: ${redactText(group.pagePath)}`);
|
|
132
132
|
for (const event of group.evidence) {
|
|
133
|
-
if (event.network)
|
|
134
|
-
|
|
133
|
+
if (event.network) {
|
|
134
|
+
const { method, url, status } = event.network;
|
|
135
|
+
facts.push(status !== undefined && status < 100
|
|
136
|
+
? `Observed network outcome: ${method} ${safeUrl(url)} (HTTP status unavailable; recorded value: ${status}).`
|
|
137
|
+
: `Observed network response: ${method} ${safeUrl(url)}${status === undefined ? '' : ` (${status})`}.`);
|
|
138
|
+
}
|
|
135
139
|
if (event.source === 'manual' && event.expected)
|
|
136
140
|
facts.push(`Reporter-provided expected behavior: ${redactText(event.expected)}${event.expectedSource ? ` (source: ${redactText(event.expectedSource)})` : ' (source missing)'}.`);
|
|
137
141
|
}
|
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import { linkFlowQaReport } from "./results.js";
|
|
|
12
12
|
import { readRunSummary, renderRunSummary } from "./run-summary.js";
|
|
13
13
|
import { readReadiness, renderReadiness } from "./readiness.js";
|
|
14
14
|
import { refineBundle } from "./refinement.js";
|
|
15
|
+
import { readIssueReport } from "./issue-report.js";
|
|
15
16
|
const help = `Error to Test — local error analysis and regression TC drafts
|
|
16
17
|
|
|
17
18
|
error-to-test analyze --input errors-1.json --input errors-2.json --profile profile.json --out new-directory
|
|
@@ -25,6 +26,7 @@ const help = `Error to Test — local error analysis and regression TC drafts
|
|
|
25
26
|
error-to-test init-profile new-directory --out profile.json
|
|
26
27
|
error-to-test init-profile new-directory --profile existing.json --out extended.json
|
|
27
28
|
error-to-test refine new-directory --profile updated.json --out refined-directory [--reviewed]
|
|
29
|
+
error-to-test issue new-directory --group GROUP_ID [--out issue.md]
|
|
28
30
|
error-to-test link-run new-directory --report path/to/qa-report.json
|
|
29
31
|
error-to-test results new-directory [--format text|json] [--out summary.md] [--fail-on STATUS ...]
|
|
30
32
|
error-to-test readiness new-directory [--format text|json]
|
|
@@ -45,7 +47,7 @@ Options:
|
|
|
45
47
|
--environment NAME Metadata for a manual report
|
|
46
48
|
--release NAME Metadata for a manual report
|
|
47
49
|
--page PATH Page reported for a manual error
|
|
48
|
-
--type TYPE javascript|promise|react|console|http|network|manual
|
|
50
|
+
--type TYPE javascript|promise|react|console|http|network|resource|manual
|
|
49
51
|
--runtime RUNTIME browser|webview-ios|webview-android|unknown (manual input)
|
|
50
52
|
--reproduce TEXT Reported action (--error only; repeatable)
|
|
51
53
|
--precondition TEXT Reported setup (--error only; repeatable)
|
|
@@ -53,11 +55,12 @@ Options:
|
|
|
53
55
|
--expected-source TEXT Expected-result source (--error only)
|
|
54
56
|
--from ISO --to ISO Filter observed timestamps; undated reports are excluded
|
|
55
57
|
--min-count N Select groups with at least N records after dedup/date filtering (1..10000)
|
|
56
|
-
--group GROUP_ID
|
|
58
|
+
--group GROUP_ID Analyze: select exact groups before min-count/top (repeat up to 100 times); issue: export exactly one group
|
|
57
59
|
--top N Generate TCs for the first N eligible ranked groups (1..100; after --min-count)
|
|
58
60
|
--out DIRECTORY New analyze directory; existing files are never overwritten
|
|
59
61
|
--out DIRECTORY New refine directory outside the source bundle (required; review defaults to pending)
|
|
60
62
|
--out FILE New init-profile JSON file; existing files are never overwritten
|
|
63
|
+
--out FILE New issue Markdown file outside the source bundle; no remote issue is filed
|
|
61
64
|
--out FILE New results summary file; existing files are never overwritten
|
|
62
65
|
--out FILE New comparison file; existing files are never overwritten
|
|
63
66
|
--max-new N Compare only: allow 0..10000 only-current signatures; exit 0 within limit, 2 over limit, 1 on error
|
|
@@ -172,11 +175,39 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
172
175
|
}
|
|
173
176
|
if (positionals.length === 0) {
|
|
174
177
|
if (Object.keys(values).length)
|
|
175
|
-
throw new Error('A command is required. Use analyze, init-profile, refine, verify, link-run, results, compare, or readiness. See --help.');
|
|
178
|
+
throw new Error('A command is required. Use analyze, init-profile, refine, issue, verify, link-run, results, compare, or readiness. See --help.');
|
|
176
179
|
process.stdout.write(help);
|
|
177
180
|
return;
|
|
178
181
|
}
|
|
179
182
|
const command = positionals[0];
|
|
183
|
+
if (command === 'issue') {
|
|
184
|
+
if (positionals.length !== 2 || !positionals[1]?.trim() || values.group?.length !== 1)
|
|
185
|
+
throw new Error('issue requires one bundle directory and exactly one --group GROUP_ID.');
|
|
186
|
+
if (Object.keys(values).some(key => !['group', 'out', 'help'].includes(key)))
|
|
187
|
+
throw new Error('Unsupported option for issue. Use only --group GROUP_ID and --out FILE.');
|
|
188
|
+
if (values.out !== undefined && !values.out.trim())
|
|
189
|
+
throw new Error('--out requires a nonempty file path.');
|
|
190
|
+
const bundle = resolve(positionals[1]);
|
|
191
|
+
const out = values.out === undefined ? undefined : resolve(values.out);
|
|
192
|
+
if (out !== undefined && insideBundle(await realpath(bundle), await canonicalOutput(out)))
|
|
193
|
+
throw new Error('The issue report must be written outside the source bundle. Choose a new --out FILE path.');
|
|
194
|
+
const content = await readIssueReport(bundle, values.group[0]);
|
|
195
|
+
if (out === undefined) {
|
|
196
|
+
await writeGateOutput(content);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
await mkdir(dirname(out), { recursive: true });
|
|
200
|
+
try {
|
|
201
|
+
await writeFile(out, content, { flag: 'wx', mode: 0o600 });
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
if (error.code === 'EEXIST')
|
|
205
|
+
throw new Error('The output file already exists. Choose a new --out FILE path.');
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
await writeGateOutput(`Issue report written: ${out}\n`);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
180
211
|
if (command === 'refine') {
|
|
181
212
|
if (positionals.length !== 2 || !positionals[1]?.trim() || !values.profile?.trim() || !values.out?.trim())
|
|
182
213
|
throw new Error('refine requires one bundle directory, --profile FILE, and --out DIRECTORY.');
|
|
@@ -391,7 +422,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
391
422
|
return;
|
|
392
423
|
}
|
|
393
424
|
if (command !== 'analyze' || positionals.length !== 1)
|
|
394
|
-
throw new Error('Use analyze, init-profile, refine, verify, link-run, results, compare, or readiness. See --help.');
|
|
425
|
+
throw new Error('Use analyze, init-profile, refine, issue, verify, link-run, results, compare, or readiness. See --help.');
|
|
395
426
|
if (values.report)
|
|
396
427
|
throw new Error('--report applies to link-run only.');
|
|
397
428
|
if (values['fail-on'] !== undefined)
|
|
@@ -405,7 +436,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
405
436
|
const format = values.format ?? 'auto';
|
|
406
437
|
if (format !== 'auto' && format !== 'json' && format !== 'jsonl' && format !== 'text')
|
|
407
438
|
throw new Error('--format must be auto, json, jsonl, or text.');
|
|
408
|
-
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual'];
|
|
439
|
+
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual'];
|
|
409
440
|
if (values.type !== undefined && !types.includes(values.type))
|
|
410
441
|
throw new Error('--type is not supported.');
|
|
411
442
|
if (values.runtime !== undefined && !['browser', 'webview-ios', 'webview-android', 'unknown'].includes(values.runtime))
|
package/dist/comparison.js
CHANGED
|
@@ -3,7 +3,7 @@ import { pagePath, redactText } from "./redact.js";
|
|
|
3
3
|
import { hash, record, timestamp } from "./validation.js";
|
|
4
4
|
const statuses = ['only-current', 'both', 'only-baseline'];
|
|
5
5
|
const runtimes = ['browser', 'webview-ios', 'webview-android', 'unknown'];
|
|
6
|
-
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual'];
|
|
6
|
+
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual'];
|
|
7
7
|
const kinds = ['browser-error-json', 'browser-error-jsonl', 'manual-json', 'manual-jsonl', 'manual-text'];
|
|
8
8
|
const normalizedMax = 128 * 1024;
|
|
9
9
|
const hex64 = /^[0-9a-f]{64}$/;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { groupObservations } from './grouping.ts';
|
|
|
4
4
|
export { createCandidates, parseProfile } from './candidates.ts';
|
|
5
5
|
export { exportFlowQa } from './exports/flow-qa.ts';
|
|
6
6
|
export { writeBundle, verifyBundle, renderReport } from './artifacts.ts';
|
|
7
|
+
export { readIssueReport } from './issue-report.ts';
|
|
7
8
|
export { linkFlowQaReport } from './results.ts';
|
|
8
9
|
export { createProfileTemplate, type ProfileTemplateOptions } from './profile-template.ts';
|
|
9
10
|
export { refineBundle } from './refinement.ts';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { groupObservations } from "./grouping.js";
|
|
|
4
4
|
export { createCandidates, parseProfile } from "./candidates.js";
|
|
5
5
|
export { exportFlowQa } from "./exports/flow-qa.js";
|
|
6
6
|
export { writeBundle, verifyBundle, renderReport } from "./artifacts.js";
|
|
7
|
+
export { readIssueReport } from "./issue-report.js";
|
|
7
8
|
export { linkFlowQaReport } from "./results.js";
|
|
8
9
|
export { createProfileTemplate } from "./profile-template.js";
|
|
9
10
|
export { refineBundle } from "./refinement.js";
|
package/dist/input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { record, text, optionalText, strings, timestamp, parseWebSteps, hash } from "./validation.js";
|
|
2
2
|
import { redactText, safeUrl } from "./redact.js";
|
|
3
3
|
import { inputSource } from "./input-source.js";
|
|
4
|
-
const TYPES = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual']);
|
|
4
|
+
const TYPES = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual']);
|
|
5
5
|
const RUNTIMES = new Set(['browser', 'webview-ios', 'webview-android', 'unknown']);
|
|
6
6
|
const MAX_RECORDS = 10_000;
|
|
7
7
|
const LOGGER_PREFIX = /^\[(?:ERROR|WARN|WARNING|INFO|DEBUG|TRACE|FATAL|vite|timestamp|\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})?)?|\d{2}:\d{2}:\d{2})\][ \t]+\S/i;
|
|
@@ -96,8 +96,8 @@ function browserEvent(value, index) {
|
|
|
96
96
|
let status;
|
|
97
97
|
if (net.status !== undefined) {
|
|
98
98
|
status = number(net.status, `${label}.network.status`, true);
|
|
99
|
-
if (status
|
|
100
|
-
throw new Error(`${label}.network.status must be
|
|
99
|
+
if (status > 599)
|
|
100
|
+
throw new Error(`${label}.network.status must be 0..599`);
|
|
101
101
|
}
|
|
102
102
|
network = { method: redactText(method).toUpperCase(), url: safeUrl(url), durationMs, ...(status === undefined ? {} : { status }) };
|
|
103
103
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { literal, readVerifiedBundle } from "./artifacts.js";
|
|
2
|
+
import { record, timestamp } from "./validation.js";
|
|
3
|
+
const MAX_REPORT_BYTES = 64 * 1024 * 1024;
|
|
4
|
+
const groupIdPattern = /^group-[0-9a-f]{16}$/;
|
|
5
|
+
const candidateIdPattern = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/;
|
|
6
|
+
const shaPattern = /^[0-9a-f]{64}$/;
|
|
7
|
+
const kinds = new Set(['browser-error-json', 'manual-json', 'manual-text', 'browser-error-jsonl', 'manual-jsonl']);
|
|
8
|
+
function invalid(detail) {
|
|
9
|
+
throw new Error(`Invalid issue report snapshot: ${detail}.`);
|
|
10
|
+
}
|
|
11
|
+
function sha(value, label) {
|
|
12
|
+
if (typeof value !== 'string' || !shaPattern.test(value))
|
|
13
|
+
invalid(label);
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function count(value, label) {
|
|
17
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0 || value > 10000)
|
|
18
|
+
invalid(label);
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
function sourceCoverage(value) {
|
|
22
|
+
const coverage = record(value, 'analysis.coverage');
|
|
23
|
+
if (!kinds.has(coverage.kind) ||
|
|
24
|
+
coverage.frequency !== (coverage.kind === 'browser-error-json' || coverage.kind === 'browser-error-jsonl' ? 'captured-events' : 'submitted-reports') ||
|
|
25
|
+
typeof coverage.partial !== 'boolean' || coverage.retention !== 'unknown')
|
|
26
|
+
invalid('source coverage');
|
|
27
|
+
const inputCount = count(coverage.inputCount, 'coverage.inputCount');
|
|
28
|
+
const duplicates = count(coverage.duplicates, 'coverage.duplicates');
|
|
29
|
+
const filtered = count(coverage.filtered, 'coverage.filtered');
|
|
30
|
+
if (duplicates + filtered > inputCount)
|
|
31
|
+
invalid('source coverage counts');
|
|
32
|
+
const lines = [
|
|
33
|
+
`Kind: ${coverage.kind}`,
|
|
34
|
+
`Frequency: ${coverage.frequency}`,
|
|
35
|
+
`Partial export: ${coverage.partial ? 'yes' : 'no'}`,
|
|
36
|
+
'Retention coverage: unknown',
|
|
37
|
+
`Input records: ${inputCount}`,
|
|
38
|
+
`Duplicate records: ${duplicates}`,
|
|
39
|
+
`Filtered records: ${filtered}`,
|
|
40
|
+
];
|
|
41
|
+
if (coverage.period !== undefined) {
|
|
42
|
+
const period = record(coverage.period, 'coverage.period');
|
|
43
|
+
if (Object.keys(period).some(key => key !== 'from' && key !== 'to') ||
|
|
44
|
+
(period.from === undefined && period.to === undefined))
|
|
45
|
+
invalid('coverage.period');
|
|
46
|
+
const from = period.from === undefined ? undefined : timestamp(period.from, 'coverage.period.from');
|
|
47
|
+
const to = period.to === undefined ? undefined : timestamp(period.to, 'coverage.period.to');
|
|
48
|
+
if (from !== undefined && to !== undefined && from > to)
|
|
49
|
+
invalid('coverage.period order');
|
|
50
|
+
if (from !== undefined)
|
|
51
|
+
lines.push(`Period from: ${period.from}`);
|
|
52
|
+
if (to !== undefined)
|
|
53
|
+
lines.push(`Period to: ${period.to}`);
|
|
54
|
+
}
|
|
55
|
+
return lines;
|
|
56
|
+
}
|
|
57
|
+
function savedGroupDetail(report, expectedIds, requestedId) {
|
|
58
|
+
const headers = [];
|
|
59
|
+
let fence;
|
|
60
|
+
for (let start = 0; start < report.length;) {
|
|
61
|
+
const newline = report.indexOf('\n', start);
|
|
62
|
+
const end = newline < 0 ? report.length : newline;
|
|
63
|
+
const raw = report.slice(start, end);
|
|
64
|
+
const line = raw.endsWith('\r') ? raw.slice(0, -1) : raw;
|
|
65
|
+
if (fence) {
|
|
66
|
+
const closer = /^ {0,3}(`+|~+)[ \t]*$/.exec(line);
|
|
67
|
+
if (closer && closer[1][0] === fence.marker && closer[1].length >= fence.length)
|
|
68
|
+
fence = undefined;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const opener = /^ {0,3}(`{3,}|~{3,})(.*)$/.exec(line);
|
|
72
|
+
if (opener && !(opener[1][0] === '`' && opener[2].includes('`'))) {
|
|
73
|
+
fence = { marker: opener[1][0], length: opener[1].length };
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const header = /^## (group-[0-9a-f]{16})$/.exec(line);
|
|
77
|
+
if (header)
|
|
78
|
+
headers.push({ id: header[1], start });
|
|
79
|
+
else if (/^ {0,3}#{1,6}[ \t]*group-/i.test(line) || (headers.length > 0 && /^##(?:[ \t]|$)/.test(line))) {
|
|
80
|
+
invalid('saved report group header layout');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (newline < 0)
|
|
85
|
+
break;
|
|
86
|
+
start = newline + 1;
|
|
87
|
+
}
|
|
88
|
+
if (fence)
|
|
89
|
+
invalid('saved report has an unclosed code fence');
|
|
90
|
+
if (headers.length !== expectedIds.length || headers.some((header, index) => header.id !== expectedIds[index])) {
|
|
91
|
+
invalid('saved report group header layout');
|
|
92
|
+
}
|
|
93
|
+
const index = headers.findIndex(header => header.id === requestedId);
|
|
94
|
+
if (index < 0)
|
|
95
|
+
invalid('requested group was not found');
|
|
96
|
+
return report.slice(headers[index].start, headers[index + 1]?.start ?? report.length).replace(/[\r\n]+$/, '');
|
|
97
|
+
}
|
|
98
|
+
/** Return one saved group section with provenance and whole-bundle coverage context. */
|
|
99
|
+
export async function readIssueReport(directory, groupId) {
|
|
100
|
+
if (typeof groupId !== 'string' || !groupIdPattern.test(groupId))
|
|
101
|
+
invalid('requested group ID');
|
|
102
|
+
const { analysis, provenance, report, verification } = await readVerifiedBundle(directory);
|
|
103
|
+
const inputSha256 = sha(provenance.inputSha256, 'provenance.inputSha256');
|
|
104
|
+
const analysisSha256 = sha(provenance.analysisSha256, 'provenance.analysisSha256');
|
|
105
|
+
const reportSha256 = sha(provenance.reportSha256, 'provenance.reportSha256');
|
|
106
|
+
const profileSha256 = provenance.profileSha256 === undefined ? undefined : sha(provenance.profileSha256, 'provenance.profileSha256');
|
|
107
|
+
const suiteSha256 = provenance.suiteSha256 === undefined ? undefined : sha(provenance.suiteSha256, 'provenance.suiteSha256');
|
|
108
|
+
if (!Array.isArray(analysis.groups) || analysis.groups.length > 10000)
|
|
109
|
+
invalid('analysis.groups');
|
|
110
|
+
const ids = [];
|
|
111
|
+
const known = new Set();
|
|
112
|
+
for (const [index, value] of analysis.groups.entries()) {
|
|
113
|
+
const id = record(value, `analysis.groups[${index}]`).id;
|
|
114
|
+
if (typeof id !== 'string' || !groupIdPattern.test(id) || known.has(id))
|
|
115
|
+
invalid('analysis group IDs');
|
|
116
|
+
known.add(id);
|
|
117
|
+
ids.push(id);
|
|
118
|
+
}
|
|
119
|
+
if (!known.has(groupId))
|
|
120
|
+
invalid('requested group was not found');
|
|
121
|
+
if (!Array.isArray(analysis.candidates) || analysis.candidates.length > 100)
|
|
122
|
+
invalid('analysis.candidates');
|
|
123
|
+
const candidateIds = new Set();
|
|
124
|
+
let selected = 0;
|
|
125
|
+
for (const [index, value] of analysis.candidates.entries()) {
|
|
126
|
+
const candidate = record(value, `analysis.candidates[${index}]`);
|
|
127
|
+
if (typeof candidate.id !== 'string' || !candidateIdPattern.test(candidate.id) || candidateIds.has(candidate.id) ||
|
|
128
|
+
typeof candidate.groupId !== 'string' || !groupIdPattern.test(candidate.groupId) || !known.has(candidate.groupId))
|
|
129
|
+
invalid('candidate IDs or group references');
|
|
130
|
+
candidateIds.add(candidate.id);
|
|
131
|
+
if (candidate.groupId === groupId)
|
|
132
|
+
selected++;
|
|
133
|
+
}
|
|
134
|
+
if (!Array.isArray(analysis.warnings) || analysis.warnings.some(warning => typeof warning !== 'string'))
|
|
135
|
+
invalid('analysis.warnings');
|
|
136
|
+
const coverage = sourceCoverage(analysis.coverage);
|
|
137
|
+
const detail = savedGroupDetail(report, ids, groupId);
|
|
138
|
+
const lines = [
|
|
139
|
+
'# Error to Test issue report', '',
|
|
140
|
+
`Group ID: ${groupId}`,
|
|
141
|
+
`Included groups: 1 of ${ids.length}`,
|
|
142
|
+
`Selected TC candidates: ${selected}`,
|
|
143
|
+
`Review acknowledgement: ${verification.reviewed ? 'yes' : 'no'}`,
|
|
144
|
+
`Source input SHA-256: ${inputSha256}`,
|
|
145
|
+
`Source analysis SHA-256: ${analysisSha256}`,
|
|
146
|
+
`Source report SHA-256: ${reportSha256}`,
|
|
147
|
+
...(profileSha256 === undefined ? [] : [`Source profile SHA-256: ${profileSha256}`]),
|
|
148
|
+
...(suiteSha256 === undefined ? [] : [`Source suite SHA-256: ${suiteSha256}`]),
|
|
149
|
+
'', '## Source coverage (whole original bundle)', '',
|
|
150
|
+
...coverage, '',
|
|
151
|
+
'Counts describe supplied records, not error rates, affected-user counts, or complete collection.',
|
|
152
|
+
'Original raw input bytes were not independently rechecked for this excerpt.',
|
|
153
|
+
'Saved candidate questions are reproduced; use readiness for actual exported blockers.',
|
|
154
|
+
'This excerpt does not establish execution, approval, or issue resolution.', '',
|
|
155
|
+
];
|
|
156
|
+
if (selected === 0)
|
|
157
|
+
lines.push('No selected TC candidates for this group.', '');
|
|
158
|
+
if (analysis.warnings.length)
|
|
159
|
+
lines.push('## Original analysis warnings', '', literal(analysis.warnings.join('\n')), '');
|
|
160
|
+
lines.push(detail, '');
|
|
161
|
+
const output = lines.join('\n');
|
|
162
|
+
if (Buffer.byteLength(output) > MAX_REPORT_BYTES)
|
|
163
|
+
throw new Error('The issue report exceeds 64 MiB. Narrow the source bundle.');
|
|
164
|
+
return output;
|
|
165
|
+
}
|
package/dist/refinement.js
CHANGED
|
@@ -6,7 +6,7 @@ import { hash, parseWebSteps, record } from "./validation.js";
|
|
|
6
6
|
const sha256 = /^[a-f0-9]{64}$/;
|
|
7
7
|
const groupId = /^group-[a-f0-9]{16}$/;
|
|
8
8
|
const caseId = /^TC_[a-f0-9]{16}$/;
|
|
9
|
-
const eventTypes = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual']);
|
|
9
|
+
const eventTypes = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual']);
|
|
10
10
|
const runtimes = new Set(['browser', 'webview-ios', 'webview-android', 'unknown']);
|
|
11
11
|
const kinds = new Set(['browser-error-json', 'manual-json', 'manual-text', 'browser-error-jsonl', 'manual-jsonl']);
|
|
12
12
|
const refinementNote = 'Refinement: Original input records were not rechecked; group ranking and the existing TC selection were preserved. Candidates were regenerated from the verified snapshot and supplied profile.';
|
|
@@ -74,7 +74,7 @@ function observation(value, label) {
|
|
|
74
74
|
string(network.method, `${label}.network.method`);
|
|
75
75
|
string(network.url, `${label}.network.url`);
|
|
76
76
|
if (network.status !== undefined) {
|
|
77
|
-
integer(network.status, `${label}.network.status
|
|
77
|
+
integer(network.status, `${label}.network.status`);
|
|
78
78
|
if (network.status > 599)
|
|
79
79
|
invalid(`${label}.network.status`);
|
|
80
80
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Flow QA reports use caseIds; linked results record an explicit selected-run scope. */
|
|
2
|
+
export interface LinkedSelection {
|
|
3
|
+
mode: 'selected';
|
|
4
|
+
totalCases: number;
|
|
5
|
+
selectedCaseIds: string[];
|
|
6
|
+
}
|
|
7
|
+
/** Keep a reported label without persisting any URL that may carry sensitive path data. */
|
|
8
|
+
export declare function safeReportedTargetName(value: unknown, label: string): string;
|
|
9
|
+
export declare function validateResultSelection(value: unknown, present: boolean, caseIds: readonly string[], expectedIds: ReadonlySet<string>, source: 'Flow QA report' | 'Linked result'): LinkedSelection | undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { redactText } from "./redact.js";
|
|
2
|
+
import { text } from "./validation.js";
|
|
3
|
+
/** Keep a reported label without persisting any URL that may carry sensitive path data. */
|
|
4
|
+
export function safeReportedTargetName(value, label) {
|
|
5
|
+
const name = text(value, label);
|
|
6
|
+
return redactText(name.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s<>"']+|(?<!:)\/\/[^\s<>"']+/gi, '[redacted-url]'));
|
|
7
|
+
}
|
|
8
|
+
export function validateResultSelection(value, present, caseIds, expectedIds, source) {
|
|
9
|
+
if (!present) {
|
|
10
|
+
if (caseIds.length !== expectedIds.size)
|
|
11
|
+
throw new Error(source === 'Flow QA report'
|
|
12
|
+
? 'The report does not account for every exported case.'
|
|
13
|
+
: 'Linked result has an incomplete case list.');
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const linked = source === 'Linked result';
|
|
17
|
+
const idKey = linked ? 'selectedCaseIds' : 'caseIds';
|
|
18
|
+
const keys = linked ? ['mode', 'totalCases', idKey] : ['totalCases', idKey];
|
|
19
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)
|
|
20
|
+
|| (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
|
|
21
|
+
|| Reflect.ownKeys(value).length !== keys.length
|
|
22
|
+
|| keys.some(key => !Object.hasOwn(value, key))) {
|
|
23
|
+
throw new Error(`${source} has an invalid selection declaration.`);
|
|
24
|
+
}
|
|
25
|
+
const declaration = value;
|
|
26
|
+
if (linked && declaration.mode !== 'selected')
|
|
27
|
+
throw new Error('Linked result has an invalid selection mode.');
|
|
28
|
+
if (!Number.isSafeInteger(declaration.totalCases) || declaration.totalCases !== expectedIds.size
|
|
29
|
+
|| caseIds.length === 0 || caseIds.length >= expectedIds.size) {
|
|
30
|
+
throw new Error(`${source} selection totalCases does not match the exported suite or is not a proper subset.`);
|
|
31
|
+
}
|
|
32
|
+
const selectedCaseIds = declaration[idKey];
|
|
33
|
+
if (!Array.isArray(selectedCaseIds) || selectedCaseIds.length !== caseIds.length
|
|
34
|
+
|| selectedCaseIds.some(id => typeof id !== 'string' || !expectedIds.has(id))
|
|
35
|
+
|| new Set(selectedCaseIds).size !== selectedCaseIds.length
|
|
36
|
+
|| !caseIds.every(id => selectedCaseIds.includes(id))) {
|
|
37
|
+
throw new Error(`${source} selected case IDs do not match the reported cases and exported suite.`);
|
|
38
|
+
}
|
|
39
|
+
return { mode: 'selected', totalCases: expectedIds.size, selectedCaseIds: [...selectedCaseIds] };
|
|
40
|
+
}
|
package/dist/results.js
CHANGED
|
@@ -3,6 +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 { safeReportedTargetName, validateResultSelection } from "./result-selection.js";
|
|
6
7
|
const runStatuses = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
|
|
7
8
|
const caseStatuses = new Set(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']);
|
|
8
9
|
/** Associate a normalized Flow QA report with the exact exported immutable suite. */
|
|
@@ -27,29 +28,33 @@ export async function linkFlowQaReport(directory, rawReport) {
|
|
|
27
28
|
const mappings = provenance.mappings.map((item, index) => record(item, `mappings[${index}]`));
|
|
28
29
|
const expected = new Map(mappings.map(item => [item.caseId, item]));
|
|
29
30
|
const seen = new Set();
|
|
31
|
+
const reportCaseIds = [];
|
|
30
32
|
const cases = report.cases.map((item, index) => {
|
|
31
33
|
const original = record(item, `report.cases[${index}]`), id = text(original.id, 'case.id');
|
|
32
34
|
const mapping = expected.get(id);
|
|
33
35
|
if (!mapping || seen.has(id))
|
|
34
36
|
throw new Error('The report contains unknown or duplicate case IDs.');
|
|
35
37
|
seen.add(id);
|
|
38
|
+
reportCaseIds.push(id);
|
|
36
39
|
const caseStatus = text(original.status, 'case.status');
|
|
37
40
|
if (!caseStatuses.has(caseStatus))
|
|
38
41
|
throw new Error('Invalid Flow QA case status.');
|
|
39
42
|
return { ...mapping, status: caseStatus, ...(original.reason === undefined ? {} : { reason: redactText(text(original.reason, 'case.reason')) }) };
|
|
40
43
|
});
|
|
41
|
-
|
|
42
|
-
throw new Error('The report does not account for every exported case.');
|
|
44
|
+
const selection = validateResultSelection(report.selection, Object.hasOwn(report, 'selection'), reportCaseIds, new Set(expected.keys()), 'Flow QA report');
|
|
43
45
|
if (status === 'passed' && cases.some(item => item.status === 'failed' || item.status === 'error'))
|
|
44
46
|
throw new Error('The report status contradicts its case results.');
|
|
45
47
|
const startedAt = timestamp(report.startedAt, 'report.startedAt'), finishedAt = timestamp(report.finishedAt, 'report.finishedAt');
|
|
46
48
|
if (finishedAt < startedAt)
|
|
47
49
|
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');
|
|
48
52
|
const output = {
|
|
49
53
|
schemaVersion: 'error-to-test/results-1', runId,
|
|
50
54
|
inputSha256: provenance.inputSha256, suiteSha256: provenance.suiteSha256,
|
|
51
55
|
startedAt, finishedAt,
|
|
52
|
-
status,
|
|
56
|
+
status, ...(targetName === undefined ? {} : { targetName }),
|
|
57
|
+
...(selection === undefined ? {} : { selection }), cases,
|
|
53
58
|
note: 'These results cover the specified assertions. No source issue was automatically closed.',
|
|
54
59
|
};
|
|
55
60
|
const resultsRoot = resolve(root, 'results');
|
package/dist/run-summary.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LinkedSelection } from './result-selection.ts';
|
|
1
2
|
export type LinkedRunStatus = 'passed' | 'failed' | 'blocked' | 'error' | 'interrupted';
|
|
2
3
|
export type LinkedCaseStatus = 'passed' | 'failed' | 'flaky' | 'blocked' | 'skipped' | 'error';
|
|
3
4
|
type DisplayCaseStatus = LinkedCaseStatus | 'not-run';
|
|
@@ -11,6 +12,8 @@ export interface RunSummary {
|
|
|
11
12
|
status: LinkedRunStatus;
|
|
12
13
|
startedAt: string;
|
|
13
14
|
finishedAt: string;
|
|
15
|
+
targetName?: string;
|
|
16
|
+
selection?: LinkedSelection;
|
|
14
17
|
};
|
|
15
18
|
counts: Record<DisplayCaseStatus, number>;
|
|
16
19
|
groups: {
|
package/dist/run-summary.js
CHANGED
|
@@ -4,6 +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
8
|
const runStatuses = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
|
|
8
9
|
const caseStatuses = new Set(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']);
|
|
9
10
|
const countStatuses = ['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error', 'not-run'];
|
|
@@ -81,7 +82,7 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
81
82
|
catch {
|
|
82
83
|
throw new Error(`Linked result ${name} is not a valid JSON object.`);
|
|
83
84
|
}
|
|
84
|
-
exactKeys(raw, ['schemaVersion', 'runId', 'inputSha256', 'suiteSha256', 'startedAt', 'finishedAt', 'status', 'cases', 'note'], [], `Linked result ${name}`);
|
|
85
|
+
exactKeys(raw, ['schemaVersion', 'runId', 'inputSha256', 'suiteSha256', 'startedAt', 'finishedAt', 'status', 'cases', 'note'], ['targetName', 'selection'], `Linked result ${name}`);
|
|
85
86
|
if (raw.schemaVersion !== 'error-to-test/results-1')
|
|
86
87
|
throw new Error(`Linked result ${name} uses an unsupported schema.`);
|
|
87
88
|
const runId = text(raw.runId, `${name}.runId`);
|
|
@@ -98,8 +99,9 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
98
99
|
if (finishedAt < startedAt)
|
|
99
100
|
throw new Error(`Linked result ${name} finished before it started.`);
|
|
100
101
|
text(raw.note, `${name}.note`);
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
const targetName = raw.targetName === undefined ? undefined : safeReportedTargetName(raw.targetName, `${name}.targetName`);
|
|
103
|
+
if (!Array.isArray(raw.cases) || raw.cases.length > expected.size)
|
|
104
|
+
throw new Error(`Linked result ${name} has an invalid case list.`);
|
|
103
105
|
const seen = new Set();
|
|
104
106
|
const cases = raw.cases.map((item, index) => {
|
|
105
107
|
const label = `${name}.cases[${index}]`;
|
|
@@ -119,12 +121,12 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
119
121
|
const reason = entry.reason === undefined ? undefined : redactText(text(entry.reason, `${label}.reason`));
|
|
120
122
|
return { ...mapping, eventIds: mapping.eventIds.map(redactText), status: caseStatus, ...(reason === undefined ? {} : { reason }) };
|
|
121
123
|
});
|
|
122
|
-
|
|
123
|
-
throw new Error(`Linked result ${name} does not account for every exported case.`);
|
|
124
|
+
const selection = validateResultSelection(raw.selection, Object.hasOwn(raw, 'selection'), cases.map(item => item.caseId), new Set(expected.keys()), 'Linked result');
|
|
124
125
|
if (status === 'passed' && cases.some(item => item.status === 'failed' || item.status === 'error')) {
|
|
125
126
|
throw new Error(`Linked result ${name} contradicts its case results.`);
|
|
126
127
|
}
|
|
127
|
-
return { runId, status: status, startedAt, finishedAt,
|
|
128
|
+
return { runId, status: status, startedAt, finishedAt,
|
|
129
|
+
...(targetName === undefined ? {} : { targetName }), ...(selection === undefined ? {} : { selection }), cases };
|
|
128
130
|
}
|
|
129
131
|
function later(a, b) {
|
|
130
132
|
if (a.finishedAt !== b.finishedAt)
|
|
@@ -227,6 +229,8 @@ export async function readRunSummary(directory) {
|
|
|
227
229
|
});
|
|
228
230
|
}
|
|
229
231
|
const warnings = ['Counts are the latest reported case outcomes, not proof that any source issue is resolved.'];
|
|
232
|
+
if (latest?.selection)
|
|
233
|
+
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.`);
|
|
230
234
|
if (analysis.warnings !== undefined)
|
|
231
235
|
warnings.push(...stringList(analysis.warnings, 'analysis.warnings').map(redactText));
|
|
232
236
|
if (runCount) {
|
|
@@ -245,7 +249,9 @@ export async function readRunSummary(directory) {
|
|
|
245
249
|
return {
|
|
246
250
|
schemaVersion: 'error-to-test/run-summary-1', inputSha256,
|
|
247
251
|
...(suiteSha256 === undefined ? {} : { suiteSha256 }), runCount,
|
|
248
|
-
...(latest === undefined ? {} : { latestRun: { runId: latest.runId, status: latest.status, startedAt: latest.startedAt, finishedAt: latest.finishedAt
|
|
252
|
+
...(latest === undefined ? {} : { latestRun: { runId: latest.runId, status: latest.status, startedAt: latest.startedAt, finishedAt: latest.finishedAt,
|
|
253
|
+
...(latest.targetName === undefined ? {} : { targetName: latest.targetName }),
|
|
254
|
+
...(latest.selection === undefined ? {} : { selection: latest.selection }) } }),
|
|
249
255
|
counts, groups, warnings,
|
|
250
256
|
};
|
|
251
257
|
}
|
|
@@ -259,6 +265,10 @@ export function renderRunSummary(summary) {
|
|
|
259
265
|
if (!uuidPattern.test(run.runId) || !runStatuses.has(run.status))
|
|
260
266
|
throw new Error('Invalid latest run in summary.');
|
|
261
267
|
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
|
+
if (run.targetName)
|
|
269
|
+
lines.push('Reported target name:', '', literal(safeReportedTargetName(run.targetName, 'summary.latestRun.targetName')), '');
|
|
270
|
+
if (run.selection)
|
|
271
|
+
lines.push(`Selected cases: ${run.selection.selectedCaseIds.length} of ${run.selection.totalCases} exported cases`, '');
|
|
262
272
|
}
|
|
263
273
|
else
|
|
264
274
|
lines.push('No linked runs were found. All selected cases are not-run.', '');
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'manual';
|
|
1
|
+
export type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'resource' | 'manual';
|
|
2
2
|
export type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';
|
|
3
3
|
export type Locator = {
|
|
4
4
|
by: 'role';
|
package/docs/releases.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
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.2.8
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
Selected reports must declare the exact reported case set and the original suite size. Linked results preserve that selection; latest-run summaries leave omitted cases `not-run` even after a previous full pass. Optional sanitized target names survive linking, without target URLs or device identifiers. Existing full results remain readable. New selection/target fields require this reader or newer, because earlier readers reject unknown fields.
|
|
10
|
+
|
|
11
|
+
The new package ecosystem smoke captures real SDK errors in Chromium, exercises review and execution boundaries through installed CLIs, links whole and selected runs, checks the `not-run` gate, and verifies installed UI/design-system assets. It also audits the fresh consumer for known high/critical runtime advisories. Release preparation now depends on this check in CI.
|
|
12
|
+
|
|
13
|
+
Local release-candidate checks on 2026-11-16: 199 tests, type checking, build, isolated package installation and the controlled browser flow. Registry publication and GitHub Actions are separate evidence; their final status is available on the matching release/workflow.
|
|
14
|
+
|
|
5
15
|
## 0.2.0
|
|
6
16
|
|
|
7
17
|
JSONL inputs add explicit `--format jsonl`, line-numbered validation, and browser/manual record kinds while preserving original bytes, multi-file provenance, comparison/baseline selection, and review gates. Existing 0.1.x bundles and formats remain supported. Integrations with exhaustive `SourceCoverage.kind` handling should include `browser-error-jsonl` and `manual-jsonl`.
|
|
@@ -10,7 +20,7 @@ This minor release sets both package manifests to `0.2.0` before verification. T
|
|
|
10
20
|
|
|
11
21
|
## Automatic publication
|
|
12
22
|
|
|
13
|
-
Pull requests and main pushes verify the package on Ubuntu and macOS.
|
|
23
|
+
Pull requests and main pushes verify the package on Ubuntu and macOS. An additional Ubuntu job installs the current tarball with published Browser Error Log 0.2.10 and Flow QA 0.8.8, then checks the complete capture/analyze/run/link loop in Chromium. Both jobs must pass before a main push prepares an immutable release source:
|
|
14
24
|
|
|
15
25
|
- 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.
|
|
16
26
|
- 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.
|
|
@@ -27,6 +37,7 @@ Publishing uses npm Trusted Publishing (GitHub Actions OIDC) for `hyeonse-swing/
|
|
|
27
37
|
npm ci
|
|
28
38
|
npm run check
|
|
29
39
|
npm run check:package
|
|
40
|
+
npm run smoke:ecosystem
|
|
30
41
|
```
|
|
31
42
|
|
|
32
43
|
To test real error capture and browser execution, supply local checked-out SDK/Flow QA sources and an installed Chromium browser:
|
|
@@ -47,4 +58,4 @@ The browser integration was verified on 2026-10-13 with a controlled local appli
|
|
|
47
58
|
| Report linkage | Before/after reports linked to the exact suite and source groups |
|
|
48
59
|
| Changed source | Stale flow and bundle rejected |
|
|
49
60
|
|
|
50
|
-
An unresolved case means the overall QA run can remain `blocked` even when the two runnable cases pass. This integration check
|
|
61
|
+
An unresolved case means the overall QA run can remain `blocked` even when the two runnable cases pass. This historical source integration check requires sibling repositories. The newer `smoke:ecosystem` check runs in CI using public packages and a local fixture; neither check fetches company repositories or application data. Live service authentication, native devices, and production behavior are outside this proof.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ihyeon/error-to-test",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Turn captured browser errors and pasted error reports into traceable regression test candidates.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Hyeonse Im",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"prepack": "npm run build",
|
|
55
55
|
"check:package": "npm run build && node scripts/package-smoke.mjs",
|
|
56
56
|
"smoke:flowqa": "node scripts/flowqa-smoke.ts",
|
|
57
|
+
"smoke:ecosystem": "npm run build && node scripts/ecosystem-smoke.mjs",
|
|
57
58
|
"demo": "node bin/error-to-test.mjs analyze --input examples/errors.json --profile examples/profile.json"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|