@riddledc/riddle-proof 0.7.185 → 0.7.187
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/cli.cjs +62 -2
- package/dist/cli.js +62 -2
- package/examples/profiles/spa-route-exit-state-hygiene.json +13 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -16384,6 +16384,28 @@ function profileFailedCleanupInventoryReason(setupViewports) {
|
|
|
16384
16384
|
}
|
|
16385
16385
|
return void 0;
|
|
16386
16386
|
}
|
|
16387
|
+
function profileHasRouteExitAffordanceReceipt(receipts) {
|
|
16388
|
+
const affordanceFields = [
|
|
16389
|
+
"navVisibleBeforeExit",
|
|
16390
|
+
"navVisible",
|
|
16391
|
+
"navigationVisible",
|
|
16392
|
+
"exitVisible",
|
|
16393
|
+
"exitControlVisible",
|
|
16394
|
+
"routeExitVisible",
|
|
16395
|
+
"homeLinkVisible"
|
|
16396
|
+
];
|
|
16397
|
+
const routeFields = ["route", "afterRoute", "nextRoute", "browserPath", "path"];
|
|
16398
|
+
return receipts.some((receipt) => {
|
|
16399
|
+
if (affordanceFields.some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0)) return true;
|
|
16400
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
16401
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
16402
|
+
const reason = cliString(receipt.reason) || "";
|
|
16403
|
+
const haystack = `${storedTo} ${summary} ${reason}`.toLowerCase();
|
|
16404
|
+
const mentionsRouteExit = haystack.includes("routeexit") || haystack.includes("route-exit") || haystack.includes("route exit") || haystack.includes("afterrouteexit") || haystack.includes("after route exit");
|
|
16405
|
+
if (!mentionsRouteExit) return false;
|
|
16406
|
+
return routeFields.some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0) || haystack.includes("route=") || haystack.includes("browserpath=");
|
|
16407
|
+
});
|
|
16408
|
+
}
|
|
16387
16409
|
function profilePackReceiptStatus(result, metadata, receipt) {
|
|
16388
16410
|
const text = receipt.toLowerCase();
|
|
16389
16411
|
const setupSummary = profileSetupSummaryRecord(result);
|
|
@@ -16398,6 +16420,7 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
16398
16420
|
...setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "window_call"))
|
|
16399
16421
|
].filter((item) => item.ok !== false);
|
|
16400
16422
|
const clickCount = setupViewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0) + profileSetupReceiptTotal(setupViewports, "click") + profileSetupReceiptTotal(setupViewports, "click_count");
|
|
16423
|
+
const visibleUiActionCount = clickCount + profileSetupReceiptTotal(setupViewports, "tap");
|
|
16401
16424
|
const setupFailureCount = profileSetupFailureCount(setupViewports);
|
|
16402
16425
|
const setupObstructionCount = profileSetupObstructionCount(setupViewports);
|
|
16403
16426
|
const inputDispatchCount = profileSetupReceiptTotal(setupViewports, "drag") + profileSetupReceiptTotal(setupViewports, "tap") + profileSetupReceiptTotal(setupViewports, "press") + profileSetupReceiptTotal(setupViewports, "keyboard_sequence");
|
|
@@ -16432,6 +16455,7 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
16432
16455
|
const hasTextVisibility = profileHasPassedCheck(result, ["text_visible", "selector_text_visible", "selector_visible"]);
|
|
16433
16456
|
const hasTextAbsence = profileHasPassedCheck(result, ["text_absent", "selector_text_absent"]);
|
|
16434
16457
|
const hasMeasuredStateChange = hasNaturalInput || hasCanvasChange || valueReceipts.some((item) => setupReturnSummaryValue(item, ["changed"]) === true || setupReturnSummaryValue(item, ["nonWhiteDelta", "darkDelta", "pixelDelta", "movementDelta"]) !== void 0);
|
|
16458
|
+
const hasRouteExitAffordanceReceipt = profileHasRouteExitAffordanceReceipt(valueReceipts);
|
|
16435
16459
|
const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
|
|
16436
16460
|
if (text.includes("artifact link") || text.includes("artifact path")) {
|
|
16437
16461
|
return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
|
|
@@ -16470,6 +16494,20 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
16470
16494
|
if (text.includes("invalid state")) {
|
|
16471
16495
|
return profileReceiptSignalStatus(hasStateContract || hasInvalidStateReceipt, "invalid-state receipt present", "invalid-state receipt missing");
|
|
16472
16496
|
}
|
|
16497
|
+
if (text.includes("through visible ui") || text.includes("visible ui action") || text.includes("ui-routed") || text.includes("ui routed") || text.includes("visible") && text.includes("route") && text.includes("exit") && text.includes("action") || text.includes("visible") && text.includes("mode") && text.includes("exit") && text.includes("action")) {
|
|
16498
|
+
return profileReceiptSignalStatus(
|
|
16499
|
+
visibleUiActionCount > 0,
|
|
16500
|
+
"visible UI action receipt present",
|
|
16501
|
+
"visible UI action receipt missing"
|
|
16502
|
+
);
|
|
16503
|
+
}
|
|
16504
|
+
if (text.includes("route-exit affordance") || text.includes("route exit affordance") || text.includes("navigation before cleanup") || text.includes("exit control")) {
|
|
16505
|
+
return profileReceiptSignalStatus(
|
|
16506
|
+
hasRouteExitAffordanceReceipt || hasStateContract || clickCount > 0,
|
|
16507
|
+
"route-exit affordance receipt present",
|
|
16508
|
+
"affordance receipt missing"
|
|
16509
|
+
);
|
|
16510
|
+
}
|
|
16473
16511
|
if (text.includes("retry") || text.includes("repair") || text.includes("reset") || text.includes("affordance")) {
|
|
16474
16512
|
return profileReceiptSignalStatus(hasStateContract || clickCount > 0, "affordance or transition receipt present", "affordance receipt missing");
|
|
16475
16513
|
}
|
|
@@ -16548,9 +16586,31 @@ function profilePackMetadataMarkdown(result) {
|
|
|
16548
16586
|
].filter(Boolean);
|
|
16549
16587
|
if (packParts.length) lines.push(`- pack: ${packParts.join(" - ")}`);
|
|
16550
16588
|
if (requiredReceipts.length) {
|
|
16589
|
+
const receiptStatuses = requiredReceipts.map((receipt) => ({
|
|
16590
|
+
receipt,
|
|
16591
|
+
item: profilePackReceiptStatus(result, metadata, receipt)
|
|
16592
|
+
}));
|
|
16593
|
+
const missingReceipts = receiptStatuses.filter(({ item }) => item.status === "missing").map(({ receipt }) => receipt);
|
|
16594
|
+
const failedReceipts = receiptStatuses.filter(({ item }) => item.status === "failed").map(({ receipt }) => receipt);
|
|
16595
|
+
const manualCount = receiptStatuses.filter(({ item }) => item.status === "manual").length;
|
|
16596
|
+
const presentCount = receiptStatuses.filter(({ item }) => item.status === "present").length;
|
|
16597
|
+
const completenessParts = [
|
|
16598
|
+
`${presentCount} present`,
|
|
16599
|
+
manualCount ? `${manualCount} manual` : "",
|
|
16600
|
+
missingReceipts.length ? `${missingReceipts.length} missing` : "",
|
|
16601
|
+
failedReceipts.length ? `${failedReceipts.length} failed` : ""
|
|
16602
|
+
].filter(Boolean);
|
|
16603
|
+
lines.push(`- pack completeness: ${missingReceipts.length || failedReceipts.length ? "incomplete" : "complete"} (${completenessParts.join(", ")})`);
|
|
16604
|
+
if (missingReceipts.length) {
|
|
16605
|
+
const listed = missingReceipts.slice(0, 5).map((receipt) => markdownInlineCode(receipt, 120)).join(", ");
|
|
16606
|
+
lines.push(`- missing required receipts: ${listed}${missingReceipts.length > 5 ? `, ${missingReceipts.length - 5} more` : ""}`);
|
|
16607
|
+
}
|
|
16608
|
+
if (failedReceipts.length) {
|
|
16609
|
+
const listed = failedReceipts.slice(0, 5).map((receipt) => markdownInlineCode(receipt, 120)).join(", ");
|
|
16610
|
+
lines.push(`- failed required receipts: ${listed}${failedReceipts.length > 5 ? `, ${failedReceipts.length - 5} more` : ""}`);
|
|
16611
|
+
}
|
|
16551
16612
|
lines.push(`- required receipts: ${requiredReceipts.length}`);
|
|
16552
|
-
for (const receipt of
|
|
16553
|
-
const item = profilePackReceiptStatus(result, metadata, receipt);
|
|
16613
|
+
for (const { receipt, item } of receiptStatuses.slice(0, 20)) {
|
|
16554
16614
|
lines.push(` - ${item.status}: ${receipt} (${item.reason})`);
|
|
16555
16615
|
}
|
|
16556
16616
|
if (requiredReceipts.length > 20) lines.push(` - ${requiredReceipts.length - 20} additional required receipt(s) omitted.`);
|
package/dist/cli.js
CHANGED
|
@@ -589,6 +589,28 @@ function profileFailedCleanupInventoryReason(setupViewports) {
|
|
|
589
589
|
}
|
|
590
590
|
return void 0;
|
|
591
591
|
}
|
|
592
|
+
function profileHasRouteExitAffordanceReceipt(receipts) {
|
|
593
|
+
const affordanceFields = [
|
|
594
|
+
"navVisibleBeforeExit",
|
|
595
|
+
"navVisible",
|
|
596
|
+
"navigationVisible",
|
|
597
|
+
"exitVisible",
|
|
598
|
+
"exitControlVisible",
|
|
599
|
+
"routeExitVisible",
|
|
600
|
+
"homeLinkVisible"
|
|
601
|
+
];
|
|
602
|
+
const routeFields = ["route", "afterRoute", "nextRoute", "browserPath", "path"];
|
|
603
|
+
return receipts.some((receipt) => {
|
|
604
|
+
if (affordanceFields.some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0)) return true;
|
|
605
|
+
const storedTo = cliString(receipt.return_stored_to) || "";
|
|
606
|
+
const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
|
|
607
|
+
const reason = cliString(receipt.reason) || "";
|
|
608
|
+
const haystack = `${storedTo} ${summary} ${reason}`.toLowerCase();
|
|
609
|
+
const mentionsRouteExit = haystack.includes("routeexit") || haystack.includes("route-exit") || haystack.includes("route exit") || haystack.includes("afterrouteexit") || haystack.includes("after route exit");
|
|
610
|
+
if (!mentionsRouteExit) return false;
|
|
611
|
+
return routeFields.some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0) || haystack.includes("route=") || haystack.includes("browserpath=");
|
|
612
|
+
});
|
|
613
|
+
}
|
|
592
614
|
function profilePackReceiptStatus(result, metadata, receipt) {
|
|
593
615
|
const text = receipt.toLowerCase();
|
|
594
616
|
const setupSummary = profileSetupSummaryRecord(result);
|
|
@@ -603,6 +625,7 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
603
625
|
...setupViewports.flatMap((viewport) => setupReceiptArray(viewport, "window_call"))
|
|
604
626
|
].filter((item) => item.ok !== false);
|
|
605
627
|
const clickCount = setupViewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0) + profileSetupReceiptTotal(setupViewports, "click") + profileSetupReceiptTotal(setupViewports, "click_count");
|
|
628
|
+
const visibleUiActionCount = clickCount + profileSetupReceiptTotal(setupViewports, "tap");
|
|
606
629
|
const setupFailureCount = profileSetupFailureCount(setupViewports);
|
|
607
630
|
const setupObstructionCount = profileSetupObstructionCount(setupViewports);
|
|
608
631
|
const inputDispatchCount = profileSetupReceiptTotal(setupViewports, "drag") + profileSetupReceiptTotal(setupViewports, "tap") + profileSetupReceiptTotal(setupViewports, "press") + profileSetupReceiptTotal(setupViewports, "keyboard_sequence");
|
|
@@ -637,6 +660,7 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
637
660
|
const hasTextVisibility = profileHasPassedCheck(result, ["text_visible", "selector_text_visible", "selector_visible"]);
|
|
638
661
|
const hasTextAbsence = profileHasPassedCheck(result, ["text_absent", "selector_text_absent"]);
|
|
639
662
|
const hasMeasuredStateChange = hasNaturalInput || hasCanvasChange || valueReceipts.some((item) => setupReturnSummaryValue(item, ["changed"]) === true || setupReturnSummaryValue(item, ["nonWhiteDelta", "darkDelta", "pixelDelta", "movementDelta"]) !== void 0);
|
|
663
|
+
const hasRouteExitAffordanceReceipt = profileHasRouteExitAffordanceReceipt(valueReceipts);
|
|
640
664
|
const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
|
|
641
665
|
if (text.includes("artifact link") || text.includes("artifact path")) {
|
|
642
666
|
return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
|
|
@@ -675,6 +699,20 @@ function profilePackReceiptStatus(result, metadata, receipt) {
|
|
|
675
699
|
if (text.includes("invalid state")) {
|
|
676
700
|
return profileReceiptSignalStatus(hasStateContract || hasInvalidStateReceipt, "invalid-state receipt present", "invalid-state receipt missing");
|
|
677
701
|
}
|
|
702
|
+
if (text.includes("through visible ui") || text.includes("visible ui action") || text.includes("ui-routed") || text.includes("ui routed") || text.includes("visible") && text.includes("route") && text.includes("exit") && text.includes("action") || text.includes("visible") && text.includes("mode") && text.includes("exit") && text.includes("action")) {
|
|
703
|
+
return profileReceiptSignalStatus(
|
|
704
|
+
visibleUiActionCount > 0,
|
|
705
|
+
"visible UI action receipt present",
|
|
706
|
+
"visible UI action receipt missing"
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
if (text.includes("route-exit affordance") || text.includes("route exit affordance") || text.includes("navigation before cleanup") || text.includes("exit control")) {
|
|
710
|
+
return profileReceiptSignalStatus(
|
|
711
|
+
hasRouteExitAffordanceReceipt || hasStateContract || clickCount > 0,
|
|
712
|
+
"route-exit affordance receipt present",
|
|
713
|
+
"affordance receipt missing"
|
|
714
|
+
);
|
|
715
|
+
}
|
|
678
716
|
if (text.includes("retry") || text.includes("repair") || text.includes("reset") || text.includes("affordance")) {
|
|
679
717
|
return profileReceiptSignalStatus(hasStateContract || clickCount > 0, "affordance or transition receipt present", "affordance receipt missing");
|
|
680
718
|
}
|
|
@@ -753,9 +791,31 @@ function profilePackMetadataMarkdown(result) {
|
|
|
753
791
|
].filter(Boolean);
|
|
754
792
|
if (packParts.length) lines.push(`- pack: ${packParts.join(" - ")}`);
|
|
755
793
|
if (requiredReceipts.length) {
|
|
794
|
+
const receiptStatuses = requiredReceipts.map((receipt) => ({
|
|
795
|
+
receipt,
|
|
796
|
+
item: profilePackReceiptStatus(result, metadata, receipt)
|
|
797
|
+
}));
|
|
798
|
+
const missingReceipts = receiptStatuses.filter(({ item }) => item.status === "missing").map(({ receipt }) => receipt);
|
|
799
|
+
const failedReceipts = receiptStatuses.filter(({ item }) => item.status === "failed").map(({ receipt }) => receipt);
|
|
800
|
+
const manualCount = receiptStatuses.filter(({ item }) => item.status === "manual").length;
|
|
801
|
+
const presentCount = receiptStatuses.filter(({ item }) => item.status === "present").length;
|
|
802
|
+
const completenessParts = [
|
|
803
|
+
`${presentCount} present`,
|
|
804
|
+
manualCount ? `${manualCount} manual` : "",
|
|
805
|
+
missingReceipts.length ? `${missingReceipts.length} missing` : "",
|
|
806
|
+
failedReceipts.length ? `${failedReceipts.length} failed` : ""
|
|
807
|
+
].filter(Boolean);
|
|
808
|
+
lines.push(`- pack completeness: ${missingReceipts.length || failedReceipts.length ? "incomplete" : "complete"} (${completenessParts.join(", ")})`);
|
|
809
|
+
if (missingReceipts.length) {
|
|
810
|
+
const listed = missingReceipts.slice(0, 5).map((receipt) => markdownInlineCode(receipt, 120)).join(", ");
|
|
811
|
+
lines.push(`- missing required receipts: ${listed}${missingReceipts.length > 5 ? `, ${missingReceipts.length - 5} more` : ""}`);
|
|
812
|
+
}
|
|
813
|
+
if (failedReceipts.length) {
|
|
814
|
+
const listed = failedReceipts.slice(0, 5).map((receipt) => markdownInlineCode(receipt, 120)).join(", ");
|
|
815
|
+
lines.push(`- failed required receipts: ${listed}${failedReceipts.length > 5 ? `, ${failedReceipts.length - 5} more` : ""}`);
|
|
816
|
+
}
|
|
756
817
|
lines.push(`- required receipts: ${requiredReceipts.length}`);
|
|
757
|
-
for (const receipt of
|
|
758
|
-
const item = profilePackReceiptStatus(result, metadata, receipt);
|
|
818
|
+
for (const { receipt, item } of receiptStatuses.slice(0, 20)) {
|
|
759
819
|
lines.push(` - ${item.status}: ${receipt} (${item.reason})`);
|
|
760
820
|
}
|
|
761
821
|
if (requiredReceipts.length > 20) lines.push(` - ${requiredReceipts.length - 20} additional required receipt(s) omitted.`);
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"label": "capture-route-active-state",
|
|
22
22
|
"timeout_ms": 10000,
|
|
23
23
|
"store_return_to": "__rpRouteExit.active",
|
|
24
|
-
"script": "const proof=window.__exampleRouteProof?.read?.()||{};const watched=['__exampleRouteProof','__exampleProofLastReceipt','exampleTouchState'];const activeGlobals=watched.filter((name)=>
|
|
24
|
+
"script": "const proof=window.__exampleRouteProof?.read?.()||{};const watched=['__exampleRouteProof','__exampleProofLastReceipt','exampleTouchState'];const activeGlobals=watched.filter((name)=>window[name]!==undefined);const out={ready:proof.ready===true,route:location.pathname,activeGlobals,activeGlobalCount:activeGlobals.length,receiptId:String(proof.receiptId||''),mode:String(proof.mode||'')};out.ok=out.ready===true&&out.activeGlobalCount>0;window.__rpRouteExit={...(window.__rpRouteExit||{}),active:out};return out;",
|
|
25
25
|
"return_summary_fields": [
|
|
26
26
|
{ "path": "ok" },
|
|
27
27
|
{ "path": "ready" },
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"label": "capture-route-exit-cleanup",
|
|
40
40
|
"timeout_ms": 10000,
|
|
41
41
|
"store_return_to": "__rpRouteExit.cleanup",
|
|
42
|
-
"script": "const watched=['__exampleRouteProof','__exampleProofLastReceipt','exampleTouchState'];const staleNames=watched.filter((name)=>
|
|
42
|
+
"script": "const watched=['__exampleRouteProof','__exampleProofLastReceipt','exampleTouchState'];const staleNames=watched.filter((name)=>window[name]!==undefined);const out={ok:location.pathname==='/'&&staleNames.length===0,route:location.pathname,staleNames,staleCount:staleNames.length};window.__rpRouteExit={...(window.__rpRouteExit||{}),cleanup:out};return out;",
|
|
43
43
|
"return_summary_fields": [
|
|
44
44
|
{ "path": "ok" },
|
|
45
45
|
{ "path": "route" },
|
|
@@ -71,6 +71,17 @@
|
|
|
71
71
|
"product_regression": "fail"
|
|
72
72
|
},
|
|
73
73
|
"metadata": {
|
|
74
|
+
"pack_id": "state_hygiene",
|
|
75
|
+
"pack_public_name": "State Hygiene Pack",
|
|
76
|
+
"required_receipts": [
|
|
77
|
+
"active route-local proof helpers and route state receipt",
|
|
78
|
+
"route-exit affordance inventory before cleanup",
|
|
79
|
+
"route or mode exit action receipt through visible UI",
|
|
80
|
+
"post-cleanup stale-state inventory after route cleanup",
|
|
81
|
+
"screenshots at active and post-cleanup boundaries",
|
|
82
|
+
"console and warning accounting",
|
|
83
|
+
"proof JSON and artifact links"
|
|
84
|
+
],
|
|
74
85
|
"purpose": "Template for SPA route-exit hygiene profiles. Replace the example route, selectors, and watched globals with route-local proof helpers, receipts, timers, input state, or touch state that must exist while the feature route is active and must be removed after visible UI navigation returns home."
|
|
75
86
|
}
|
|
76
87
|
}
|