@ihyeon/error-to-test 0.1.16 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +42 -1
- package/README.md +46 -1
- package/dist/analysis.js +3 -0
- package/dist/candidates.d.ts +3 -1
- package/dist/candidates.js +3 -3
- package/dist/cli.js +20 -10
- package/dist/comparison.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/input.d.ts +1 -1
- package/dist/input.js +80 -11
- package/dist/profile-template.d.ts +4 -1
- package/dist/profile-template.js +94 -4
- package/dist/types.d.ts +1 -1
- package/docs/releases.md +6 -0
- package/examples/manual.jsonl +3 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -51,7 +51,7 @@ error-to-test analyze --input morning.json --input afternoon.json --min-count 3
|
|
|
51
51
|
error-to-test verify ./combined --input morning.json --input afternoon.json
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
최대 50개 파일, 합산 10 MiB·원본 10,000건까지 받습니다. 중복도 한도에 포함합니다. SDK JSON 내보내기·배열끼리, 수동 JSON끼리,
|
|
54
|
+
최대 50개 파일, 합산 10 MiB·원본 10,000건까지 받습니다. 중복도 한도에 포함합니다. SDK JSON 내보내기·배열끼리, 수동 JSON끼리, 텍스트끼리, 같은 종류의 JSONL끼리처럼 같은 입력 형식끼리 합칩니다. 텍스트는 파일 하나가 보고서 한 건이며, `--format`과 메타데이터·필터는 모든 파일에 적용합니다. 표준 입력(`--input -`)은 `analyze`에서 단독으로 사용하고, `verify`에는 원본 파일을 지정하세요.
|
|
55
55
|
|
|
56
56
|
파일과 표준 입력은 올바른 UTF-8이어야 합니다. 잘못된 바이트가 같은 대체 문자로 변환되어 원본 변경을 놓치지 않도록 해시 계산 전에 잘못된 인코딩을 거부합니다.
|
|
57
57
|
|
|
@@ -61,6 +61,30 @@ error-to-test verify ./combined --input morning.json --input afternoon.json
|
|
|
61
61
|
|
|
62
62
|
API에서도 `analyzeErrors([firstContent, secondContent], options)`, `parseInput([firstContent, secondContent], options)`, `await analyzeWithBaseline([firstContent, secondContent], baselineDirectory, options)`으로 사용합니다. 원본 검증은 `await verifyBundle(directory, { input: [firstContent, secondContent] })`입니다. 원소 하나의 배열은 문자열 하나와 동일합니다. 프로필 보완·이전 분석 대비 선택에도 같은 입력 순서를 유지하고, 기존 맥락 질문과 검토 조건을 적용합니다.
|
|
63
63
|
|
|
64
|
+
한 줄에 오류 한 건을 저장한 **JSONL 로그**는 `--format jsonl`로 분석합니다.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
error-to-test analyze --input errors.jsonl --format jsonl --out ./jsonl-analysis
|
|
68
|
+
error-to-test analyze --input morning.jsonl --input afternoon.jsonl --format jsonl --min-count 3 --out ./combined-jsonl
|
|
69
|
+
cat errors.jsonl | error-to-test analyze --input - --format jsonl --out ./piped-jsonl
|
|
70
|
+
error-to-test verify ./jsonl-analysis --input errors.jsonl
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
각 줄은 `schemaVersion: 1`인 완전한 SDK 이벤트 객체이거나, `schemaVersion` 없이 `message`를 필수로 가진 수동 오류 객체입니다. 한 파일과 함께 분석할 여러 파일에서 두 종류를 섞을 수 없습니다. 수동 오류는 다음처럼 작성합니다.
|
|
74
|
+
|
|
75
|
+
```jsonl
|
|
76
|
+
{"id":"first","message":"TypeError: item is undefined","page":"/items","runtime":"browser"}
|
|
77
|
+
{"id":"second","message":"TypeError: item is undefined","page":"/items","runtime":"browser"}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
[JSONL 예제](examples/manual.jsonl)는 `node bin/error-to-test.mjs analyze --input examples/manual.jsonl --format jsonl --min-count 2`로 실행합니다. 반복된 묶음 하나를 TC 대상으로 선택하고 전체 두 묶음을 남깁니다. 기대 결과나 실행할 assertion은 추측하지 않습니다.
|
|
81
|
+
|
|
82
|
+
LF·CRLF, 빈 줄, 문자열 안의 이스케이프된 줄바꿈과 파일 맨 앞의 BOM 하나를 지원합니다. 각 유효 줄은 완전한 JSON 객체 하나여야 합니다. 배열·내보내기 래퍼(`events`/`errors`)·줄별 `partial` 정보·알 수 없는 스키마는 거부합니다. 잘못된 줄은 건너뛰지 않고 1부터 시작하는 입력 파일 번호·실제 줄 번호로 알리며, 오류 원문은 진단 메시지에 넣지 않습니다. JSONL 자동 감지는 하지 않으므로 `--format jsonl`을 지정하세요. 기존 `auto`·`json`·`text` 동작은 유지합니다.
|
|
83
|
+
|
|
84
|
+
수집 범위는 `browser-error-jsonl`의 수집 이벤트 또는 `manual-jsonl`의 제출 보고서로 기록합니다. JSONL에는 내보내기의 부분 수집 정보가 없으므로 `partial: false`는 표시가 제공되지 않았다는 의미이며, 수집 완전성·보존 범위 미상 경고를 남깁니다. 완전한 수집을 뜻하지 않습니다. 기존 합산 한도·중복 제거·필터·원본 바이트 해시·프로필·검토 조건을 적용하고, 빈 줄은 건수에 넣지 않습니다.
|
|
85
|
+
|
|
86
|
+
API는 `analyzeErrors(content, { format: 'jsonl' })`이며 여러 파일의 문자열 배열도 지원합니다. 같은 건수 기준의 JSON·JSONL 번들은 `compare`와 `--baseline`으로 연결하며 형식 차이 경고를 유지합니다. 수집 이벤트와 제출 보고서는 비교할 수 없습니다. 기존 0.1.x 번들은 계속 읽을 수 있고, JSONL 번들은 0.2.0 이상이 필요합니다.
|
|
87
|
+
|
|
64
88
|
두 분석 결과는 `compare`로 비교할 수 있습니다. 릴리스가 바뀐 뒤 어떤 오류 서명이 다시 관측됐는지 확인할 때 사용합니다.
|
|
65
89
|
|
|
66
90
|
```sh
|
|
@@ -113,6 +137,23 @@ error-to-test analyze --input errors.json --min-count 3 --profile ./review-profi
|
|
|
113
137
|
|
|
114
138
|
`init-profile`은 검증에 통과한 번들만 읽고 새 파일에 저장합니다. 수정된 번들, 선택된 TC가 없는 결과, 기존 출력 파일은 거부합니다. 원래 분석 산출물을 덮어쓰지 않습니다. API의 `createProfileTemplate(analysis)`도 편집용 `error-to-test/profile-1` 객체를 만들며, 완성된 실행 프로필을 의미하지 않습니다.
|
|
115
139
|
|
|
140
|
+
이미 작성한 프로필은 `--profile`로 이어서 보완할 수 있습니다.
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
error-to-test analyze --input current-errors.jsonl --format jsonl --out ./current-analysis
|
|
144
|
+
error-to-test init-profile ./current-analysis --profile ./existing-profile.json --out ./expanded-profile.json
|
|
145
|
+
# 새로 추가된 빈 요구사항·출처·준비 조건·동작·assertion 작성
|
|
146
|
+
error-to-test analyze --input current-errors.jsonl --format jsonl --profile ./expanded-profile.json --out ./expanded-analysis
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
기존 프로필은 요구사항·기대 결과 출처 등 일반 프로필 검증을 통과해야 합니다. 이름과 규칙 순서·ID·조건·단계·기대 결과·준비 확인·질문을 검증된 값 그대로 보존합니다. 알 수 없는 필드와 파일 서식은 보존하지 않습니다. 기존 질문과 준비 미확인 상태도 남아 실행을 차단합니다.
|
|
150
|
+
|
|
151
|
+
TC 생성과 동일하게 모든 조건을 함께 검사해 기존 규칙이 적용되는 선택 묶음을 찾습니다. 넓은 조건의 규칙은 원래 조건 안에서 여러 묶음에 적용될 수 있습니다. 다른 릴리스의 정확한 `match.groupId`는 그대로 두며, 새 묶음에 단계·기대 결과를 복사하지 않습니다. 기존 규칙이 없는 선택 묶음에만 순위대로 빈 검토 항목을 붙입니다. 새 항목의 ID가 충돌하면 숫자 접미사를 붙이고 기존 ID는 유지합니다. 모두 기존 규칙으로 다뤄지면 항목을 추가하지 않습니다.
|
|
152
|
+
|
|
153
|
+
새 항목은 기대 결과·출처가 비어 있고, 준비 미확인과 검토 질문을 유지합니다. 직접 채운 뒤 원래 입력·메타데이터·필터·이전 분석 기준으로 다시 분석하세요. 기존 검토 조건도 적용합니다. 과거 규칙을 자동 삭제하지 않으므로 합산 100개 규칙·1 MiB 한도를 지켜야 합니다. 민감한 정보가 있는 기존 메타데이터·실행 단계는 파일 생성 전에 거부합니다. 기본·확장 템플릿 모두 번들의 `results` 폴더 밖에 있는 새 파일에 저장합니다.
|
|
154
|
+
|
|
155
|
+
API는 `createProfileTemplate(analysis, { profile: existingProfile })`입니다. JSON 값만으로 구성한 객체 또는 BOM 하나를 지원하는 JSON 문자열을 1 MiB까지 받으며 입력 객체를 변경하지 않습니다. 객체의 선택 필드가 `undefined`이면 해당 속성을 생략하세요. `profile`을 생략하면 기존 빈 템플릿을 만듭니다.
|
|
156
|
+
|
|
116
157
|
```sh
|
|
117
158
|
node bin/error-to-test.mjs verify .error-to-test/example --input examples/errors.json --profile examples/profile.json
|
|
118
159
|
node bin/error-to-test.mjs analyze --input examples/errors.json --profile examples/profile.json --reviewed --out .error-to-test/reviewed
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ error-to-test analyze --input morning.json --input afternoon.json --min-count 3
|
|
|
76
76
|
error-to-test verify ./combined --input morning.json --input afternoon.json
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Supply up to 50 files with a combined limit of 10 MiB and 10,000 raw records, including duplicates. Files must have the same input kind: SDK JSON exports/arrays together, manual JSON files together,
|
|
79
|
+
Supply up to 50 files with a combined limit of 10 MiB and 10,000 raw records, including duplicates. Files must have the same input kind: SDK JSON exports/arrays together, manual JSON files together, text reports together, or JSONL files of the same record kind together. Each text file is one report. `--format` and metadata/filter options apply to every file. Standard input (`--input -`) must be the only input to `analyze`; `verify` requires original files.
|
|
80
80
|
|
|
81
81
|
Files and standard input must be valid UTF-8. Malformed encoding is rejected before hashing, so distinct invalid bytes cannot silently become the same replacement character.
|
|
82
82
|
|
|
@@ -86,6 +86,32 @@ For multiple files, `analysis.source.inputs` records each original SHA-256 and U
|
|
|
86
86
|
|
|
87
87
|
The API accepts ordered content arrays: `analyzeErrors([firstContent, secondContent], options)`, `parseInput([firstContent, secondContent], options)`, and `await analyzeWithBaseline([firstContent, secondContent], baselineDirectory, options)`. Verify with `await verifyBundle(directory, { input: [firstContent, secondContent] })`. A one-element array is equivalent to its single string. Profile refinement and baseline selection work with the same ordered inputs and existing review gates.
|
|
88
88
|
|
|
89
|
+
### Read JSONL logs
|
|
90
|
+
|
|
91
|
+
Use explicit `--format jsonl` for one error object per line:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
error-to-test analyze --input errors.jsonl --format jsonl --out ./jsonl-analysis
|
|
95
|
+
error-to-test analyze --input morning.jsonl --input afternoon.jsonl --format jsonl --min-count 3 --out ./combined-jsonl
|
|
96
|
+
cat errors.jsonl | error-to-test analyze --input - --format jsonl --out ./piped-jsonl
|
|
97
|
+
error-to-test verify ./jsonl-analysis --input errors.jsonl
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Each record is either a full Browser Error Log v1 event with `schemaVersion: 1`, or a plain manual error object with a required `message` and no `schemaVersion`. For manual reports:
|
|
101
|
+
|
|
102
|
+
```jsonl
|
|
103
|
+
{"id":"first","message":"TypeError: item is undefined","page":"/items","runtime":"browser"}
|
|
104
|
+
{"id":"second","message":"TypeError: item is undefined","page":"/items","runtime":"browser"}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
See [examples/manual.jsonl](examples/manual.jsonl) for a complete sample: `node bin/error-to-test.mjs analyze --input examples/manual.jsonl --format jsonl --min-count 2` selects one recurring group and retains both groups for review. No expectation or runnable assertion is invented.
|
|
108
|
+
|
|
109
|
+
LF and CRLF, blank lines, escaped newlines in strings, and one leading file BOM are supported. Each nonblank physical line must contain one complete JSON object. Arrays, export envelopes (`events`/`errors`), record-level `partial` metadata, unknown schema versions, and mixed browser/manual records are rejected. Syntax and record errors identify the 1-based input file and physical line without echoing the record. `auto`, `json`, and `text` retain their existing behavior; JSONL is never auto-detected.
|
|
110
|
+
|
|
111
|
+
Coverage records `browser-error-jsonl` / `captured-events` or `manual-jsonl` / `submitted-reports`. JSONL carries no export coverage metadata: `partial: false` means no partial flag was supplied, and a warning keeps collection completeness and retention unknown. JSONL does not establish complete collection. The same combined byte/file/record limits, raw-record deduplication, filters, original-byte hashes, review gates, and profile rules apply. Empty lines are not records; malformed lines are never silently skipped.
|
|
112
|
+
|
|
113
|
+
Use `analyzeErrors(content, { format: 'jsonl' })` or ordered content arrays in the API. Comparison and `--baseline` can read JSON and JSONL bundles of matching count frequency, preserving the kind-difference warning. Captured events and submitted reports still cannot be compared. Existing 0.1.x bundles remain readable; JSONL bundles require 0.2.0 or newer.
|
|
114
|
+
|
|
89
115
|
### Compare two analyses
|
|
90
116
|
|
|
91
117
|
Compare verified snapshots, including snapshots from different releases:
|
|
@@ -148,6 +174,25 @@ For each scenario, fill `requirement` and `expectedSource`, establish `precondit
|
|
|
148
174
|
|
|
149
175
|
`init-profile` requires a new output file, refuses stale bundles and empty candidate selections, and never overwrites an existing file. The original analysis artifacts remain unchanged. The API equivalent is `createProfileTemplate(analysis)`; its result is an incomplete `error-to-test/profile-1` object for editing, not an execution-ready profile.
|
|
150
176
|
|
|
177
|
+
### Extend an existing profile
|
|
178
|
+
|
|
179
|
+
Keep existing scenario rules and add review templates for selected groups that they do not cover:
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
error-to-test analyze --input current-errors.jsonl --format jsonl --out ./current-analysis
|
|
183
|
+
error-to-test init-profile ./current-analysis --profile ./existing-profile.json --out ./expanded-profile.json
|
|
184
|
+
# Fill only the new blank requirements, sources, setup, actions, and assertions.
|
|
185
|
+
error-to-test analyze --input current-errors.jsonl --format jsonl --profile ./expanded-profile.json --out ./expanded-analysis
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The existing profile must pass normal profile validation: its requirements and expectation sources must already be filled. Profile name, scenario order, IDs, match conditions, steps, expectations, setup flags, and questions are retained as validated profile values. Unknown fields and file formatting are not preserved. Existing questions and unconfirmed setup still block cases.
|
|
189
|
+
|
|
190
|
+
Coverage uses exactly the same matching rules as TC generation, with all supplied predicates combined. An existing broad rule can cover several selected groups within its original conditions. An exact `match.groupId` from another release remains exact; its steps and expectation are not copied to a new group. Only uncovered selected groups receive new blank templates in ranked order. New scenario IDs gain deterministic numeric suffixes on collision; existing IDs stay unchanged. If all selected groups are covered, the result contains only the existing rules.
|
|
191
|
+
|
|
192
|
+
New templates retain blank expectation fields, `setupConfirmed: false`, and the review question. Fill them explicitly before reanalysis, using the original inputs, metadata, filters, and optional baseline. The usual review gate applies. Existing scenarios are never automatically deleted; the combined profile must stay within 100 scenarios and 1 MiB. Sensitive existing metadata or execution steps are rejected before writing. Output must be a new file outside the bundle's `results` directory, for both basic and extended templates.
|
|
193
|
+
|
|
194
|
+
The API is `createProfileTemplate(analysis, { profile: existingProfile })`; `profile` accepts an object containing only JSON values or a JSON string, including one leading BOM, within 1 MiB. Omit undefined optional properties from object inputs. The function does not mutate either input. Without `profile`, it produces the original blank template.
|
|
195
|
+
|
|
151
196
|
## Review and use Flow QA
|
|
152
197
|
|
|
153
198
|
Generated files (Flow QA source is limited to 128 KB; suite JSON to 512 KiB):
|
package/dist/analysis.js
CHANGED
|
@@ -55,6 +55,9 @@ function analyze(content, options, baseline) {
|
|
|
55
55
|
if (comparison.baseline.coverage.period) {
|
|
56
56
|
warnings.push('Baseline date filtering applies only to reports with observed timestamps; undated reports may have been excluded.');
|
|
57
57
|
}
|
|
58
|
+
if (comparison.baseline.coverage.kind === 'browser-error-jsonl' || comparison.baseline.coverage.kind === 'manual-jsonl') {
|
|
59
|
+
warnings.push('Baseline JSONL has no export coverage metadata; partial false means unmarked, and collection completeness and retention are unknown.');
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
62
|
const eligibleGroups = selectedGroups.filter(group => group.count >= minCount);
|
|
60
63
|
if (eligibleGroups.length < selectedGroups.length)
|
package/dist/candidates.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type { AppProfile, IssueGroup, TestCandidate } from './types.ts';
|
|
1
|
+
import type { AppProfile, IssueGroup, ScenarioRule, TestCandidate, WebStep } from './types.ts';
|
|
2
|
+
export declare function stepsContainSensitiveData(steps: WebStep[]): boolean;
|
|
2
3
|
export declare function parseProfile(raw: unknown): AppProfile;
|
|
4
|
+
export declare function matchesScenarioRule(rule: ScenarioRule, group: IssueGroup): boolean;
|
|
3
5
|
export declare function createCandidates(groups: IssueGroup[], profile?: AppProfile): TestCandidate[];
|
package/dist/candidates.js
CHANGED
|
@@ -23,7 +23,7 @@ function profileText(value, label) {
|
|
|
23
23
|
function profileStrings(value, label) {
|
|
24
24
|
return strings(value, label).map((item, index) => profileText(item, `${label}[${index}]`));
|
|
25
25
|
}
|
|
26
|
-
function stepsContainSensitiveData(steps) {
|
|
26
|
+
export function stepsContainSensitiveData(steps) {
|
|
27
27
|
const credentialFill = steps.some((step) => step.type === 'fill' &&
|
|
28
28
|
/password|passwd|secret|token|api[_-]?key|authorization|cookie|session/i.test(`${step.locator.value} ${'name' in step.locator ? step.locator.name ?? '' : ''}`));
|
|
29
29
|
if (credentialFill)
|
|
@@ -92,7 +92,7 @@ function confirmed(value, label) {
|
|
|
92
92
|
throw new Error(`${label} must be a boolean.`);
|
|
93
93
|
return value;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
export function matchesScenarioRule(rule, group) {
|
|
96
96
|
const match = rule.match;
|
|
97
97
|
return (match.groupId === undefined || match.groupId === group.id)
|
|
98
98
|
&& (!match.type || match.type === group.type)
|
|
@@ -184,7 +184,7 @@ function createOne(group, rule) {
|
|
|
184
184
|
}
|
|
185
185
|
export function createCandidates(groups, profile) {
|
|
186
186
|
return groups.flatMap((group) => {
|
|
187
|
-
const rules = (profile?.scenarios ?? []).filter((rule) =>
|
|
187
|
+
const rules = (profile?.scenarios ?? []).filter((rule) => matchesScenarioRule(rule, group)).sort((a, b) => a.id.localeCompare(b.id));
|
|
188
188
|
return rules.length ? rules.map((rule) => createOne(group, rule)) : [createOne(group)];
|
|
189
189
|
});
|
|
190
190
|
}
|
package/dist/cli.js
CHANGED
|
@@ -15,21 +15,23 @@ const help = `Error to Test — local error analysis and regression TC drafts
|
|
|
15
15
|
error-to-test analyze --input errors-1.json --input errors-2.json --profile profile.json --out new-directory
|
|
16
16
|
error-to-test analyze --input errors.json --baseline previous-bundle --out new-directory
|
|
17
17
|
error-to-test analyze --input error.txt --format text --page /items --out new-directory
|
|
18
|
+
error-to-test analyze --input errors.jsonl --format jsonl --out new-directory
|
|
18
19
|
error-to-test analyze --error "TypeError: item is undefined" --page /items --out new-directory
|
|
19
20
|
cat error.txt | error-to-test analyze --input - --format text --out new-directory
|
|
20
21
|
error-to-test verify new-directory [--input errors-1.json --input errors-2.json] [--profile profile.json]
|
|
21
22
|
error-to-test init-profile new-directory --out profile.json
|
|
23
|
+
error-to-test init-profile new-directory --profile existing.json --out extended.json
|
|
22
24
|
error-to-test link-run new-directory --report path/to/qa-report.json
|
|
23
25
|
error-to-test results new-directory [--format text|json] [--out summary.md]
|
|
24
26
|
error-to-test compare BASELINE CURRENT [--format text|json] [--out comparison.md]
|
|
25
27
|
|
|
26
28
|
Options:
|
|
27
|
-
--input FILE SDK export, manual JSON, or plain error text; repeat for same-format files in order (analyze: sole - for stdin)
|
|
29
|
+
--input FILE SDK export, manual JSON, JSONL, or plain error text; repeat for same-format files in order (analyze: sole - for stdin)
|
|
28
30
|
--error TEXT Submit a single error directly; remaining lines are its stack
|
|
29
|
-
--format auto|json|text Analyze input format; auto rejects malformed JSON-looking input
|
|
31
|
+
--format auto|json|jsonl|text Analyze input format; JSONL requires explicit selection and one record per line; auto rejects malformed JSON-looking input
|
|
30
32
|
--format text|json Results summary format (default: text Markdown)
|
|
31
33
|
--format text|json Compare format (default: text Markdown)
|
|
32
|
-
--profile FILE Confirmed app scenarios and explicit assertions (
|
|
34
|
+
--profile FILE Confirmed app scenarios and explicit assertions (analyze/verify); existing profile to extend (init-profile)
|
|
33
35
|
--baseline DIRECTORY Select only signatures absent from this verified bundle, before --min-count and --top; retain all groups in analysis.json (analyze only)
|
|
34
36
|
--project NAME Metadata for a manual report
|
|
35
37
|
--environment NAME Metadata for a manual report
|
|
@@ -145,16 +147,24 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
145
147
|
if (command === 'init-profile') {
|
|
146
148
|
if (positionals.length !== 2 || !positionals[1] || !values.out)
|
|
147
149
|
throw new Error('init-profile requires one bundle directory and --out FILE.');
|
|
148
|
-
if (Object.keys(values).some(key => !['out', 'help'].includes(key)))
|
|
149
|
-
throw new Error('Unsupported option for init-profile. Use only --out FILE.');
|
|
150
|
-
|
|
150
|
+
if (Object.keys(values).some(key => !['out', 'profile', 'help'].includes(key)))
|
|
151
|
+
throw new Error('Unsupported option for init-profile. Use only --profile FILE and --out FILE.');
|
|
152
|
+
if (values.profile !== undefined && !values.profile.trim())
|
|
153
|
+
throw new Error('--profile requires a nonempty file path.');
|
|
154
|
+
const bundle = resolve(positionals[1]);
|
|
155
|
+
const { analysis } = await readVerifiedBundle(bundle);
|
|
151
156
|
if (analysis.schemaVersion !== 'error-to-test/analysis-1' || !Array.isArray(analysis.groups) || !Array.isArray(analysis.candidates))
|
|
152
157
|
throw new Error('Unsupported analysis contract.');
|
|
153
|
-
const profile =
|
|
158
|
+
const profile = values.profile === undefined
|
|
159
|
+
? createProfileTemplate(analysis)
|
|
160
|
+
: createProfileTemplate(analysis, { profile: await readBoundedFile(resolve(values.profile), 1024 * 1024) });
|
|
154
161
|
const content = jsonText(profile);
|
|
155
162
|
if (Buffer.byteLength(content) > 1024 * 1024)
|
|
156
163
|
throw new Error('The generated profile exceeds 1 MiB. Narrow the selected groups.');
|
|
157
164
|
const out = resolve(values.out);
|
|
165
|
+
if (insideBundleResults(await realpath(bundle), await canonicalOutput(out))) {
|
|
166
|
+
throw new Error('The profile cannot be written inside the bundle results directory. Choose an outside --out FILE path.');
|
|
167
|
+
}
|
|
158
168
|
await mkdir(dirname(out), { recursive: true });
|
|
159
169
|
try {
|
|
160
170
|
await writeFile(out, content, { flag: 'wx', mode: 0o600 });
|
|
@@ -164,7 +174,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
164
174
|
throw new Error('The output file already exists. Choose a new --out FILE path.');
|
|
165
175
|
throw error;
|
|
166
176
|
}
|
|
167
|
-
process.stdout.write(`Profile template written: ${out}\
|
|
177
|
+
process.stdout.write(`Profile template written: ${out}\n${values.profile === undefined ? '' : 'Existing rules were retained; fill and review any new blank scenarios manually. This does not approve the profile.\n'}Fill requirement, expectedSource, preconditions, and steps; confirm setupConfirmed and clear answered questions. Then rerun analyze with the original input and --profile ${out}.\n`);
|
|
168
178
|
return;
|
|
169
179
|
}
|
|
170
180
|
if (command === 'link-run') {
|
|
@@ -274,8 +284,8 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
274
284
|
if ((values.input === undefined) === (values.error === undefined))
|
|
275
285
|
throw new Error('Provide exactly one of --input or --error.');
|
|
276
286
|
const format = values.format ?? 'auto';
|
|
277
|
-
if (format !== 'auto' && format !== 'json' && format !== 'text')
|
|
278
|
-
throw new Error('--format must be auto, json, or text.');
|
|
287
|
+
if (format !== 'auto' && format !== 'json' && format !== 'jsonl' && format !== 'text')
|
|
288
|
+
throw new Error('--format must be auto, json, jsonl, or text.');
|
|
279
289
|
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual'];
|
|
280
290
|
if (values.type !== undefined && !types.includes(values.type))
|
|
281
291
|
throw new Error('--type is not supported.');
|
package/dist/comparison.js
CHANGED
|
@@ -4,7 +4,7 @@ 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
6
|
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'manual'];
|
|
7
|
-
const kinds = ['browser-error-json', 'manual-json', 'manual-text'];
|
|
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}$/;
|
|
10
10
|
const groupId = /^group-[0-9a-f]{16}$/;
|
|
@@ -24,7 +24,7 @@ function coverage(value, label) {
|
|
|
24
24
|
if (!kinds.includes(raw.kind))
|
|
25
25
|
throw new Error(`${label}.kind is unsupported.`);
|
|
26
26
|
const kind = raw.kind;
|
|
27
|
-
const frequency = kind === 'browser-error-json' ? 'captured-events' : 'submitted-reports';
|
|
27
|
+
const frequency = kind === 'browser-error-json' || kind === 'browser-error-jsonl' ? 'captured-events' : 'submitted-reports';
|
|
28
28
|
if (raw.frequency !== frequency)
|
|
29
29
|
throw new Error(`${label}.frequency is incompatible with kind.`);
|
|
30
30
|
if (typeof raw.partial !== 'boolean' || raw.retention !== 'unknown')
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ 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
7
|
export { linkFlowQaReport } from './results.ts';
|
|
8
|
-
export { createProfileTemplate } from './profile-template.ts';
|
|
8
|
+
export { createProfileTemplate, type ProfileTemplateOptions } from './profile-template.ts';
|
|
9
9
|
export { readRunSummary, renderRunSummary, type RunSummary, type LinkedRunStatus, type LinkedCaseStatus } from './run-summary.ts';
|
|
10
10
|
export { compareBundles, renderComparison, type AnalysisComparison, type ComparisonStatus, type ComparisonSide, type ComparisonOccurrence, type ComparisonIssue } from './comparison.ts';
|
|
11
11
|
export type * from './types.ts';
|
package/dist/input.d.ts
CHANGED
package/dist/input.js
CHANGED
|
@@ -151,7 +151,53 @@ function manualError(value, index, defaults) {
|
|
|
151
151
|
...(!alteredExpected && expectedSource !== undefined ? { expectedSource } : {}), steps: stepResult.steps,
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function jsonlError(fileIndex, lineNumber, reason) {
|
|
155
|
+
return new Error(`JSONL input file ${fileIndex}, line ${lineNumber}: ${reason}`);
|
|
156
|
+
}
|
|
157
|
+
function decodeJsonl(content, fileIndex, remainingRecords) {
|
|
158
|
+
// A single file-leading BOM affects parsing only; inputSource hashes the original content.
|
|
159
|
+
const lines = content.replace(/^\uFEFF/, '').split('\n');
|
|
160
|
+
const raw = [];
|
|
161
|
+
const lineNumbers = [];
|
|
162
|
+
let kind;
|
|
163
|
+
for (const [index, line] of lines.entries()) {
|
|
164
|
+
if (/^[ \t\r]*$/.test(line))
|
|
165
|
+
continue;
|
|
166
|
+
const lineNumber = index + 1;
|
|
167
|
+
if (raw.length >= remainingRecords)
|
|
168
|
+
throw new Error('Input exceeds 10000 records');
|
|
169
|
+
let item;
|
|
170
|
+
try {
|
|
171
|
+
item = JSON.parse(line);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
throw jsonlError(fileIndex, lineNumber, 'Malformed JSON record.');
|
|
175
|
+
}
|
|
176
|
+
if (item === null || typeof item !== 'object' || Array.isArray(item)) {
|
|
177
|
+
throw jsonlError(fileIndex, lineNumber, 'Record must be a JSON object.');
|
|
178
|
+
}
|
|
179
|
+
const value = item;
|
|
180
|
+
if (Object.hasOwn(value, 'events') || Object.hasOwn(value, 'errors') || Object.hasOwn(value, 'partial')) {
|
|
181
|
+
throw jsonlError(fileIndex, lineNumber, 'Export envelopes and coverage metadata are unsupported.');
|
|
182
|
+
}
|
|
183
|
+
const lineKind = Object.hasOwn(value, 'schemaVersion') ? 'browser-error-jsonl' : 'manual-jsonl';
|
|
184
|
+
if (lineKind === 'browser-error-jsonl' && value.schemaVersion !== 1) {
|
|
185
|
+
throw jsonlError(fileIndex, lineNumber, 'Unsupported schemaVersion.');
|
|
186
|
+
}
|
|
187
|
+
if (kind !== undefined && kind !== lineKind) {
|
|
188
|
+
throw jsonlError(fileIndex, lineNumber, 'Mixed browser and manual records are unsupported.');
|
|
189
|
+
}
|
|
190
|
+
kind = lineKind;
|
|
191
|
+
raw.push(item);
|
|
192
|
+
lineNumbers.push(lineNumber);
|
|
193
|
+
}
|
|
194
|
+
if (kind === undefined)
|
|
195
|
+
throw new Error(`JSONL input file ${fileIndex}: Input has no records.`);
|
|
196
|
+
return { kind, partial: false, raw, lineNumbers };
|
|
197
|
+
}
|
|
198
|
+
function decodeDocument(content, format, fileIndex, remainingRecords) {
|
|
199
|
+
if (format === 'jsonl')
|
|
200
|
+
return decodeJsonl(content, fileIndex, remainingRecords);
|
|
155
201
|
const trimmed = content.trimStart();
|
|
156
202
|
const isJson = format === 'json' || (format === 'auto' && /^[\[{]/.test(trimmed) && !LOGGER_PREFIX.test(trimmed));
|
|
157
203
|
if (isJson) {
|
|
@@ -206,30 +252,46 @@ function decodeDocument(content, format) {
|
|
|
206
252
|
export function parseInput(content, options = {}) {
|
|
207
253
|
const source = inputSource(content);
|
|
208
254
|
const files = typeof content === 'string' ? [content] : content;
|
|
209
|
-
|
|
255
|
+
const format = options.format ?? 'auto';
|
|
256
|
+
if (format !== 'jsonl' && files.some(file => !file.trim()))
|
|
210
257
|
throw new Error('Input is empty');
|
|
211
258
|
const from = options.from === undefined ? undefined : timestamp(options.from, 'from');
|
|
212
259
|
const to = options.to === undefined ? undefined : timestamp(options.to, 'to');
|
|
213
260
|
if (from && to && from > to)
|
|
214
261
|
throw new Error('from must not exceed to');
|
|
215
|
-
|
|
216
|
-
if (!['auto', 'json', 'text'].includes(format))
|
|
262
|
+
if (!['auto', 'json', 'text', 'jsonl'].includes(format))
|
|
217
263
|
throw new Error('Invalid input format');
|
|
218
264
|
let kind;
|
|
219
265
|
let partial = false;
|
|
220
266
|
const raw = [];
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
267
|
+
const jsonlLocations = [];
|
|
268
|
+
for (const [fileIndex, file] of files.entries()) {
|
|
269
|
+
const document = decodeDocument(file, format, fileIndex + 1, MAX_RECORDS - raw.length);
|
|
270
|
+
if (kind !== undefined && document.kind !== kind) {
|
|
271
|
+
if (format === 'jsonl')
|
|
272
|
+
throw jsonlError(fileIndex + 1, document.lineNumbers[0], 'Input files must have the same source kind.');
|
|
224
273
|
throw new Error('Input files must have the same source kind.');
|
|
274
|
+
}
|
|
225
275
|
kind = document.kind;
|
|
226
276
|
partial ||= document.partial;
|
|
227
277
|
if (raw.length + document.raw.length > MAX_RECORDS)
|
|
228
278
|
throw new Error('Input exceeds 10000 records');
|
|
229
279
|
raw.push(...document.raw);
|
|
280
|
+
if (document.lineNumbers)
|
|
281
|
+
jsonlLocations.push(...document.lineNumbers.map(lineNumber => ({ fileIndex: fileIndex + 1, lineNumber })));
|
|
230
282
|
}
|
|
231
|
-
const
|
|
232
|
-
|
|
283
|
+
const browser = kind === 'browser-error-json' || kind === 'browser-error-jsonl';
|
|
284
|
+
const observations = raw.map((item, index) => {
|
|
285
|
+
if (format !== 'jsonl')
|
|
286
|
+
return browser ? browserEvent(item, index) : manualError(item, index, options);
|
|
287
|
+
try {
|
|
288
|
+
return browser ? browserEvent(item, index) : manualError(item, index, options);
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
const location = jsonlLocations[index];
|
|
292
|
+
throw jsonlError(location.fileIndex, location.lineNumber, browser ? 'Invalid browser record.' : 'Invalid manual record.');
|
|
293
|
+
}
|
|
294
|
+
});
|
|
233
295
|
const inputCount = raw.length;
|
|
234
296
|
const seen = new Map();
|
|
235
297
|
const unique = [];
|
|
@@ -240,8 +302,13 @@ export function parseInput(content, options = {}) {
|
|
|
240
302
|
const source = canonical(raw[index]);
|
|
241
303
|
const previous = seen.get(key);
|
|
242
304
|
if (previous !== undefined) {
|
|
243
|
-
if (previous !== source)
|
|
305
|
+
if (previous !== source) {
|
|
306
|
+
if (format === 'jsonl') {
|
|
307
|
+
const location = jsonlLocations[index];
|
|
308
|
+
throw jsonlError(location.fileIndex, location.lineNumber, 'Conflicting duplicate ID.');
|
|
309
|
+
}
|
|
244
310
|
throw new Error(`Conflicting duplicate ID: ${item.id}`);
|
|
311
|
+
}
|
|
245
312
|
duplicates++;
|
|
246
313
|
}
|
|
247
314
|
else {
|
|
@@ -252,6 +319,8 @@ export function parseInput(content, options = {}) {
|
|
|
252
319
|
const warnings = [];
|
|
253
320
|
if (source.inputs)
|
|
254
321
|
warnings.push(`Combined ${source.inputs.length} input files in supplied order; counts describe the supplied records across files, not global rates.`);
|
|
322
|
+
if (format === 'jsonl')
|
|
323
|
+
warnings.push('JSONL has no export coverage metadata; collection completeness and retention are unknown.');
|
|
255
324
|
if (partial)
|
|
256
325
|
warnings.push('Source export is partial; observed counts may be incomplete.');
|
|
257
326
|
if (duplicates)
|
|
@@ -277,7 +346,7 @@ export function parseInput(content, options = {}) {
|
|
|
277
346
|
warnings.push('Undated manual reports were excluded by date filters.');
|
|
278
347
|
return {
|
|
279
348
|
observations: selected,
|
|
280
|
-
coverage: { kind: kind, frequency:
|
|
349
|
+
coverage: { kind: kind, frequency: browser ? 'captured-events' : 'submitted-reports',
|
|
281
350
|
partial, inputCount, duplicates, filtered, retention: 'unknown',
|
|
282
351
|
...(from || to ? { period: { ...(from ? { from } : {}), ...(to ? { to } : {}) } } : {}) },
|
|
283
352
|
sha256: source.sha256, ...(source.inputs ? { inputs: source.inputs } : {}), warnings,
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { Analysis, AppProfile } from './types.ts';
|
|
2
|
-
export
|
|
2
|
+
export interface ProfileTemplateOptions {
|
|
3
|
+
profile?: unknown;
|
|
4
|
+
}
|
|
5
|
+
export declare function createProfileTemplate(analysis: Analysis, options?: ProfileTemplateOptions): AppProfile;
|
package/dist/profile-template.js
CHANGED
|
@@ -1,7 +1,85 @@
|
|
|
1
|
+
import { matchesScenarioRule, parseProfile, stepsContainSensitiveData } from "./candidates.js";
|
|
1
2
|
import { pagePath, redactText, safeUrl } from "./redact.js";
|
|
2
3
|
import { parseWebSteps, record } from "./validation.js";
|
|
3
4
|
const idPattern = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/;
|
|
4
5
|
const question = 'Confirm the expected behavior, setup, reproduction steps, and assertion, then remove this question.';
|
|
6
|
+
const maxProfileBytes = 1024 * 1024;
|
|
7
|
+
function assertJsonValue(value, active) {
|
|
8
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean' || (typeof value === 'number' && Number.isFinite(value)))
|
|
9
|
+
return;
|
|
10
|
+
if (typeof value !== 'object')
|
|
11
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
12
|
+
if (active.has(value))
|
|
13
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
14
|
+
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
|
|
15
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
16
|
+
}
|
|
17
|
+
active.add(value);
|
|
18
|
+
try {
|
|
19
|
+
const keys = Reflect.ownKeys(value);
|
|
20
|
+
if (Array.isArray(value) && keys.length !== value.length + 1)
|
|
21
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
22
|
+
for (const key of keys) {
|
|
23
|
+
if (Array.isArray(value) && key === 'length')
|
|
24
|
+
continue;
|
|
25
|
+
if (typeof key !== 'string' || (Array.isArray(value) && (!/^(0|[1-9]\d*)$/.test(key) || Number(key) >= value.length))) {
|
|
26
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
27
|
+
}
|
|
28
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
29
|
+
if (!descriptor?.enumerable || !('value' in descriptor))
|
|
30
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
31
|
+
assertJsonValue(descriptor.value, active);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
active.delete(value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function existingProfile(raw) {
|
|
39
|
+
let input;
|
|
40
|
+
if (typeof raw === 'string') {
|
|
41
|
+
if (Buffer.byteLength(raw, 'utf8') > maxProfileBytes)
|
|
42
|
+
throw new Error('The profile must be 1 MiB or smaller.');
|
|
43
|
+
try {
|
|
44
|
+
input = JSON.parse(raw.replace(/^\uFEFF/, ''));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw new Error('The profile is not valid JSON.');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let serialized;
|
|
52
|
+
try {
|
|
53
|
+
assertJsonValue(raw, new WeakSet());
|
|
54
|
+
serialized = JSON.stringify(raw);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new Error('The profile object must contain only JSON values.');
|
|
58
|
+
}
|
|
59
|
+
if (Buffer.byteLength(serialized, 'utf8') > maxProfileBytes)
|
|
60
|
+
throw new Error('The profile must be 1 MiB or smaller.');
|
|
61
|
+
input = JSON.parse(serialized);
|
|
62
|
+
}
|
|
63
|
+
const parsed = parseProfile(input);
|
|
64
|
+
if (parsed.scenarios.some((scenario) => redactText(scenario.id) !== scenario.id ||
|
|
65
|
+
(scenario.match.groupId !== undefined && redactText(scenario.match.groupId) !== scenario.match.groupId))) {
|
|
66
|
+
throw new Error('The existing profile contains sensitive scenario IDs; remove them before extending it.');
|
|
67
|
+
}
|
|
68
|
+
if (parsed.scenarios.some((scenario) => stepsContainSensitiveData(scenario.steps))) {
|
|
69
|
+
throw new Error('The existing profile contains sensitive execution steps; remove them before extending it.');
|
|
70
|
+
}
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
73
|
+
function newScenarioId(base, used) {
|
|
74
|
+
if (!used.has(base))
|
|
75
|
+
return base;
|
|
76
|
+
for (let number = 2;; number++) {
|
|
77
|
+
const suffix = `-${number}`;
|
|
78
|
+
const candidate = `${base.slice(0, 80 - suffix.length)}${suffix}`;
|
|
79
|
+
if (!used.has(candidate))
|
|
80
|
+
return candidate;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
5
83
|
function selectedId(value, label) {
|
|
6
84
|
if (typeof value !== 'string' || !idPattern.test(value))
|
|
7
85
|
throw new Error(`${label} must be a Flow QA-compatible ID.`);
|
|
@@ -33,7 +111,7 @@ function reviewTitle(message) {
|
|
|
33
111
|
const short = [...safe].slice(0, 190).join('').trim();
|
|
34
112
|
return `Review ${short || 'observed error'}`;
|
|
35
113
|
}
|
|
36
|
-
export function createProfileTemplate(analysis) {
|
|
114
|
+
export function createProfileTemplate(analysis, options = {}) {
|
|
37
115
|
const input = record(analysis, 'analysis');
|
|
38
116
|
if (!Array.isArray(input.groups) || input.groups.length > 10000)
|
|
39
117
|
throw new Error('analysis.groups must be an array of at most 10000 groups.');
|
|
@@ -45,8 +123,10 @@ export function createProfileTemplate(analysis) {
|
|
|
45
123
|
}
|
|
46
124
|
if (selected.size > 100)
|
|
47
125
|
throw new Error('Template supports at most 100 selected groups and scenarios.');
|
|
126
|
+
const existing = options.profile === undefined ? undefined : existingProfile(options.profile);
|
|
48
127
|
const seen = new Set();
|
|
49
|
-
const scenarios = [];
|
|
128
|
+
const scenarios = existing ? [...existing.scenarios] : [];
|
|
129
|
+
const usedIds = new Set(scenarios.map((scenario) => scenario.id));
|
|
50
130
|
for (const [index, raw] of input.groups.entries()) {
|
|
51
131
|
const group = record(raw, `analysis.groups[${index}]`);
|
|
52
132
|
const id = selectedId(group.id, `analysis.groups[${index}].id`);
|
|
@@ -55,10 +135,16 @@ export function createProfileTemplate(analysis) {
|
|
|
55
135
|
if (seen.has(id))
|
|
56
136
|
throw new Error(`Selected group ID is duplicated: ${id}.`);
|
|
57
137
|
seen.add(id);
|
|
138
|
+
if (existing && existing.scenarios.some((scenario) => matchesScenarioRule(scenario, group)))
|
|
139
|
+
continue;
|
|
58
140
|
if (`review-${id}`.length > 80)
|
|
59
141
|
throw new Error(`Selected group ID is too long for a profile scenario: ${id}.`);
|
|
142
|
+
if (scenarios.length >= 100)
|
|
143
|
+
throw new Error('The extended profile supports at most 100 scenarios.');
|
|
144
|
+
const scenarioId = existing ? newScenarioId(`review-${id}`, usedIds) : `review-${id}`;
|
|
145
|
+
usedIds.add(scenarioId);
|
|
60
146
|
scenarios.push({
|
|
61
|
-
id:
|
|
147
|
+
id: scenarioId,
|
|
62
148
|
title: reviewTitle(group.message),
|
|
63
149
|
match: { groupId: id },
|
|
64
150
|
requirement: '',
|
|
@@ -71,5 +157,9 @@ export function createProfileTemplate(analysis) {
|
|
|
71
157
|
}
|
|
72
158
|
if (seen.size !== selected.size)
|
|
73
159
|
throw new Error('Selected candidate references a missing group ID.');
|
|
74
|
-
|
|
160
|
+
const profile = { schemaVersion: 'error-to-test/profile-1', name: existing?.name ?? 'Error to Test review', scenarios };
|
|
161
|
+
if (existing && Buffer.byteLength(`${JSON.stringify(profile, null, 2)}\n`, 'utf8') > maxProfileBytes) {
|
|
162
|
+
throw new Error('The generated profile exceeds 1 MiB. Narrow the selected groups or scenario details.');
|
|
163
|
+
}
|
|
164
|
+
return profile;
|
|
75
165
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface ErrorObservation {
|
|
|
66
66
|
steps: WebStep[];
|
|
67
67
|
}
|
|
68
68
|
export interface SourceCoverage {
|
|
69
|
-
kind: 'browser-error-json' | 'manual-json' | 'manual-text';
|
|
69
|
+
kind: 'browser-error-json' | 'manual-json' | 'manual-text' | 'browser-error-jsonl' | 'manual-jsonl';
|
|
70
70
|
frequency: 'captured-events' | 'submitted-reports';
|
|
71
71
|
partial: boolean;
|
|
72
72
|
inputCount: number;
|
package/docs/releases.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.0
|
|
6
|
+
|
|
7
|
+
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`.
|
|
8
|
+
|
|
9
|
+
This minor release sets both package manifests to `0.2.0` before verification. The workflow publishes that exact source commit without creating an additional patch bump.
|
|
10
|
+
|
|
5
11
|
## Automatic publication
|
|
6
12
|
|
|
7
13
|
Pull requests and main pushes verify the package on Ubuntu and macOS. A verified main push then prepares an immutable release source:
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{"id":"jsonl-1","project":"demo","environment":"test","release":"r1","runtime":"browser","type":"javascript","page":"/items","message":"TypeError: item is undefined","stack":" at render (/app.js:10:2)"}
|
|
2
|
+
{"id":"jsonl-2","project":"demo","environment":"test","release":"r1","runtime":"browser","type":"javascript","page":"/items","message":"TypeError: item is undefined","stack":" at render (/app.js:10:2)"}
|
|
3
|
+
{"id":"jsonl-3","project":"demo","environment":"test","release":"r1","runtime":"browser","type":"javascript","page":"/settings","message":"ReferenceError: settings is not defined","stack":" at showSettings (/settings.js:4:1)"}
|
package/package.json
CHANGED