@ihyeon/error-to-test 0.2.2 → 0.2.4
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 +34 -0
- package/README.md +46 -0
- package/dist/analysis.d.ts +1 -0
- package/dist/analysis.js +15 -0
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +9 -1
- package/dist/cli.js +28 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/readiness.d.ts +27 -0
- package/dist/readiness.js +134 -0
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -137,6 +137,21 @@ error-to-test analyze --input current-errors.json --baseline ./before --min-coun
|
|
|
137
137
|
|
|
138
138
|
이전에 없었다는 표시가 새로 유입된 버그나 회귀를 확정하지는 않습니다. 부분 내보내기·기간·수집 범위 차이 등 비교 경고를 유지하고, 수집 이벤트와 수동 제출 보고서를 섞으면 거부합니다. 출력은 이전 번들의 `results` 폴더 밖에 있는 새 디렉터리만 허용합니다. API는 `await analyzeWithBaseline(content, baselineDirectory, { minCount: 3, top: 10, profile })`이며 이전 번들 검증도 수행합니다.
|
|
139
139
|
|
|
140
|
+
**특정 오류 묶음만 골라 TC를 생성**하려면 `--group`을 사용하세요. 먼저 분석한 `report.md`나 `analysis.json`에서 묶음 ID를 확인합니다.
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
error-to-test analyze --input errors.json --out ./all-errors
|
|
144
|
+
# 아래 예시 ID를 ./all-errors/report.md의 실제 ID로 바꾸세요.
|
|
145
|
+
error-to-test analyze --input errors.json --group group-0123456789abcdef --group group-fedcba9876543210 --out ./selected-tcs
|
|
146
|
+
error-to-test init-profile ./selected-tcs --out ./selected-profile.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
최대 100회 지정할 수 있으며 중복 ID는 한 번만 적용합니다. `group-` 뒤에 소문자 16진수 16자리가 붙는 정확한 ID여야 하며, 현재 입력의 원본·날짜 필터를 적용한 뒤에도 존재해야 합니다. 다른 릴리스·변경된 입력·제외된 기간의 ID 등 알 수 없는 ID는 번들 생성 전에 오류로 알립니다. ID를 얻은 분석과 같은 원본 파일·순서·수동 메타데이터·날짜 필터로 다시 분석하세요.
|
|
150
|
+
|
|
151
|
+
지정한 묶음과 `--baseline`의 교집합에 기존 순위대로 `--min-count`, `--top`을 적용합니다. ID를 입력한 순서로 우선순위가 바뀌지 않습니다. 알려진 ID라도 이 조건 때문에 TC가 생성되지 않을 수 있으며, 선택된 TC가 없으면 suite 없는 정상 번들을 만들고 `readiness`는 `empty`와 종료 코드 2를 반환합니다. 한 묶음에 여러 프로필 규칙이 적용되면 기존처럼 여러 TC를 생성할 수 있습니다.
|
|
152
|
+
|
|
153
|
+
전체 오류 묶음·원본 해시·수집 범위는 보존합니다. 요청한 ID는 정렬·중복 제거해 `analysis.groupFilter.groupIds`에 기록하고 분석 해시로 보호하며, 보고서에도 선택 범위를 남깁니다. 비교와 이전 분석 기준의 건수는 전체 묶음을 계속 사용합니다. 맥락 질문과 검토 조건도 유지합니다. `--group`을 생략하면 기존 선택 방식이며, 다른 명령에서는 거부합니다. API는 `analyzeErrors(content, { groupIds: [groupId] })`와 `analyzeWithBaseline()`의 같은 옵션입니다. 비어 있지 않은 최대 100개 항목 배열을 받으며 입력 배열을 변경하지 않습니다.
|
|
154
|
+
|
|
140
155
|
`report.md` 상단에서 TC 초안 수와 추가 정보가 필요한 TC 수를 확인할 수 있습니다. 초안도 실행 전에 검토해야 합니다. 오류 묶음·수집 건수와 함께 대표 로그의 오류·React 컴포넌트 스택, 재현 방법·사전 조건·테스트 단계·부족한 정보도 표시합니다. 같은 스택은 한 번만 표시하며, 전체 로그의 모든 스택을 나열하지는 않습니다. 재현 단계와 정상 기대 결과, 명시적인 assertion이 없으면 질문이 있는 TC를 생성합니다. 직접 입력한 보고서에는 실제 발생 시각·사용자 수를 만들어 넣지 않습니다. 수집 건수도 실제 발생률을 뜻하지 않으며, 원본 내보내기의 일부 데이터 표시를 유지합니다.
|
|
141
156
|
|
|
142
157
|
기본 suite는 검토 질문으로 실행이 차단됩니다. TC와 프로필을 확인한 뒤 다른 출력 폴더에 `--reviewed`로 다시 생성하면 검토 질문만 제거됩니다. 나머지 질문은 그대로 실행을 차단합니다. 프로필의 `setupConfirmed`는 준비 조건을 확인했다는 표시이며, 계정·데이터를 자동으로 준비하는 기능은 아닙니다.
|
|
@@ -183,6 +198,25 @@ flow-qa init
|
|
|
183
198
|
flow-qa ui
|
|
184
199
|
```
|
|
185
200
|
|
|
201
|
+
실행 전에는 `readiness`로 **선택된 TC의 기록된 차단 사유**를 모아 확인할 수 있습니다.
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
error-to-test readiness ./review-analysis
|
|
205
|
+
error-to-test readiness ./review-analysis --format json
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
번들을 검증한 뒤 초안·추가 정보 필요·실행 차단 건수, 검토 확인 여부와 TC별 미해결 질문을 표시합니다. 실제 내보낸 Flow QA suite의 질문도 반영하므로 검토 대기나 민감한 실행 단계 때문에 차단된 경우도 남습니다.
|
|
209
|
+
|
|
210
|
+
| 종료 코드 | 의미 |
|
|
211
|
+
| --- | --- |
|
|
212
|
+
| `0` | 선택된 TC가 하나 이상이고, 모두 검토된 초안이며 기록된 차단 사유가 없음 |
|
|
213
|
+
| `1` | 잘못된 옵션·잘못되거나 변경된 번들·출력 오류 |
|
|
214
|
+
| `2` | 차단된 TC가 있거나 선택된 TC가 없음 |
|
|
215
|
+
|
|
216
|
+
전체 보고서를 stdout에 출력한 뒤 0 또는 2를 반환합니다. JSON은 `error-to-test/readiness-1`이며 `status`(`ready`·`blocked`·`empty`), 검토 상태·건수·TC별 `blockers`·입력/분석/suite 해시를 제공합니다. API는 `await readReadiness(directory)`와 `renderReadiness(summary)`이며 API 호출은 종료 코드를 변경하지 않습니다.
|
|
217
|
+
|
|
218
|
+
저장된 번들의 질문과 검토 상태를 점검하는 기능입니다. 브라우저 실행·계정·준비 데이터·수집 범위를 확인하거나 연결 실행 결과를 읽지는 않습니다. `--top`·`--min-count`·이전 분석 기준으로 제외된 묶음은 선택 TC 건수에 포함되지 않습니다. 검토 확인만으로 미해결 맥락이 사라지지 않으며, 빈 선택도 통과시키지 않습니다. 원본 입력·프로필 바이트 확인은 `verify --input ... --profile ...`로 별도 수행하세요. 번들 경로와 선택적인 `--format text|json`만 받으며 파일을 저장하거나 기존 TC를 승인하지 않습니다.
|
|
219
|
+
|
|
186
220
|
Flow QA 설치와 실행 대상 설정은 별도로 필요합니다. 위 `flows/`·`cases/` 구조를 기존 검토 화면에서 읽을 수 있습니다. 분석 명령은 브라우저를 실행하거나 외부 모델에 요청하지 않습니다. TC 통과만으로 원래 오류를 수정 완료 처리하지 않습니다.
|
|
187
221
|
|
|
188
222
|
실행 후 `node bin/error-to-test.mjs link-run .error-to-test/reviewed --report /path/to/qa-report.json`으로 결과를 원래 오류 묶음에 연결할 수 있습니다. suite 해시와 모든 case ID가 일치해야 하며, 결과는 `results/<runId>.json`에 저장합니다. 원본 e2e 리포트 대신 Flow QA가 정리한 `report-1`을 사용하세요.
|
package/README.md
CHANGED
|
@@ -172,6 +172,25 @@ The analysis records `selection.mode: "only-current"`, the baseline input and ve
|
|
|
172
172
|
|
|
173
173
|
The async API is `await analyzeWithBaseline(content, baselineDirectory, { minCount: 3, top: 10, profile })`. It verifies the baseline bundle itself and accepts the same analysis options as `analyzeErrors`.
|
|
174
174
|
|
|
175
|
+
### Generate TCs for specific error groups
|
|
176
|
+
|
|
177
|
+
Use `--group` to focus on exact group IDs from an initial `report.md` or `analysis.json`:
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
error-to-test analyze --input errors.json --out ./all-errors
|
|
181
|
+
# Replace these example IDs with actual IDs from ./all-errors/report.md.
|
|
182
|
+
error-to-test analyze --input errors.json --group group-0123456789abcdef --group group-fedcba9876543210 --out ./selected-tcs
|
|
183
|
+
error-to-test init-profile ./selected-tcs --out ./selected-profile.json
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Repeat `--group` up to 100 times. Each ID must have the exact `group-` plus 16 lowercase hexadecimal digits format and exist in the current input after source/date filters. Duplicate IDs are counted once. Unknown IDs fail before a bundle is written, so an ID from a different release, changed input, or excluded period cannot silently generate an empty suite. Reuse the same input files, order, manual metadata, and date filters used to obtain the IDs.
|
|
187
|
+
|
|
188
|
+
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
|
+
|
|
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; other commands reject this analyze-only option.
|
|
191
|
+
|
|
192
|
+
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
|
+
|
|
175
194
|
## Confirm the intended behavior
|
|
176
195
|
|
|
177
196
|
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.
|
|
@@ -238,6 +257,33 @@ flow-qa ui
|
|
|
238
257
|
|
|
239
258
|
Flow QA is installed/configured separately. Its UI can read this `flows/` + `cases/` layout. Select the intended test target, review the cases in Flow QA, and execute there or with its CLI. Source changes invalidate existing bundles/suites; regenerate after review. `verify` checks artifact consistency, and checks original input/profile bytes only when supplied. It is not a signature or proof that a testcase fixes the reported cause. A passing functional assertion does not automatically close an error issue.
|
|
240
259
|
|
|
260
|
+
### Check recorded execution blockers
|
|
261
|
+
|
|
262
|
+
`readiness` verifies an existing bundle and summarizes the selected TCs before execution. It shows draft/needs-context counts, review acknowledgement, and each case's outstanding questions, including blockers recorded in the exported Flow QA suite.
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
error-to-test readiness ./analysis
|
|
266
|
+
error-to-test readiness ./analysis --format json
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
| Exit code | Meaning |
|
|
270
|
+
| --- | --- |
|
|
271
|
+
| `0` | At least one selected case; every case is a reviewed draft with no recorded blockers |
|
|
272
|
+
| `1` | Invalid options, invalid or changed bundle, or output error |
|
|
273
|
+
| `2` | Some selected cases are blocked, or no cases were selected |
|
|
274
|
+
|
|
275
|
+
The full Markdown/JSON report is written to stdout before returning `0` or `2`. JSON uses `error-to-test/readiness-1`, with `status` (`ready`, `blocked`, or `empty`), `reviewed`, candidate counts, per-case `blockers`, and input/analysis/suite hashes. An empty selection is never a successful readiness check. `--reviewed` is an analyze option; it cannot approve an existing bundle through `readiness`.
|
|
276
|
+
|
|
277
|
+
This checks recorded blockers in the verified snapshot. It does not execute a browser, test credentials or setup, read linked run results, or establish source collection completeness. Groups excluded by `--top`, `--min-count`, or baseline selection are outside the selected-case counts. Drafts still need review; acknowledging review does not clear missing context. Original input/profile bytes are not rechecked by this command; use `verify --input ... --profile ...` for that. The command accepts only a bundle directory and optional `--format text|json`, writes no files, and preserves all artifacts.
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
import { readReadiness, renderReadiness } from '@ihyeon/error-to-test';
|
|
281
|
+
|
|
282
|
+
const summary = await readReadiness('./analysis');
|
|
283
|
+
console.log(renderReadiness(summary));
|
|
284
|
+
// API calls return a summary; only the CLI assigns readiness exit codes.
|
|
285
|
+
```
|
|
286
|
+
|
|
241
287
|
## JavaScript API
|
|
242
288
|
|
|
243
289
|
```js
|
package/dist/analysis.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface AnalyzeOptions extends ParseInputOptions {
|
|
|
4
4
|
profile?: unknown;
|
|
5
5
|
top?: number;
|
|
6
6
|
minCount?: number;
|
|
7
|
+
groupIds?: readonly string[];
|
|
7
8
|
}
|
|
8
9
|
export declare function analyzeErrors(content: string | readonly string[], options?: AnalyzeOptions): Analysis;
|
|
9
10
|
export declare function analyzeWithBaseline(content: string | readonly string[], baselineDirectory: string, options?: AnalyzeOptions): Promise<Analysis>;
|
package/dist/analysis.js
CHANGED
|
@@ -11,6 +11,12 @@ function analyze(content, options, baseline) {
|
|
|
11
11
|
const minCount = options.minCount ?? 1;
|
|
12
12
|
if (!Number.isInteger(minCount) || minCount < 1 || minCount > 10000)
|
|
13
13
|
throw new Error('minCount must be an integer between 1 and 10000.');
|
|
14
|
+
const requestedGroupIds = options.groupIds;
|
|
15
|
+
if (requestedGroupIds !== undefined && (!Array.isArray(requestedGroupIds) || requestedGroupIds.length < 1 || requestedGroupIds.length > 100 ||
|
|
16
|
+
!requestedGroupIds.every(id => typeof id === 'string' && /^group-[0-9a-f]{16}$/.test(id)))) {
|
|
17
|
+
throw new Error('groupIds must contain 1 to 100 valid group IDs.');
|
|
18
|
+
}
|
|
19
|
+
const groupIds = requestedGroupIds === undefined ? undefined : [...new Set(requestedGroupIds)].sort();
|
|
14
20
|
let rawProfile = options.profile;
|
|
15
21
|
const profileSource = typeof rawProfile === 'string' ? rawProfile : rawProfile === undefined ? undefined : JSON.stringify(rawProfile);
|
|
16
22
|
if (typeof rawProfile === 'string') {
|
|
@@ -26,6 +32,9 @@ function analyze(content, options, baseline) {
|
|
|
26
32
|
const profile = rawProfile === undefined ? undefined : parseProfile(rawProfile);
|
|
27
33
|
const input = parseInput(content, options);
|
|
28
34
|
const groups = groupObservations(input.observations);
|
|
35
|
+
if (groupIds && groupIds.some(id => !groups.some(group => group.id === id))) {
|
|
36
|
+
throw new Error('A requested group ID was not found in the filtered input.');
|
|
37
|
+
}
|
|
29
38
|
const source = { sha256: input.sha256, ...(input.inputs ? { inputs: input.inputs } : {}),
|
|
30
39
|
...(profileSource !== undefined ? { profileSha256: hash(profileSource) } : {}) };
|
|
31
40
|
const warnings = [...input.warnings];
|
|
@@ -59,6 +68,11 @@ function analyze(content, options, baseline) {
|
|
|
59
68
|
warnings.push('Baseline JSONL has no export coverage metadata; partial false means unmarked, and collection completeness and retention are unknown.');
|
|
60
69
|
}
|
|
61
70
|
}
|
|
71
|
+
if (groupIds) {
|
|
72
|
+
const requested = new Set(groupIds);
|
|
73
|
+
selectedGroups = selectedGroups.filter(group => requested.has(group.id));
|
|
74
|
+
warnings.push(`Explicit group TC selection: ${groupIds.length} requested groups; ${selectedGroups.length} intersect the current selection before minCount and top. All groups remain in analysis.json.`);
|
|
75
|
+
}
|
|
62
76
|
const eligibleGroups = selectedGroups.filter(group => group.count >= minCount);
|
|
63
77
|
if (eligibleGroups.length < selectedGroups.length)
|
|
64
78
|
warnings.push(`TC selection requires at least ${minCount} supplied records per group; ${eligibleGroups.length} of ${selectedGroups.length} groups are eligible. All groups remain in analysis.json. These counts are supplied records, not global rates.`);
|
|
@@ -74,6 +88,7 @@ function analyze(content, options, baseline) {
|
|
|
74
88
|
candidates: createCandidates(eligibleGroups.slice(0, top), profile),
|
|
75
89
|
warnings,
|
|
76
90
|
...(selection ? { selection } : {}),
|
|
91
|
+
...(groupIds ? { groupFilter: { groupIds } } : {}),
|
|
77
92
|
};
|
|
78
93
|
}
|
|
79
94
|
export function analyzeErrors(content, options = {}) {
|
package/dist/artifacts.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function readVerifiedBundle(directory: string, options?: {
|
|
|
13
13
|
}): Promise<{
|
|
14
14
|
analysis: Record<string, unknown>;
|
|
15
15
|
provenance: Record<string, unknown>;
|
|
16
|
+
suite?: Record<string, unknown>;
|
|
16
17
|
verification: {
|
|
17
18
|
suite: boolean;
|
|
18
19
|
reviewed: boolean;
|
package/dist/artifacts.js
CHANGED
|
@@ -30,6 +30,12 @@ export function renderReport(analysis) {
|
|
|
30
30
|
'The source SHA-256 commits to the ordered file hashes and byte lengths. Verify with every original file in the same order.',
|
|
31
31
|
...analysis.source.inputs.map((input, index) => `${index + 1}. SHA-256: ${input.sha256} · Bytes: ${input.byteLength}`),
|
|
32
32
|
].join('\n')), '');
|
|
33
|
+
if (analysis.groupFilter)
|
|
34
|
+
lines.push('## Explicit group selection', '', literal([
|
|
35
|
+
`Requested group IDs: ${analysis.groupFilter.groupIds.join(', ')}`,
|
|
36
|
+
'TCs are selected from these exact current groups, intersected with any baseline selection, before min-count and top. Input ID order does not change ranking.',
|
|
37
|
+
'All observed groups remain in this analysis. Unselected groups are outside the TC scope.',
|
|
38
|
+
].join('\n')), '');
|
|
33
39
|
if (analysis.selection)
|
|
34
40
|
lines.push('## Baseline candidate selection', '', literal([
|
|
35
41
|
'Mode: only-current (signatures absent from the supplied baseline)',
|
|
@@ -150,6 +156,7 @@ export async function readVerifiedBundle(directory, options = {}) {
|
|
|
150
156
|
if (JSON.stringify(mappings) !== JSON.stringify(provenance.mappings))
|
|
151
157
|
throw new Error('STALE_BUNDLE: Case provenance mappings no longer match the analysis.');
|
|
152
158
|
let suiteExists = false;
|
|
159
|
+
let verifiedSuite;
|
|
153
160
|
if (provenance.suiteSha256 !== undefined) {
|
|
154
161
|
const content = await readBoundedFile(resolve(root, 'cases/error-to-test.json'), 8 * 1024 * 1024);
|
|
155
162
|
if (hash(content) !== provenance.suiteSha256)
|
|
@@ -158,6 +165,7 @@ export async function readVerifiedBundle(directory, options = {}) {
|
|
|
158
165
|
if (suite.schemaVersion !== 'flow-qa/suite-1' || suiteSource.file !== 'flows/error-to-test.md' || suiteSource.sha256 !== provenance.flowSha256)
|
|
159
166
|
throw new Error('STALE_BUNDLE: Suite source no longer matches the flow.');
|
|
160
167
|
suiteExists = true;
|
|
168
|
+
verifiedSuite = suite;
|
|
161
169
|
}
|
|
162
170
|
if (options.input !== undefined) {
|
|
163
171
|
const provided = inputSource(options.input);
|
|
@@ -169,7 +177,7 @@ export async function readVerifiedBundle(directory, options = {}) {
|
|
|
169
177
|
}
|
|
170
178
|
if (options.profile !== undefined && hash(options.profile) !== provenance.profileSha256)
|
|
171
179
|
throw new Error('STALE_BUNDLE: Profile changed since analysis.');
|
|
172
|
-
return { analysis, provenance, verification: { suite: suiteExists, reviewed: provenance.reviewed, sourceChecked: options.input !== undefined } };
|
|
180
|
+
return { analysis, provenance, ...(verifiedSuite === undefined ? {} : { suite: verifiedSuite }), verification: { suite: suiteExists, reviewed: provenance.reviewed, sourceChecked: options.input !== undefined } };
|
|
173
181
|
}
|
|
174
182
|
export async function verifyBundle(directory, options = {}) {
|
|
175
183
|
return (await readVerifiedBundle(directory, options)).verification;
|
package/dist/cli.js
CHANGED
|
@@ -10,10 +10,12 @@ import { createProfileTemplate } from "./profile-template.js";
|
|
|
10
10
|
import { redactText } from "./redact.js";
|
|
11
11
|
import { linkFlowQaReport } from "./results.js";
|
|
12
12
|
import { readRunSummary, renderRunSummary } from "./run-summary.js";
|
|
13
|
+
import { readReadiness, renderReadiness } from "./readiness.js";
|
|
13
14
|
const help = `Error to Test — local error analysis and regression TC drafts
|
|
14
15
|
|
|
15
16
|
error-to-test analyze --input errors-1.json --input errors-2.json --profile profile.json --out new-directory
|
|
16
17
|
error-to-test analyze --input errors.json --baseline previous-bundle --out new-directory
|
|
18
|
+
error-to-test analyze --input errors.json --group GROUP_ID --group OTHER_GROUP_ID --out selected-directory
|
|
17
19
|
error-to-test analyze --input error.txt --format text --page /items --out new-directory
|
|
18
20
|
error-to-test analyze --input errors.jsonl --format jsonl --out new-directory
|
|
19
21
|
error-to-test analyze --error "TypeError: item is undefined" --page /items --out new-directory
|
|
@@ -23,6 +25,7 @@ const help = `Error to Test — local error analysis and regression TC drafts
|
|
|
23
25
|
error-to-test init-profile new-directory --profile existing.json --out extended.json
|
|
24
26
|
error-to-test link-run new-directory --report path/to/qa-report.json
|
|
25
27
|
error-to-test results new-directory [--format text|json] [--out summary.md]
|
|
28
|
+
error-to-test readiness new-directory [--format text|json]
|
|
26
29
|
error-to-test compare BASELINE CURRENT [--format text|json] [--out comparison.md] [--max-new N]
|
|
27
30
|
|
|
28
31
|
Options:
|
|
@@ -31,6 +34,7 @@ Options:
|
|
|
31
34
|
--format auto|json|jsonl|text Analyze input format; JSONL requires explicit selection and one record per line; auto rejects malformed JSON-looking input
|
|
32
35
|
--format text|json Results summary format (default: text Markdown)
|
|
33
36
|
--format text|json Compare format (default: text Markdown)
|
|
37
|
+
--format text|json Readiness format (default: text Markdown; exit 0 ready, 2 blocked/empty, 1 on error)
|
|
34
38
|
--profile FILE Confirmed app scenarios and explicit assertions (analyze/verify); existing profile to extend (init-profile)
|
|
35
39
|
--baseline DIRECTORY Select only signatures absent from this verified bundle, before --min-count and --top; retain all groups in analysis.json (analyze only)
|
|
36
40
|
--project NAME Metadata for a manual report
|
|
@@ -45,6 +49,7 @@ Options:
|
|
|
45
49
|
--expected-source TEXT Expected-result source (--error only)
|
|
46
50
|
--from ISO --to ISO Filter observed timestamps; undated reports are excluded
|
|
47
51
|
--min-count N Select groups with at least N records after dedup/date filtering (1..10000)
|
|
52
|
+
--group GROUP_ID Select TCs only for these exact current group IDs; repeat up to 100 times (analyze only; before --min-count/--top)
|
|
48
53
|
--top N Generate TCs for the first N eligible ranked groups (1..100; after --min-count)
|
|
49
54
|
--out DIRECTORY New analyze directory; existing files are never overwritten
|
|
50
55
|
--out FILE New init-profile JSON file; existing files are never overwritten
|
|
@@ -142,7 +147,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
142
147
|
help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string', multiple: true }, error: { type: 'string' }, report: { type: 'string' },
|
|
143
148
|
format: { type: 'string' }, profile: { type: 'string' }, baseline: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
|
|
144
149
|
release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
|
|
145
|
-
top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
|
|
150
|
+
top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, out: { type: 'string' }, reviewed: { type: 'boolean' },
|
|
146
151
|
reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
|
|
147
152
|
expected: { type: 'string' }, 'expected-source': { type: 'string' },
|
|
148
153
|
} });
|
|
@@ -157,7 +162,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
157
162
|
}
|
|
158
163
|
if (positionals.length === 0) {
|
|
159
164
|
if (Object.keys(values).length)
|
|
160
|
-
throw new Error('A command is required. Use analyze, init-profile, verify, link-run, results, or
|
|
165
|
+
throw new Error('A command is required. Use analyze, init-profile, verify, link-run, results, compare, or readiness. See --help.');
|
|
161
166
|
process.stdout.write(help);
|
|
162
167
|
return;
|
|
163
168
|
}
|
|
@@ -244,6 +249,23 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
244
249
|
process.stdout.write(`Results summary written: ${out}\n`);
|
|
245
250
|
return;
|
|
246
251
|
}
|
|
252
|
+
if (command === 'readiness') {
|
|
253
|
+
if (positionals.length !== 2 || !positionals[1]?.trim())
|
|
254
|
+
throw new Error('readiness requires one bundle directory.');
|
|
255
|
+
if (Object.keys(values).some(key => !['format', 'help'].includes(key)))
|
|
256
|
+
throw new Error('Unsupported option for readiness. Use only --format text|json.');
|
|
257
|
+
const format = values.format ?? 'text';
|
|
258
|
+
if (format !== 'text' && format !== 'json')
|
|
259
|
+
throw new Error('readiness --format must be text or json.');
|
|
260
|
+
const summary = await readReadiness(resolve(positionals[1]));
|
|
261
|
+
const content = format === 'json' ? jsonText(summary) : renderReadiness(summary);
|
|
262
|
+
if (Buffer.byteLength(content) > 64 * 1024 * 1024)
|
|
263
|
+
throw new Error('The readiness summary exceeds 64 MiB. Narrow the bundle before requesting output.');
|
|
264
|
+
await writeGateOutput(content);
|
|
265
|
+
if (summary.status !== 'ready')
|
|
266
|
+
process.exitCode = 2;
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
247
269
|
if (command === 'compare') {
|
|
248
270
|
if (positionals.length !== 3 || !positionals[1] || !positionals[2])
|
|
249
271
|
throw new Error('compare requires BASELINE and CURRENT bundle directories.');
|
|
@@ -317,7 +339,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
317
339
|
return;
|
|
318
340
|
}
|
|
319
341
|
if (command !== 'analyze' || positionals.length !== 1)
|
|
320
|
-
throw new Error('Use analyze, init-profile, verify, link-run, results, or
|
|
342
|
+
throw new Error('Use analyze, init-profile, verify, link-run, results, compare, or readiness. See --help.');
|
|
321
343
|
if (values.report)
|
|
322
344
|
throw new Error('--report applies to link-run only.');
|
|
323
345
|
if (values['max-new'] !== undefined)
|
|
@@ -360,6 +382,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
360
382
|
project: values.project, environment: values.environment, release: values.release, page: values.page, type: values.type, runtime: values.runtime,
|
|
361
383
|
from: values.from, to: values.to, ...(values.top !== undefined ? { top: Number(values.top) } : {}),
|
|
362
384
|
...(values['min-count'] !== undefined ? { minCount: Number(values['min-count']) } : {}),
|
|
385
|
+
...(values.group !== undefined ? { groupIds: values.group } : {}),
|
|
363
386
|
};
|
|
364
387
|
const baseline = values.baseline === undefined ? undefined : resolve(values.baseline);
|
|
365
388
|
const analysis = baseline === undefined ? analyzeErrors(content, options) : await analyzeWithBaseline(content, baseline, options);
|
|
@@ -372,6 +395,8 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
372
395
|
process.stdout.write(`${analysis.groups.length} error groups; ${analysis.candidates.length} TC candidates (${drafts} drafts, ${analysis.candidates.length - drafts} need context).\n`);
|
|
373
396
|
if (analysis.selection)
|
|
374
397
|
process.stdout.write(`${analysis.selection.onlyCurrentGroupCount} only-current groups; ${analysis.selection.excludedGroupCount} baseline-matched groups excluded from TC selection.\n`);
|
|
398
|
+
if (analysis.groupFilter)
|
|
399
|
+
process.stdout.write(`${analysis.groupFilter.groupIds.length} explicit group IDs requested; min-count, top, and baseline selection still apply.\n`);
|
|
375
400
|
process.stdout.write(`Review ${resolve(out, 'report.md')}\n${files.length} artifacts written. Review acknowledgment: ${values.reviewed ? 'yes' : 'pending'}.\n`);
|
|
376
401
|
}
|
|
377
402
|
export function reportCliError(error) {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export { writeBundle, verifyBundle, renderReport } from './artifacts.ts';
|
|
|
7
7
|
export { linkFlowQaReport } from './results.ts';
|
|
8
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
|
+
export { readReadiness, renderReadiness, type ReadinessSummary } from './readiness.ts';
|
|
10
11
|
export { compareBundles, renderComparison, type AnalysisComparison, type ComparisonStatus, type ComparisonSide, type ComparisonOccurrence, type ComparisonIssue } from './comparison.ts';
|
|
11
12
|
export type * from './types.ts';
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { writeBundle, verifyBundle, renderReport } from "./artifacts.js";
|
|
|
7
7
|
export { linkFlowQaReport } from "./results.js";
|
|
8
8
|
export { createProfileTemplate } from "./profile-template.js";
|
|
9
9
|
export { readRunSummary, renderRunSummary } from "./run-summary.js";
|
|
10
|
+
export { readReadiness, renderReadiness } from "./readiness.js";
|
|
10
11
|
export { compareBundles, renderComparison } from "./comparison.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ReadinessSummary {
|
|
2
|
+
schemaVersion: 'error-to-test/readiness-1';
|
|
3
|
+
inputSha256: string;
|
|
4
|
+
analysisSha256: string;
|
|
5
|
+
suiteSha256?: string;
|
|
6
|
+
reviewed: boolean;
|
|
7
|
+
status: 'ready' | 'blocked' | 'empty';
|
|
8
|
+
counts: {
|
|
9
|
+
groups: number;
|
|
10
|
+
selected: number;
|
|
11
|
+
draft: number;
|
|
12
|
+
needsContext: number;
|
|
13
|
+
ready: number;
|
|
14
|
+
blocked: number;
|
|
15
|
+
};
|
|
16
|
+
cases: {
|
|
17
|
+
caseId: string;
|
|
18
|
+
candidateId: string;
|
|
19
|
+
groupId: string;
|
|
20
|
+
state: 'draft' | 'needs-context';
|
|
21
|
+
title: string;
|
|
22
|
+
blockers: string[];
|
|
23
|
+
}[];
|
|
24
|
+
warnings: string[];
|
|
25
|
+
}
|
|
26
|
+
export declare function readReadiness(directory: string): Promise<ReadinessSummary>;
|
|
27
|
+
export declare function renderReadiness(summary: ReadinessSummary): string;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { literal, readVerifiedBundle } from "./artifacts.js";
|
|
2
|
+
import { redactText } from "./redact.js";
|
|
3
|
+
import { record, text } from "./validation.js";
|
|
4
|
+
const idPattern = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/;
|
|
5
|
+
const shaPattern = /^[0-9a-f]{64}$/;
|
|
6
|
+
const notes = [
|
|
7
|
+
'Readiness means only that no selected-case blockers are recorded in this snapshot. It does not prove runtime access, credentials, coverage, or execution.',
|
|
8
|
+
'Original input files were not supplied for this check; source content was not independently verified.',
|
|
9
|
+
'No browser execution was performed.',
|
|
10
|
+
];
|
|
11
|
+
function id(value, label) {
|
|
12
|
+
const result = text(value, label);
|
|
13
|
+
if (!idPattern.test(result))
|
|
14
|
+
throw new Error(`${label} must be a Flow QA-compatible ID.`);
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
function sha(value, label) {
|
|
18
|
+
const result = text(value, label);
|
|
19
|
+
if (!shaPattern.test(result))
|
|
20
|
+
throw new Error(`${label} must be a SHA-256 digest.`);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function strings(value, label) {
|
|
24
|
+
if (!Array.isArray(value))
|
|
25
|
+
throw new Error(`${label} must be a string array.`);
|
|
26
|
+
return value.map((item, index) => redactText(text(item, `${label}[${index}]`)));
|
|
27
|
+
}
|
|
28
|
+
function count(value, label) {
|
|
29
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
30
|
+
throw new Error(`${label} must be a non-negative integer.`);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
export async function readReadiness(directory) {
|
|
34
|
+
const { analysis, provenance, suite, verification } = await readVerifiedBundle(directory);
|
|
35
|
+
const inputSha256 = sha(provenance.inputSha256, 'provenance.inputSha256');
|
|
36
|
+
const analysisSha256 = sha(provenance.analysisSha256, 'provenance.analysisSha256');
|
|
37
|
+
const suiteSha256 = provenance.suiteSha256 === undefined ? undefined : sha(provenance.suiteSha256, 'provenance.suiteSha256');
|
|
38
|
+
if (verification.suite !== Boolean(suite) || verification.suite !== Boolean(suiteSha256))
|
|
39
|
+
throw new Error('STALE_BUNDLE: Suite provenance is inconsistent.');
|
|
40
|
+
if (!Array.isArray(analysis.groups) || analysis.groups.length > 10000 || !Array.isArray(analysis.candidates) || analysis.candidates.length > 100) {
|
|
41
|
+
throw new Error('STALE_BUNDLE: Analysis groups or selected candidates are invalid.');
|
|
42
|
+
}
|
|
43
|
+
const groups = new Set();
|
|
44
|
+
analysis.groups.forEach((raw, index) => {
|
|
45
|
+
const groupId = id(record(raw, `analysis.groups[${index}]`).id, `analysis.groups[${index}].id`);
|
|
46
|
+
if (groups.has(groupId))
|
|
47
|
+
throw new Error('STALE_BUNDLE: Analysis group IDs are duplicated.');
|
|
48
|
+
groups.add(groupId);
|
|
49
|
+
});
|
|
50
|
+
const candidates = new Map();
|
|
51
|
+
analysis.candidates.forEach((raw, index) => {
|
|
52
|
+
const candidate = record(raw, `analysis.candidates[${index}]`);
|
|
53
|
+
const candidateId = id(candidate.id, `analysis.candidates[${index}].id`);
|
|
54
|
+
const groupId = id(candidate.groupId, `analysis.candidates[${index}].groupId`);
|
|
55
|
+
if (!groups.has(groupId))
|
|
56
|
+
throw new Error('STALE_BUNDLE: A selected candidate refers to a missing group.');
|
|
57
|
+
if (candidates.has(candidateId))
|
|
58
|
+
throw new Error('STALE_BUNDLE: Candidate IDs are duplicated.');
|
|
59
|
+
if (candidate.state !== 'draft' && candidate.state !== 'needs-context')
|
|
60
|
+
throw new Error('STALE_BUNDLE: A selected candidate has an invalid state.');
|
|
61
|
+
candidates.set(candidateId, { groupId, state: candidate.state, title: redactText(text(candidate.title, `analysis.candidates[${index}].title`)), questions: strings(candidate.questions, `analysis.candidates[${index}].questions`) });
|
|
62
|
+
});
|
|
63
|
+
if (Boolean(suite) !== Boolean(candidates.size))
|
|
64
|
+
throw new Error('STALE_BUNDLE: Suite presence does not match selected candidates.');
|
|
65
|
+
if (!Array.isArray(provenance.mappings) || provenance.mappings.length !== candidates.size)
|
|
66
|
+
throw new Error('STALE_BUNDLE: Case mappings are invalid.');
|
|
67
|
+
const mappings = new Map();
|
|
68
|
+
provenance.mappings.forEach((raw, index) => {
|
|
69
|
+
const mapping = record(raw, `provenance.mappings[${index}]`);
|
|
70
|
+
const caseId = id(mapping.caseId, `provenance.mappings[${index}].caseId`);
|
|
71
|
+
const candidateId = id(mapping.candidateId, `provenance.mappings[${index}].candidateId`);
|
|
72
|
+
const groupId = id(mapping.groupId, `provenance.mappings[${index}].groupId`);
|
|
73
|
+
if (mappings.has(caseId) || caseId !== candidateId || candidates.get(candidateId)?.groupId !== groupId)
|
|
74
|
+
throw new Error('STALE_BUNDLE: Case mappings are inconsistent.');
|
|
75
|
+
mappings.set(caseId, { candidateId, groupId });
|
|
76
|
+
});
|
|
77
|
+
const cases = [];
|
|
78
|
+
if (suite) {
|
|
79
|
+
if (!Array.isArray(suite.cases) || suite.cases.length !== candidates.size)
|
|
80
|
+
throw new Error('STALE_BUNDLE: Suite cases do not match selected candidates.');
|
|
81
|
+
const seen = new Set();
|
|
82
|
+
suite.cases.forEach((raw, index) => {
|
|
83
|
+
const suiteCase = record(raw, `suite.cases[${index}]`);
|
|
84
|
+
const caseId = id(suiteCase.id, `suite.cases[${index}].id`);
|
|
85
|
+
const mapping = mappings.get(caseId);
|
|
86
|
+
if (!mapping || seen.has(caseId))
|
|
87
|
+
throw new Error('STALE_BUNDLE: Suite contains an unknown or duplicate case ID.');
|
|
88
|
+
seen.add(caseId);
|
|
89
|
+
const candidate = candidates.get(mapping.candidateId);
|
|
90
|
+
const suiteQuestions = strings(suiteCase.questions, `suite.cases[${index}].questions`);
|
|
91
|
+
const blockers = [...new Set([...suiteQuestions, ...candidate.questions])];
|
|
92
|
+
if (candidate.state === 'needs-context' && blockers.length === 0)
|
|
93
|
+
blockers.push('Resolve missing context before running this case.');
|
|
94
|
+
if (!verification.reviewed && suiteQuestions.length === 0)
|
|
95
|
+
blockers.push('Bundle review is pending.');
|
|
96
|
+
cases.push({ caseId, candidateId: mapping.candidateId, groupId: mapping.groupId, state: candidate.state, title: candidate.title, blockers: [...new Set(blockers)] });
|
|
97
|
+
});
|
|
98
|
+
if (seen.size !== candidates.size)
|
|
99
|
+
throw new Error('STALE_BUNDLE: Suite is missing selected cases.');
|
|
100
|
+
}
|
|
101
|
+
const draft = cases.filter(item => item.state === 'draft').length;
|
|
102
|
+
const needsContext = cases.length - draft;
|
|
103
|
+
const ready = cases.filter(item => item.state === 'draft' && verification.reviewed && item.blockers.length === 0).length;
|
|
104
|
+
const blocked = cases.length - ready;
|
|
105
|
+
const warnings = [...strings(analysis.warnings, 'analysis.warnings'), ...notes];
|
|
106
|
+
return {
|
|
107
|
+
schemaVersion: 'error-to-test/readiness-1', inputSha256, analysisSha256,
|
|
108
|
+
...(suiteSha256 === undefined ? {} : { suiteSha256 }), reviewed: verification.reviewed,
|
|
109
|
+
status: cases.length === 0 ? 'empty' : blocked === 0 ? 'ready' : 'blocked',
|
|
110
|
+
counts: { groups: groups.size, selected: cases.length, draft, needsContext, ready, blocked }, cases, warnings,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function renderReadiness(summary) {
|
|
114
|
+
if (summary.schemaVersion !== 'error-to-test/readiness-1' || !['ready', 'blocked', 'empty'].includes(summary.status) || typeof summary.reviewed !== 'boolean')
|
|
115
|
+
throw new Error('Invalid readiness summary.');
|
|
116
|
+
const lines = ['# Error to Test readiness', '', `Status: ${summary.status}`, `Review acknowledged: ${summary.reviewed ? 'yes' : 'no'}`,
|
|
117
|
+
`Input SHA-256: ${sha(summary.inputSha256, 'summary.inputSha256')}`,
|
|
118
|
+
`Analysis SHA-256: ${sha(summary.analysisSha256, 'summary.analysisSha256')}`];
|
|
119
|
+
if (summary.suiteSha256 !== undefined)
|
|
120
|
+
lines.push(`Suite SHA-256: ${sha(summary.suiteSha256, 'summary.suiteSha256')}`);
|
|
121
|
+
lines.push('', '## Counts', '');
|
|
122
|
+
for (const key of ['groups', 'selected', 'draft', 'needsContext', 'ready', 'blocked'])
|
|
123
|
+
lines.push(`- ${key}: ${count(summary.counts[key], `summary.counts.${key}`)}`);
|
|
124
|
+
lines.push('', '## Cases', '');
|
|
125
|
+
if (!summary.cases.length)
|
|
126
|
+
lines.push('No selected cases.', '');
|
|
127
|
+
for (const item of summary.cases) {
|
|
128
|
+
if (item.state !== 'draft' && item.state !== 'needs-context')
|
|
129
|
+
throw new Error('Invalid readiness case state.');
|
|
130
|
+
lines.push(`### ${id(item.caseId, 'summary.caseId')}`, '', `Candidate ID: ${id(item.candidateId, 'summary.candidateId')}`, `Group ID: ${id(item.groupId, 'summary.groupId')}`, `State: ${item.state}`, '', 'Title:', '', literal(text(item.title, 'summary.title')), '', 'Recorded blockers:', '', literal(strings(item.blockers, 'summary.blockers').join('\n') || 'None'), '');
|
|
131
|
+
}
|
|
132
|
+
lines.push('## Warnings and limits', '', literal(strings(summary.warnings, 'summary.warnings').join('\n') || 'None'), '');
|
|
133
|
+
return `${lines.join('\n')}\n`;
|
|
134
|
+
}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED