@ihyeon/error-to-test 0.2.3 → 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 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`는 준비 조건을 확인했다는 표시이며, 계정·데이터를 자동으로 준비하는 기능은 아닙니다.
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.
@@ -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.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)',
package/dist/cli.js CHANGED
@@ -15,6 +15,7 @@ const help = `Error to Test — local error analysis and regression TC drafts
15
15
 
16
16
  error-to-test analyze --input errors-1.json --input errors-2.json --profile profile.json --out new-directory
17
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
18
19
  error-to-test analyze --input error.txt --format text --page /items --out new-directory
19
20
  error-to-test analyze --input errors.jsonl --format jsonl --out new-directory
20
21
  error-to-test analyze --error "TypeError: item is undefined" --page /items --out new-directory
@@ -48,6 +49,7 @@ Options:
48
49
  --expected-source TEXT Expected-result source (--error only)
49
50
  --from ISO --to ISO Filter observed timestamps; undated reports are excluded
50
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)
51
53
  --top N Generate TCs for the first N eligible ranked groups (1..100; after --min-count)
52
54
  --out DIRECTORY New analyze directory; existing files are never overwritten
53
55
  --out FILE New init-profile JSON file; existing files are never overwritten
@@ -145,7 +147,7 @@ export async function main(args = process.argv.slice(2)) {
145
147
  help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string', multiple: true }, error: { type: 'string' }, report: { type: 'string' },
146
148
  format: { type: 'string' }, profile: { type: 'string' }, baseline: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
147
149
  release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
148
- 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' },
149
151
  reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
150
152
  expected: { type: 'string' }, 'expected-source': { type: 'string' },
151
153
  } });
@@ -380,6 +382,7 @@ export async function main(args = process.argv.slice(2)) {
380
382
  project: values.project, environment: values.environment, release: values.release, page: values.page, type: values.type, runtime: values.runtime,
381
383
  from: values.from, to: values.to, ...(values.top !== undefined ? { top: Number(values.top) } : {}),
382
384
  ...(values['min-count'] !== undefined ? { minCount: Number(values['min-count']) } : {}),
385
+ ...(values.group !== undefined ? { groupIds: values.group } : {}),
383
386
  };
384
387
  const baseline = values.baseline === undefined ? undefined : resolve(values.baseline);
385
388
  const analysis = baseline === undefined ? analyzeErrors(content, options) : await analyzeWithBaseline(content, baseline, options);
@@ -392,6 +395,8 @@ export async function main(args = process.argv.slice(2)) {
392
395
  process.stdout.write(`${analysis.groups.length} error groups; ${analysis.candidates.length} TC candidates (${drafts} drafts, ${analysis.candidates.length - drafts} need context).\n`);
393
396
  if (analysis.selection)
394
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`);
395
400
  process.stdout.write(`Review ${resolve(out, 'report.md')}\n${files.length} artifacts written. Review acknowledgment: ${values.reviewed ? 'yes' : 'pending'}.\n`);
396
401
  }
397
402
  export function reportCliError(error) {
package/dist/types.d.ts CHANGED
@@ -179,6 +179,9 @@ export interface Analysis {
179
179
  onlyCurrentGroupCount: number;
180
180
  excludedGroupCount: number;
181
181
  };
182
+ groupFilter?: {
183
+ groupIds: string[];
184
+ };
182
185
  }
183
186
  export interface FlowQaSuite {
184
187
  schemaVersion: 'flow-qa/suite-1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihyeon/error-to-test",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
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",