@ihyeon/error-to-test 0.5.5 → 0.5.6
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 +2 -0
- package/README.md +2 -0
- package/dist/comparison.js +2 -2
- package/dist/grouping.js +9 -7
- package/dist/input.js +4 -4
- package/dist/issue-report.js +2 -2
- package/dist/results.js +2 -2
- package/dist/run-summary.js +4 -4
- package/dist/validation.d.ts +2 -0
- package/dist/validation.js +15 -1
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -121,6 +121,8 @@ error-to-test compare ./before ./current
|
|
|
121
121
|
error-to-test compare ./before ./current --format json --out ./comparison.json
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
이전 기준본에서 호출 위치가 다른 오류가 같은 메시지로 묶였거나 밀리초보다 정밀한 시간 범위로 필터링했다면, 기준본과 비교본의 원본 로그를 모두 0.5.6 이상으로 다시 분석한 뒤 `compare`나 `--max-new`를 실행하세요. 저장된 번들에는 생성 당시의 그룹과 시간 범위가 남습니다.
|
|
125
|
+
|
|
124
126
|
현재에만 있는 서명(`only-current`), 양쪽에 있는 서명(`both`), 이전에만 있는 서명(`only-baseline`)으로 나누고 제공된 로그 건수와 증감을 보여줍니다. 릴리스만 제외하고 프로젝트·환경·실행 환경·오류 유형·페이지 경로·전체 오류 서명이 일치해야 합니다. 메시지나 소스 위치가 바뀌면 별도 서명이며, 비슷한 문장을 같은 원인으로 추정하지 않습니다.
|
|
125
127
|
|
|
126
128
|
TC 생성 대상에서 제외된 묶음도 모두 비교합니다. 한쪽에 여러 릴리스가 있으면 같은 비교 키의 건수를 합산하고 원래 묶음 ID·릴리스 목록을 남깁니다. 단일 릴리스끼리 비교하려면 먼저 `analyze --release`로 범위를 정하세요. 페이지 조회 수는 합산하지 않습니다.
|
package/README.md
CHANGED
|
@@ -133,6 +133,8 @@ error-to-test compare ./before ./current
|
|
|
133
133
|
error-to-test compare ./before ./current --format json --out ./comparison.json
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
+
If an older baseline grouped distinct source locations under the same error message, reanalyze the original logs for both snapshots with 0.5.6 or later before running `compare` or `--max-new`. Do the same for older analyses filtered with sub-millisecond time bounds. A saved bundle retains the groups and time window computed when it was created.
|
|
137
|
+
|
|
136
138
|
Each signature is classified as `only-current`, `both`, or `only-baseline`, with supplied record counts on both sides and their difference. Matching keeps project, environment, runtime, error type, page path, and the complete fingerprint-v1 signature; only release is excluded. Changes to messages or source locations remain separate signatures. This comparison does not infer a common root cause from similar text.
|
|
137
139
|
|
|
138
140
|
All source groups participate, including groups excluded from TC generation by `--top` or `--min-count`. Multiple release groups with the same comparison key are aggregated on each side, with their original group IDs and release labels preserved. Use `analyze --release` first when you want one release per side. View counts are not summed or compared.
|
package/dist/comparison.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fencedText, literal, readVerifiedBundle } from "./artifacts.js";
|
|
2
2
|
import { pagePath, redactText } from "./redact.js";
|
|
3
|
-
import { hash, record, timestamp } from "./validation.js";
|
|
3
|
+
import { compareTimestamps, hash, record, timestamp } from "./validation.js";
|
|
4
4
|
const statuses = ['only-current', 'both', 'only-baseline'];
|
|
5
5
|
const runtimes = ['browser', 'webview-ios', 'webview-android', 'unknown'];
|
|
6
6
|
const types = ['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual'];
|
|
@@ -37,7 +37,7 @@ function coverage(value, label) {
|
|
|
37
37
|
const p = record(raw.period, `${label}.period`);
|
|
38
38
|
const from = p.from === undefined ? undefined : timestamp(p.from, `${label}.period.from`);
|
|
39
39
|
const to = p.to === undefined ? undefined : timestamp(p.to, `${label}.period.to`);
|
|
40
|
-
if (from && to && from >
|
|
40
|
+
if (from && to && compareTimestamps(from, to) > 0)
|
|
41
41
|
throw new Error(`${label}.period.from exceeds to.`);
|
|
42
42
|
if (!from && !to)
|
|
43
43
|
throw new Error(`${label}.period must contain a bound.`);
|
package/dist/grouping.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
-
import { hash } from "./validation.js";
|
|
2
|
+
import { compareTimestamps, hash } from "./validation.js";
|
|
3
3
|
import { pagePath } from "./redact.js";
|
|
4
|
-
function sourceFrame(stack) {
|
|
4
|
+
function sourceFrame(stack, message) {
|
|
5
5
|
if (!stack)
|
|
6
6
|
return '';
|
|
7
7
|
const lines = stack.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
8
|
-
const frame = lines.find((line) =>
|
|
8
|
+
const frame = lines.find((line) => line !== message && (/^at\s+\S/.test(line)
|
|
9
|
+
|| /^[^@:]*@(?:.+:\d+|\[native code\])$/.test(line)
|
|
10
|
+
|| /^(?:[a-z][\w+.-]*:\/\/|\.{0,2}\/|[A-Za-z]:[\\/]|[^\s:]+\.\w+)\S*:\d+$/.test(line)));
|
|
9
11
|
return frame ?? '';
|
|
10
12
|
}
|
|
11
13
|
function signature(item) {
|
|
12
14
|
const network = item.network;
|
|
13
15
|
const site = network
|
|
14
16
|
? `${network.method.toUpperCase()} ${pagePath(network.url)} ${network.status ?? ''}`
|
|
15
|
-
: sourceFrame(item.stack
|
|
17
|
+
: sourceFrame(item.stack, item.message) || sourceFrame(item.componentStack, item.message);
|
|
16
18
|
return [item.name ?? '', item.message, site].join(' | ');
|
|
17
19
|
}
|
|
18
20
|
function sharedContext(observations) {
|
|
@@ -58,16 +60,16 @@ export function groupObservations(observations) {
|
|
|
58
60
|
group.count++;
|
|
59
61
|
group.eventIds.push(item.id);
|
|
60
62
|
group.evidence.push(item);
|
|
61
|
-
if (item.occurredAt && (!group.lastOccurredAt || item.occurredAt
|
|
63
|
+
if (item.occurredAt && (!group.lastOccurredAt || compareTimestamps(item.occurredAt, group.lastOccurredAt) > 0))
|
|
62
64
|
group.lastOccurredAt = item.occurredAt;
|
|
63
65
|
}
|
|
64
66
|
for (const group of groups.values()) {
|
|
65
67
|
group.eventIds.sort();
|
|
66
68
|
group.viewCount = new Set(group.evidence.map((item) => item.viewId).filter((id) => !!id)).size;
|
|
67
69
|
group.context = sharedContext(group.evidence);
|
|
68
|
-
group.evidence.sort((a, b) => (b.occurredAt
|
|
70
|
+
group.evidence.sort((a, b) => compareTimestamps(b.occurredAt, a.occurredAt) || a.id.localeCompare(b.id));
|
|
69
71
|
group.evidence = group.evidence.slice(0, 5);
|
|
70
72
|
}
|
|
71
73
|
return [...groups.values()].sort((a, b) => b.viewCount - a.viewCount || b.count - a.count ||
|
|
72
|
-
(b.lastOccurredAt
|
|
74
|
+
compareTimestamps(b.lastOccurredAt, a.lastOccurredAt) || a.id.localeCompare(b.id));
|
|
73
75
|
}
|
package/dist/input.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { record, text, optionalText, strings, timestamp, parseWebSteps, hash } from "./validation.js";
|
|
1
|
+
import { compareTimestamps, record, text, optionalText, strings, timestamp, parseWebSteps, hash } from "./validation.js";
|
|
2
2
|
import { redactText, safeUrl } from "./redact.js";
|
|
3
3
|
import { inputSource } from "./input-source.js";
|
|
4
4
|
const TYPES = new Set(['javascript', 'promise', 'react', 'console', 'http', 'network', 'resource', 'manual']);
|
|
@@ -257,7 +257,7 @@ export function parseInput(content, options = {}) {
|
|
|
257
257
|
throw new Error('Input is empty');
|
|
258
258
|
const from = options.from === undefined ? undefined : timestamp(options.from, 'from');
|
|
259
259
|
const to = options.to === undefined ? undefined : timestamp(options.to, 'to');
|
|
260
|
-
if (from && to && from >
|
|
260
|
+
if (from && to && compareTimestamps(from, to) > 0)
|
|
261
261
|
throw new Error('from must not exceed to');
|
|
262
262
|
if (!['auto', 'json', 'text', 'jsonl'].includes(format))
|
|
263
263
|
throw new Error('Invalid input format');
|
|
@@ -334,8 +334,8 @@ export function parseInput(content, options = {}) {
|
|
|
334
334
|
(!options.release || item.release === options.release) &&
|
|
335
335
|
(!options.page || item.page === safeUrl(options.page)) &&
|
|
336
336
|
(!options.type || item.type === options.type) &&
|
|
337
|
-
(!from || !!item.occurredAt && item.occurredAt >=
|
|
338
|
-
(!to || !!item.occurredAt && item.occurredAt <=
|
|
337
|
+
(!from || !!item.occurredAt && compareTimestamps(item.occurredAt, from) >= 0) &&
|
|
338
|
+
(!to || !!item.occurredAt && compareTimestamps(item.occurredAt, to) <= 0);
|
|
339
339
|
if (!matches)
|
|
340
340
|
filtered++;
|
|
341
341
|
return matches;
|
package/dist/issue-report.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { literal, readVerifiedBundle } from "./artifacts.js";
|
|
2
|
-
import { record, timestamp } from "./validation.js";
|
|
2
|
+
import { compareTimestamps, record, timestamp } from "./validation.js";
|
|
3
3
|
const MAX_REPORT_BYTES = 64 * 1024 * 1024;
|
|
4
4
|
const groupIdPattern = /^group-[0-9a-f]{16}$/;
|
|
5
5
|
const candidateIdPattern = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/;
|
|
@@ -46,7 +46,7 @@ function sourceCoverage(value) {
|
|
|
46
46
|
invalid('coverage.period');
|
|
47
47
|
const from = period.from === undefined ? undefined : timestamp(period.from, 'coverage.period.from');
|
|
48
48
|
const to = period.to === undefined ? undefined : timestamp(period.to, 'coverage.period.to');
|
|
49
|
-
if (from !== undefined && to !== undefined && from >
|
|
49
|
+
if (from !== undefined && to !== undefined && compareTimestamps(from, to) > 0)
|
|
50
50
|
invalid('coverage.period order');
|
|
51
51
|
if (from !== undefined)
|
|
52
52
|
lines.push(`Period from: ${period.from}`);
|
package/dist/results.js
CHANGED
|
@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { link, lstat, mkdir, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { jsonText, readVerifiedBundle } from "./artifacts.js";
|
|
5
|
-
import { record, text, timestamp } from "./validation.js";
|
|
5
|
+
import { compareTimestamps, record, text, timestamp } from "./validation.js";
|
|
6
6
|
import { redactText } from "./redact.js";
|
|
7
7
|
import { reportedTargetIdentity, validateResultSelection } from "./result-selection.js";
|
|
8
8
|
import { MAX_LINKED_RESULT_BYTES } from "./run-summary.js";
|
|
@@ -59,7 +59,7 @@ export async function linkFlowQaReport(directory, rawReport) {
|
|
|
59
59
|
if (status === 'passed' && cases.some(item => item.status !== 'passed'))
|
|
60
60
|
throw new Error('The report status contradicts its case results.');
|
|
61
61
|
const startedAt = timestamp(report.startedAt, 'report.startedAt'), finishedAt = timestamp(report.finishedAt, 'report.finishedAt');
|
|
62
|
-
if (finishedAt <
|
|
62
|
+
if (compareTimestamps(finishedAt, startedAt) < 0)
|
|
63
63
|
throw new Error('The run finished before its start timestamp.');
|
|
64
64
|
const output = {
|
|
65
65
|
schemaVersion: 'error-to-test/results-1', runId,
|
package/dist/run-summary.js
CHANGED
|
@@ -3,7 +3,7 @@ import { lstat, open, opendir } from 'node:fs/promises';
|
|
|
3
3
|
import { join, resolve } from 'node:path';
|
|
4
4
|
import { literal, readVerifiedBundle } from "./artifacts.js";
|
|
5
5
|
import { redactText } from "./redact.js";
|
|
6
|
-
import { record, text, timestamp } from "./validation.js";
|
|
6
|
+
import { compareTimestamps, record, text, timestamp } from "./validation.js";
|
|
7
7
|
import { safeReportedTargetName, validatedTargetFingerprint, validateResultSelection } from "./result-selection.js";
|
|
8
8
|
const runStatuses = new Set(['passed', 'failed', 'blocked', 'error', 'interrupted']);
|
|
9
9
|
const caseStatuses = new Set(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']);
|
|
@@ -96,7 +96,7 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
96
96
|
throw new Error(`Linked result ${name} has an invalid run status.`);
|
|
97
97
|
const startedAt = timestamp(raw.startedAt, `${name}.startedAt`);
|
|
98
98
|
const finishedAt = timestamp(raw.finishedAt, `${name}.finishedAt`);
|
|
99
|
-
if (finishedAt <
|
|
99
|
+
if (compareTimestamps(finishedAt, startedAt) < 0)
|
|
100
100
|
throw new Error(`Linked result ${name} finished before it started.`);
|
|
101
101
|
text(raw.note, `${name}.note`);
|
|
102
102
|
const targetName = raw.targetName === undefined ? undefined : safeReportedTargetName(raw.targetName, `${name}.targetName`);
|
|
@@ -134,9 +134,9 @@ function parseResult(content, name, inputSha256, suiteSha256, expected) {
|
|
|
134
134
|
}
|
|
135
135
|
function later(a, b) {
|
|
136
136
|
if (a.finishedAt !== b.finishedAt)
|
|
137
|
-
return a.finishedAt
|
|
137
|
+
return compareTimestamps(a.finishedAt, b.finishedAt) > 0;
|
|
138
138
|
if (a.startedAt !== b.startedAt)
|
|
139
|
-
return a.startedAt
|
|
139
|
+
return compareTimestamps(a.startedAt, b.startedAt) > 0;
|
|
140
140
|
return a.runId > b.runId;
|
|
141
141
|
}
|
|
142
142
|
function nonnegativeCount(value, label) {
|
package/dist/validation.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export declare function text(value: unknown, label: string, required?: boolean):
|
|
|
5
5
|
export declare function optionalText(value: unknown, label: string): string | undefined;
|
|
6
6
|
export declare function strings(value: unknown, label: string): string[];
|
|
7
7
|
export declare function timestamp(value: unknown, label: string): string;
|
|
8
|
+
/** Compare timestamps normalized by timestamp(), including their sub-millisecond digits. */
|
|
9
|
+
export declare function compareTimestamps(left?: string, right?: string): number;
|
|
8
10
|
export declare function parseWebSteps(value: unknown, label: string): WebStep[];
|
package/dist/validation.js
CHANGED
|
@@ -36,7 +36,21 @@ export function timestamp(value, label) {
|
|
|
36
36
|
const local = new Date(parsed + offset * 60000);
|
|
37
37
|
if (!Number.isFinite(parsed) || local.getUTCFullYear() !== year || local.getUTCMonth() + 1 !== month || local.getUTCDate() !== day || local.getUTCHours() !== hour || local.getUTCMinutes() !== minute || local.getUTCSeconds() !== second)
|
|
38
38
|
throw new Error(`${label} is not a valid timestamp.`);
|
|
39
|
-
|
|
39
|
+
const utc = new Date(parsed).toISOString();
|
|
40
|
+
const fraction = match[7]?.padEnd(9, '0');
|
|
41
|
+
if (!fraction || fraction.slice(3) === '000000')
|
|
42
|
+
return utc;
|
|
43
|
+
return `${utc.slice(0, -4)}${fraction}Z`;
|
|
44
|
+
}
|
|
45
|
+
/** Compare timestamps normalized by timestamp(), including their sub-millisecond digits. */
|
|
46
|
+
export function compareTimestamps(left, right) {
|
|
47
|
+
if (!left || !right)
|
|
48
|
+
return Number(Boolean(left)) - Number(Boolean(right));
|
|
49
|
+
const milliseconds = Date.parse(left) - Date.parse(right);
|
|
50
|
+
if (milliseconds !== 0)
|
|
51
|
+
return Math.sign(milliseconds);
|
|
52
|
+
const fraction = (value) => Number(/\.([0-9]{3,9})Z$/.exec(value)?.[1]?.padEnd(9, '0') ?? '000000000');
|
|
53
|
+
return Math.sign(fraction(left) - fraction(right));
|
|
40
54
|
}
|
|
41
55
|
const roles = new Set(['button', 'link', 'textbox', 'heading', 'checkbox', 'radio', 'combobox', 'option', 'status', 'alert', 'dialog', 'tab', 'row', 'cell', 'list', 'listitem', 'navigation', 'searchbox', 'switch']);
|
|
42
56
|
function exactKeys(raw, keys, label) {
|
package/package.json
CHANGED