@midscene/core 1.15.2-beta-20261012123219.0 → 1.15.2
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/dist/es/agent/action-readiness.mjs +6 -3
- package/dist/es/agent/action-readiness.mjs.map +1 -1
- package/dist/es/agent/agent.mjs +4 -2
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/execution-session.mjs.map +1 -1
- package/dist/es/agent/task-builder.mjs +35 -16
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +35 -12
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/device/index.mjs +7 -6
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/report-generator.mjs +30 -14
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/report.mjs +121 -44
- package/dist/es/report.mjs.map +1 -1
- package/dist/es/service/index.mjs.map +1 -1
- package/dist/es/task-runner.mjs +22 -12
- package/dist/es/task-runner.mjs.map +1 -1
- package/dist/es/test-run-report.mjs.map +1 -1
- package/dist/es/test-runner/engine/case-runner.mjs +1 -1
- package/dist/es/test-runner/engine/case-runner.mjs.map +1 -1
- package/dist/es/test-runner/engine/document-runtime.mjs +42 -12
- package/dist/es/test-runner/engine/document-runtime.mjs.map +1 -1
- package/dist/es/test-runner/engine/execute-step.mjs +130 -12
- package/dist/es/test-runner/engine/execute-step.mjs.map +1 -1
- package/dist/es/test-runner/engine/index.mjs +1 -0
- package/dist/es/test-runner/engine/project-runtime.mjs +14 -5
- package/dist/es/test-runner/engine/project-runtime.mjs.map +1 -1
- package/dist/es/test-runner/engine/resource-operations.mjs +286 -35
- package/dist/es/test-runner/engine/resource-operations.mjs.map +1 -1
- package/dist/es/test-runner/engine/result-metadata.mjs +21 -0
- package/dist/es/test-runner/engine/result-metadata.mjs.map +1 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs +30 -9
- package/dist/es/test-runner/engine/run-collected-case.mjs.map +1 -1
- package/dist/es/test-runner/engine/run-workflow-document.mjs +57 -10
- package/dist/es/test-runner/engine/run-workflow-document.mjs.map +1 -1
- package/dist/es/test-runner/errors.mjs +26 -13
- package/dist/es/test-runner/errors.mjs.map +1 -1
- package/dist/es/test-runner/execution-record.mjs +2 -0
- package/dist/es/test-runner/execution-record.mjs.map +1 -1
- package/dist/es/test-runner/index.mjs +3 -0
- package/dist/es/test-runner/reporting/agent-report.mjs +2 -7
- package/dist/es/test-runner/reporting/agent-report.mjs.map +1 -1
- package/dist/es/test-runner/reporting/merge-report.mjs +207 -6
- package/dist/es/test-runner/reporting/merge-report.mjs.map +1 -1
- package/dist/es/test-runner/reporting/metrics.mjs +77 -0
- package/dist/es/test-runner/reporting/metrics.mjs.map +1 -0
- package/dist/es/test-runner/reporting/sanitize.mjs +92 -16
- package/dist/es/test-runner/reporting/sanitize.mjs.map +1 -1
- package/dist/es/test-runner/reporting/test-plan.mjs +56 -0
- package/dist/es/test-runner/reporting/test-plan.mjs.map +1 -0
- package/dist/es/test-runner/reporting/test-run-report.mjs +208 -21
- package/dist/es/test-runner/reporting/test-run-report.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +1 -1
- package/dist/es/yaml/legacy-yaml-runtime.mjs +3 -3
- package/dist/es/yaml/legacy-yaml-runtime.mjs.map +1 -1
- package/dist/lib/agent/action-readiness.js +6 -3
- package/dist/lib/agent/action-readiness.js.map +1 -1
- package/dist/lib/agent/agent.js +4 -2
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/execution-session.js.map +1 -1
- package/dist/lib/agent/task-builder.js +42 -23
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/tasks.js +35 -12
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/device/index.js +7 -6
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/report-generator.js +30 -14
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/report.js +121 -44
- package/dist/lib/report.js.map +1 -1
- package/dist/lib/service/index.js.map +1 -1
- package/dist/lib/task-runner.js +22 -12
- package/dist/lib/task-runner.js.map +1 -1
- package/dist/lib/test-run-report.js.map +1 -1
- package/dist/lib/test-runner/engine/case-runner.js +1 -1
- package/dist/lib/test-runner/engine/case-runner.js.map +1 -1
- package/dist/lib/test-runner/engine/document-runtime.js +41 -11
- package/dist/lib/test-runner/engine/document-runtime.js.map +1 -1
- package/dist/lib/test-runner/engine/execute-step.js +131 -10
- package/dist/lib/test-runner/engine/execute-step.js.map +1 -1
- package/dist/lib/test-runner/engine/index.js +9 -2
- package/dist/lib/test-runner/engine/index.js.map +1 -1
- package/dist/lib/test-runner/engine/project-runtime.js +13 -4
- package/dist/lib/test-runner/engine/project-runtime.js.map +1 -1
- package/dist/lib/test-runner/engine/resource-operations.js +319 -38
- package/dist/lib/test-runner/engine/resource-operations.js.map +1 -1
- package/dist/lib/test-runner/engine/result-metadata.js +58 -0
- package/dist/lib/test-runner/engine/result-metadata.js.map +1 -0
- package/dist/lib/test-runner/engine/run-collected-case.js +29 -8
- package/dist/lib/test-runner/engine/run-collected-case.js.map +1 -1
- package/dist/lib/test-runner/engine/run-workflow-document.js +57 -10
- package/dist/lib/test-runner/engine/run-workflow-document.js.map +1 -1
- package/dist/lib/test-runner/errors.js +42 -23
- package/dist/lib/test-runner/errors.js.map +1 -1
- package/dist/lib/test-runner/execution-record.js +2 -0
- package/dist/lib/test-runner/execution-record.js.map +1 -1
- package/dist/lib/test-runner/index.js +88 -16
- package/dist/lib/test-runner/index.js.map +1 -1
- package/dist/lib/test-runner/node/index.js +2 -2
- package/dist/lib/test-runner/reporting/agent-report.js +2 -7
- package/dist/lib/test-runner/reporting/agent-report.js.map +1 -1
- package/dist/lib/test-runner/reporting/merge-report.js +207 -6
- package/dist/lib/test-runner/reporting/merge-report.js.map +1 -1
- package/dist/lib/test-runner/reporting/metrics.js +114 -0
- package/dist/lib/test-runner/reporting/metrics.js.map +1 -0
- package/dist/lib/test-runner/reporting/sanitize.js +94 -15
- package/dist/lib/test-runner/reporting/sanitize.js.map +1 -1
- package/dist/lib/test-runner/reporting/test-plan.js +90 -0
- package/dist/lib/test-runner/reporting/test-plan.js.map +1 -0
- package/dist/lib/test-runner/reporting/test-run-report.js +208 -21
- package/dist/lib/test-runner/reporting/test-run-report.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/yaml/legacy-yaml-runtime.js +2 -2
- package/dist/lib/yaml/legacy-yaml-runtime.js.map +1 -1
- package/dist/types/agent/action-readiness.d.ts +1 -1
- package/dist/types/agent/action-readiness.d.ts.map +1 -1
- package/dist/types/agent/agent.d.ts +1 -1
- package/dist/types/agent/agent.d.ts.map +1 -1
- package/dist/types/agent/execution-session.d.ts +1 -1
- package/dist/types/agent/execution-session.d.ts.map +1 -1
- package/dist/types/agent/task-builder.d.ts +4 -2
- package/dist/types/agent/task-builder.d.ts.map +1 -1
- package/dist/types/agent/tasks.d.ts +3 -0
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/device/index.d.ts +3 -3
- package/dist/types/device/index.d.ts.map +1 -1
- package/dist/types/report-generator.d.ts +4 -2
- package/dist/types/report-generator.d.ts.map +1 -1
- package/dist/types/report.d.ts.map +1 -1
- package/dist/types/service/index.d.ts +2 -2
- package/dist/types/service/index.d.ts.map +1 -1
- package/dist/types/task-runner.d.ts +1 -1
- package/dist/types/task-runner.d.ts.map +1 -1
- package/dist/types/test-run-report.d.ts +157 -8
- package/dist/types/test-run-report.d.ts.map +1 -1
- package/dist/types/test-runner/engine/document-runtime.d.ts.map +1 -1
- package/dist/types/test-runner/engine/execute-step.d.ts +1 -0
- package/dist/types/test-runner/engine/execute-step.d.ts.map +1 -1
- package/dist/types/test-runner/engine/index.d.ts +1 -0
- package/dist/types/test-runner/engine/index.d.ts.map +1 -1
- package/dist/types/test-runner/engine/project-runtime.d.ts.map +1 -1
- package/dist/types/test-runner/engine/resource-operations.d.ts +41 -3
- package/dist/types/test-runner/engine/resource-operations.d.ts.map +1 -1
- package/dist/types/test-runner/engine/result-metadata.d.ts +18 -0
- package/dist/types/test-runner/engine/result-metadata.d.ts.map +1 -0
- package/dist/types/test-runner/engine/run-collected-case.d.ts.map +1 -1
- package/dist/types/test-runner/engine/run-workflow-document.d.ts.map +1 -1
- package/dist/types/test-runner/engine/types.d.ts +47 -8
- package/dist/types/test-runner/engine/types.d.ts.map +1 -1
- package/dist/types/test-runner/errors.d.ts +7 -0
- package/dist/types/test-runner/errors.d.ts.map +1 -1
- package/dist/types/test-runner/execution-record.d.ts.map +1 -1
- package/dist/types/test-runner/index.d.ts +2 -0
- package/dist/types/test-runner/index.d.ts.map +1 -1
- package/dist/types/test-runner/node/types.d.ts +9 -1
- package/dist/types/test-runner/node/types.d.ts.map +1 -1
- package/dist/types/test-runner/parser/types.d.ts +5 -0
- package/dist/types/test-runner/parser/types.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/agent-report.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/merge-report.d.ts +1 -1
- package/dist/types/test-runner/reporting/merge-report.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/metrics.d.ts +7 -0
- package/dist/types/test-runner/reporting/metrics.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts +1 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/test-plan.d.ts +8 -0
- package/dist/types/test-runner/reporting/test-plan.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/test-run-report.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/types.d.ts +6 -1
- package/dist/types/test-runner/reporting/types.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -27,6 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
buildTestRunReportDump: ()=>buildTestRunReportDump,
|
|
28
28
|
collectTestRunReportSources: ()=>collectTestRunReportSources
|
|
29
29
|
});
|
|
30
|
+
const external_metrics_js_namespaceObject = require("./metrics.js");
|
|
30
31
|
const external_sanitize_js_namespaceObject = require("./sanitize.js");
|
|
31
32
|
const exactMidsceneDetailNodes = new Set([
|
|
32
33
|
'aiAct',
|
|
@@ -38,16 +39,66 @@ const reportSourcesForScope = (context, scopeId)=>context.sourcesByScope.get(sco
|
|
|
38
39
|
const addDiagnostic = (context, diagnostic)=>{
|
|
39
40
|
context.diagnostics.push(diagnostic);
|
|
40
41
|
};
|
|
41
|
-
const buildStep = (step, scopeId, context, executionId)=>{
|
|
42
|
+
const buildStep = (step, scopeId, context, executionId, plan)=>{
|
|
43
|
+
const stepId = `${executionId}:${step.phase}:${step.stepIndex}`;
|
|
44
|
+
if ('not-run' === step.status) return {
|
|
45
|
+
id: stepId,
|
|
46
|
+
...plan ? {
|
|
47
|
+
planStepId: plan.id,
|
|
48
|
+
title: plan.title
|
|
49
|
+
} : {},
|
|
50
|
+
phase: step.phase,
|
|
51
|
+
stepIndex: step.stepIndex,
|
|
52
|
+
node: step.node,
|
|
53
|
+
status: 'not-run',
|
|
54
|
+
notRunReason: (0, external_sanitize_js_namespaceObject.sanitizeReportText)(step.notRunReason),
|
|
55
|
+
...step.blockedBy ? {
|
|
56
|
+
blockedBy: step.blockedBy
|
|
57
|
+
} : {},
|
|
58
|
+
continuedAfterError: step.continuedAfterError,
|
|
59
|
+
...step.waitForPreviousOperationMs ? {
|
|
60
|
+
waitForPreviousOperationMs: step.waitForPreviousOperationMs
|
|
61
|
+
} : {},
|
|
62
|
+
input: (0, external_sanitize_js_namespaceObject.sanitizeReportValue)(step.input),
|
|
63
|
+
...step.error ? {
|
|
64
|
+
error: (0, external_sanitize_js_namespaceObject.sanitizeReportError)(step.error)
|
|
65
|
+
} : {},
|
|
66
|
+
...step.operations ? {
|
|
67
|
+
operations: {
|
|
68
|
+
...step.operations,
|
|
69
|
+
events: [
|
|
70
|
+
...step.operations.events
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
} : {}
|
|
74
|
+
};
|
|
42
75
|
const details = [];
|
|
43
76
|
const unresolvedExecutionIds = [];
|
|
77
|
+
const usage = [];
|
|
78
|
+
const missingUsage = [];
|
|
44
79
|
for (const trace of step.report?.traces ?? []){
|
|
80
|
+
context.tracedScopes.add(scopeId);
|
|
81
|
+
const metrics = context.executionMetrics.get(trace.executionId) ?? trace.metrics;
|
|
82
|
+
if (metrics) {
|
|
83
|
+
context.executionMetrics.set(trace.executionId, metrics);
|
|
84
|
+
usage.push(metrics);
|
|
85
|
+
}
|
|
86
|
+
context.expectedExecutions.add(scopedExecutionKey(scopeId, trace.executionId));
|
|
45
87
|
const previousScope = context.tracedScopeByExecution.get(trace.executionId);
|
|
46
88
|
if (previousScope && previousScope !== scopeId) throw new Error(`Agent execution ${trace.executionId} was traced by multiple test scopes (${previousScope}, ${scopeId}).`);
|
|
47
89
|
context.tracedScopeByExecution.set(trace.executionId, scopeId);
|
|
48
90
|
const detail = context.detailsByScopeAndExecution.get(scopedExecutionKey(scopeId, trace.executionId));
|
|
49
|
-
if (detail)
|
|
50
|
-
|
|
91
|
+
if (detail) {
|
|
92
|
+
details.push(detail);
|
|
93
|
+
context.capturedExecutions.add(scopedExecutionKey(scopeId, trace.executionId));
|
|
94
|
+
} else {
|
|
95
|
+
unresolvedExecutionIds.push(trace.executionId);
|
|
96
|
+
if (!metrics) {
|
|
97
|
+
const reason = `Model usage is unavailable for execution ${trace.executionId}.`;
|
|
98
|
+
missingUsage.push(reason);
|
|
99
|
+
context.missingMetrics.add(reason);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
51
102
|
}
|
|
52
103
|
let agentDetailDiagnostic;
|
|
53
104
|
if (unresolvedExecutionIds.length > 0) {
|
|
@@ -59,6 +110,7 @@ const buildStep = (step, scopeId, context, executionId)=>{
|
|
|
59
110
|
message: `Agent detail could not be resolved for execution ${executionId} in test scope ${scopeId}.`,
|
|
60
111
|
scopeId,
|
|
61
112
|
executionId,
|
|
113
|
+
stepId,
|
|
62
114
|
...sources.length > 0 ? {
|
|
63
115
|
sourcePaths: sources.map((source)=>source.sourcePath)
|
|
64
116
|
} : {}
|
|
@@ -70,16 +122,46 @@ const buildStep = (step, scopeId, context, executionId)=>{
|
|
|
70
122
|
code: 'agent-detail-unavailable',
|
|
71
123
|
message: `No stable Agent execution reference was captured for ${step.node} in test scope ${scopeId}.`,
|
|
72
124
|
scopeId,
|
|
125
|
+
stepId,
|
|
73
126
|
...reportSourcesForScope(context, scopeId).length > 0 ? {
|
|
74
127
|
sourcePaths: reportSourcesForScope(context, scopeId).map((source)=>source.sourcePath)
|
|
75
128
|
} : {}
|
|
76
129
|
});
|
|
77
130
|
}
|
|
131
|
+
const collectionErrors = step.report?.collectionErrors?.map(external_sanitize_js_namespaceObject.sanitizeReportError) ?? [];
|
|
132
|
+
for (const error of collectionErrors)addDiagnostic(context, {
|
|
133
|
+
level: 'warning',
|
|
134
|
+
code: 'agent-source-unavailable',
|
|
135
|
+
scopeId,
|
|
136
|
+
stepId,
|
|
137
|
+
error,
|
|
138
|
+
message: `Report collection for ${step.node}: ${error.message}`
|
|
139
|
+
});
|
|
140
|
+
const snapshots = step.report?.sources?.flatMap((source)=>source.collection ? [
|
|
141
|
+
source.collection
|
|
142
|
+
] : []) ?? [];
|
|
143
|
+
const evidenceCollection = snapshots.length || collectionErrors.length || details.length || unresolvedExecutionIds.length ? {
|
|
144
|
+
status: collectionErrors.length || unresolvedExecutionIds.length || snapshots.some((snapshot)=>'partial' === snapshot.status) ? details.length ? 'partial' : 'unknown' : 'complete',
|
|
145
|
+
...snapshots.length ? {
|
|
146
|
+
capturedAt: snapshots.map((snapshot)=>snapshot.capturedAt).sort().at(-1)
|
|
147
|
+
} : {},
|
|
148
|
+
...collectionErrors.length ? {
|
|
149
|
+
errors: collectionErrors
|
|
150
|
+
} : {}
|
|
151
|
+
} : void 0;
|
|
152
|
+
if (!step.report?.traces.length && collectionErrors.length && !details.length) {
|
|
153
|
+
const reason = `Model usage could not be collected for step ${stepId}.`;
|
|
154
|
+
missingUsage.push(reason);
|
|
155
|
+
context.missingMetrics.add(reason);
|
|
156
|
+
}
|
|
78
157
|
const input = step.input;
|
|
79
158
|
const candidateTitle = input?.prompt ?? input?.script ?? input?.scenario ?? input?.title;
|
|
80
159
|
const prompt = 'string' == typeof candidateTitle ? candidateTitle : 'object' == typeof candidateTitle && null !== candidateTitle && 'prompt' in candidateTitle && 'string' == typeof candidateTitle.prompt ? candidateTitle.prompt : void 0;
|
|
81
160
|
return {
|
|
82
|
-
id:
|
|
161
|
+
id: stepId,
|
|
162
|
+
...plan ? {
|
|
163
|
+
planStepId: plan.id
|
|
164
|
+
} : {},
|
|
83
165
|
phase: step.phase,
|
|
84
166
|
stepIndex: step.stepIndex,
|
|
85
167
|
node: step.node,
|
|
@@ -88,9 +170,20 @@ const buildStep = (step, scopeId, context, executionId)=>{
|
|
|
88
170
|
} : {},
|
|
89
171
|
status: step.status,
|
|
90
172
|
continuedAfterError: step.continuedAfterError,
|
|
173
|
+
...step.waitForPreviousOperationMs ? {
|
|
174
|
+
waitForPreviousOperationMs: step.waitForPreviousOperationMs
|
|
175
|
+
} : {},
|
|
91
176
|
startedAt: step.startedAt,
|
|
92
177
|
endedAt: step.endedAt,
|
|
93
178
|
durationMs: step.durationMs,
|
|
179
|
+
...step.operations ? {
|
|
180
|
+
operations: {
|
|
181
|
+
...step.operations,
|
|
182
|
+
events: [
|
|
183
|
+
...step.operations.events
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
} : {},
|
|
94
187
|
input: (0, external_sanitize_js_namespaceObject.sanitizeReportValue)(step.input),
|
|
95
188
|
...step.output ? {
|
|
96
189
|
output: {
|
|
@@ -110,22 +203,48 @@ const buildStep = (step, scopeId, context, executionId)=>{
|
|
|
110
203
|
} : {},
|
|
111
204
|
...agentDetailDiagnostic ? {
|
|
112
205
|
agentDetailDiagnostic
|
|
206
|
+
} : {},
|
|
207
|
+
...usage.length || missingUsage.length ? {
|
|
208
|
+
metrics: (0, external_metrics_js_namespaceObject.sumTestRunReportMetrics)(usage, missingUsage)
|
|
209
|
+
} : {},
|
|
210
|
+
...evidenceCollection ? {
|
|
211
|
+
evidenceCollection: {
|
|
212
|
+
...evidenceCollection,
|
|
213
|
+
...missingUsage.length ? {
|
|
214
|
+
modelUsageUnavailable: true
|
|
215
|
+
} : {}
|
|
216
|
+
}
|
|
113
217
|
} : {}
|
|
114
218
|
};
|
|
115
219
|
};
|
|
116
220
|
const attemptReportScope = (attempt)=>attempt.reportScopeId ?? attempt.runId;
|
|
117
|
-
const buildAttempt = (attempt, context)=>{
|
|
221
|
+
const buildAttempt = (attempt, context, plan)=>{
|
|
118
222
|
const scopeId = attemptReportScope(attempt);
|
|
119
223
|
return {
|
|
120
224
|
attemptId: attempt.runId,
|
|
121
225
|
attemptIndex: attempt.attemptIndex,
|
|
122
226
|
status: attempt.status,
|
|
227
|
+
...attempt.executionStatus ? {
|
|
228
|
+
executionStatus: attempt.executionStatus
|
|
229
|
+
} : {},
|
|
230
|
+
...attempt.phases ? {
|
|
231
|
+
phases: attempt.phases
|
|
232
|
+
} : {},
|
|
233
|
+
...attempt.cleanup ? {
|
|
234
|
+
cleanup: attempt.cleanup
|
|
235
|
+
} : {},
|
|
236
|
+
...attempt.pendingOperations ? {
|
|
237
|
+
pendingOperations: attempt.pendingOperations
|
|
238
|
+
} : {},
|
|
239
|
+
...attempt.retryDecision ? {
|
|
240
|
+
retryDecision: attempt.retryDecision
|
|
241
|
+
} : {},
|
|
123
242
|
startedAt: attempt.startedAt,
|
|
124
243
|
endedAt: attempt.endedAt,
|
|
125
244
|
durationMs: attempt.durationMs,
|
|
126
|
-
beforeEach: attempt.beforeEach.map((step)=>buildStep(step, scopeId, context, attempt.runId)),
|
|
127
|
-
steps: attempt.steps.map((step)=>buildStep(step, scopeId, context, attempt.runId)),
|
|
128
|
-
afterEach: attempt.afterEach.map((step)=>buildStep(step, scopeId, context, attempt.runId)),
|
|
245
|
+
beforeEach: attempt.beforeEach.map((step)=>buildStep(step, scopeId, context, attempt.runId, plan?.beforeEach[step.stepIndex])),
|
|
246
|
+
steps: attempt.steps.map((step)=>buildStep(step, scopeId, context, attempt.runId, plan?.steps[step.stepIndex])),
|
|
247
|
+
afterEach: attempt.afterEach.map((step)=>buildStep(step, scopeId, context, attempt.runId, plan?.afterEach[step.stepIndex])),
|
|
129
248
|
...attempt.executionErrors?.length ? {
|
|
130
249
|
hostErrors: attempt.executionErrors.map((error)=>({
|
|
131
250
|
phase: 'execution',
|
|
@@ -140,7 +259,10 @@ const buildAttempt = (attempt, context)=>{
|
|
|
140
259
|
} : {}
|
|
141
260
|
};
|
|
142
261
|
};
|
|
143
|
-
const buildCase = (outcome, context)=>({
|
|
262
|
+
const buildCase = (outcome, context, plan)=>({
|
|
263
|
+
...plan ? {
|
|
264
|
+
plan
|
|
265
|
+
} : {},
|
|
144
266
|
caseId: outcome.caseId,
|
|
145
267
|
name: outcome.name,
|
|
146
268
|
caseIndex: outcome.caseIndex,
|
|
@@ -150,15 +272,19 @@ const buildCase = (outcome, context)=>({
|
|
|
150
272
|
} : {},
|
|
151
273
|
attempts: (outcome.attempts ?? (outcome.run ? [
|
|
152
274
|
outcome.run
|
|
153
|
-
] : [])).map((attempt)=>buildAttempt(attempt, context))
|
|
275
|
+
] : [])).map((attempt)=>buildAttempt(attempt, context, plan))
|
|
154
276
|
});
|
|
155
277
|
const documentReportScope = (document)=>document.reportScopeId ?? document.documentRunId;
|
|
156
|
-
const buildDocument = (documentId, document, cases, context)=>{
|
|
278
|
+
const buildDocument = (documentId, document, cases, context, plan)=>{
|
|
279
|
+
plan ??= document?.plan;
|
|
157
280
|
const sourcePath = document?.sourcePath ?? cases[0]?.sourcePath ?? '<unknown>';
|
|
158
281
|
const status = document?.status ?? (cases.some((item)=>'success' !== item.status) ? 'failed' : 'success');
|
|
159
282
|
const scopeId = document ? documentReportScope(document) : void 0;
|
|
160
283
|
return {
|
|
161
284
|
documentId,
|
|
285
|
+
...plan ? {
|
|
286
|
+
plan
|
|
287
|
+
} : {},
|
|
162
288
|
...document ? {
|
|
163
289
|
logicalDocumentId: document.documentId,
|
|
164
290
|
documentRunId: document.documentRunId,
|
|
@@ -168,14 +294,29 @@ const buildDocument = (documentId, document, cases, context)=>{
|
|
|
168
294
|
} : {},
|
|
169
295
|
sourcePath,
|
|
170
296
|
status,
|
|
297
|
+
...document?.executionStatus ? {
|
|
298
|
+
executionStatus: document.executionStatus
|
|
299
|
+
} : {},
|
|
300
|
+
...document?.phases ? {
|
|
301
|
+
phases: document.phases
|
|
302
|
+
} : {},
|
|
303
|
+
...document?.cleanup ? {
|
|
304
|
+
cleanup: document.cleanup
|
|
305
|
+
} : {},
|
|
306
|
+
...document?.pendingOperations ? {
|
|
307
|
+
pendingOperations: document.pendingOperations
|
|
308
|
+
} : {},
|
|
309
|
+
...document?.retryDecision ? {
|
|
310
|
+
retryDecision: document.retryDecision
|
|
311
|
+
} : {},
|
|
171
312
|
...document ? {
|
|
172
313
|
startedAt: document.startedAt,
|
|
173
314
|
endedAt: document.endedAt,
|
|
174
315
|
durationMs: document.durationMs
|
|
175
316
|
} : {},
|
|
176
|
-
beforeAll: (document?.beforeAll ?? []).map((step)=>buildStep(step, scopeId, context, document.documentRunId)),
|
|
177
|
-
cases: cases.map((outcome)=>buildCase(outcome, context)),
|
|
178
|
-
afterAll: (document?.afterAll ?? []).map((step)=>buildStep(step, scopeId, context, document.documentRunId)),
|
|
317
|
+
beforeAll: (document?.beforeAll ?? []).map((step)=>buildStep(step, scopeId, context, document.documentRunId, plan?.beforeAll[step.stepIndex])),
|
|
318
|
+
cases: cases.map((outcome)=>buildCase(outcome, context, plan?.cases.find((item)=>item.caseId === outcome.caseId))),
|
|
319
|
+
afterAll: (document?.afterAll ?? []).map((step)=>buildStep(step, scopeId, context, document.documentRunId, plan?.afterAll[step.stepIndex])),
|
|
179
320
|
...document?.hostErrors?.length || document?.executionErrors?.length ? {
|
|
180
321
|
hostErrors: [
|
|
181
322
|
...document?.hostErrors ?? [],
|
|
@@ -233,19 +374,22 @@ const buildProject = (project, context)=>{
|
|
|
233
374
|
}
|
|
234
375
|
const result = buildDocument(documentId, last, [
|
|
235
376
|
...outcomes.values()
|
|
236
|
-
], context);
|
|
377
|
+
], context, project.plans?.find((plan)=>plan.documentId === last.documentId));
|
|
237
378
|
if (group.length > 1) {
|
|
238
379
|
result.startedAt = first.startedAt;
|
|
239
380
|
result.durationMs = Math.max(0, Date.parse(last.endedAt) - Date.parse(first.startedAt));
|
|
240
381
|
result.attempts = group.map((document)=>{
|
|
241
|
-
const { cases: _cases, ...attempt } = buildDocument(documentId, document, [], context);
|
|
382
|
+
const { cases: _cases, ...attempt } = buildDocument(documentId, document, [], context, project.plans?.find((plan)=>plan.documentId === document.documentId));
|
|
242
383
|
return attempt;
|
|
243
384
|
});
|
|
244
385
|
}
|
|
245
386
|
return result;
|
|
246
387
|
});
|
|
247
|
-
for (const documentId of new Set(project.cases.map((outcome)=>outcome.documentId)))if (!documentCount.has(documentId)) documents.push(buildDocument(documentId, void 0, project.cases.filter((outcome)=>outcome.documentId === documentId), context));
|
|
388
|
+
for (const documentId of new Set(project.cases.map((outcome)=>outcome.documentId)))if (!documentCount.has(documentId)) documents.push(buildDocument(documentId, void 0, project.cases.filter((outcome)=>outcome.documentId === documentId), context, project.plans?.find((plan)=>plan.documentId === documentId)));
|
|
248
389
|
return {
|
|
390
|
+
...project.plans ? {
|
|
391
|
+
plans: project.plans
|
|
392
|
+
} : {},
|
|
249
393
|
projectId: project.projectId,
|
|
250
394
|
name: project.name,
|
|
251
395
|
...project.platform?.trim() ? {
|
|
@@ -259,6 +403,12 @@ const buildProject = (project, context)=>{
|
|
|
259
403
|
startedAt: project.lifecycle.startedAt,
|
|
260
404
|
endedAt: project.lifecycle.endedAt,
|
|
261
405
|
durationMs: project.lifecycle.durationMs,
|
|
406
|
+
...project.lifecycle.cleanup ? {
|
|
407
|
+
cleanup: project.lifecycle.cleanup
|
|
408
|
+
} : {},
|
|
409
|
+
...project.lifecycle.pendingOperations ? {
|
|
410
|
+
pendingOperations: project.lifecycle.pendingOperations
|
|
411
|
+
} : {},
|
|
262
412
|
...project.lifecycle.setupError ? {
|
|
263
413
|
setupError: (0, external_sanitize_js_namespaceObject.sanitizeReportError)(project.lifecycle.setupError)
|
|
264
414
|
} : {},
|
|
@@ -315,15 +465,24 @@ function buildTestRunReportDump(result, index) {
|
|
|
315
465
|
});
|
|
316
466
|
}
|
|
317
467
|
const context = {
|
|
318
|
-
diagnostics: []
|
|
468
|
+
diagnostics: (index.diagnostics ?? []).map((diagnostic)=>({
|
|
469
|
+
...diagnostic,
|
|
470
|
+
message: (0, external_sanitize_js_namespaceObject.sanitizeReportText)(diagnostic.message)
|
|
471
|
+
})),
|
|
319
472
|
sourcesByScope,
|
|
320
473
|
detailsByScopeAndExecution,
|
|
321
|
-
tracedScopeByExecution: new Map()
|
|
474
|
+
tracedScopeByExecution: new Map(),
|
|
475
|
+
expectedExecutions: new Set(),
|
|
476
|
+
capturedExecutions: new Set(),
|
|
477
|
+
executionMetrics: new Map(Object.entries(index.executionMetrics ?? {})),
|
|
478
|
+
missingMetrics: new Set(),
|
|
479
|
+
tracedScopes: new Set()
|
|
322
480
|
};
|
|
323
481
|
for (const error of result.errors ?? [])addDiagnostic(context, {
|
|
324
482
|
level: 'error',
|
|
325
483
|
code: 'run-infrastructure-error',
|
|
326
|
-
message: (0, external_sanitize_js_namespaceObject.sanitizeReportError)(error).message
|
|
484
|
+
message: (0, external_sanitize_js_namespaceObject.sanitizeReportError)(error).message,
|
|
485
|
+
error: (0, external_sanitize_js_namespaceObject.sanitizeReportError)(error)
|
|
327
486
|
});
|
|
328
487
|
for (const source of index.sources)if (0 === source.executionIds.length) addDiagnostic(context, {
|
|
329
488
|
level: 'warning',
|
|
@@ -335,10 +494,28 @@ function buildTestRunReportDump(result, index) {
|
|
|
335
494
|
]
|
|
336
495
|
});
|
|
337
496
|
const projects = result.projects.map((project)=>buildProject(project, context));
|
|
497
|
+
for (const diagnostic of index.diagnostics ?? [])if ('agent-source-unavailable' === diagnostic.code && (!diagnostic.scopeId || !context.tracedScopes.has(diagnostic.scopeId))) context.missingMetrics.add(diagnostic.message);
|
|
498
|
+
const metrics = (0, external_metrics_js_namespaceObject.sumTestRunReportMetrics)([
|
|
499
|
+
...index.sources.length || !index.executionMetrics && (index.metrics.modelCallCount || index.metrics.collection) ? [
|
|
500
|
+
index.capturedMetrics ?? index.metrics
|
|
501
|
+
] : [],
|
|
502
|
+
...[
|
|
503
|
+
...context.executionMetrics.entries()
|
|
504
|
+
].filter(([id])=>!index.executionMetrics?.[id]).map(([, value])=>value)
|
|
505
|
+
], [
|
|
506
|
+
...context.missingMetrics
|
|
507
|
+
]);
|
|
338
508
|
return {
|
|
339
509
|
schemaVersion: 1,
|
|
340
510
|
kind: 'test-runner',
|
|
341
511
|
runId: result.runId,
|
|
512
|
+
...result.operationLog ? {
|
|
513
|
+
operationLogs: [
|
|
514
|
+
{
|
|
515
|
+
...result.operationLog
|
|
516
|
+
}
|
|
517
|
+
]
|
|
518
|
+
} : {},
|
|
342
519
|
status: result.status,
|
|
343
520
|
startedAt: result.startedAt,
|
|
344
521
|
endedAt: result.endedAt,
|
|
@@ -346,7 +523,17 @@ function buildTestRunReportDump(result, index) {
|
|
|
346
523
|
summary: {
|
|
347
524
|
...result.summary
|
|
348
525
|
},
|
|
349
|
-
metrics:
|
|
526
|
+
metrics: {
|
|
527
|
+
...metrics,
|
|
528
|
+
collection: {
|
|
529
|
+
...metrics.collection,
|
|
530
|
+
expectedExecutionCount: context.expectedExecutions.size,
|
|
531
|
+
capturedExecutionCount: context.capturedExecutions.size
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
...index.executionMetrics || context.executionMetrics.size ? {
|
|
535
|
+
executionMetrics: Object.fromEntries(context.executionMetrics)
|
|
536
|
+
} : {},
|
|
350
537
|
projects,
|
|
351
538
|
...context.diagnostics.length > 0 ? {
|
|
352
539
|
diagnostics: context.diagnostics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-runner/reporting/test-run-report.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/test-runner/reporting/test-run-report.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n IndexedTestRunReportSource,\n TestRunReportAgentDetail,\n TestRunReportAttempt,\n TestRunReportCase,\n TestRunReportDiagnostic,\n TestRunReportDocument,\n TestRunReportDump,\n TestRunReportProject,\n TestRunReportSource,\n TestRunReportSourceIndex,\n TestRunReportStep,\n} from '../../test-run-report';\nimport type {\n CaseRunResult,\n StepRunResult,\n WorkflowDocumentRunResult,\n} from '../engine/types';\nimport {\n sanitizeReportError,\n sanitizeReportText,\n sanitizeReportValue,\n} from './sanitize';\nimport type { RunReportCaseInput, RunReportInput } from './types';\n\nconst exactMidsceneDetailNodes = new Set([\n 'aiAct',\n 'aiAssert',\n 'recordToReport',\n]);\n\ninterface ManifestBuildContext {\n diagnostics: TestRunReportDiagnostic[];\n sourcesByScope: Map<string, IndexedTestRunReportSource[]>;\n detailsByScopeAndExecution: Map<string, TestRunReportAgentDetail>;\n tracedScopeByExecution: Map<string, string>;\n}\n\nconst scopedExecutionKey = (scopeId: string, executionId: string): string =>\n `${scopeId}\\u0000${executionId}`;\n\nconst reportSourcesForScope = (\n context: ManifestBuildContext,\n scopeId: string,\n): IndexedTestRunReportSource[] => context.sourcesByScope.get(scopeId) ?? [];\n\nconst addDiagnostic = (\n context: ManifestBuildContext,\n diagnostic: TestRunReportDiagnostic,\n): void => {\n context.diagnostics.push(diagnostic);\n};\n\nconst buildStep = (\n step: StepRunResult,\n scopeId: string,\n context: ManifestBuildContext,\n executionId: string,\n): TestRunReportStep => {\n const details: TestRunReportAgentDetail[] = [];\n const unresolvedExecutionIds: string[] = [];\n for (const trace of step.report?.traces ?? []) {\n const previousScope = context.tracedScopeByExecution.get(trace.executionId);\n if (previousScope && previousScope !== scopeId) {\n throw new Error(\n `Agent execution ${trace.executionId} was traced by multiple test scopes (${previousScope}, ${scopeId}).`,\n );\n }\n context.tracedScopeByExecution.set(trace.executionId, scopeId);\n const detail = context.detailsByScopeAndExecution.get(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n if (detail) details.push(detail);\n else unresolvedExecutionIds.push(trace.executionId);\n }\n\n let agentDetailDiagnostic: string | undefined;\n if (unresolvedExecutionIds.length > 0) {\n agentDetailDiagnostic = `Agent detail could not be resolved for ${unresolvedExecutionIds.join(', ')}.`;\n const sources = reportSourcesForScope(context, scopeId);\n for (const executionId of unresolvedExecutionIds) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unresolved',\n message: `Agent detail could not be resolved for execution ${executionId} in test scope ${scopeId}.`,\n scopeId,\n executionId,\n ...(sources.length > 0\n ? { sourcePaths: sources.map((source) => source.sourcePath) }\n : {}),\n });\n }\n } else if (details.length === 0 && exactMidsceneDetailNodes.has(step.node)) {\n agentDetailDiagnostic =\n 'This Agent did not expose a stable execution reference for the Step.';\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unavailable',\n message: `No stable Agent execution reference was captured for ${step.node} in test scope ${scopeId}.`,\n scopeId,\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n sourcePaths: reportSourcesForScope(context, scopeId).map(\n (source) => source.sourcePath,\n ),\n }\n : {}),\n });\n }\n\n const input = step.input as Record<string, unknown> | undefined;\n const candidateTitle =\n input?.prompt ?? input?.script ?? input?.scenario ?? input?.title;\n const prompt =\n typeof candidateTitle === 'string'\n ? candidateTitle\n : typeof candidateTitle === 'object' &&\n candidateTitle !== null &&\n 'prompt' in candidateTitle &&\n typeof candidateTitle.prompt === 'string'\n ? candidateTitle.prompt\n : undefined;\n return {\n id: `${executionId}:${step.phase}:${step.stepIndex}`,\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n ...(prompt ? { title: sanitizeReportText(prompt, 240) } : {}),\n status: step.status,\n continuedAfterError: step.continuedAfterError,\n startedAt: step.startedAt,\n endedAt: step.endedAt,\n durationMs: step.durationMs,\n input: sanitizeReportValue(step.input),\n ...(step.output\n ? {\n output: {\n ...(step.output.summary === undefined\n ? {}\n : { summary: sanitizeReportText(step.output.summary) }),\n ...(step.output.data === undefined\n ? {}\n : { data: sanitizeReportValue(step.output.data) }),\n },\n }\n : {}),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(details.length > 0 ? { agentDetails: details } : {}),\n ...(agentDetailDiagnostic ? { agentDetailDiagnostic } : {}),\n };\n};\n\nconst attemptReportScope = (attempt: CaseRunResult): string =>\n attempt.reportScopeId ?? attempt.runId;\n\nconst buildAttempt = (\n attempt: CaseRunResult,\n context: ManifestBuildContext,\n): TestRunReportAttempt => {\n const scopeId = attemptReportScope(attempt);\n return {\n attemptId: attempt.runId,\n attemptIndex: attempt.attemptIndex,\n status: attempt.status,\n startedAt: attempt.startedAt,\n endedAt: attempt.endedAt,\n durationMs: attempt.durationMs,\n beforeEach: attempt.beforeEach.map((step) =>\n buildStep(step, scopeId, context, attempt.runId),\n ),\n steps: attempt.steps.map((step) =>\n buildStep(step, scopeId, context, attempt.runId),\n ),\n afterEach: attempt.afterEach.map((step) =>\n buildStep(step, scopeId, context, attempt.runId),\n ),\n ...(attempt.executionErrors?.length\n ? {\n hostErrors: attempt.executionErrors.map((error) => ({\n phase: 'execution' as const,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(attempt.teardownErrors?.length\n ? { teardownErrors: attempt.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildCase = (\n outcome: RunReportCaseInput,\n context: ManifestBuildContext,\n): TestRunReportCase => ({\n caseId: outcome.caseId,\n name: outcome.name,\n caseIndex: outcome.caseIndex,\n status: outcome.status,\n ...(outcome.notRunReason ? { notRunReason: outcome.notRunReason } : {}),\n attempts: (outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => buildAttempt(attempt, context),\n ),\n});\n\nconst documentReportScope = (document: WorkflowDocumentRunResult): string =>\n document.reportScopeId ?? document.documentRunId;\n\nconst buildDocument = (\n documentId: string,\n document: WorkflowDocumentRunResult | undefined,\n cases: readonly RunReportCaseInput[],\n context: ManifestBuildContext,\n): TestRunReportDocument => {\n const sourcePath =\n document?.sourcePath ?? cases[0]?.sourcePath ?? '<unknown>';\n const status =\n document?.status ??\n (cases.some((item) => item.status !== 'success') ? 'failed' : 'success');\n const scopeId = document ? documentReportScope(document) : undefined;\n return {\n documentId,\n ...(document\n ? {\n logicalDocumentId: document.documentId,\n documentRunId: document.documentRunId,\n ...(document.attemptIndex === undefined\n ? {}\n : { attemptIndex: document.attemptIndex }),\n }\n : {}),\n sourcePath,\n status,\n ...(document\n ? {\n startedAt: document.startedAt,\n endedAt: document.endedAt,\n durationMs: document.durationMs,\n }\n : {}),\n beforeAll: (document?.beforeAll ?? []).map((step) =>\n buildStep(step, scopeId!, context, document!.documentRunId),\n ),\n cases: cases.map((outcome) => buildCase(outcome, context)),\n afterAll: (document?.afterAll ?? []).map((step) =>\n buildStep(step, scopeId!, context, document!.documentRunId),\n ),\n ...(document?.hostErrors?.length || document?.executionErrors?.length\n ? {\n hostErrors: [\n ...(document?.hostErrors ?? []),\n ...(document?.executionErrors ?? []).map((error) => ({\n phase: 'execution' as const,\n error,\n })),\n ].map(({ phase, error }) => ({\n phase,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(document?.teardownErrors?.length\n ? { teardownErrors: document.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(scopeId && reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildProject = (\n project: RunReportInput['projects'][number],\n context: ManifestBuildContext,\n): TestRunReportProject => {\n const documentCount = new Map<string, number>();\n for (const document of project.documents) {\n documentCount.set(\n document.documentId,\n (documentCount.get(document.documentId) ?? 0) + 1,\n );\n }\n for (const outcome of project.cases) {\n if (\n (documentCount.get(outcome.documentId) ?? 0) > 1 &&\n !outcome.documentRunId\n ) {\n throw new Error(\n `Case ${outcome.caseId} must identify its documentRunId when a document has multiple attempts.`,\n );\n }\n }\n // A new attemptIndex 0 begins a distinct invocation of the same file. Only\n // whole-file retries belong to one logical document and its Case history.\n const groups: WorkflowDocumentRunResult[][] = [];\n const currentGroup = new Map<string, WorkflowDocumentRunResult[]>();\n for (const document of project.documents) {\n let group = currentGroup.get(document.documentId);\n if (!group || !document.attemptIndex) {\n group = [];\n groups.push(group);\n currentGroup.set(document.documentId, group);\n }\n group.push(document);\n }\n const documents = groups.map((group) => {\n const first = group[0];\n const last = group.at(-1)!;\n const documentId =\n groups.filter((item) => item[0].documentId === first.documentId).length >\n 1\n ? `${first.documentId}:${first.documentRunId}`\n : first.documentId;\n const outcomes = new Map<string, RunReportCaseInput>();\n for (const document of group) {\n for (const outcome of project.cases.filter(\n (item) =>\n item.documentId === document.documentId &&\n (!item.documentRunId ||\n item.documentRunId === document.documentRunId),\n )) {\n const previous = outcomes.get(outcome.caseId);\n outcomes.set(outcome.caseId, {\n ...outcome,\n attempts: [\n ...(previous?.attempts ?? []),\n ...(outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => ({\n ...attempt,\n attemptIndex: document.attemptIndex ?? attempt.attemptIndex,\n }),\n ),\n ],\n });\n }\n }\n const result = buildDocument(\n documentId,\n last,\n [...outcomes.values()],\n context,\n );\n if (group.length > 1) {\n result.startedAt = first.startedAt;\n result.durationMs = Math.max(\n 0,\n Date.parse(last.endedAt) - Date.parse(first.startedAt),\n );\n result.attempts = group.map((document) => {\n const { cases: _cases, ...attempt } = buildDocument(\n documentId,\n document,\n [],\n context,\n );\n return attempt;\n });\n }\n return result;\n });\n // Collection/setup failures can have Cases but no started document runtime.\n for (const documentId of new Set(\n project.cases.map((outcome) => outcome.documentId),\n )) {\n if (!documentCount.has(documentId)) {\n documents.push(\n buildDocument(\n documentId,\n undefined,\n project.cases.filter((outcome) => outcome.documentId === documentId),\n context,\n ),\n );\n }\n }\n\n return {\n projectId: project.projectId,\n name: project.name,\n ...(project.platform?.trim() ? { platform: project.platform.trim() } : {}),\n status: project.status,\n retry: project.retry,\n ...(project.lifecycle\n ? {\n lifecycle: {\n status: project.lifecycle.status,\n startedAt: project.lifecycle.startedAt,\n endedAt: project.lifecycle.endedAt,\n durationMs: project.lifecycle.durationMs,\n ...(project.lifecycle.setupError\n ? {\n setupError: sanitizeReportError(project.lifecycle.setupError),\n }\n : {}),\n ...(project.lifecycle.teardownErrors?.length\n ? {\n teardownErrors:\n project.lifecycle.teardownErrors.map(sanitizeReportError),\n }\n : {}),\n },\n }\n : {}),\n documents,\n collectionErrors: project.collectionErrors.map((collectionError) => ({\n sourcePath: collectionError.sourcePath,\n error: sanitizeReportError(collectionError.error),\n })),\n };\n};\n\nexport function collectTestRunReportSources(\n result: RunReportInput,\n): TestRunReportSource[] {\n const sources: TestRunReportSource[] = [];\n for (const project of result.projects) {\n for (const document of project.documents) {\n for (const source of document.reportSources ?? [])\n sources.push({ ...source, scopeId: documentReportScope(document) });\n for (const sourcePath of (document.reportPaths ?? []).filter(\n (path) =>\n !document.reportSources?.some((source) => source.sourcePath === path),\n )) {\n sources.push({\n scopeId: documentReportScope(document),\n sourcePath,\n });\n }\n }\n for (const outcome of project.cases) {\n for (const attempt of outcome.attempts ??\n (outcome.run ? [outcome.run] : [])) {\n for (const source of attempt.reportSources ?? [])\n sources.push({ ...source, scopeId: attemptReportScope(attempt) });\n for (const sourcePath of (attempt.reportPaths ?? []).filter(\n (path) =>\n !attempt.reportSources?.some(\n (source) => source.sourcePath === path,\n ),\n )) {\n sources.push({ scopeId: attemptReportScope(attempt), sourcePath });\n }\n }\n }\n }\n return sources;\n}\n\nexport function buildTestRunReportDump(\n result: RunReportInput,\n index: TestRunReportSourceIndex,\n): TestRunReportDump {\n const sourcesByScope = new Map<string, IndexedTestRunReportSource[]>();\n const detailsByScopeAndExecution = new Map<\n string,\n TestRunReportAgentDetail\n >();\n for (const source of index.sources) {\n const scopeSources = sourcesByScope.get(source.scopeId) ?? [];\n scopeSources.push(source);\n sourcesByScope.set(source.scopeId, scopeSources);\n for (const executionId of source.executionIds) {\n detailsByScopeAndExecution.set(\n scopedExecutionKey(source.scopeId, executionId),\n { reportId: source.reportId, executionId },\n );\n }\n }\n const context: ManifestBuildContext = {\n diagnostics: [],\n sourcesByScope,\n detailsByScopeAndExecution,\n tracedScopeByExecution: new Map(),\n };\n for (const error of result.errors ?? []) {\n addDiagnostic(context, {\n level: 'error',\n code: 'run-infrastructure-error',\n message: sanitizeReportError(error).message,\n });\n }\n for (const source of index.sources) {\n if (source.executionIds.length === 0) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'source-without-executions',\n message: `Agent report contains no executions: ${source.sourcePath}`,\n scopeId: source.scopeId,\n sourcePaths: [source.sourcePath],\n });\n }\n }\n\n const projects = result.projects.map((project) =>\n buildProject(project, context),\n );\n return {\n schemaVersion: 1,\n kind: 'test-runner',\n runId: result.runId,\n status: result.status,\n startedAt: result.startedAt,\n endedAt: result.endedAt,\n durationMs: result.durationMs,\n summary: { ...result.summary },\n metrics: index.metrics,\n projects,\n ...(context.diagnostics.length > 0\n ? { diagnostics: context.diagnostics }\n : {}),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","exactMidsceneDetailNodes","Set","scopedExecutionKey","scopeId","executionId","reportSourcesForScope","context","addDiagnostic","diagnostic","buildStep","step","details","unresolvedExecutionIds","trace","previousScope","Error","detail","agentDetailDiagnostic","sources","source","input","candidateTitle","prompt","undefined","sanitizeReportText","sanitizeReportValue","sanitizeReportError","attemptReportScope","attempt","buildAttempt","error","buildCase","outcome","documentReportScope","document","buildDocument","documentId","cases","sourcePath","status","item","phase","buildProject","project","documentCount","Map","groups","currentGroup","group","documents","first","last","outcomes","previous","result","Math","Date","_cases","collectionError","collectTestRunReportSources","path","buildTestRunReportDump","index","sourcesByScope","detailsByScopeAndExecution","scopeSources","projects"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;ACmBA,MAAMI,2BAA2B,IA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A2B,GAAG,CAC5B9D,mBAAmBiB,OAAO,OAAO,EAAEf,cACnC;YAAE,UAAUe,OAAO,QAAQ;YAAEf;QAAY;IAG/C;IACA,MAAME,UAAgC;QACpC,aAAa,EAAE;QACfyD;QACAC;QACA,wBAAwB,IAAInB;IAC9B;IACA,KAAK,MAAMf,SAASwB,OAAO,MAAM,IAAI,EAAE,CACrC/C,cAAcD,SAAS;QACrB,OAAO;QACP,MAAM;QACN,SAASoB,AAAAA,IAAAA,qCAAAA,mBAAAA,AAAAA,EAAoBI,OAAO,OAAO;IAC7C;IAEF,KAAK,MAAMX,UAAU2C,MAAM,OAAO,CAChC,IAAI3C,AAA+B,MAA/BA,OAAO,YAAY,CAAC,MAAM,EAC5BZ,cAAcD,SAAS;QACrB,OAAO;QACP,MAAM;QACN,SAAS,CAAC,qCAAqC,EAAEa,OAAO,UAAU,EAAE;QACpE,SAASA,OAAO,OAAO;QACvB,aAAa;YAACA,OAAO,UAAU;SAAC;IAClC;IAIJ,MAAM+C,WAAWZ,OAAO,QAAQ,CAAC,GAAG,CAAC,CAACX,UACpCD,aAAaC,SAASrC;IAExB,OAAO;QACL,eAAe;QACf,MAAM;QACN,OAAOgD,OAAO,KAAK;QACnB,QAAQA,OAAO,MAAM;QACrB,WAAWA,OAAO,SAAS;QAC3B,SAASA,OAAO,OAAO;QACvB,YAAYA,OAAO,UAAU;QAC7B,SAAS;YAAE,GAAGA,OAAO,OAAO;QAAC;QAC7B,SAASQ,MAAM,OAAO;QACtBI;QACA,GAAI5D,QAAQ,WAAW,CAAC,MAAM,GAAG,IAC7B;YAAE,aAAaA,QAAQ,WAAW;QAAC,IACnC,CAAC,CAAC;IACR;AACF"}
|
|
1
|
+
{"version":3,"file":"test-runner/reporting/test-run-report.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/test-runner/reporting/test-run-report.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n IndexedTestRunReportSource,\n TestRunReportAgentDetail,\n TestRunReportAttempt,\n TestRunReportCase,\n TestRunReportCasePlan,\n TestRunReportDiagnostic,\n TestRunReportDocument,\n TestRunReportDocumentPlan,\n TestRunReportDump,\n TestRunReportMetrics,\n TestRunReportPlannedStep,\n TestRunReportProject,\n TestRunReportSource,\n TestRunReportSourceIndex,\n TestRunReportStep,\n} from '../../test-run-report';\nimport type {\n CaseRunResult,\n StepRunResult,\n WorkflowDocumentRunResult,\n} from '../engine/types';\nimport { sumTestRunReportMetrics } from './metrics';\nimport {\n sanitizeReportError,\n sanitizeReportText,\n sanitizeReportValue,\n} from './sanitize';\nimport type { RunReportCaseInput, RunReportInput } from './types';\n\nconst exactMidsceneDetailNodes = new Set([\n 'aiAct',\n 'aiAssert',\n 'recordToReport',\n]);\n\ninterface ManifestBuildContext {\n diagnostics: TestRunReportDiagnostic[];\n sourcesByScope: Map<string, IndexedTestRunReportSource[]>;\n detailsByScopeAndExecution: Map<string, TestRunReportAgentDetail>;\n tracedScopeByExecution: Map<string, string>;\n expectedExecutions: Set<string>;\n capturedExecutions: Set<string>;\n executionMetrics: Map<string, TestRunReportMetrics>;\n missingMetrics: Set<string>;\n tracedScopes: Set<string>;\n}\n\nconst scopedExecutionKey = (scopeId: string, executionId: string): string =>\n `${scopeId}\\u0000${executionId}`;\n\nconst reportSourcesForScope = (\n context: ManifestBuildContext,\n scopeId: string,\n): IndexedTestRunReportSource[] => context.sourcesByScope.get(scopeId) ?? [];\n\nconst addDiagnostic = (\n context: ManifestBuildContext,\n diagnostic: TestRunReportDiagnostic,\n): void => {\n context.diagnostics.push(diagnostic);\n};\n\nconst buildStep = (\n step: StepRunResult,\n scopeId: string,\n context: ManifestBuildContext,\n executionId: string,\n plan?: TestRunReportPlannedStep,\n): TestRunReportStep => {\n const stepId = `${executionId}:${step.phase}:${step.stepIndex}`;\n if (step.status === 'not-run')\n return {\n id: stepId,\n ...(plan ? { planStepId: plan.id, title: plan.title } : {}),\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n status: 'not-run',\n notRunReason: sanitizeReportText(step.notRunReason),\n ...(step.blockedBy ? { blockedBy: step.blockedBy } : {}),\n continuedAfterError: step.continuedAfterError,\n ...(step.waitForPreviousOperationMs\n ? { waitForPreviousOperationMs: step.waitForPreviousOperationMs }\n : {}),\n input: sanitizeReportValue(step.input),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(step.operations\n ? {\n operations: {\n ...step.operations,\n events: [...step.operations.events],\n },\n }\n : {}),\n };\n const details: TestRunReportAgentDetail[] = [];\n const unresolvedExecutionIds: string[] = [];\n const usage: TestRunReportMetrics[] = [];\n const missingUsage: string[] = [];\n for (const trace of step.report?.traces ?? []) {\n context.tracedScopes.add(scopeId);\n const metrics =\n context.executionMetrics.get(trace.executionId) ?? trace.metrics;\n if (metrics) {\n context.executionMetrics.set(trace.executionId, metrics);\n usage.push(metrics);\n }\n context.expectedExecutions.add(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n const previousScope = context.tracedScopeByExecution.get(trace.executionId);\n if (previousScope && previousScope !== scopeId) {\n throw new Error(\n `Agent execution ${trace.executionId} was traced by multiple test scopes (${previousScope}, ${scopeId}).`,\n );\n }\n context.tracedScopeByExecution.set(trace.executionId, scopeId);\n const detail = context.detailsByScopeAndExecution.get(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n if (detail) {\n details.push(detail);\n context.capturedExecutions.add(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n } else {\n unresolvedExecutionIds.push(trace.executionId);\n if (!metrics) {\n const reason = `Model usage is unavailable for execution ${trace.executionId}.`;\n missingUsage.push(reason);\n context.missingMetrics.add(reason);\n }\n }\n }\n\n let agentDetailDiagnostic: string | undefined;\n if (unresolvedExecutionIds.length > 0) {\n agentDetailDiagnostic = `Agent detail could not be resolved for ${unresolvedExecutionIds.join(', ')}.`;\n const sources = reportSourcesForScope(context, scopeId);\n for (const executionId of unresolvedExecutionIds) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unresolved',\n message: `Agent detail could not be resolved for execution ${executionId} in test scope ${scopeId}.`,\n scopeId,\n executionId,\n stepId,\n ...(sources.length > 0\n ? { sourcePaths: sources.map((source) => source.sourcePath) }\n : {}),\n });\n }\n } else if (details.length === 0 && exactMidsceneDetailNodes.has(step.node)) {\n agentDetailDiagnostic =\n 'This Agent did not expose a stable execution reference for the Step.';\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unavailable',\n message: `No stable Agent execution reference was captured for ${step.node} in test scope ${scopeId}.`,\n scopeId,\n stepId,\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n sourcePaths: reportSourcesForScope(context, scopeId).map(\n (source) => source.sourcePath,\n ),\n }\n : {}),\n });\n }\n\n const collectionErrors =\n step.report?.collectionErrors?.map(sanitizeReportError) ?? [];\n for (const error of collectionErrors) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-source-unavailable',\n scopeId,\n stepId,\n error,\n message: `Report collection for ${step.node}: ${error.message}`,\n });\n }\n const snapshots =\n step.report?.sources?.flatMap((source) =>\n source.collection ? [source.collection] : [],\n ) ?? [];\n const evidenceCollection =\n snapshots.length ||\n collectionErrors.length ||\n details.length ||\n unresolvedExecutionIds.length\n ? {\n status: (collectionErrors.length ||\n unresolvedExecutionIds.length ||\n snapshots.some((snapshot) => snapshot.status === 'partial')\n ? details.length\n ? 'partial'\n : 'unknown'\n : 'complete') as 'complete' | 'partial' | 'unknown',\n ...(snapshots.length\n ? {\n capturedAt: snapshots\n .map((snapshot) => snapshot.capturedAt)\n .sort()\n .at(-1),\n }\n : {}),\n ...(collectionErrors.length ? { errors: collectionErrors } : {}),\n }\n : undefined;\n // A missing link does not invalidate usage already captured independently.\n if (\n !step.report?.traces.length &&\n collectionErrors.length &&\n !details.length\n ) {\n const reason = `Model usage could not be collected for step ${stepId}.`;\n missingUsage.push(reason);\n context.missingMetrics.add(reason);\n }\n\n const input = step.input as Record<string, unknown> | undefined;\n const candidateTitle =\n input?.prompt ?? input?.script ?? input?.scenario ?? input?.title;\n const prompt =\n typeof candidateTitle === 'string'\n ? candidateTitle\n : typeof candidateTitle === 'object' &&\n candidateTitle !== null &&\n 'prompt' in candidateTitle &&\n typeof candidateTitle.prompt === 'string'\n ? candidateTitle.prompt\n : undefined;\n return {\n id: stepId,\n ...(plan ? { planStepId: plan.id } : {}),\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n ...(prompt ? { title: sanitizeReportText(prompt, 240) } : {}),\n status: step.status,\n continuedAfterError: step.continuedAfterError,\n ...(step.waitForPreviousOperationMs\n ? { waitForPreviousOperationMs: step.waitForPreviousOperationMs }\n : {}),\n startedAt: step.startedAt,\n endedAt: step.endedAt,\n durationMs: step.durationMs,\n ...(step.operations\n ? {\n operations: {\n ...step.operations,\n events: [...step.operations.events],\n },\n }\n : {}),\n input: sanitizeReportValue(step.input),\n ...(step.output\n ? {\n output: {\n ...(step.output.summary === undefined\n ? {}\n : { summary: sanitizeReportText(step.output.summary) }),\n ...(step.output.data === undefined\n ? {}\n : { data: sanitizeReportValue(step.output.data) }),\n },\n }\n : {}),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(details.length > 0 ? { agentDetails: details } : {}),\n ...(agentDetailDiagnostic ? { agentDetailDiagnostic } : {}),\n ...(usage.length || missingUsage.length\n ? { metrics: sumTestRunReportMetrics(usage, missingUsage) }\n : {}),\n ...(evidenceCollection\n ? {\n evidenceCollection: {\n ...evidenceCollection,\n ...(missingUsage.length ? { modelUsageUnavailable: true } : {}),\n },\n }\n : {}),\n };\n};\n\nconst attemptReportScope = (attempt: CaseRunResult): string =>\n attempt.reportScopeId ?? attempt.runId;\n\nconst buildAttempt = (\n attempt: CaseRunResult,\n context: ManifestBuildContext,\n plan?: TestRunReportCasePlan,\n): TestRunReportAttempt => {\n const scopeId = attemptReportScope(attempt);\n return {\n attemptId: attempt.runId,\n attemptIndex: attempt.attemptIndex,\n status: attempt.status,\n ...(attempt.executionStatus\n ? { executionStatus: attempt.executionStatus }\n : {}),\n ...(attempt.phases ? { phases: attempt.phases } : {}),\n ...(attempt.cleanup ? { cleanup: attempt.cleanup } : {}),\n ...(attempt.pendingOperations\n ? { pendingOperations: attempt.pendingOperations }\n : {}),\n ...(attempt.retryDecision ? { retryDecision: attempt.retryDecision } : {}),\n startedAt: attempt.startedAt,\n endedAt: attempt.endedAt,\n durationMs: attempt.durationMs,\n beforeEach: attempt.beforeEach.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.beforeEach[step.stepIndex],\n ),\n ),\n steps: attempt.steps.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.steps[step.stepIndex],\n ),\n ),\n afterEach: attempt.afterEach.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.afterEach[step.stepIndex],\n ),\n ),\n ...(attempt.executionErrors?.length\n ? {\n hostErrors: attempt.executionErrors.map((error) => ({\n phase: 'execution' as const,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(attempt.teardownErrors?.length\n ? { teardownErrors: attempt.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildCase = (\n outcome: RunReportCaseInput,\n context: ManifestBuildContext,\n plan?: TestRunReportCasePlan,\n): TestRunReportCase => ({\n ...(plan ? { plan } : {}),\n caseId: outcome.caseId,\n name: outcome.name,\n caseIndex: outcome.caseIndex,\n status: outcome.status,\n ...(outcome.notRunReason ? { notRunReason: outcome.notRunReason } : {}),\n attempts: (outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => buildAttempt(attempt, context, plan),\n ),\n});\n\nconst documentReportScope = (document: WorkflowDocumentRunResult): string =>\n document.reportScopeId ?? document.documentRunId;\n\nconst buildDocument = (\n documentId: string,\n document: WorkflowDocumentRunResult | undefined,\n cases: readonly RunReportCaseInput[],\n context: ManifestBuildContext,\n plan?: TestRunReportDocumentPlan,\n): TestRunReportDocument => {\n plan ??= document?.plan;\n const sourcePath =\n document?.sourcePath ?? cases[0]?.sourcePath ?? '<unknown>';\n const status =\n document?.status ??\n (cases.some((item) => item.status !== 'success') ? 'failed' : 'success');\n const scopeId = document ? documentReportScope(document) : undefined;\n return {\n documentId,\n ...(plan ? { plan } : {}),\n ...(document\n ? {\n logicalDocumentId: document.documentId,\n documentRunId: document.documentRunId,\n ...(document.attemptIndex === undefined\n ? {}\n : { attemptIndex: document.attemptIndex }),\n }\n : {}),\n sourcePath,\n status,\n ...(document?.executionStatus\n ? { executionStatus: document.executionStatus }\n : {}),\n ...(document?.phases ? { phases: document.phases } : {}),\n ...(document?.cleanup ? { cleanup: document.cleanup } : {}),\n ...(document?.pendingOperations\n ? { pendingOperations: document.pendingOperations }\n : {}),\n ...(document?.retryDecision\n ? { retryDecision: document.retryDecision }\n : {}),\n ...(document\n ? {\n startedAt: document.startedAt,\n endedAt: document.endedAt,\n durationMs: document.durationMs,\n }\n : {}),\n beforeAll: (document?.beforeAll ?? []).map((step) =>\n buildStep(\n step,\n scopeId!,\n context,\n document!.documentRunId,\n plan?.beforeAll[step.stepIndex],\n ),\n ),\n cases: cases.map((outcome) =>\n buildCase(\n outcome,\n context,\n plan?.cases.find((item) => item.caseId === outcome.caseId),\n ),\n ),\n afterAll: (document?.afterAll ?? []).map((step) =>\n buildStep(\n step,\n scopeId!,\n context,\n document!.documentRunId,\n plan?.afterAll[step.stepIndex],\n ),\n ),\n ...(document?.hostErrors?.length || document?.executionErrors?.length\n ? {\n hostErrors: [\n ...(document?.hostErrors ?? []),\n ...(document?.executionErrors ?? []).map((error) => ({\n phase: 'execution' as const,\n error,\n })),\n ].map(({ phase, error }) => ({\n phase,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(document?.teardownErrors?.length\n ? { teardownErrors: document.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(scopeId && reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildProject = (\n project: RunReportInput['projects'][number],\n context: ManifestBuildContext,\n): TestRunReportProject => {\n const documentCount = new Map<string, number>();\n for (const document of project.documents) {\n documentCount.set(\n document.documentId,\n (documentCount.get(document.documentId) ?? 0) + 1,\n );\n }\n for (const outcome of project.cases) {\n if (\n (documentCount.get(outcome.documentId) ?? 0) > 1 &&\n !outcome.documentRunId\n ) {\n throw new Error(\n `Case ${outcome.caseId} must identify its documentRunId when a document has multiple attempts.`,\n );\n }\n }\n // A new attemptIndex 0 begins a distinct invocation of the same file. Only\n // whole-file retries belong to one logical document and its Case history.\n const groups: WorkflowDocumentRunResult[][] = [];\n const currentGroup = new Map<string, WorkflowDocumentRunResult[]>();\n for (const document of project.documents) {\n let group = currentGroup.get(document.documentId);\n if (!group || !document.attemptIndex) {\n group = [];\n groups.push(group);\n currentGroup.set(document.documentId, group);\n }\n group.push(document);\n }\n const documents = groups.map((group) => {\n const first = group[0];\n const last = group.at(-1)!;\n const documentId =\n groups.filter((item) => item[0].documentId === first.documentId).length >\n 1\n ? `${first.documentId}:${first.documentRunId}`\n : first.documentId;\n const outcomes = new Map<string, RunReportCaseInput>();\n for (const document of group) {\n for (const outcome of project.cases.filter(\n (item) =>\n item.documentId === document.documentId &&\n (!item.documentRunId ||\n item.documentRunId === document.documentRunId),\n )) {\n const previous = outcomes.get(outcome.caseId);\n outcomes.set(outcome.caseId, {\n ...outcome,\n attempts: [\n ...(previous?.attempts ?? []),\n ...(outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => ({\n ...attempt,\n attemptIndex: document.attemptIndex ?? attempt.attemptIndex,\n }),\n ),\n ],\n });\n }\n }\n const result = buildDocument(\n documentId,\n last,\n [...outcomes.values()],\n context,\n project.plans?.find((plan) => plan.documentId === last.documentId),\n );\n if (group.length > 1) {\n result.startedAt = first.startedAt;\n result.durationMs = Math.max(\n 0,\n Date.parse(last.endedAt) - Date.parse(first.startedAt),\n );\n result.attempts = group.map((document) => {\n const { cases: _cases, ...attempt } = buildDocument(\n documentId,\n document,\n [],\n context,\n project.plans?.find(\n (plan) => plan.documentId === document.documentId,\n ),\n );\n return attempt;\n });\n }\n return result;\n });\n // Collection/setup failures can have Cases but no started document runtime.\n for (const documentId of new Set(\n project.cases.map((outcome) => outcome.documentId),\n )) {\n if (!documentCount.has(documentId)) {\n documents.push(\n buildDocument(\n documentId,\n undefined,\n project.cases.filter((outcome) => outcome.documentId === documentId),\n context,\n project.plans?.find((plan) => plan.documentId === documentId),\n ),\n );\n }\n }\n\n return {\n ...(project.plans ? { plans: project.plans } : {}),\n projectId: project.projectId,\n name: project.name,\n ...(project.platform?.trim() ? { platform: project.platform.trim() } : {}),\n status: project.status,\n retry: project.retry,\n ...(project.lifecycle\n ? {\n lifecycle: {\n status: project.lifecycle.status,\n startedAt: project.lifecycle.startedAt,\n endedAt: project.lifecycle.endedAt,\n durationMs: project.lifecycle.durationMs,\n ...(project.lifecycle.cleanup\n ? { cleanup: project.lifecycle.cleanup }\n : {}),\n ...(project.lifecycle.pendingOperations\n ? { pendingOperations: project.lifecycle.pendingOperations }\n : {}),\n ...(project.lifecycle.setupError\n ? {\n setupError: sanitizeReportError(project.lifecycle.setupError),\n }\n : {}),\n ...(project.lifecycle.teardownErrors?.length\n ? {\n teardownErrors:\n project.lifecycle.teardownErrors.map(sanitizeReportError),\n }\n : {}),\n },\n }\n : {}),\n documents,\n collectionErrors: project.collectionErrors.map((collectionError) => ({\n sourcePath: collectionError.sourcePath,\n error: sanitizeReportError(collectionError.error),\n })),\n };\n};\n\nexport function collectTestRunReportSources(\n result: RunReportInput,\n): TestRunReportSource[] {\n const sources: TestRunReportSource[] = [];\n for (const project of result.projects) {\n for (const document of project.documents) {\n for (const source of document.reportSources ?? [])\n sources.push({ ...source, scopeId: documentReportScope(document) });\n for (const sourcePath of (document.reportPaths ?? []).filter(\n (path) =>\n !document.reportSources?.some((source) => source.sourcePath === path),\n )) {\n sources.push({\n scopeId: documentReportScope(document),\n sourcePath,\n });\n }\n }\n for (const outcome of project.cases) {\n for (const attempt of outcome.attempts ??\n (outcome.run ? [outcome.run] : [])) {\n for (const source of attempt.reportSources ?? [])\n sources.push({ ...source, scopeId: attemptReportScope(attempt) });\n for (const sourcePath of (attempt.reportPaths ?? []).filter(\n (path) =>\n !attempt.reportSources?.some(\n (source) => source.sourcePath === path,\n ),\n )) {\n sources.push({ scopeId: attemptReportScope(attempt), sourcePath });\n }\n }\n }\n }\n return sources;\n}\n\nexport function buildTestRunReportDump(\n result: RunReportInput,\n index: TestRunReportSourceIndex,\n): TestRunReportDump {\n const sourcesByScope = new Map<string, IndexedTestRunReportSource[]>();\n const detailsByScopeAndExecution = new Map<\n string,\n TestRunReportAgentDetail\n >();\n for (const source of index.sources) {\n const scopeSources = sourcesByScope.get(source.scopeId) ?? [];\n scopeSources.push(source);\n sourcesByScope.set(source.scopeId, scopeSources);\n for (const executionId of source.executionIds) {\n detailsByScopeAndExecution.set(\n scopedExecutionKey(source.scopeId, executionId),\n { reportId: source.reportId, executionId },\n );\n }\n }\n const context: ManifestBuildContext = {\n diagnostics: (index.diagnostics ?? []).map((diagnostic) => ({\n ...diagnostic,\n message: sanitizeReportText(diagnostic.message),\n })),\n sourcesByScope,\n detailsByScopeAndExecution,\n tracedScopeByExecution: new Map(),\n expectedExecutions: new Set(),\n capturedExecutions: new Set(),\n executionMetrics: new Map(Object.entries(index.executionMetrics ?? {})),\n missingMetrics: new Set(),\n tracedScopes: new Set(),\n };\n for (const error of result.errors ?? []) {\n addDiagnostic(context, {\n level: 'error',\n code: 'run-infrastructure-error',\n message: sanitizeReportError(error).message,\n error: sanitizeReportError(error),\n });\n }\n for (const source of index.sources) {\n if (source.executionIds.length === 0) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'source-without-executions',\n message: `Agent report contains no executions: ${source.sourcePath}`,\n scopeId: source.scopeId,\n sourcePaths: [source.sourcePath],\n });\n }\n }\n\n const projects = result.projects.map((project) =>\n buildProject(project, context),\n );\n for (const diagnostic of index.diagnostics ?? [])\n if (\n diagnostic.code === 'agent-source-unavailable' &&\n (!diagnostic.scopeId || !context.tracedScopes.has(diagnostic.scopeId))\n )\n context.missingMetrics.add(diagnostic.message);\n const metrics = sumTestRunReportMetrics(\n [\n ...(index.sources.length ||\n (!index.executionMetrics &&\n (index.metrics.modelCallCount || index.metrics.collection))\n ? [index.capturedMetrics ?? index.metrics]\n : []),\n ...[...context.executionMetrics.entries()]\n .filter(([id]) => !index.executionMetrics?.[id])\n .map(([, value]) => value),\n ],\n [...context.missingMetrics],\n );\n return {\n schemaVersion: 1,\n kind: 'test-runner',\n runId: result.runId,\n ...(result.operationLog\n ? { operationLogs: [{ ...result.operationLog }] }\n : {}),\n status: result.status,\n startedAt: result.startedAt,\n endedAt: result.endedAt,\n durationMs: result.durationMs,\n summary: { ...result.summary },\n metrics: {\n ...metrics,\n collection: {\n ...metrics.collection!,\n expectedExecutionCount: context.expectedExecutions.size,\n capturedExecutionCount: context.capturedExecutions.size,\n },\n },\n ...(index.executionMetrics || context.executionMetrics.size\n ? { executionMetrics: Object.fromEntries(context.executionMetrics) }\n : {}),\n projects,\n ...(context.diagnostics.length > 0\n ? { diagnostics: context.diagnostics }\n : {}),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","exactMidsceneDetailNodes","Set","scopedExecutionKey","scopeId","executionId","reportSourcesForScope","context","addDiagnostic","diagnostic","buildStep","step","plan","stepId","sanitizeReportText","sanitizeReportValue","sanitizeReportError","details","unresolvedExecutionIds","usage","missingUsage","trace","metrics","previousScope","Error","detail","reason","agentDetailDiagnostic","sources","source","collectionErrors","error","snapshots","evidenceCollection","snapshot","undefined","input","candidateTitle","prompt","sumTestRunReportMetrics","attemptReportScope","attempt","buildAttempt","buildCase","outcome","documentReportScope","document","buildDocument","documentId","cases","sourcePath","status","item","phase","buildProject","project","documentCount","Map","groups","currentGroup","group","documents","first","last","outcomes","previous","result","Math","Date","_cases","collectionError","collectTestRunReportSources","path","buildTestRunReportDump","index","sourcesByScope","detailsByScopeAndExecution","scopeSources","projects","id","value"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;ACwBA,MAAMI,2BAA2B,IAAIC,IAAI;IACvC;IACA;IACA;CACD;AAcD,MAAMC,qBAAqB,CAACC,SAAiBC,cAC3C,GAAGD,QAAQ,MAAM,EAAEC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