@riddledc/riddle-proof 0.7.69 → 0.7.71
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.md +3 -1
- package/dist/{chunk-ZQPC7PYM.js → chunk-HXYLTNZT.js} +55 -12
- package/dist/cli.cjs +72 -14
- package/dist/cli.js +18 -3
- package/dist/index.cjs +55 -12
- package/dist/index.js +1 -1
- package/dist/profile.cjs +55 -12
- package/dist/profile.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -318,7 +318,9 @@ setup screenshots, compact text samples, and failures so setup-heavy clickthroug
|
|
|
318
318
|
can be reviewed without reading every raw setup-action result. Long click
|
|
319
319
|
sequences include `clicked_total` and `clicked_truncated`; the compact `clicked`
|
|
320
320
|
list keeps the first and last clicked targets so later route switches and reset
|
|
321
|
-
actions stay visible.
|
|
321
|
+
actions stay visible. Click actions with `click_count` greater than `1` are
|
|
322
|
+
included in clicked-target evidence and rolled up as `click_count_action_total`
|
|
323
|
+
and `click_count_value_total`.
|
|
322
324
|
|
|
323
325
|
`target.timeout_sec` is optional. Use it for known-heavy profile targets so the
|
|
324
326
|
profile carries its own hosted Riddle worker budget; an explicit CLI `--timeout`
|
|
@@ -231,12 +231,18 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
231
231
|
viewports: viewports.map((viewport) => {
|
|
232
232
|
const results = viewport.setup_action_results || [];
|
|
233
233
|
const failed = results.filter((result) => result.ok === false);
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
234
|
+
const successfulClicks = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
235
|
+
const clickCountValues = successfulClicks.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0).filter((value) => value !== void 0);
|
|
236
|
+
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
237
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
238
|
+
return {
|
|
239
|
+
ordinal: result.ordinal ?? null,
|
|
240
|
+
selector: result.selector ?? null,
|
|
241
|
+
frame_selector: result.frame_selector ?? null,
|
|
242
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
243
|
+
...clickCount ? { click_count: clickCount } : {}
|
|
244
|
+
};
|
|
245
|
+
});
|
|
240
246
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
241
247
|
const text_samples = results.filter((result) => result.ok !== false && typeof result.text === "string" && (profileSetupResultAction(result) === "assert_text_visible" || profileSetupResultAction(result) === "assert_text_absent" || profileSetupResultAction(result) === "wait_for_text")).map((result) => ({
|
|
242
248
|
ordinal: result.ordinal ?? null,
|
|
@@ -256,6 +262,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
256
262
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
257
263
|
clicked_total: clickedItems.length,
|
|
258
264
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
265
|
+
click_count_action_total: clickCountValues.length,
|
|
266
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
259
267
|
clicked,
|
|
260
268
|
text_samples,
|
|
261
269
|
failed: failed.map((result) => ({
|
|
@@ -1489,11 +1497,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
|
|
|
1489
1497
|
requiredNetworkMockHitCount(mock)
|
|
1490
1498
|
])),
|
|
1491
1499
|
max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
|
|
1500
|
+
response_hits_by_label: networkMockResponseHitsByLabel(events),
|
|
1492
1501
|
failed
|
|
1493
1502
|
},
|
|
1494
1503
|
message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
|
|
1495
1504
|
};
|
|
1496
1505
|
}
|
|
1506
|
+
function networkMockResponseHitsByLabel(events) {
|
|
1507
|
+
const responseHits = {};
|
|
1508
|
+
for (const event of events) {
|
|
1509
|
+
if (!event || event.ok === false) continue;
|
|
1510
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
1511
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
1512
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
1513
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
1514
|
+
responseHits[label] || (responseHits[label] = {});
|
|
1515
|
+
responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
|
|
1516
|
+
}
|
|
1517
|
+
return responseHits;
|
|
1518
|
+
}
|
|
1497
1519
|
function requiredNetworkMockHitCount(mock) {
|
|
1498
1520
|
if (mock.required === false) return 0;
|
|
1499
1521
|
if (mock.required_hit_count !== void 0) return mock.required_hit_count;
|
|
@@ -1896,14 +1918,22 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
1896
1918
|
viewports: (viewports || []).map((viewport) => {
|
|
1897
1919
|
const results = viewport.setup_action_results || [];
|
|
1898
1920
|
const failed = results.filter((result) => result && result.ok === false);
|
|
1921
|
+
const successfulClicks = results.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
1922
|
+
const clickCountValues = successfulClicks
|
|
1923
|
+
.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined)
|
|
1924
|
+
.filter((value) => value !== undefined);
|
|
1899
1925
|
const clickedItems = results
|
|
1900
1926
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
1901
|
-
.map((result) =>
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1927
|
+
.map((result) => {
|
|
1928
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined;
|
|
1929
|
+
return {
|
|
1930
|
+
ordinal: result.ordinal ?? null,
|
|
1931
|
+
selector: result.selector ?? null,
|
|
1932
|
+
frame_selector: result.frame_selector ?? null,
|
|
1933
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
1934
|
+
...(clickCount ? { click_count: clickCount } : {}),
|
|
1935
|
+
};
|
|
1936
|
+
});
|
|
1907
1937
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
1908
1938
|
const textSamples = results
|
|
1909
1939
|
.filter((result) => result && result.ok !== false && typeof result.text === "string" && (
|
|
@@ -1931,6 +1961,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
1931
1961
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
1932
1962
|
clicked_total: clickedItems.length,
|
|
1933
1963
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
1964
|
+
click_count_action_total: clickCountValues.length,
|
|
1965
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
1934
1966
|
clicked,
|
|
1935
1967
|
text_samples: textSamples,
|
|
1936
1968
|
failed: failed.map((result) => ({
|
|
@@ -2007,11 +2039,21 @@ function assessProfile(profile, evidence) {
|
|
|
2007
2039
|
const hitsByLabel = {};
|
|
2008
2040
|
const requiredHitsByLabel = {};
|
|
2009
2041
|
const maxHitsByLabel = {};
|
|
2042
|
+
const responseHitsByLabel = {};
|
|
2010
2043
|
for (const mock of profile.target.network_mocks) {
|
|
2011
2044
|
hitsByLabel[mock.label] = hitCountForMock(mock);
|
|
2012
2045
|
if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
|
|
2013
2046
|
if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
|
|
2014
2047
|
}
|
|
2048
|
+
for (const event of events) {
|
|
2049
|
+
if (!event || event.ok === false) continue;
|
|
2050
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
2051
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
2052
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
2053
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
2054
|
+
responseHitsByLabel[label] ||= {};
|
|
2055
|
+
responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
|
|
2056
|
+
}
|
|
2015
2057
|
checks.push({
|
|
2016
2058
|
type: "network_mocks_succeeded",
|
|
2017
2059
|
label: "network mocks succeeded",
|
|
@@ -2023,6 +2065,7 @@ function assessProfile(profile, evidence) {
|
|
|
2023
2065
|
hits_by_label: hitsByLabel,
|
|
2024
2066
|
required_hits_by_label: requiredHitsByLabel,
|
|
2025
2067
|
max_hits_by_label: maxHitsByLabel,
|
|
2068
|
+
response_hits_by_label: responseHitsByLabel,
|
|
2026
2069
|
failed,
|
|
2027
2070
|
},
|
|
2028
2071
|
message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
|
package/dist/cli.cjs
CHANGED
|
@@ -7104,12 +7104,18 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
7104
7104
|
viewports: viewports.map((viewport) => {
|
|
7105
7105
|
const results = viewport.setup_action_results || [];
|
|
7106
7106
|
const failed = results.filter((result) => result.ok === false);
|
|
7107
|
-
const
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7107
|
+
const successfulClicks = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
7108
|
+
const clickCountValues = successfulClicks.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0).filter((value) => value !== void 0);
|
|
7109
|
+
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
7110
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
7111
|
+
return {
|
|
7112
|
+
ordinal: result.ordinal ?? null,
|
|
7113
|
+
selector: result.selector ?? null,
|
|
7114
|
+
frame_selector: result.frame_selector ?? null,
|
|
7115
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
7116
|
+
...clickCount ? { click_count: clickCount } : {}
|
|
7117
|
+
};
|
|
7118
|
+
});
|
|
7113
7119
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
7114
7120
|
const text_samples = results.filter((result) => result.ok !== false && typeof result.text === "string" && (profileSetupResultAction(result) === "assert_text_visible" || profileSetupResultAction(result) === "assert_text_absent" || profileSetupResultAction(result) === "wait_for_text")).map((result) => ({
|
|
7115
7121
|
ordinal: result.ordinal ?? null,
|
|
@@ -7129,6 +7135,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
7129
7135
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
7130
7136
|
clicked_total: clickedItems.length,
|
|
7131
7137
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
7138
|
+
click_count_action_total: clickCountValues.length,
|
|
7139
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
7132
7140
|
clicked,
|
|
7133
7141
|
text_samples,
|
|
7134
7142
|
failed: failed.map((result) => ({
|
|
@@ -8362,11 +8370,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
|
|
|
8362
8370
|
requiredNetworkMockHitCount(mock)
|
|
8363
8371
|
])),
|
|
8364
8372
|
max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
|
|
8373
|
+
response_hits_by_label: networkMockResponseHitsByLabel(events),
|
|
8365
8374
|
failed
|
|
8366
8375
|
},
|
|
8367
8376
|
message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
|
|
8368
8377
|
};
|
|
8369
8378
|
}
|
|
8379
|
+
function networkMockResponseHitsByLabel(events) {
|
|
8380
|
+
const responseHits = {};
|
|
8381
|
+
for (const event of events) {
|
|
8382
|
+
if (!event || event.ok === false) continue;
|
|
8383
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
8384
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
8385
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
8386
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
8387
|
+
responseHits[label] || (responseHits[label] = {});
|
|
8388
|
+
responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
|
|
8389
|
+
}
|
|
8390
|
+
return responseHits;
|
|
8391
|
+
}
|
|
8370
8392
|
function requiredNetworkMockHitCount(mock) {
|
|
8371
8393
|
if (mock.required === false) return 0;
|
|
8372
8394
|
if (mock.required_hit_count !== void 0) return mock.required_hit_count;
|
|
@@ -8753,14 +8775,22 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
8753
8775
|
viewports: (viewports || []).map((viewport) => {
|
|
8754
8776
|
const results = viewport.setup_action_results || [];
|
|
8755
8777
|
const failed = results.filter((result) => result && result.ok === false);
|
|
8778
|
+
const successfulClicks = results.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
8779
|
+
const clickCountValues = successfulClicks
|
|
8780
|
+
.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined)
|
|
8781
|
+
.filter((value) => value !== undefined);
|
|
8756
8782
|
const clickedItems = results
|
|
8757
8783
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
8758
|
-
.map((result) =>
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8784
|
+
.map((result) => {
|
|
8785
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined;
|
|
8786
|
+
return {
|
|
8787
|
+
ordinal: result.ordinal ?? null,
|
|
8788
|
+
selector: result.selector ?? null,
|
|
8789
|
+
frame_selector: result.frame_selector ?? null,
|
|
8790
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
8791
|
+
...(clickCount ? { click_count: clickCount } : {}),
|
|
8792
|
+
};
|
|
8793
|
+
});
|
|
8764
8794
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
8765
8795
|
const textSamples = results
|
|
8766
8796
|
.filter((result) => result && result.ok !== false && typeof result.text === "string" && (
|
|
@@ -8788,6 +8818,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
8788
8818
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
8789
8819
|
clicked_total: clickedItems.length,
|
|
8790
8820
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
8821
|
+
click_count_action_total: clickCountValues.length,
|
|
8822
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
8791
8823
|
clicked,
|
|
8792
8824
|
text_samples: textSamples,
|
|
8793
8825
|
failed: failed.map((result) => ({
|
|
@@ -8864,11 +8896,21 @@ function assessProfile(profile, evidence) {
|
|
|
8864
8896
|
const hitsByLabel = {};
|
|
8865
8897
|
const requiredHitsByLabel = {};
|
|
8866
8898
|
const maxHitsByLabel = {};
|
|
8899
|
+
const responseHitsByLabel = {};
|
|
8867
8900
|
for (const mock of profile.target.network_mocks) {
|
|
8868
8901
|
hitsByLabel[mock.label] = hitCountForMock(mock);
|
|
8869
8902
|
if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
|
|
8870
8903
|
if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
|
|
8871
8904
|
}
|
|
8905
|
+
for (const event of events) {
|
|
8906
|
+
if (!event || event.ok === false) continue;
|
|
8907
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
8908
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
8909
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
8910
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
8911
|
+
responseHitsByLabel[label] ||= {};
|
|
8912
|
+
responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
|
|
8913
|
+
}
|
|
8872
8914
|
checks.push({
|
|
8873
8915
|
type: "network_mocks_succeeded",
|
|
8874
8916
|
label: "network mocks succeeded",
|
|
@@ -8880,6 +8922,7 @@ function assessProfile(profile, evidence) {
|
|
|
8880
8922
|
hits_by_label: hitsByLabel,
|
|
8881
8923
|
required_hits_by_label: requiredHitsByLabel,
|
|
8882
8924
|
max_hits_by_label: maxHitsByLabel,
|
|
8925
|
+
response_hits_by_label: responseHitsByLabel,
|
|
8883
8926
|
failed,
|
|
8884
8927
|
},
|
|
8885
8928
|
message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
|
|
@@ -11244,20 +11287,26 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
11244
11287
|
return sum + labels.filter((label) => typeof label === "string" && label.trim()).length;
|
|
11245
11288
|
}, 0);
|
|
11246
11289
|
const clickedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0);
|
|
11290
|
+
const clickCountActionTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_action_total) || 0), 0);
|
|
11291
|
+
const clickCountValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_value_total) || 0), 0);
|
|
11247
11292
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
11248
11293
|
const lines = [
|
|
11249
11294
|
`- setup actions: ${declaredActions === void 0 ? "unknown" : declaredActions} declared, ${totalResults} recorded result(s) across ${viewports.length} viewport(s)`,
|
|
11250
11295
|
`- setup screenshots: ${setupScreenshots}`,
|
|
11251
11296
|
`- clicked targets: ${clickedTotal}${failedTotal ? `; failed setup actions: ${failedTotal}` : ""}`
|
|
11252
11297
|
];
|
|
11298
|
+
if (clickCountActionTotal) {
|
|
11299
|
+
lines.push(`- click counts: ${clickCountActionTotal} action(s), click_count total ${clickCountValueTotal}`);
|
|
11300
|
+
}
|
|
11253
11301
|
for (const viewport of viewports.slice(0, 8)) {
|
|
11254
11302
|
const name = cliString(viewport.name) || "viewport";
|
|
11255
11303
|
const ok = viewport.ok === false ? "failed" : "ok";
|
|
11256
11304
|
const resultCount = cliFiniteNumber(viewport.result_count) || 0;
|
|
11257
11305
|
const screenshotCount = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
|
|
11258
11306
|
const clicked = cliFiniteNumber(viewport.clicked_total) || 0;
|
|
11307
|
+
const clickCountActions = cliFiniteNumber(viewport.click_count_action_total) || 0;
|
|
11259
11308
|
const observedPath = cliString(viewport.observed_path);
|
|
11260
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${observedPath ? `, path ${observedPath}` : ""}`);
|
|
11309
|
+
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
11261
11310
|
}
|
|
11262
11311
|
if (viewports.length > 8) lines.push(`- ${viewports.length - 8} additional viewport(s) omitted from setup summary.`);
|
|
11263
11312
|
return lines;
|
|
@@ -11272,10 +11321,12 @@ function profileNetworkMockSummaryMarkdown(result) {
|
|
|
11272
11321
|
const hitsByLabel = cliRecord(evidence.hits_by_label) || {};
|
|
11273
11322
|
const requiredHitsByLabel = cliRecord(evidence.required_hits_by_label) || {};
|
|
11274
11323
|
const maxHitsByLabel = cliRecord(evidence.max_hits_by_label) || {};
|
|
11324
|
+
const responseHitsByLabel = cliRecord(evidence.response_hits_by_label) || {};
|
|
11275
11325
|
const labels = Array.from(/* @__PURE__ */ new Set([
|
|
11276
11326
|
...Object.keys(hitsByLabel),
|
|
11277
11327
|
...Object.keys(requiredHitsByLabel),
|
|
11278
|
-
...Object.keys(maxHitsByLabel)
|
|
11328
|
+
...Object.keys(maxHitsByLabel),
|
|
11329
|
+
...Object.keys(responseHitsByLabel)
|
|
11279
11330
|
])).sort();
|
|
11280
11331
|
const mockCount = cliFiniteNumber(evidence.mock_count);
|
|
11281
11332
|
const requiredCount = cliFiniteNumber(evidence.required_count);
|
|
@@ -11293,6 +11344,13 @@ function profileNetworkMockSummaryMarkdown(result) {
|
|
|
11293
11344
|
if (requiredHits !== void 0) parts.push(`required ${requiredHits}`);
|
|
11294
11345
|
if (maxHits !== void 0) parts.push(`max ${maxHits}`);
|
|
11295
11346
|
lines.push(`- ${label}: ${parts.join(", ")}`);
|
|
11347
|
+
const responseHits = cliRecord(responseHitsByLabel[label]);
|
|
11348
|
+
const responseLabels = responseHits ? Object.keys(responseHits).sort() : [];
|
|
11349
|
+
if (responseHits && responseLabels.length) {
|
|
11350
|
+
const responseParts = responseLabels.slice(0, 8).map((responseLabel) => `${responseLabel} ${cliRecordNumber(responseHits, responseLabel) ?? 0}`);
|
|
11351
|
+
const omitted = responseLabels.length > 8 ? `; ${responseLabels.length - 8} additional response label(s) omitted` : "";
|
|
11352
|
+
lines.push(`- ${label} responses: ${responseParts.join("; ")}${omitted}`);
|
|
11353
|
+
}
|
|
11296
11354
|
}
|
|
11297
11355
|
if (labels.length > 16) lines.push(`- ${labels.length - 16} additional network mock label(s) omitted from summary.`);
|
|
11298
11356
|
return lines;
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
profileStatusExitCode,
|
|
11
11
|
resolveRiddleProofProfileTargetUrl,
|
|
12
12
|
resolveRiddleProofProfileTimeoutSec
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HXYLTNZT.js";
|
|
14
14
|
import {
|
|
15
15
|
createRiddleApiClient,
|
|
16
16
|
parseRiddleViewport
|
|
@@ -351,20 +351,26 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
351
351
|
return sum + labels.filter((label) => typeof label === "string" && label.trim()).length;
|
|
352
352
|
}, 0);
|
|
353
353
|
const clickedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0);
|
|
354
|
+
const clickCountActionTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_action_total) || 0), 0);
|
|
355
|
+
const clickCountValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_value_total) || 0), 0);
|
|
354
356
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
355
357
|
const lines = [
|
|
356
358
|
`- setup actions: ${declaredActions === void 0 ? "unknown" : declaredActions} declared, ${totalResults} recorded result(s) across ${viewports.length} viewport(s)`,
|
|
357
359
|
`- setup screenshots: ${setupScreenshots}`,
|
|
358
360
|
`- clicked targets: ${clickedTotal}${failedTotal ? `; failed setup actions: ${failedTotal}` : ""}`
|
|
359
361
|
];
|
|
362
|
+
if (clickCountActionTotal) {
|
|
363
|
+
lines.push(`- click counts: ${clickCountActionTotal} action(s), click_count total ${clickCountValueTotal}`);
|
|
364
|
+
}
|
|
360
365
|
for (const viewport of viewports.slice(0, 8)) {
|
|
361
366
|
const name = cliString(viewport.name) || "viewport";
|
|
362
367
|
const ok = viewport.ok === false ? "failed" : "ok";
|
|
363
368
|
const resultCount = cliFiniteNumber(viewport.result_count) || 0;
|
|
364
369
|
const screenshotCount = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
|
|
365
370
|
const clicked = cliFiniteNumber(viewport.clicked_total) || 0;
|
|
371
|
+
const clickCountActions = cliFiniteNumber(viewport.click_count_action_total) || 0;
|
|
366
372
|
const observedPath = cliString(viewport.observed_path);
|
|
367
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${observedPath ? `, path ${observedPath}` : ""}`);
|
|
373
|
+
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
368
374
|
}
|
|
369
375
|
if (viewports.length > 8) lines.push(`- ${viewports.length - 8} additional viewport(s) omitted from setup summary.`);
|
|
370
376
|
return lines;
|
|
@@ -379,10 +385,12 @@ function profileNetworkMockSummaryMarkdown(result) {
|
|
|
379
385
|
const hitsByLabel = cliRecord(evidence.hits_by_label) || {};
|
|
380
386
|
const requiredHitsByLabel = cliRecord(evidence.required_hits_by_label) || {};
|
|
381
387
|
const maxHitsByLabel = cliRecord(evidence.max_hits_by_label) || {};
|
|
388
|
+
const responseHitsByLabel = cliRecord(evidence.response_hits_by_label) || {};
|
|
382
389
|
const labels = Array.from(/* @__PURE__ */ new Set([
|
|
383
390
|
...Object.keys(hitsByLabel),
|
|
384
391
|
...Object.keys(requiredHitsByLabel),
|
|
385
|
-
...Object.keys(maxHitsByLabel)
|
|
392
|
+
...Object.keys(maxHitsByLabel),
|
|
393
|
+
...Object.keys(responseHitsByLabel)
|
|
386
394
|
])).sort();
|
|
387
395
|
const mockCount = cliFiniteNumber(evidence.mock_count);
|
|
388
396
|
const requiredCount = cliFiniteNumber(evidence.required_count);
|
|
@@ -400,6 +408,13 @@ function profileNetworkMockSummaryMarkdown(result) {
|
|
|
400
408
|
if (requiredHits !== void 0) parts.push(`required ${requiredHits}`);
|
|
401
409
|
if (maxHits !== void 0) parts.push(`max ${maxHits}`);
|
|
402
410
|
lines.push(`- ${label}: ${parts.join(", ")}`);
|
|
411
|
+
const responseHits = cliRecord(responseHitsByLabel[label]);
|
|
412
|
+
const responseLabels = responseHits ? Object.keys(responseHits).sort() : [];
|
|
413
|
+
if (responseHits && responseLabels.length) {
|
|
414
|
+
const responseParts = responseLabels.slice(0, 8).map((responseLabel) => `${responseLabel} ${cliRecordNumber(responseHits, responseLabel) ?? 0}`);
|
|
415
|
+
const omitted = responseLabels.length > 8 ? `; ${responseLabels.length - 8} additional response label(s) omitted` : "";
|
|
416
|
+
lines.push(`- ${label} responses: ${responseParts.join("; ")}${omitted}`);
|
|
417
|
+
}
|
|
403
418
|
}
|
|
404
419
|
if (labels.length > 16) lines.push(`- ${labels.length - 16} additional network mock label(s) omitted from summary.`);
|
|
405
420
|
return lines;
|
package/dist/index.cjs
CHANGED
|
@@ -8945,12 +8945,18 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
8945
8945
|
viewports: viewports.map((viewport) => {
|
|
8946
8946
|
const results = viewport.setup_action_results || [];
|
|
8947
8947
|
const failed = results.filter((result) => result.ok === false);
|
|
8948
|
-
const
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8948
|
+
const successfulClicks = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
8949
|
+
const clickCountValues = successfulClicks.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0).filter((value) => value !== void 0);
|
|
8950
|
+
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
8951
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
8952
|
+
return {
|
|
8953
|
+
ordinal: result.ordinal ?? null,
|
|
8954
|
+
selector: result.selector ?? null,
|
|
8955
|
+
frame_selector: result.frame_selector ?? null,
|
|
8956
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
8957
|
+
...clickCount ? { click_count: clickCount } : {}
|
|
8958
|
+
};
|
|
8959
|
+
});
|
|
8954
8960
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
8955
8961
|
const text_samples = results.filter((result) => result.ok !== false && typeof result.text === "string" && (profileSetupResultAction(result) === "assert_text_visible" || profileSetupResultAction(result) === "assert_text_absent" || profileSetupResultAction(result) === "wait_for_text")).map((result) => ({
|
|
8956
8962
|
ordinal: result.ordinal ?? null,
|
|
@@ -8970,6 +8976,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
8970
8976
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
8971
8977
|
clicked_total: clickedItems.length,
|
|
8972
8978
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
8979
|
+
click_count_action_total: clickCountValues.length,
|
|
8980
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
8973
8981
|
clicked,
|
|
8974
8982
|
text_samples,
|
|
8975
8983
|
failed: failed.map((result) => ({
|
|
@@ -10203,11 +10211,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
|
|
|
10203
10211
|
requiredNetworkMockHitCount(mock)
|
|
10204
10212
|
])),
|
|
10205
10213
|
max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
|
|
10214
|
+
response_hits_by_label: networkMockResponseHitsByLabel(events),
|
|
10206
10215
|
failed
|
|
10207
10216
|
},
|
|
10208
10217
|
message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
|
|
10209
10218
|
};
|
|
10210
10219
|
}
|
|
10220
|
+
function networkMockResponseHitsByLabel(events) {
|
|
10221
|
+
const responseHits = {};
|
|
10222
|
+
for (const event of events) {
|
|
10223
|
+
if (!event || event.ok === false) continue;
|
|
10224
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
10225
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
10226
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
10227
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
10228
|
+
responseHits[label] || (responseHits[label] = {});
|
|
10229
|
+
responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
|
|
10230
|
+
}
|
|
10231
|
+
return responseHits;
|
|
10232
|
+
}
|
|
10211
10233
|
function requiredNetworkMockHitCount(mock) {
|
|
10212
10234
|
if (mock.required === false) return 0;
|
|
10213
10235
|
if (mock.required_hit_count !== void 0) return mock.required_hit_count;
|
|
@@ -10610,14 +10632,22 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
10610
10632
|
viewports: (viewports || []).map((viewport) => {
|
|
10611
10633
|
const results = viewport.setup_action_results || [];
|
|
10612
10634
|
const failed = results.filter((result) => result && result.ok === false);
|
|
10635
|
+
const successfulClicks = results.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
10636
|
+
const clickCountValues = successfulClicks
|
|
10637
|
+
.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined)
|
|
10638
|
+
.filter((value) => value !== undefined);
|
|
10613
10639
|
const clickedItems = results
|
|
10614
10640
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
10615
|
-
.map((result) =>
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10641
|
+
.map((result) => {
|
|
10642
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined;
|
|
10643
|
+
return {
|
|
10644
|
+
ordinal: result.ordinal ?? null,
|
|
10645
|
+
selector: result.selector ?? null,
|
|
10646
|
+
frame_selector: result.frame_selector ?? null,
|
|
10647
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
10648
|
+
...(clickCount ? { click_count: clickCount } : {}),
|
|
10649
|
+
};
|
|
10650
|
+
});
|
|
10621
10651
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
10622
10652
|
const textSamples = results
|
|
10623
10653
|
.filter((result) => result && result.ok !== false && typeof result.text === "string" && (
|
|
@@ -10645,6 +10675,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
10645
10675
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
10646
10676
|
clicked_total: clickedItems.length,
|
|
10647
10677
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
10678
|
+
click_count_action_total: clickCountValues.length,
|
|
10679
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
10648
10680
|
clicked,
|
|
10649
10681
|
text_samples: textSamples,
|
|
10650
10682
|
failed: failed.map((result) => ({
|
|
@@ -10721,11 +10753,21 @@ function assessProfile(profile, evidence) {
|
|
|
10721
10753
|
const hitsByLabel = {};
|
|
10722
10754
|
const requiredHitsByLabel = {};
|
|
10723
10755
|
const maxHitsByLabel = {};
|
|
10756
|
+
const responseHitsByLabel = {};
|
|
10724
10757
|
for (const mock of profile.target.network_mocks) {
|
|
10725
10758
|
hitsByLabel[mock.label] = hitCountForMock(mock);
|
|
10726
10759
|
if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
|
|
10727
10760
|
if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
|
|
10728
10761
|
}
|
|
10762
|
+
for (const event of events) {
|
|
10763
|
+
if (!event || event.ok === false) continue;
|
|
10764
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
10765
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
10766
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
10767
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
10768
|
+
responseHitsByLabel[label] ||= {};
|
|
10769
|
+
responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
|
|
10770
|
+
}
|
|
10729
10771
|
checks.push({
|
|
10730
10772
|
type: "network_mocks_succeeded",
|
|
10731
10773
|
label: "network mocks succeeded",
|
|
@@ -10737,6 +10779,7 @@ function assessProfile(profile, evidence) {
|
|
|
10737
10779
|
hits_by_label: hitsByLabel,
|
|
10738
10780
|
required_hits_by_label: requiredHitsByLabel,
|
|
10739
10781
|
max_hits_by_label: maxHitsByLabel,
|
|
10782
|
+
response_hits_by_label: responseHitsByLabel,
|
|
10740
10783
|
failed,
|
|
10741
10784
|
},
|
|
10742
10785
|
message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
resolveRiddleProofProfileTimeoutSec,
|
|
59
59
|
slugifyRiddleProofProfileName,
|
|
60
60
|
summarizeRiddleProofProfileResult
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-HXYLTNZT.js";
|
|
62
62
|
import {
|
|
63
63
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
64
64
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -274,12 +274,18 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
274
274
|
viewports: viewports.map((viewport) => {
|
|
275
275
|
const results = viewport.setup_action_results || [];
|
|
276
276
|
const failed = results.filter((result) => result.ok === false);
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
277
|
+
const successfulClicks = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
278
|
+
const clickCountValues = successfulClicks.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0).filter((value) => value !== void 0);
|
|
279
|
+
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
280
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
281
|
+
return {
|
|
282
|
+
ordinal: result.ordinal ?? null,
|
|
283
|
+
selector: result.selector ?? null,
|
|
284
|
+
frame_selector: result.frame_selector ?? null,
|
|
285
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
286
|
+
...clickCount ? { click_count: clickCount } : {}
|
|
287
|
+
};
|
|
288
|
+
});
|
|
283
289
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
284
290
|
const text_samples = results.filter((result) => result.ok !== false && typeof result.text === "string" && (profileSetupResultAction(result) === "assert_text_visible" || profileSetupResultAction(result) === "assert_text_absent" || profileSetupResultAction(result) === "wait_for_text")).map((result) => ({
|
|
285
291
|
ordinal: result.ordinal ?? null,
|
|
@@ -299,6 +305,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
299
305
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
300
306
|
clicked_total: clickedItems.length,
|
|
301
307
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
308
|
+
click_count_action_total: clickCountValues.length,
|
|
309
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
302
310
|
clicked,
|
|
303
311
|
text_samples,
|
|
304
312
|
failed: failed.map((result) => ({
|
|
@@ -1532,11 +1540,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
|
|
|
1532
1540
|
requiredNetworkMockHitCount(mock)
|
|
1533
1541
|
])),
|
|
1534
1542
|
max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
|
|
1543
|
+
response_hits_by_label: networkMockResponseHitsByLabel(events),
|
|
1535
1544
|
failed
|
|
1536
1545
|
},
|
|
1537
1546
|
message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
|
|
1538
1547
|
};
|
|
1539
1548
|
}
|
|
1549
|
+
function networkMockResponseHitsByLabel(events) {
|
|
1550
|
+
const responseHits = {};
|
|
1551
|
+
for (const event of events) {
|
|
1552
|
+
if (!event || event.ok === false) continue;
|
|
1553
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
1554
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
1555
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
1556
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
1557
|
+
responseHits[label] || (responseHits[label] = {});
|
|
1558
|
+
responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
|
|
1559
|
+
}
|
|
1560
|
+
return responseHits;
|
|
1561
|
+
}
|
|
1540
1562
|
function requiredNetworkMockHitCount(mock) {
|
|
1541
1563
|
if (mock.required === false) return 0;
|
|
1542
1564
|
if (mock.required_hit_count !== void 0) return mock.required_hit_count;
|
|
@@ -1939,14 +1961,22 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
1939
1961
|
viewports: (viewports || []).map((viewport) => {
|
|
1940
1962
|
const results = viewport.setup_action_results || [];
|
|
1941
1963
|
const failed = results.filter((result) => result && result.ok === false);
|
|
1964
|
+
const successfulClicks = results.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false);
|
|
1965
|
+
const clickCountValues = successfulClicks
|
|
1966
|
+
.map((result) => typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined)
|
|
1967
|
+
.filter((value) => value !== undefined);
|
|
1942
1968
|
const clickedItems = results
|
|
1943
1969
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
1944
|
-
.map((result) =>
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1970
|
+
.map((result) => {
|
|
1971
|
+
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : undefined;
|
|
1972
|
+
return {
|
|
1973
|
+
ordinal: result.ordinal ?? null,
|
|
1974
|
+
selector: result.selector ?? null,
|
|
1975
|
+
frame_selector: result.frame_selector ?? null,
|
|
1976
|
+
text: compactProfileSetupSummaryText(result.text),
|
|
1977
|
+
...(clickCount ? { click_count: clickCount } : {}),
|
|
1978
|
+
};
|
|
1979
|
+
});
|
|
1950
1980
|
const clicked = sampleProfileSetupSummaryItems(clickedItems, 8);
|
|
1951
1981
|
const textSamples = results
|
|
1952
1982
|
.filter((result) => result && result.ok !== false && typeof result.text === "string" && (
|
|
@@ -1974,6 +2004,8 @@ function profileSetupSummary(viewports, actionCount) {
|
|
|
1974
2004
|
setup_screenshots: profileSetupScreenshotLabels(results),
|
|
1975
2005
|
clicked_total: clickedItems.length,
|
|
1976
2006
|
clicked_truncated: clickedItems.length > clicked.length,
|
|
2007
|
+
click_count_action_total: clickCountValues.length,
|
|
2008
|
+
click_count_value_total: clickCountValues.reduce((sum, value) => sum + value, 0),
|
|
1977
2009
|
clicked,
|
|
1978
2010
|
text_samples: textSamples,
|
|
1979
2011
|
failed: failed.map((result) => ({
|
|
@@ -2050,11 +2082,21 @@ function assessProfile(profile, evidence) {
|
|
|
2050
2082
|
const hitsByLabel = {};
|
|
2051
2083
|
const requiredHitsByLabel = {};
|
|
2052
2084
|
const maxHitsByLabel = {};
|
|
2085
|
+
const responseHitsByLabel = {};
|
|
2053
2086
|
for (const mock of profile.target.network_mocks) {
|
|
2054
2087
|
hitsByLabel[mock.label] = hitCountForMock(mock);
|
|
2055
2088
|
if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
|
|
2056
2089
|
if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
|
|
2057
2090
|
}
|
|
2091
|
+
for (const event of events) {
|
|
2092
|
+
if (!event || event.ok === false) continue;
|
|
2093
|
+
const label = typeof event.label === "string" ? event.label : "";
|
|
2094
|
+
const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
|
|
2095
|
+
const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
|
|
2096
|
+
if (!label || !responseLabel || !hasSequenceResponse) continue;
|
|
2097
|
+
responseHitsByLabel[label] ||= {};
|
|
2098
|
+
responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
|
|
2099
|
+
}
|
|
2058
2100
|
checks.push({
|
|
2059
2101
|
type: "network_mocks_succeeded",
|
|
2060
2102
|
label: "network mocks succeeded",
|
|
@@ -2066,6 +2108,7 @@ function assessProfile(profile, evidence) {
|
|
|
2066
2108
|
hits_by_label: hitsByLabel,
|
|
2067
2109
|
required_hits_by_label: requiredHitsByLabel,
|
|
2068
2110
|
max_hits_by_label: maxHitsByLabel,
|
|
2111
|
+
response_hits_by_label: responseHitsByLabel,
|
|
2069
2112
|
failed,
|
|
2070
2113
|
},
|
|
2071
2114
|
message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
|
package/dist/profile.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
resolveRiddleProofProfileTimeoutSec,
|
|
20
20
|
slugifyRiddleProofProfileName,
|
|
21
21
|
summarizeRiddleProofProfileResult
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HXYLTNZT.js";
|
|
23
23
|
export {
|
|
24
24
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
25
25
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|