@ihyeon/error-to-test 0.4.5 → 0.4.7

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
@@ -234,13 +234,13 @@ API는 `await refineBundle(directory, profileJsonText)`입니다. JSON 문자열
234
234
  ```sh
235
235
  node bin/error-to-test.mjs verify .error-to-test/example --input examples/errors.json --profile examples/profile.json
236
236
  node bin/error-to-test.mjs analyze --input examples/errors.json --profile examples/profile.json --reviewed --out .error-to-test/reviewed
237
- cd .error-to-test/reviewed
238
- flow-qa validate cases/error-to-test.json
239
- flow-qa generate cases/error-to-test.json
240
- flow-qa init
241
- flow-qa ui
237
+ node bin/error-to-test.mjs prepare-run .error-to-test/reviewed --out ./qa-run --input examples/errors.json --profile examples/profile.json
238
+ flow-qa validate cases/error-to-test.json --workspace ./qa-run
239
+ flow-qa ui --workspace ./qa-run
242
240
  ```
243
241
 
242
+ 새 작업 공간에 검토한 흐름과 TC의 원본 바이트를 보존하며 대상 설정은 비어 있습니다. 분석 폴더 밖의 새 경로를 지정하세요. 선택한 TC에 검토·맥락이 더 필요하거나 선택이 비어 있으면 종료 코드 2, 입력·출력 경로에 문제가 있으면 1을 반환합니다.
243
+
244
244
  실행 전에는 `readiness`로 **선택된 TC의 기록된 차단 사유**를 모아 확인할 수 있습니다.
245
245
 
246
246
  ```sh
@@ -325,6 +325,8 @@ error-to-test results ./analysis --fail-on failed --fail-on error --fail-on not-
325
325
 
326
326
  전체 보고서를 출력하거나 저장한 뒤 0 또는 2를 반환하고 숫자로 된 판정 요약은 stderr에 씁니다. JSON stdout은 기존 `error-to-test/run-summary-1` 형식이며 판정 필드를 추가하지 않습니다. 출력 오류는 판정 요약 없이 코드 1로 처리하고 기존 파일은 보존합니다.
327
327
 
328
+ 전체 통과를 요구할 때는 `error-to-test results ./analysis --require-pass`를 사용합니다. 선택한 대상의 최신 실행 자체가 통과했고, 내보낸 TC가 하나 이상이며 그 실행에서 모두 통과해야 종료 코드 0입니다. 중단·부분 실행·미실행은 2입니다. 대상이 여럿이거나 대상 정보가 없는 기록이 섞여 있으면 확인하려는 `--target-fingerprint`를 지정하세요. 대상이 없는 기록만 있다면 대상 정보가 있는 보고서가 필요합니다. 잘못된 입력·옵션·출력 오류는 1입니다.
329
+
328
330
  선택한 대상 범위의 최신 실행 하나에 있는 TC 결과만 평가하며 과거 실패나 다른 대상의 결과를 합치거나 실행 전체 상태를 별도 조건으로 삼지 않습니다. 연결 실행이 없으면 선택된 TC는 `not-run`이므로 미실행도 실패시킬 때 이 값을 지정하세요. 지정하지 않은 상태는 실패 조건이 아니지만, 선택된 TC가 없는 결과는 항상 코드 2입니다. 검토 대기와 미해결 맥락은 실행 전 `readiness`로 별도 점검하세요. 정책 통과는 검토 승인·브라우저 실행 증명·원본 오류 수정 완료를 의미하지 않습니다.
329
331
 
330
332
  `--fail-on`을 생략하면 기존 결과 조회 동작과 종료 코드를 유지합니다. `--fail-on`은 `results` 전용이고 `--target-fingerprint`는 `results`와 `trace`에서 사용합니다. 요약은 `error-to-test/run-summary-1`을 유지하면서 대상 목록·범위 필드를 추가합니다. API에서는 `readRunSummary(directory, { targetFingerprint })`가 반환한 `counts`로 정책을 적용할 수 있습니다.
package/README.md CHANGED
@@ -316,13 +316,13 @@ Default suites have a review question on every case. Read the artifacts, confirm
316
316
  ```sh
317
317
  node bin/error-to-test.mjs verify .error-to-test/example --input examples/errors.json --profile examples/profile.json
318
318
  node bin/error-to-test.mjs analyze --input examples/errors.json --profile examples/profile.json --reviewed --out .error-to-test/reviewed
