@ihyeon/error-to-test 0.5.3 → 0.5.5

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
@@ -252,7 +252,7 @@ API는 `await refineBundle(directory, profileJsonText)`입니다. JSON 문자열
252
252
 
253
253
  ### 원본 로그 없이 관측된 다른 묶음 선택
254
254
 
255
- `reselect`는 처음 분석할 때 `--top`이나 `--min-count`에서 빠졌지만 저장된 분석에 남아 있는 오류 묶음으로 새 검토 번들을 만듭니다. 원본 `analysis.json`이나 `report.md`에서 묶음 ID를 읽고, 요구사항과 단언을 확인한 전체 프로필을 전달하세요.
255
+ `reselect`는 처음 분석할 때 `--top`이나 `--min-count`에서 빠졌지만 저장된 분석에 남아 있는 오류 묶음으로 새 검토 번들을 만듭니다. 새로 생성한 `report.md`의 **Saved group reselection options**에서 재선택할 수 있는 묶음 ID와 재분석이 필요한 옛 묶음을 확인하고, 요구사항과 단언을 확인한 전체 프로필을 전달하세요.
256
256
 
257
257
  ```sh
258
258
  error-to-test reselect ./initial-analysis --group group-0123456789abcdef --profile ./other-profile.json --out ./other-analysis
@@ -308,10 +308,13 @@ SDK가 반환한 오류 ID에서 그룹·TC 후보·검토 차단 사유·최근
308
308
  ```sh
309
309
  error-to-test trace ./review-analysis --event-id "YOUR_EVENT_ID"
310
310
  error-to-test trace ./review-analysis --event-id "YOUR_EVENT_ID" --project "YOUR_PROJECT"
311
+ error-to-test trace ./review-analysis --reference '{"project":"YOUR_PROJECT","eventId":"YOUR_EVENT_ID"}'
311
312
  error-to-test trace ./review-analysis --event-id "YOUR_EVENT_ID" --format json
312
313
  error-to-test trace ./review-analysis --event-id "YOUR_EVENT_ID" --target-fingerprint "$TARGET_FINGERPRINT"
313
314
  ```
314
315
 
316
+ Browser Error Log에서 복사한 JSON을 `--reference`에 붙여 넣으면 공백이나 따옴표가 포함된 프로젝트 이름과 오류 ID까지 그대로 조회합니다. `--reference`와 개별 ID·프로젝트 옵션은 함께 사용하지 않습니다.
317
+
315
318
  `error-to-test/trace-1`은 여러 프로젝트에서 같은 ID를 썼다면 일치하는 그룹을 모두 반환합니다. `--project`로 프로젝트 이름을 정확히 지정하면 그 프로젝트만 조회하며, ID가 다른 프로젝트에만 있으면 `found: false`와 종료 코드 2를 반환합니다. 미선택·차단·검토 준비와 최근 실행에서 빠진 TC의 `not-run`을 구분하고, 실행 결과는 `results`와 동일한 대상 범위·최근 실행 규칙을 따릅니다. 오류 메시지나 스택 대신 ID·프로젝트·그룹·TC·상태와 입력 해시, 부분 수집 여부, 보존 범위 미확인 경고를 표시합니다. ID가 저장된 분석 입력에 없으면 `found: false`와 종료 코드 2를 반환합니다. 서비스 전체에서 발생하지 않았다는 뜻은 아닙니다. 잘못된 번들·옵션은 코드 1입니다. 원본 바이트는 필요 시 `verify --input`으로 확인하세요. API는 `readEventTrace(directory, eventId, { project, targetFingerprint })`와 `renderEventTrace(trace)`입니다.
316
319
 
317
320
  Flow QA 설치와 실행 대상 설정은 별도로 필요합니다. 위 `flows/`·`cases/` 구조를 기존 검토 화면에서 읽을 수 있습니다. 분석 명령은 브라우저를 실행하거나 외부 모델에 요청하지 않습니다. TC 통과만으로 원래 오류를 수정 완료 처리하지 않습니다.
package/README.md CHANGED
@@ -320,7 +320,7 @@ await writeBundle('./refined', analysis); // Review remains pending by default.
320
320
 
321
321
  ### Select another observed group without the original logs
322
322
 
323
- `reselect` creates a new bundle for explicitly named groups that were observed but excluded from the source bundle's candidates by `--top` or `--min-count`. Read their IDs in the source `analysis.json` or `report.md`, then provide a complete replacement profile with reviewed requirements and assertions:
323
+ `reselect` creates a new bundle for explicitly named groups that were observed but excluded from the source bundle's candidates by `--top` or `--min-count`. In a newly generated `report.md`, the **Saved group reselection options** section lists available group IDs and identifies old groups that need reanalysis. Provide a complete replacement profile with reviewed requirements and assertions:
324
324
 
325
325
  ```sh
