@ihyeon/error-to-test 0.5.3 → 0.5.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 +1 -1
- package/README.md +1 -1
- package/dist/artifacts.js +15 -0
- package/dist/refinement.js +11 -4
- package/dist/reselection-choices.d.ts +6 -0
- package/dist/reselection-choices.js +19 -0
- package/package.json +1 -1
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`에서 빠졌지만 저장된 분석에 남아 있는 오류 묶음으로 새 검토 번들을 만듭니다.
|
|
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
|
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`.
|
|
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
|
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/refinement.js
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
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
|
-
|
|
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,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