319
- cd .error-to-test/reviewed
320
- flow-qa validate cases/error-to-test.json
321
- flow-qa generate cases/error-to-test.json
322
- flow-qa init
323
- flow-qa ui
319
+ node bin/error-to-test.mjs prepare-run .error-to-test/reviewed --out ./qa-run --input examples/errors.json --profile examples/profile.json
320
+ flow-qa validate cases/error-to-test.json --workspace ./qa-run
321
+ flow-qa ui --workspace ./qa-run
324
322
  ```
325
323
 
324
+ The new workspace contains the reviewed flow and suite with their original bytes and an empty target configuration. Choose a fresh path outside the bundle. Exit 2 means at least one selected case still needs review or context, or the selection is empty. Exit 1 indicates invalid input or an output conflict.
325
+
326
326
  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.
327
327
 
328
328
  ### Check recorded execution blockers
@@ -440,6 +440,8 @@ if (summary.targets.length) {
440
440
 
441
441
  ### Fail CI on selected case outcomes
442
442
 
443
+ For a release check, use `error-to-test results ./analysis --require-pass`. Exit 0 requires a nonempty set of exported cases, all passed in the latest run, and the overall run reported as passed. A partial, missing or interrupted run exits 2. With multiple target fingerprints or unscoped history, pass `--target-fingerprint` for the intended target. A history consisting only of unidentified runs needs a report with a target. Invalid options, input or output exit 1.
444
+
443
445
  Use repeatable `--fail-on` with `results` to apply a policy to the latest linked run's case counts:
444
446
 
445
447
  ```sh
@@ -459,7 +461,7 @@ The full existing Markdown/JSON report is output or saved before returning `0` o
459
461
 
460
462
  Only the case outcomes from the one latest linked run in the chosen scope are evaluated. Historical failures and outcomes from other targets are not combined with newer results, and the overall run status is not a separate gate condition. Without a linked run, selected cases are `not-run`: include `--fail-on not-run` if unexecuted cases should fail. A status you did not choose does not fail the gate, but an empty selection always does. Use `readiness` separately to check recorded context/review blockers before execution. Passing this policy does not approve cases, prove a browser ran, or resolve source errors.
461
463
 
462
- Omitting `--fail-on` preserves the existing results behavior and exit codes. Both `--fail-on` and `--target-fingerprint` are results-only. The summary keeps `error-to-test/run-summary-1` with additive target inventory and scope fields. API callers can apply their own policy to the `counts` returned by `await readRunSummary(directory, { targetFingerprint })`.
464
+ Omitting both gate options preserves the existing results behavior and exit codes. Both `--fail-on` and `--target-fingerprint` are results-only. The summary keeps `error-to-test/run-summary-1` with additive target inventory and scope fields. API callers can apply their own policy to the `counts` returned by `await readRunSummary(directory, { targetFingerprint })`.
463
465
 
464
466
  ## Data handling and checks
465
467
 
@@ -6,6 +6,8 @@ export declare function renderReport(analysis: Analysis): string;
6
6
  export declare function writeBundle(directory: string, analysis: Analysis, options?: {
7
7
  reviewed?: boolean;
8
8
  }): Promise<string[]>;
9
+ /** Names come from our two fixed output layouts. The directory itself is reserved before any files are written. */
10
+ export declare function writeNewDirectory(directory: string, files: Record<string, string>): Promise<string[]>;
9
11
  export declare function readBoundedFile(path: string, maxBytes?: number): Promise<string>;