326
326
  error-to-test reselect ./initial-analysis --group group-0123456789abcdef --profile ./other-profile.json --out ./other-analysis
@@ -402,10 +402,13 @@ Use the ID shown by Browser Error Log to find its observed groups, selected TC c
402
402
  ```sh
403
403
  error-to-test trace ./analysis --event-id "YOUR_EVENT_ID"
404
404
  error-to-test trace ./analysis --event-id "YOUR_EVENT_ID" --project "YOUR_PROJECT"
405
+ error-to-test trace ./analysis --reference '{"project":"YOUR_PROJECT","eventId":"YOUR_EVENT_ID"}'
405
406
  error-to-test trace ./analysis --event-id "YOUR_EVENT_ID" --format json
406
407
  error-to-test trace ./analysis --event-id "YOUR_EVENT_ID" --target-fingerprint "$TARGET_FINGERPRINT"
407
408
  ```
408
409
 
410
+ Paste the JSON copied from Browser Error Log into `--reference` to match its exact project and event ID, including spaces and quotes. Use `--reference` or the separate ID and project options.
411
+
409
412
  The read-only `error-to-test/trace-1` result includes all matching groups because two projects can reuse an ID. Pass `--project` to match one exact project name; an ID found only in other projects then yields `found: false` and exit `2`. It retains `unselected`, `blocked`, and `review-ready` states; a selected case omitted from the latest linked run is `not-run`. Linked results use the same latest-run and target-scope rules as `results`. Output includes source hashes, partial-export status, and unknown retention without copying error messages or stacks. An ID missing from the saved input yields `found: false` and CLI exit `2`; it does not establish that the event never occurred or was never collected. Invalid bundles, linked results, or options exit `1`. Original input bytes can be rechecked with `verify --input` when available.
410
413
 
411
414
  The API is `await readEventTrace(directory, eventId, { project, targetFingerprint })` and `renderEventTrace(trace)`. Omit the options argument to use all projects and the latest linked run across all targets. `trace` reads the verified snapshot and writes no files.
package/dist/artifacts.js CHANGED
@@ -5,6 +5,7 @@ import { exportFlowQa } from "./exports/flow-qa.js";
5
5
  import { hash, record, text } from "./validation.js";
6
6
  import { redactText } from "./redact.js";
7
7
  import { inputSource, validateInputSource } from "./input-source.js";
8
+ import { reselectionChoices } from "./reselection-choices.js";
8
9
  export function jsonText(value) { return `${JSON.stringify(value, null, 2)}\n`; }
9
10
  // Use only after callers have sanitized each untrusted field for its context.
10
11
  export function fencedText(value) {
@@ -65,6 +66,20 @@ export function renderReport(analysis) {
65
66
  `Groups excluded as already observed: ${analysis.selection.excludedGroupCount}`,
66
67
  'All current groups remain below. Absence from this baseline does not establish when an error was introduced.',
67
68
  ].join('\n')), '');
69
+ const choices = reselectionChoices(analysis);
70
+ if (choices.restriction === 'selection') {
71
+ lines.push('## Saved group reselection options', '', 'This bundle uses baseline or explicit group selection. Reanalyze the original input to change the TC group scope.', '');
72
+ }
73
+ else if (choices.restriction === 'reselection') {
74
+ lines.push('## Saved group reselection options', '', 'Use the original ranked analysis bundle to select another observed group.', '');
75
+ }
76
+ else if (choices.available.length || choices.missingContext.length) {
77
+ lines.push('## Saved group reselection options', '', `Observed groups available to reselect: ${choices.available.map(group => group.id).join(', ') || 'none'}`, '');
78
+ if (choices.missingContext.length) {
79
+ lines.push(`Older groups requiring reanalysis of the original input: ${choices.missingContext.map(group => group.id).join(', ')}`, '');
80
+ }
81
+ lines.push('Use reselect with an available group ID, a confirmed profile, and a new output directory. Review the new pending bundle before execution.', '');
82
+ }
68
83
  if (analysis.warnings.length)
69
84
  lines.push('## Coverage and selection notes', '', literal(analysis.warnings.join('\n')), '');
70
85
  if (!analysis.groups.length)
