@ihyeon/error-to-test 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md CHANGED
@@ -34,7 +34,15 @@ node bin/error-to-test.mjs analyze --input examples/error.txt --page /items --ru
34
34
  node bin/error-to-test.mjs analyze --input examples/errors.json --profile examples/profile.json --out .error-to-test/example
35
35
  ```
36
36
 
37
- 결과는 `analysis.json`, `report.md`, `flows/error-to-test.md`, `cases/error-to-test.json`, `provenance.json`입니다. 빈 조회 결과에는 suite를 만들지 않습니다. 출력 폴더는 매번 새 경로를 지정해야 합니다.
37
+ 결과는 `analysis.json`, `report.md`, `flows/error-to-test.md`, `cases/error-to-test.json`, `provenance.json`입니다. 선택된 TC 후보가 없으면 suite를 만들지 않습니다. 출력 폴더는 매번 새 경로를 지정해야 합니다.
38
+
39
+ `--min-count N`으로 입력에 N건 이상 있는 오류 묶음만 TC 후보로 만들 수 있습니다. 범위는 1~10,000이며 기본값은 1입니다. 중복 제거·날짜 필터 적용 후 건수를 기준으로 고르고, `--top`은 그중 순위가 높은 묶음 수를 제한합니다. 기준 미만의 묶음도 `analysis.json`과 `report.md`에 남으며, 제외가 발생하면 보고서에 선택 기준을 표시합니다. 이 건수는 입력에 포함된 수집 이벤트·제출 보고서 수입니다.
40
+
41
+ ```sh
42
+ error-to-test analyze --input errors.json --min-count 3 --top 10 --out ./recurring-errors
43
+ ```
44
+
45
+ JavaScript API에서는 `analyzeErrors(content, { minCount: 3, top: 10 })`으로 같은 기준을 적용합니다.
38
46
 
39
47
  `report.md` 상단에서 TC 초안 수와 추가 정보가 필요한 TC 수를 확인할 수 있습니다. 초안도 실행 전에 검토해야 합니다. 오류 묶음·수집 건수와 함께 대표 로그의 오류·React 컴포넌트 스택, 재현 방법·사전 조건·테스트 단계·부족한 정보도 표시합니다. 같은 스택은 한 번만 표시하며, 전체 로그의 모든 스택을 나열하지는 않습니다. 재현 단계와 정상 기대 결과, 명시적인 assertion이 없으면 질문이 있는 TC를 생성합니다. 직접 입력한 보고서에는 실제 발생 시각·사용자 수를 만들어 넣지 않습니다. 수집 건수도 실제 발생률을 뜻하지 않으며, 원본 내보내기의 일부 데이터 표시를 유지합니다.
40
48
 
package/README.md CHANGED
@@ -61,6 +61,12 @@ Accepts Browser Error Log v1 `{schemaVersion: 1, partial?: boolean, events: [...
61
61
 
62
62
  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
63
 
64
+ 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.
65
+
66
+ ```sh
67
+ error-to-test analyze --input errors.json --min-count 3 --top 10 --out ./recurring-errors
68
+ ```
69
+
64
70
  ## Confirm the intended behavior
65
71
 
66
72
  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.
@@ -74,7 +80,7 @@ Generated files (Flow QA source is limited to 128 KB; suite JSON to 512 KiB):
74
80
  - `analysis.json`: coverage, ranked groups, safe representative evidence, full-source context checks, and TC candidates.
75
81
  - `report.md`: human-readable analysis with draft and needs-context TC totals, unique error and React component stacks from representative evidence, reported reproduction, preconditions, proposed test steps, and missing context.
76
82
  - `flows/error-to-test.md`: observed facts, requirements, steps, and questions.
77
- - `cases/error-to-test.json`: Flow QA `suite-1` (omitted when no records match).
83
+ - `cases/error-to-test.json`: Flow QA `suite-1` (omitted when no TC candidates are selected).
78
84
  - `provenance.json`: source/profile/analysis/report/flow/suite hashes and event → group → case mappings.
79
85
 
80
86
  Default suites have a review question on every case. Read the artifacts, confirm the profile/steps, then repeat analysis to **another output directory** with `--reviewed`. This acknowledges review; missing context still blocks execution. No analysis command runs the browser.
@@ -103,6 +109,8 @@ await writeBundle('./new-result', analysis);
103
109
 
104
110
  Analysis is deterministic and has no runtime dependencies. Optional model-assisted drafting, collecting new interaction breadcrumbs, direct collector APIs, and a dedicated web input screen are later extensions. Browser/WebView logs can be analyzed; native or WebView execution is not established by a log and remains blocked until the correct context is supplied.
105
111
 
112
+ The API supports the same selection with `analyzeErrors(content, { minCount: 3, top: 10 })`.
113
+
106
114
  After a Flow QA run, associate its normalized report with the exact exported suite:
107
115
 
108
116
  ```sh
@@ -3,5 +3,6 @@ import type { Analysis } from './types.ts';
3
3
  export interface AnalyzeOptions extends ParseInputOptions {
4
4
  profile?: unknown;
5
5
  top?: number;
6
+ minCount?: number;
6
7
  }
7
8
  export declare function analyzeErrors(content: string, options?: AnalyzeOptions): Analysis;
package/dist/analysis.js CHANGED
@@ -6,6 +6,9 @@ export function analyzeErrors(content, options = {}) {
6
6
  const top = options.top ?? 100;
7
7
  if (!Number.isInteger(top) || top < 1 || top > 100)
8
8
  throw new Error('top must be an integer between 1 and 100.');
9
+ const minCount = options.minCount ?? 1;
10
+ if (!Number.isInteger(minCount) || minCount < 1 || minCount > 10000)
11
+ throw new Error('minCount must be an integer between 1 and 10000.');
9
12
  let rawProfile = options.profile;
10
13
  const profileSource = typeof rawProfile === 'string' ? rawProfile : rawProfile === undefined ? undefined : JSON.stringify(rawProfile);
11
14
  if (typeof rawProfile === 'string') {
@@ -21,15 +24,20 @@ export function analyzeErrors(content, options = {}) {
21
24
  const profile = rawProfile === undefined ? undefined : parseProfile(rawProfile);
22
25
  const input = parseInput(content, options);
23
26
  const groups = groupObservations(input.observations);
27
+ const eligibleGroups = groups.filter(group => group.count >= minCount);
24
28
  const warnings = [...input.warnings];
25
- if (groups.length > top)
26
- warnings.push(`TC selection includes the first ${top} of ${groups.length} ranked groups. All groups remain in analysis.json.`);
29
+ if (eligibleGroups.length < groups.length)
30
+ warnings.push(`TC selection requires at least ${minCount} supplied records per group; ${eligibleGroups.length} of ${groups.length} groups are eligible. All groups remain in analysis.json. These counts are supplied records, not global rates.`);
31
+ if (eligibleGroups.length > top)
32
+ warnings.push(minCount === 1
33
+ ? `TC selection includes the first ${top} of ${groups.length} ranked groups. All groups remain in analysis.json.`
34
+ : `TC selection includes the first ${top} of ${eligibleGroups.length} eligible ranked groups. All groups remain in analysis.json.`);
27
35
  return {
28
36
  schemaVersion: 'error-to-test/analysis-1',
29
37
  source: { sha256: input.sha256, ...(profileSource !== undefined ? { profileSha256: hash(profileSource) } : {}) },
30
38
  coverage: input.coverage,
31
39
  groups,
32
- candidates: createCandidates(groups.slice(0, top), profile),
40
+ candidates: createCandidates(eligibleGroups.slice(0, top), profile),
33
41
  warnings,
34
42
  };
35
43
  }
package/dist/cli.js CHANGED
@@ -31,7 +31,8 @@ Options:
31
31
  --expected TEXT Reported intended result (--error only)
32
32
  --expected-source TEXT Expected-result source (--error only)
33
33
  --from ISO --to ISO Filter observed timestamps; undated reports are excluded
34
- --top N Generate TCs for the first N ranked groups (1..100)
34
+ --min-count N Select groups with at least N records after dedup/date filtering (1..10000)
35
+ --top N Generate TCs for the first N eligible ranked groups (1..100; after --min-count)
35
36
  --out DIRECTORY New directory; existing files are never overwritten
36
37
  --reviewed Acknowledge review; unresolved questions still block cases
37
38
  --report FILE Normalized Flow QA report (link-run only)
@@ -59,7 +60,7 @@ export async function main(args = process.argv.slice(2)) {
59
60
  help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string' }, error: { type: 'string' }, report: { type: 'string' },
60
61
  format: { type: 'string' }, profile: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
61
62
  release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
62
- top: { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
63
+ top: { type: 'string' }, 'min-count': { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
63
64
  reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
64
65
  expected: { type: 'string' }, 'expected-source': { type: 'string' },
65
66
  } });
@@ -146,6 +147,7 @@ export async function main(args = process.argv.slice(2)) {
146
147
  format: inputFormat, ...(values.profile ? { profile: await readBoundedFile(resolve(values.profile), 1024 * 1024) } : {}),
147
148
  project: values.project, environment: values.environment, release: values.release, page: values.page, type: values.type, runtime: values.runtime,
148
149
  from: values.from, to: values.to, ...(values.top !== undefined ? { top: Number(values.top) } : {}),
150
+ ...(values['min-count'] !== undefined ? { minCount: Number(values['min-count']) } : {}),
149
151
  });
150
152
  const out = resolve(values.out ?? `.error-to-test/run-${Date.now()}-${randomUUID().slice(0, 8)}`);
151
153
  const files = await writeBundle(out, analysis, { reviewed: values.reviewed });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihyeon/error-to-test",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
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",