10
12
  export declare function readVerifiedBundle(directory: string, options?: {
11
13
  input?: string | readonly string[];
@@ -14,6 +16,8 @@ export declare function readVerifiedBundle(directory: string, options?: {
14
16
  analysis: Record<string, unknown>;
15
17
  provenance: Record<string, unknown>;
16
18
  report: string;
19
+ flowText: string;
20
+ suiteText?: string;
17
21
  suite?: Record<string, unknown>;
18
22
  verification: {
19
23
  suite: boolean;
package/dist/artifacts.js CHANGED
@@ -93,6 +93,10 @@ export async function writeBundle(directory, analysis, options = {}) {
93
93
  };
94
94
  if (Buffer.byteLength(files['analysis.json']) > 64 * 1024 * 1024 || Buffer.byteLength(report) > 64 * 1024 * 1024)
95
95
  throw new Error('The analysis artifacts exceed 64 MiB. Narrow the input or selected scenario details.');
96
+ return writeNewDirectory(directory, files);
97
+ }
98
+ /** Names come from our two fixed output layouts. The directory itself is reserved before any files are written. */
99
+ export async function writeNewDirectory(directory, files) {
96
100
  const root = resolve(directory);
97
101
  await mkdir(dirname(root), { recursive: true });
98
102
  try {
@@ -103,8 +107,6 @@ export async function writeBundle(directory, analysis, options = {}) {
103
107
  throw new Error('The output directory already exists. Choose a new --out path.');
104
108
  throw error;
105
109
  }
106
- // Exclusive files preserve any concurrent or user-supplied edits. A failed write leaves
107
- // an inspectable partial bundle, never an apparently verified complete result.
108
110
  for (const [name, content] of Object.entries(files)) {
109
111
  await mkdir(dirname(resolve(root, name)), { recursive: true });
110
112
  await writeFile(resolve(root, name), content, { flag: 'wx', mode: 0o600 });
@@ -164,7 +166,7 @@ export async function readVerifiedBundle(directory, options = {}) {
164
166
  });
165
167
  if (JSON.stringify(mappings) !== JSON.stringify(provenance.mappings))
166
168
  throw new Error('STALE_BUNDLE: Case provenance mappings no longer match the analysis.');
167
- let suiteExists = false;
169
+ let suiteText;
168
170
  let verifiedSuite;
169
171
  if (provenance.suiteSha256 !== undefined) {
170
172
  const content = await readBoundedFile(resolve(root, 'cases/error-to-test.json'), 8 * 1024 * 1024);
@@ -173,7 +175,7 @@ export async function readVerifiedBundle(directory, options = {}) {
173
175
  const suite = parse(content, 'suite'), suiteSource = record(suite.source, 'suite.source');
174
176
  if (suite.schemaVersion !== 'flow-qa/suite-1' || suiteSource.file !== 'flows/error-to-test.md' || suiteSource.sha256 !== provenance.flowSha256)
175
177
  throw new Error('STALE_BUNDLE: Suite source no longer matches the flow.');
176
- suiteExists = true;
178
+ suiteText = content;
177
179
  verifiedSuite = suite;
178
180
  }
179
181
  if (options.input !== undefined) {
@@ -186,7 +188,7 @@ export async function readVerifiedBundle(directory, options = {}) {
186
188
  }
187
189
  if (options.profile !== undefined && hash(options.profile) !== provenance.profileSha256)
188
190
  throw new Error('STALE_BUNDLE: Profile changed since analysis.');
189
- return { analysis, provenance, report, ...(verifiedSuite === undefined ? {} : { suite: verifiedSuite }), verification: { suite: suiteExists, reviewed: provenance.reviewed, sourceChecked: options.input !== undefined } };
191
+ return { analysis, provenance, report, flowText: flow, suiteText, ...(verifiedSuite === undefined ? {} : { suite: verifiedSuite }), verification: { suite: verifiedSuite !== undefined, reviewed: provenance.reviewed, sourceChecked: options.input !== undefined } };
190
192
  }
191
193
  export async function verifyBundle(directory, options = {}) {
192
194
  return (await readVerifiedBundle(directory, options)).verification;
package/dist/cli.js CHANGED
@@ -4,13 +4,13 @@ import { randomUUID } from 'node:crypto';
4
4
  import { lstat, mkdir, readFile, realpath, writeFile } from 'node:fs/promises';
5
5
  import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
6
6
  import { analyzeErrors, analyzeWithBaseline } from "./analysis.js";
7
- import { jsonText, readBoundedFile, readVerifiedBundle, verifyBundle, writeBundle } from "./artifacts.js";
7
+ import { jsonText, readBoundedFile, readVerifiedBundle, writeNewDirectory, writeBundle } from "./artifacts.js";
8
8
  import { compareBundles, renderComparison } from "./comparison.js";
9
9
  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
+ import { readReadiness, renderReadiness, summarizeReadiness } from "./readiness.js";
14
14
  import { readCoverage, renderCoverage } from "./coverage.js";
15
15
  import { readEventTrace, renderEventTrace } from "./trace.js";
16
16
  import { refineBundle } from "./refinement.js";
@@ -25,12 +25,13 @@ const help = `Error to Test — local error analysis and regression TC drafts
25
25
  error-to-test analyze --error "TypeError: item is undefined" --page /items --out new-directory
26
26
  cat error.txt | error-to-test analyze --input - --format text --out new-directory
27
27
  error-to-test verify new-directory [--input errors-1.json --input errors-2.json] [--profile profile.json]
28
+ error-to-test prepare-run reviewed-bundle --out new-workspace [--input errors.json] [--profile profile.json]
28
29
  error-to-test init-profile new-directory --out profile.json
29
30
  error-to-test init-profile new-directory --profile existing.json --out extended.json
30
31
  error-to-test refine new-directory --profile updated.json --out refined-directory [--reviewed]
31
32
  error-to-test issue new-directory --group GROUP_ID [--out issue.md]
32
33
  error-to-test link-run new-directory --report path/to/qa-report.json
33
- error-to-test results new-directory [--format text|json] [--out summary.md] [--target-fingerprint SHA256] [--fail-on STATUS ...]
34
+ error-to-test results new-directory [--format text|json] [--out summary.md] [--target-fingerprint SHA256] [--require-pass | --fail-on STATUS ...]
34
35
  error-to-test readiness new-directory [--format text|json]
35
36
  error-to-test coverage new-directory [--format text|json]
36
37
  error-to-test trace new-directory --event-id ID [--format text|json] [--target-fingerprint SHA256]
@@ -41,6 +42,7 @@ Options:
41
42
  --error TEXT Submit a single error directly; remaining lines are its stack
42
43
  --format auto|json|jsonl|text Analyze input format; JSONL requires explicit selection and one record per line; auto rejects malformed JSON-looking input
43
44
  --format text|json Results summary format (default: text Markdown)
45
+ --require-pass Require a passed full run and all exported cases passed on one identified target (exit 2 otherwise)
44
46
  --fail-on STATUS Results gate: failed|flaky|blocked|skipped|error|not-run (repeatable; exit 2 on a match or no selected cases, 1 on error)
45
47
  --target-fingerprint SHA256 Scope results or trace to this target's 64-character lowercase SHA-256 fingerprint
46
48
  --format text|json Compare format (default: text Markdown)
@@ -114,14 +116,26 @@ async function writeGateOutput(content) {
114
116
  });
115
117
  }
116
118
  const resultsGateStatuses = ['failed', 'flaky', 'blocked', 'skipped', 'error', 'not-run'];
117
- async function inputContents(paths, allowStdin) {
119
+ function incompleteRun(summary) {
120
+ if (!summary.latestRun)
121
+ return 'No linked run in this target scope.';
122
+ if (!summary.selectedTargetFingerprint && (summary.targets.length !== 1 || summary.unscopedRunCount > 0)) {
123
+ return 'The target is ambiguous or unidentified. Select --target-fingerprint from the results inventory or link a run with an identified target.';
124
+ }
125
+ if (summary.latestRun.status !== 'passed')
126
+ return `The latest run reported ${summary.latestRun.status}.`;
127
+ if (!summary.counts.passed || resultsGateStatuses.some(status => summary.counts[status] > 0)) {
128
+ return 'Every exported case must have a passing outcome in this run. See the case counts.';
129
+ }
130
+ }
131
+ async function inputContents(paths, command) {
118
132
  if (paths.length < 1 || paths.length > 50)
119
133
  throw new Error('Provide between 1 and 50 --input files.');
120
134
  if (paths.some(path => !path.trim()))
121
135
  throw new Error('--input requires a nonempty file path.');
122
136
  if (paths.includes('-')) {
123
- if (!allowStdin)
124
- throw new Error('verify --input - is not supported. Supply the original file.');
137
+ if (command !== 'analyze')
138
+ throw new Error(`${command} --input - is not supported. Supply the original file.`);
125
139
  if (paths.length !== 1)
126
140
  throw new Error('--input - must be the sole input.');
127
141
  return stdinText();
@@ -168,7 +182,7 @@ export async function main(args = process.argv.slice(2)) {
168
182
  help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string', multiple: true }, error: { type: 'string' }, report: { type: 'string' },
169
183
  format: { type: 'string' }, profile: { type: 'string' }, baseline: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
170
184
  release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
171
- top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, 'fail-on': { type: 'string', multiple: true }, 'target-fingerprint': { type: 'string' }, 'event-id': { type: 'string' }, out: { type: 'string' }, reviewed: { type: 'boolean' },
185
+ 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' },
172
186
  reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
173
187
  expected: { type: 'string' }, 'expected-source': { type: 'string' },
174
188
  } });
@@ -183,7 +197,7 @@ export async function main(args = process.argv.slice(2)) {
183
197
  }
184
198
  if (positionals.length === 0) {
185
199
  if (Object.keys(values).length)
186
- throw new Error('A command is required. Use analyze, init-profile, refine, issue, verify, link-run, results, compare, readiness, coverage, or trace. See --help.');
200
+ throw new Error('A command is required. Use analyze, init-profile, refine, issue, verify, prepare-run, link-run, results, compare, readiness, coverage, or trace. See --help.');
187
201
  process.stdout.write(help);
188
202
  return;
189
203
  }
@@ -283,12 +297,15 @@ export async function main(args = process.argv.slice(2)) {
283
297
  if (command === 'results') {
284
298
  if (positionals.length !== 2 || !positionals[1])
285
299
  throw new Error('results requires one bundle directory.');
286
- if (Object.keys(values).some(key => !['format', 'out', 'fail-on', 'target-fingerprint', 'help'].includes(key)))
287
- throw new Error('Unsupported option for results. Use only --format text|json, --out FILE, --target-fingerprint SHA256, and --fail-on STATUS.');
300
+ if (Object.keys(values).some(key => !['format', 'out', 'fail-on', 'require-pass', 'target-fingerprint', 'help'].includes(key)))
301
+ throw new Error('Unsupported option for results. Use only --format text|json, --out FILE, --target-fingerprint SHA256, and --require-pass or --fail-on STATUS.');
288
302
  const format = values.format ?? 'text';
289
303
  if (format !== 'text' && format !== 'json')
290
304
  throw new Error('results --format must be text or json.');
305
+ const requirePass = values['require-pass'] === true;
291
306
  const requestedStatuses = values['fail-on'];
307
+ if (requirePass && requestedStatuses)
308
+ throw new Error('Choose --require-pass or a custom --fail-on case policy.');
292
309
  if (requestedStatuses?.some(status => !resultsGateStatuses.includes(status))) {
293
310
  throw new Error('results --fail-on must be failed, flaky, blocked, skipped, error, or not-run.');
294
311
  }
@@ -299,6 +316,13 @@ export async function main(args = process.argv.slice(2)) {
299
316
  if (Buffer.byteLength(content) > 64 * 1024 * 1024)
300
317
  throw new Error('The results summary exceeds 64 MiB. Narrow the bundle before requesting output.');
301
318
  const finishGate = () => {
319
+ if (requirePass) {
320
+ const blocker = incompleteRun(summary);
321
+ process.stderr.write(blocker ? `Full-run gate failed: ${blocker}\n` : `Full-run gate passed: ${summary.counts.passed} case(s) passed.\n`);
322
+ if (blocker)
323
+ process.exitCode = 2;
324
+ return;
325
+ }
302
326
  if (failOn === undefined)
303
327
  return;
304
328
  const selectedTotal = Object.values(summary.counts).reduce((total, count) => total + count, 0);
@@ -308,11 +332,14 @@ export async function main(args = process.argv.slice(2)) {
308
332
  process.stderr.write(selectedTotal === 0
309
333
  ? 'Results gate failed: no selected cases.\n'
310
334
  : `Results gate ${failed ? 'failed' : 'passed'}: ${matchTotal} cases match --fail-on (${detail}).\n`);
335
+ if (!failed && summary.latestRun && summary.latestRun.status !== 'passed') {
336
+ process.stderr.write(`Overall run: ${summary.latestRun.status}. --fail-on checks case counts only.\n`);
337
+ }
311
338
  if (failed)
312
339
  process.exitCode = 2;
313
340
  };
314
341
  if (values.out === undefined) {
315
- if (failOn === undefined)
342
+ if (!requirePass && failOn === undefined)
316
343
  process.stdout.write(content);
317
344
  else
318
345
  await writeGateOutput(content);
@@ -333,7 +360,7 @@ export async function main(args = process.argv.slice(2)) {
333
360
  throw error;
334
361
  }
335
362
  const written = `Results summary written: ${out}\n`;
336
- if (failOn === undefined)
363
+ if (!requirePass && failOn === undefined)
337
364
  process.stdout.write(written);
338
365
  else
339
366
  await writeGateOutput(written);
@@ -451,22 +478,51 @@ export async function main(args = process.argv.slice(2)) {
451
478
  finishGate();
452
479
  return;
453
480
  }
454
- if (command === 'verify') {
455
- if (positionals.length !== 2 || !positionals[1])
456
- throw new Error('verify requires one bundle directory.');
457
- if (Object.keys(values).some(key => !['input', 'profile', 'help'].includes(key)))
458
- throw new Error('Unsupported option for verify.');
459
- const result = await verifyBundle(resolve(positionals[1]), {
460
- ...(values.input ? { input: await inputContents(values.input, false) } : {}),
481
+ if (command === 'verify' || command === 'prepare-run') {
482
+ if (positionals.length !== 2 || !positionals[1]?.trim())
483
+ throw new Error(`${command} requires one bundle directory.`);
484
+ const allowed = command === 'prepare-run' ? ['input', 'profile', 'out', 'help'] : ['input', 'profile', 'help'];
485
+ if (Object.keys(values).some(key => !allowed.includes(key)))
486
+ throw new Error(`Unsupported option for ${command}.`);
487
+ if (command === 'prepare-run' && !values.out?.trim())
488
+ throw new Error('prepare-run requires --out NEW_WORKSPACE.');
489
+ if (values.profile !== undefined && !values.profile.trim())
490
+ throw new Error('--profile requires a nonempty file path.');
491
+ const directory = resolve(positionals[1]);
492
+ const snapshot = await readVerifiedBundle(directory, {
493
+ ...(values.input ? { input: await inputContents(values.input, command) } : {}),
461
494
  ...(values.profile ? { profile: await readBoundedFile(resolve(values.profile), 1024 * 1024) } : {}),
462
495
  });
463
- process.stdout.write(`Bundle verified. Suite: ${result.suite ? 'present' : 'none'}; review: ${result.reviewed ? 'acknowledged' : 'pending'}; original input: ${result.sourceChecked ? 'checked' : 'not supplied'}.\n`);
496
+ const result = snapshot.verification;
497
+ if (command === 'verify') {
498
+ process.stdout.write(`Bundle verified. Suite: ${result.suite ? 'present' : 'none'}; review: ${result.reviewed ? 'acknowledged' : 'pending'}; original input: ${result.sourceChecked ? 'checked' : 'not supplied'}.\n`);
499
+ return;
500
+ }
501
+ const readiness = summarizeReadiness(snapshot);
502
+ if (readiness.status !== 'ready' || snapshot.suiteText === undefined) {
503
+ process.stderr.write(`Workspace not created. Readiness: ${readiness.status}. Run error-to-test readiness on the bundle to inspect blockers.\n`);
504
+ process.exitCode = 2;
505
+ return;
506
+ }
507
+ const out = await canonicalOutput(resolve(values.out));
508
+ if (insideBundle(await realpath(directory), out))
509
+ throw new Error('Choose a new workspace outside the source bundle.');
510
+ await writeNewDirectory(out, {
511
+ 'flows/error-to-test.md': snapshot.flowText,
512
+ 'cases/error-to-test.json': snapshot.suiteText,
513
+ '.gitignore': '.flowqa/\n.env\n.env.*\n',
514
+ // Publish the config last so a partial write cannot be used to run the suite.
515
+ 'flowqa.config.json': jsonText({ schemaVersion: 'flow-qa/config-1', targets: {} }),
516
+ });
517
+ process.stdout.write(`Flow QA workspace: ${out}\nReviewed cases: ${readiness.counts.ready}. Suite SHA-256: ${readiness.suiteSha256}\nOriginal input: ${result.sourceChecked ? 'checked' : 'not supplied'}. No target selected or browser run.\nConnect your chosen target in this workspace. Run cases/error-to-test.json, then use link-run with the original analysis bundle.\n`);
464
518
  return;
465
519
  }
466
520
  if (command !== 'analyze' || positionals.length !== 1)
467
- throw new Error('Use analyze, init-profile, refine, issue, verify, link-run, results, compare, readiness, coverage, or trace. See --help.');
521
+ throw new Error('Use analyze, init-profile, refine, issue, verify, prepare-run, link-run, results, compare, readiness, coverage, or trace. See --help.');
468
522
  if (values.report)
469
523
  throw new Error('--report applies to link-run only.');
524
+ if (values['require-pass'])
525
+ throw new Error('--require-pass applies to results only.');
470
526
  if (values['fail-on'] !== undefined)
471
527
  throw new Error('--fail-on applies to results only.');
472
528
  if (values['target-fingerprint'] !== undefined)
@@ -506,7 +562,7 @@ export async function main(args = process.argv.slice(2)) {
506
562
  else {
507
563
  if (values.reproduce || values.precondition || values.expected || values['expected-source'])
508
564
  throw new Error('Reported context options require --error. Use manual JSON or a profile for file input.');
509
- content = await inputContents(values.input, true);
565
+ content = await inputContents(values.input, 'analyze');
510
566
  }
511
567
  const options = {
512
568
  format: inputFormat, ...(values.profile ? { profile: await readBoundedFile(resolve(values.profile), 1024 * 1024) } : {}),
package/docs/releases.md CHANGED
@@ -2,6 +2,14 @@
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.4.7 — distinguish a passed case from a completed run
6
+
7
+ `results --require-pass` checks that the latest run on the intended target completed with every exported case passing. An interrupted runner can preserve passing case results. The custom `--fail-on` case policy keeps its exit behavior and reports the overall run status when a case policy passes a non-passing run.
8
+
9
+ ## 0.4.6 — reviewed Flow QA workspace
10
+
11
+ `prepare-run` verifies the analysis bundle and creates a fresh Flow QA workspace with its original flow and suite bytes. Original inputs and the profile can be checked during the same operation. A blocked or empty selection exits 2 before creating the directory. The operator chooses the target and initiates execution in Flow QA.
12
+
5
13
  ## 0.4.5 — interpret SDK batches and linked browser runs
6
14
 
7
15
  Reports and event traces now show whether the source marked an export partial and separately state that collection completeness is unverified. The readiness warning identifies the check that produced it when a trace also lists browser runs. The packaged skill shows how to copy a reviewed suite into an initialized Flow QA workspace and check its bytes before execution.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihyeon/error-to-test",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
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",
@@ -12,6 +12,6 @@ Use the installed `@ihyeon/error-to-test` package and the user's supplied local
12
12
  3. If a candidate lacks confirmed behavior, setup, actions, expectation source, or an observable assertion, keep its questions and `needs-context` state. Ask the user or requirement owner for the missing facts. A model may draft wording from evidence but must not invent the contract or silently approve a case.
13
13
  4. Generate a profile template from a verified bundle only when the selected groups have an owner who can confirm requirements. Fill it from confirmed evidence, then analyze or refine into another new directory. Review cases and acknowledge with `--reviewed` only after actual review; it does not clear remaining blockers.
14
14
  5. Run `verify` with original input/profile when available, then `readiness` and `coverage`. If the user provides a Browser Error Log event ID, run `trace BUNDLE --event-id ID` to connect it to saved groups and candidates. `coverage` accounts for observed groups in the saved input, not production error coverage or test execution. A `review-ready` candidate is not a passing test.
15
- 6. Hand the verified suite to Flow QA with an explicitly selected target. Only link a normalized Flow QA report whose suite hash and case IDs match. Interpret `results` and an event `trace` for the latest run in the chosen target scope; selected cases omitted from that run are `not-run`. No successful case automatically closes the source error.
15
+ 6. Use `prepare-run BUNDLE --out NEW_WORKSPACE` to transfer the verified flow and suite together. Supply original input/profile files when available. Connect the explicitly selected target in that workspace. Only link a normalized Flow QA report whose suite hash and case IDs match. Interpret `results` and an event `trace` for the latest run in the chosen target scope; selected cases omitted from that run are `not-run`. Use `results --require-pass` to check completed execution for all exported cases on the intended target. No successful case automatically closes the source error.
16
16
 
17
17
  Keep source and execution target distinct. The input log, its URLs, the profile, and the exported suite do not select or authorize a live test target, credentials, deployment, upload, or issue filing. State local and execution limitations in the handoff.
@@ -40,25 +40,26 @@ The template is `error-to-test/profile-1` and intentionally incomplete. Each sce
40
40
 
41
41
  ## Flow QA handoff and results
42
42
 
43
- Handoff includes `report.md`, `analysis.json`, `provenance.json`, and, when selected candidates exist, `flows/error-to-test.md` and `cases/error-to-test.json`. Verify source/profile bytes if available. Record input kind, filters, partial flag, unknown retention, selected versus all observed groups, unresolved questions, review status, and exact target the operator chose. The bundle itself does not run a browser or select a target. Flow QA resolves the suite's source-flow path against its workspace. Flow QA can validate the suite directly in the analysis directory. To connect a target and run the case, use an initialized Flow QA workspace containing `flowqa.config.json`. In a fresh workspace, preserve both generated files at their original relative paths.
43
+ Handoff includes `report.md`, `analysis.json`, `provenance.json`, and, when selected candidates exist, `flows/error-to-test.md` and `cases/error-to-test.json`. Verify source/profile bytes if available. Record input kind, filters, partial flag, unknown retention, selected versus all observed groups, unresolved questions, review status, and exact target the operator chose. The bundle itself does not run a browser or select a target. Prepare an empty-target workspace from the reviewed bundle. Supply each original input in order and the profile if available.
44
44
 
45
45
  ```sh
46
- flow-qa init ./qa-run
47
- cp -n ./reviewed-analysis/flows/error-to-test.md ./qa-run/flows/error-to-test.md
48
- cp -n ./reviewed-analysis/cases/error-to-test.json ./qa-run/cases/error-to-test.json
49
- cmp ./reviewed-analysis/flows/error-to-test.md ./qa-run/flows/error-to-test.md &&
50
- cmp ./reviewed-analysis/cases/error-to-test.json ./qa-run/cases/error-to-test.json &&
51
- flow-qa validate cases/error-to-test.json --workspace ./qa-run
46
+ error-to-test prepare-run ./reviewed-analysis --out ./qa-run --input errors.json --profile ./review-profile.json
47
+ flow-qa validate cases/error-to-test.json --workspace ./qa-run
52
48
  ```
53
49
 
54
- If either comparison reports a difference, choose a fresh directory and copy both files again. Once validation succeeds, use the same `--workspace ./qa-run` for Flow QA’s `connect` and `run` commands.
50
+ Choose a new path outside the bundle. The workspace holds the verified source flow and suite, a local ignore file and a config with zero targets. Exit 2 means the selection is blocked or empty. Use `readiness` to see which cases need attention. Exit 1 means verification or writing failed. Once prepared, connect the user's chosen target and run in the same workspace. For example, with the authorized preview URL in `PREVIEW_URL`:
55
51
 
56
- After Flow QA runs the exported suite on that chosen target and writes a normalized `flow-qa/report-1` report:
52
+ ```sh
53
+ flow-qa connect preview --url "$PREVIEW_URL" --workspace ./qa-run
54
+ flow-qa run cases/error-to-test.json --workspace ./qa-run --target preview
55
+ ```
56
+
57
+ Set `RUN_ID` to the exact ID from this Flow QA execution. Link its normalized report and check the latest run in the chosen target scope.
57
58
 
58
59
  ```sh
59
- error-to-test link-run ./reviewed-analysis --report ./flow-qa-report.json
60
+ error-to-test link-run ./reviewed-analysis --report "./qa-run/.flowqa/runs/$RUN_ID/qa-report.json"
60
61
  error-to-test results ./reviewed-analysis --format json
61
- error-to-test results ./reviewed-analysis --target-fingerprint <64-lowercase-hex-fingerprint> --fail-on failed --fail-on error --fail-on not-run
62
+ error-to-test results ./reviewed-analysis --target-fingerprint "$TARGET_FINGERPRINT" --require-pass
62
63
  ```
63
64
 
64
- Get a target fingerprint from the unfiltered `results --format json` target inventory before using the filter. Never infer a target from a log URL. Linking requires the exported suite hash and declared case IDs to match. The latest linked run supplies outcomes; selected runs leave other cases `not-run`. Results can be `passed`, `failed`, `flaky`, `blocked`, `skipped`, `error`, or `not-run`. A `--fail-on` gate exits 2 on matching cases or empty selection, 1 for invalid data, 0 otherwise. A passing gate proves only that the specified policy was met for the reported run; it does not prove source issue resolution.
65
+ Set `TARGET_FINGERPRINT` from the unfiltered `results --format json` target inventory before using the filter. Never infer a target from a log URL. Linking requires the exported suite hash and declared case IDs to match. The latest linked run supplies outcomes; selected runs leave other cases `not-run`. Results can be `passed`, `failed`, `flaky`, `blocked`, `skipped`, `error`, or `not-run`. The full-run gate exits 2 unless every exported case and the latest run passed on one identified target. A stopped run can retain passing cases. A custom `--fail-on` gate checks only case counts and exits 2 on matching cases or empty selection, 1 for invalid data, 0 otherwise. A passing gate proves only that the specified policy was met for the reported run; it does not prove source issue resolution.