package/dist/cli.js CHANGED
@@ -38,7 +38,7 @@ const help = `Error to Test — local error analysis and regression TC drafts
38
38
  error-to-test results new-directory [--format text|json] [--out summary.md] [--target-fingerprint SHA256] [--require-pass | --fail-on STATUS ...]
39
39
  error-to-test readiness new-directory [--format text|json]
40
40
  error-to-test coverage new-directory [--format text|json]
41
- error-to-test trace new-directory --event-id ID [--project NAME] [--format text|json] [--target-fingerprint SHA256]
41
+ error-to-test trace new-directory (--event-id ID [--project NAME] | --reference JSON) [--format text|json] [--target-fingerprint SHA256]
42
42
  error-to-test compare BASELINE CURRENT [--format text|json] [--out comparison.md] [--max-new N]
43
43
 
44
44
  Options:
@@ -53,6 +53,7 @@ Options:
53
53
  --format text|json Readiness format (default: text Markdown; exit 0 ready, 2 blocked/empty, 1 on error)
54
54
  --format text|json Observed group coverage format (default: text Markdown; read-only, no gate)
55
55
  --event-id ID Trace an SDK event ID within one saved analysis (exit 2 when absent)
56
+ --reference JSON Trace a copied Browser Error Log {project,eventId} reference
56
57
  --project NAME Scope trace matches to one exact project name
57
58
  --target-fingerprint SHA256 Scope trace outcomes to this linked target fingerprint
58
59
  --profile FILE Confirmed app scenarios and explicit assertions (analyze/verify); existing profile to extend (init-profile)
@@ -189,7 +190,7 @@ export async function main(args = process.argv.slice(2)) {
189
190
  help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string', multiple: true }, error: { type: 'string' }, report: { type: 'string' },
190
191
  format: { type: 'string' }, profile: { type: 'string' }, baseline: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
191
192
  release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
192
- top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, 'fail-on': { type: 'string', multiple: true }, 'require-pass': { type: 'boolean' }, 'target-fingerprint': { type: 'string' }, 'event-id': { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
193
+ top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, 'fail-on': { type: 'string', multiple: true }, 'require-pass': { type: 'boolean' }, 'target-fingerprint': { type: 'string' }, 'event-id': { type: 'string' }, reference: { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
193
194
  draft: { type: 'string' }, port: { type: 'string' },
194
195
  reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
195
196
  expected: { type: 'string' }, 'expected-source': { type: 'string' },
@@ -458,17 +459,45 @@ export async function main(args = process.argv.slice(2)) {
458
459
  return;
459
460
  }
460
461
  if (command === 'trace') {
461
- if (positionals.length !== 2 || !positionals[1]?.trim() || !values['event-id']?.trim()) {
462
- throw new Error('trace requires one bundle directory and --event-id ID.');
462
+ if (positionals.length !== 2 || !positionals[1]?.trim() ||
463
+ (values['event-id'] === undefined) === (values.reference === undefined)) {
464
+ throw new Error('trace requires one bundle directory and exactly one of --event-id ID or --reference JSON.');
463
465
  }
464
- if (Object.keys(values).some(key => !['event-id', 'project', 'format', 'target-fingerprint', 'help'].includes(key))) {
465
- throw new Error('Unsupported option for trace. Use only --event-id ID, --project NAME, --format text|json, and --target-fingerprint SHA256.');
466
+ if (Object.keys(values).some(key => !['event-id', 'reference', 'project', 'format', 'target-fingerprint', 'help'].includes(key))) {
467
+ throw new Error('Unsupported option for trace. Use only --event-id ID, --reference JSON, --project NAME, --format text|json, and --target-fingerprint SHA256.');
466
468
  }
467
469
  const format = values.format ?? 'text';
468
470
  if (format !== 'text' && format !== 'json')
469
471
  throw new Error('trace --format must be text or json.');
470
- const trace = await readEventTrace(resolve(positionals[1]), values['event-id'], {
471
- project: values.project, targetFingerprint: values['target-fingerprint'],
472
+ if (values.reference !== undefined && values.project !== undefined) {
473
+ throw new Error('Use --reference on its own; it already contains the project and event ID.');
474
+ }
475
+ let eventId = values['event-id'];
476
+ let project = values.project;
477
+ if (values.reference !== undefined) {
478
+ if (Buffer.byteLength(values.reference, 'utf8') > 64 * 1024) {
479
+ throw new Error('--reference JSON must be 64 KiB or smaller.');
480
+ }
481
+ let parsed;
482
+ try {
483
+ parsed = JSON.parse(values.reference);
484
+ }
485
+ catch {
486
+ throw new Error('--reference requires a JSON object with project and eventId strings.');
487
+ }
488
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
489
+ throw new Error('--reference requires a JSON object with project and eventId strings.');
490
+ }
491
+ const candidate = parsed;
492
+ if (typeof candidate.project !== 'string' || !candidate.project.trim() ||
493
+ typeof candidate.eventId !== 'string' || !candidate.eventId.trim()) {
494
+ throw new Error('--reference requires a JSON object with project and eventId strings.');
495
+ }
496
+ eventId = candidate.eventId;
497
+ project = candidate.project;
498
+ }
499
+ const trace = await readEventTrace(resolve(positionals[1]), eventId, {
500
+ project, targetFingerprint: values['target-fingerprint'],
472
501
  });
473
502
  const content = format === 'json' ? jsonText(trace) : renderEventTrace(trace);
474
503
  if (Buffer.byteLength(content) > 64 * 1024 * 1024)
@@ -583,6 +612,8 @@ export async function main(args = process.argv.slice(2)) {
583
612
  throw new Error('--target-fingerprint applies to results only.');
584
613
  if (values['event-id'] !== undefined)
585
614
  throw new Error('--event-id applies to trace only.');
615
+ if (values.reference !== undefined)
616
+ throw new Error('--reference applies to trace only.');
586
617
  if (values['max-new'] !== undefined)
587
618
  throw new Error('--max-new applies to compare only.');
588
619
  if (values.baseline !== undefined && values.baseline.trim() === '')
@@ -2,6 +2,7 @@ import { readVerifiedBundle } from "./artifacts.js";
2
2
  import { createCandidates, parseProfile } from "./candidates.js";
3
3
  import { validateInputSource } from "./input-source.js";
4
4
  import { redactText } from "./redact.js";
5
+ import { reselectionChoices } from "./reselection-choices.js";
5
6
  import { hash, parseWebSteps, record } from "./validation.js";
6
7
  const sha256 = /^[a-f0-9]{64}$/;
7
8
  const groupId = /^group-[a-f0-9]{16}$/;
@@ -233,21 +234,27 @@ async function rebuildBundle(directory, profile, requestedGroupIds) {
233
234
  throw new Error('Provide 1 to 100 distinct observed group IDs.');
234
235
  }
235
236
  const verified = await readVerifiedBundle(directory);
236
- if (requestedGroupIds !== undefined && (verified.analysis.selection !== undefined || verified.analysis.groupFilter !== undefined)) {
237
+ const { analysis, selectedGroups } = checkedAnalysis(verified.analysis, verified.provenance, requestedGroupIds !== undefined);
238
+ const choices = requestedGroupIds === undefined ? undefined : reselectionChoices(analysis);
239
+ if (choices?.restriction === 'selection') {
237
240
  throw new Error('Saved baseline or explicit group selection cannot be expanded. Reanalyze the original input.');
238
241
  }
239
- if (requestedGroupIds !== undefined && verified.analysis.reselection !== undefined) {
242
+ if (choices?.restriction === 'reselection') {
240
243
  throw new Error('This bundle already reselected observed groups. Use the original ranked analysis bundle to choose another group.');
241
244
  }
242
- const { analysis, selectedGroups } = checkedAnalysis(verified.analysis, verified.provenance, requestedGroupIds !== undefined);
243
245
  let targetGroups = selectedGroups;
244
246
  if (requestedGroupIds !== undefined) {
245
247
  const previouslySelected = new Set(selectedGroups.map(item => item.id));
246
248
  const requested = new Set(requestedGroupIds);
249
+ const available = new Set(choices.available.map(item => item.id));
250
+ const missingContext = new Set(choices.missingContext.map(item => item.id));
247
251
  if (requestedGroupIds.some(id => previouslySelected.has(id))) {
248
252
  throw new Error('Choose only observed groups excluded from the source candidates.');
249
253
  }
250
- targetGroups = analysis.groups.filter(item => requested.has(item.id));
254
+ if (requestedGroupIds.some(id => missingContext.has(id))) {
255
+ throw new Error('Selected group lacks full source context. Reanalyze the original input before refining.');
256
+ }
257
+ targetGroups = analysis.groups.filter(item => requested.has(item.id) && available.has(item.id));
251
258
  if (targetGroups.length !== requested.size)
252
259
  throw new Error('A requested group ID was not observed in the source bundle.');
253
260
  targetGroups.forEach((item, index) => group(item, `reselected.groups[${index}]`, true));
@@ -0,0 +1,6 @@
1
+ import type { Analysis, IssueGroup } from './types.ts';
2
+ export declare function reselectionChoices(analysis: Analysis): {
3
+ available: IssueGroup[];
4
+ missingContext: IssueGroup[];
5
+ restriction?: 'selection' | 'reselection';
6
+ };
@@ -0,0 +1,19 @@
1
+ export function reselectionChoices(analysis) {
2
+ if (analysis.selection || analysis.groupFilter) {
3
+ return { available: [], missingContext: [], restriction: 'selection' };
4
+ }
5
+ if (analysis.reselection) {
6
+ return { available: [], missingContext: [], restriction: 'reselection' };
7
+ }
8
+ const selected = new Set(analysis.candidates.map(candidate => candidate.groupId));
9
+ const excluded = analysis.groups.filter(group => !selected.has(group.id));
10
+ const available = [];
11
+ const missingContext = [];
12
+ for (const group of excluded) {
13
+ if (group.context === undefined)
14
+ missingContext.push(group);
15
+ else
16
+ available.push(group);
17
+ }
18
+ return { available, missingContext };
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihyeon/error-to-test",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
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",