@riddledc/riddle-proof 0.8.56 → 0.8.58
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/{chunk-6KYXX4OE.js → chunk-62XLYPMS.js} +93 -2
- package/dist/chunk-KG64Y5MC.js +155 -0
- package/dist/{chunk-54DIEDR3.js → chunk-ONOPGCID.js} +1 -1
- package/dist/cli/index.js +3 -2
- package/dist/cli.cjs +266 -27
- package/dist/cli.js +3 -2
- package/dist/index.cjs +554 -313
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/dist/pr-comment.cjs +268 -27
- package/dist/pr-comment.d.cts +21 -1
- package/dist/pr-comment.d.ts +21 -1
- package/dist/pr-comment.js +2 -1
- package/dist/public-state.cjs +179 -0
- package/dist/public-state.d.cts +29 -0
- package/dist/public-state.d.ts +29 -0
- package/dist/public-state.js +7 -0
- package/dist/spec/index.cjs +156 -2
- package/dist/spec/index.d.cts +1 -0
- package/dist/spec/index.d.ts +1 -0
- package/dist/spec/index.js +5 -1
- package/dist/spec/public-state.cjs +181 -0
- package/dist/spec/public-state.d.cts +1 -0
- package/dist/spec/public-state.d.ts +1 -0
- package/dist/spec/public-state.js +7 -0
- package/package.json +12 -2
package/dist/index.cjs
CHANGED
|
@@ -1609,7 +1609,7 @@ function normalizeStageRequest(state, requestedAdvanceStage) {
|
|
|
1609
1609
|
if (!state?.recon_results || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) return "recon";
|
|
1610
1610
|
return null;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1612
|
+
function stringValue2(value) {
|
|
1613
1613
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
1614
1614
|
}
|
|
1615
1615
|
function commandResult(command, args, cwd, timeout = 6e4) {
|
|
@@ -1632,7 +1632,7 @@ function repoDirForSync(state) {
|
|
|
1632
1632
|
state?.repo_dir,
|
|
1633
1633
|
state?.after_worktree,
|
|
1634
1634
|
state?.before_worktree
|
|
1635
|
-
].map(
|
|
1635
|
+
].map(stringValue2).filter(Boolean);
|
|
1636
1636
|
return candidates.find((candidate) => (0, import_node_fs2.existsSync)(import_node_path2.default.join(candidate, ".git"))) || "";
|
|
1637
1637
|
}
|
|
1638
1638
|
function parseWorktreeList(output) {
|
|
@@ -1752,32 +1752,32 @@ function baseCheckoutReport(repoDir, baseBranch, updateRequested, updateAllowed)
|
|
|
1752
1752
|
return report;
|
|
1753
1753
|
}
|
|
1754
1754
|
function normalizeGhPrStatus(value) {
|
|
1755
|
-
const status =
|
|
1755
|
+
const status = stringValue2(value).toLowerCase();
|
|
1756
1756
|
if (status === "merged") return "merged";
|
|
1757
1757
|
if (status === "open") return "open";
|
|
1758
1758
|
if (status === "closed") return "closed";
|
|
1759
1759
|
return status || "unknown";
|
|
1760
1760
|
}
|
|
1761
1761
|
function prRefFromState(state) {
|
|
1762
|
-
return
|
|
1762
|
+
return stringValue2(state?.pr_number) || stringValue2(state?.pr_url);
|
|
1763
1763
|
}
|
|
1764
1764
|
function prNumberFromUrl(url) {
|
|
1765
1765
|
const match = url.match(/\/pull\/(\d+)(?:$|[?#])/);
|
|
1766
1766
|
return match?.[1] || "";
|
|
1767
1767
|
}
|
|
1768
1768
|
function normalizePrState(raw, state, checkedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
1769
|
-
const mergeCommit = typeof raw?.mergeCommit === "object" && raw.mergeCommit ?
|
|
1770
|
-
const url =
|
|
1769
|
+
const mergeCommit = typeof raw?.mergeCommit === "object" && raw.mergeCommit ? stringValue2(raw.mergeCommit.oid) : stringValue2(raw?.mergeCommit);
|
|
1770
|
+
const url = stringValue2(raw?.url) || stringValue2(state?.pr_url);
|
|
1771
1771
|
return {
|
|
1772
1772
|
status: normalizeGhPrStatus(raw?.state),
|
|
1773
1773
|
pr_url: url || null,
|
|
1774
1774
|
pr_number: String(raw?.number || state?.pr_number || prNumberFromUrl(url) || ""),
|
|
1775
|
-
repo:
|
|
1776
|
-
head_branch:
|
|
1777
|
-
base_branch:
|
|
1775
|
+
repo: stringValue2(state?.repo) || null,
|
|
1776
|
+
head_branch: stringValue2(raw?.headRefName) || stringValue2(state?.target_branch) || stringValue2(state?.branch) || null,
|
|
1777
|
+
base_branch: stringValue2(raw?.baseRefName) || stringValue2(state?.base_branch) || "main",
|
|
1778
1778
|
merge_commit: mergeCommit || null,
|
|
1779
|
-
merged_at:
|
|
1780
|
-
closed_at:
|
|
1779
|
+
merged_at: stringValue2(raw?.mergedAt) || null,
|
|
1780
|
+
closed_at: stringValue2(raw?.closedAt) || null,
|
|
1781
1781
|
checked_at: checkedAt,
|
|
1782
1782
|
source: "gh"
|
|
1783
1783
|
};
|
|
@@ -1794,7 +1794,7 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
|
|
|
1794
1794
|
branch_delete_errors: [],
|
|
1795
1795
|
pruned: false
|
|
1796
1796
|
};
|
|
1797
|
-
const baseBranch =
|
|
1797
|
+
const baseBranch = stringValue2(prState.base_branch) || stringValue2(state?.base_branch) || "main";
|
|
1798
1798
|
let fetchedBase = params.fetch_base === false;
|
|
1799
1799
|
if (params.fetch_base !== false && baseBranch) {
|
|
1800
1800
|
const fetch2 = commandResult("git", ["fetch", "origin", baseBranch], repoDir, 12e4);
|
|
@@ -1812,7 +1812,7 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
const removed = [];
|
|
1814
1814
|
const removeErrors = [];
|
|
1815
|
-
for (const candidate of [state?.before_worktree, state?.after_worktree].map(
|
|
1815
|
+
for (const candidate of [state?.before_worktree, state?.after_worktree].map(stringValue2).filter(Boolean)) {
|
|
1816
1816
|
if (!(0, import_node_fs2.existsSync)(candidate) || import_node_path2.default.resolve(candidate) === import_node_path2.default.resolve(repoDir)) continue;
|
|
1817
1817
|
const remove = commandResult("git", ["worktree", "remove", "--force", candidate], repoDir, 12e4);
|
|
1818
1818
|
if (remove.ok) {
|
|
@@ -1823,7 +1823,7 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
cleanup.worktrees_removed = removed;
|
|
1825
1825
|
cleanup.worktree_remove_errors = removeErrors;
|
|
1826
|
-
const afterBranch =
|
|
1826
|
+
const afterBranch = stringValue2(state?.after_worktree_branch);
|
|
1827
1827
|
if (afterBranch.startsWith("riddle-proof/")) {
|
|
1828
1828
|
const deleted = commandResult("git", ["branch", "-D", afterBranch], repoDir, 6e4);
|
|
1829
1829
|
if (deleted.ok) {
|
|
@@ -1859,7 +1859,7 @@ function syncPrLifecycle(statePath, params) {
|
|
|
1859
1859
|
const prState2 = {
|
|
1860
1860
|
status: missingPr ? "orphaned" : "unavailable",
|
|
1861
1861
|
pr_url: state.pr_url || null,
|
|
1862
|
-
pr_number: String(state.pr_number || prNumberFromUrl(
|
|
1862
|
+
pr_number: String(state.pr_number || prNumberFromUrl(stringValue2(state.pr_url)) || ""),
|
|
1863
1863
|
repo: state.repo || null,
|
|
1864
1864
|
head_branch: state.target_branch || state.branch || null,
|
|
1865
1865
|
base_branch: state.base_branch || "main",
|
|
@@ -1888,7 +1888,7 @@ function syncPrLifecycle(statePath, params) {
|
|
|
1888
1888
|
const prState2 = {
|
|
1889
1889
|
status: "unavailable",
|
|
1890
1890
|
pr_url: state.pr_url || null,
|
|
1891
|
-
pr_number: String(state.pr_number || prNumberFromUrl(
|
|
1891
|
+
pr_number: String(state.pr_number || prNumberFromUrl(stringValue2(state.pr_url)) || ""),
|
|
1892
1892
|
repo: state.repo || null,
|
|
1893
1893
|
head_branch: state.target_branch || state.branch || null,
|
|
1894
1894
|
base_branch: state.base_branch || "main",
|
|
@@ -2669,8 +2669,8 @@ ${implementRes.stdout || ""}
|
|
|
2669
2669
|
${implementRes.stderr || ""}`;
|
|
2670
2670
|
if (implementError.includes("No implementation detected")) {
|
|
2671
2671
|
const implementationState = readState(config.statePath) || {};
|
|
2672
|
-
const implementationSummary =
|
|
2673
|
-
const implementationDetectionSummary =
|
|
2672
|
+
const implementationSummary = stringValue2(implementationState?.implementation_summary) || null;
|
|
2673
|
+
const implementationDetectionSummary = stringValue2(implementationState?.implementation_detection_summary) || null;
|
|
2674
2674
|
const implementationDetection = implementationState?.implementation_detection && typeof implementationState.implementation_detection === "object" && !Array.isArray(implementationState.implementation_detection) ? implementationState.implementation_detection : null;
|
|
2675
2675
|
recordAttempt("implement", "checkpoint", "Implementation checkpoint found no material code changes yet.", {
|
|
2676
2676
|
checkpoint: "implement_changes_missing",
|
|
@@ -2788,14 +2788,14 @@ ${implementRes.stderr || ""}`;
|
|
|
2788
2788
|
const captureQuality = verifyDecisionRequest2?.capture_quality || {};
|
|
2789
2789
|
const conclusiveVerifyBlockers2 = proofAssessmentHardBlockersForState({
|
|
2790
2790
|
...failedVerifyState,
|
|
2791
|
-
structured_interaction_capture_failure_summary:
|
|
2792
|
-
structured_interaction_failure_summary:
|
|
2791
|
+
structured_interaction_capture_failure_summary: stringValue2(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_capture_failure_summary) || void 0,
|
|
2792
|
+
structured_interaction_failure_summary: stringValue2(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_failure_summary) || void 0
|
|
2793
2793
|
});
|
|
2794
|
-
const structuredInteractionFailureSummary2 =
|
|
2794
|
+
const structuredInteractionFailureSummary2 = stringValue2(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue2(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_capture_failure_summary) || stringValue2(failedVerifyState?.structured_interaction_failure_summary) || stringValue2(conclusiveVerifyBlockers2[0]);
|
|
2795
2795
|
const captureTerminalBlocker = failedVerifyStatus === "capture_error" || conclusiveVerifyBlockers2.length > 0 || Boolean(structuredInteractionFailureSummary2) || captureQuality?.terminal_blocker === true || captureQuality?.blocking === true;
|
|
2796
|
-
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ?
|
|
2796
|
+
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue2(captureQuality?.summary) : "";
|
|
2797
2797
|
const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
|
|
2798
|
-
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary2 ||
|
|
2798
|
+
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary2 || stringValue2(verifyDecisionRequest2?.summary) || stringValue2(failedVerifyState?.verify_summary) || stringValue2(failedVerifyState?.proof_summary) || stringValue2(verifyRes.error) || "Verify capture failed before the evidence could be judged.";
|
|
2799
2799
|
const failedVerifyDetails = {
|
|
2800
2800
|
executed,
|
|
2801
2801
|
verifyStatus: failedVerifyStatus,
|
|
@@ -2873,10 +2873,10 @@ ${implementRes.stderr || ""}`;
|
|
|
2873
2873
|
};
|
|
2874
2874
|
const conclusiveVerifyBlockers = proofAssessmentHardBlockersForState({
|
|
2875
2875
|
...state,
|
|
2876
|
-
structured_interaction_capture_failure_summary:
|
|
2877
|
-
structured_interaction_failure_summary:
|
|
2876
|
+
structured_interaction_capture_failure_summary: stringValue2(verifyDecisionRequest?.structured_interaction_capture_failure_summary) || stringValue2(state?.structured_interaction_capture_failure_summary) || void 0,
|
|
2877
|
+
structured_interaction_failure_summary: stringValue2(verifyDecisionRequest?.structured_interaction_failure_summary) || stringValue2(state?.structured_interaction_failure_summary) || void 0
|
|
2878
2878
|
});
|
|
2879
|
-
const structuredInteractionFailureSummary =
|
|
2879
|
+
const structuredInteractionFailureSummary = stringValue2(verifyDecisionRequest?.structured_interaction_capture_failure_summary) || stringValue2(verifyDecisionRequest?.structured_interaction_failure_summary) || stringValue2(state?.structured_interaction_capture_failure_summary) || stringValue2(state?.structured_interaction_failure_summary) || stringValue2(conclusiveVerifyBlockers[0]);
|
|
2880
2880
|
if (verifyStatus !== "evidence_captured") {
|
|
2881
2881
|
const captureQuality = verifyDecisionRequest?.capture_quality || {};
|
|
2882
2882
|
const captureTerminalBlocker = conclusiveVerifyBlockers.length > 0 || Boolean(structuredInteractionFailureSummary) || captureQuality?.terminal_blocker === true || captureQuality?.blocking === true;
|
|
@@ -2888,9 +2888,9 @@ ${implementRes.stderr || ""}`;
|
|
|
2888
2888
|
});
|
|
2889
2889
|
state = readState(config.statePath);
|
|
2890
2890
|
}
|
|
2891
|
-
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ?
|
|
2891
|
+
const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue2(captureQuality?.summary) : "";
|
|
2892
2892
|
const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
|
|
2893
|
-
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary ||
|
|
2893
|
+
const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary || stringValue2(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
|
|
2894
2894
|
recordAttempt("verify", "checkpoint", summary, {
|
|
2895
2895
|
autoApproved: verifyRes.autoApproved || false,
|
|
2896
2896
|
checkpoint: checkpointName,
|
|
@@ -3535,6 +3535,7 @@ __export(index_exports, {
|
|
|
3535
3535
|
summarizeCaptureArtifacts: () => summarizeCaptureArtifacts,
|
|
3536
3536
|
summarizeRiddleProofPrComment: () => summarizeRiddleProofPrComment,
|
|
3537
3537
|
summarizeRiddleProofProfileResult: () => summarizeRiddleProofProfileResult,
|
|
3538
|
+
summarizeRiddleProofPublicState: () => summarizeRiddleProofPublicState,
|
|
3538
3539
|
visualSessionFingerprint: () => visualSessionFingerprint,
|
|
3539
3540
|
visualSessionFingerprintBasis: () => visualSessionFingerprintBasis
|
|
3540
3541
|
});
|
|
@@ -5077,6 +5078,158 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
|
|
|
5077
5078
|
return state;
|
|
5078
5079
|
}
|
|
5079
5080
|
|
|
5081
|
+
// src/public-state.ts
|
|
5082
|
+
function asRecord(value) {
|
|
5083
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
5084
|
+
}
|
|
5085
|
+
function stringValue(value) {
|
|
5086
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
5087
|
+
}
|
|
5088
|
+
function booleanValue(value) {
|
|
5089
|
+
return typeof value === "boolean" ? value : void 0;
|
|
5090
|
+
}
|
|
5091
|
+
function numberValue(value) {
|
|
5092
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
5093
|
+
}
|
|
5094
|
+
function firstStringValue(...values) {
|
|
5095
|
+
for (const value of values) {
|
|
5096
|
+
const text = stringValue(value);
|
|
5097
|
+
if (text) return text;
|
|
5098
|
+
}
|
|
5099
|
+
return void 0;
|
|
5100
|
+
}
|
|
5101
|
+
function firstBooleanValue(...values) {
|
|
5102
|
+
for (const value of values) {
|
|
5103
|
+
const bool = booleanValue(value);
|
|
5104
|
+
if (typeof bool === "boolean") return bool;
|
|
5105
|
+
}
|
|
5106
|
+
return void 0;
|
|
5107
|
+
}
|
|
5108
|
+
function firstRecordValue(...values) {
|
|
5109
|
+
for (const value of values) {
|
|
5110
|
+
const record = asRecord(value);
|
|
5111
|
+
if (Object.keys(record).length) return record;
|
|
5112
|
+
}
|
|
5113
|
+
return void 0;
|
|
5114
|
+
}
|
|
5115
|
+
function countValue(value) {
|
|
5116
|
+
const number = numberValue(value);
|
|
5117
|
+
return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
|
|
5118
|
+
}
|
|
5119
|
+
function checkpointSummaryFrom(...values) {
|
|
5120
|
+
const record = firstRecordValue(...values);
|
|
5121
|
+
if (!record) return void 0;
|
|
5122
|
+
const accepted = countValue(record.response_count);
|
|
5123
|
+
const rejected = countValue(record.rejected_response_count);
|
|
5124
|
+
const ignored = countValue(record.ignored_response_count);
|
|
5125
|
+
const duplicate = countValue(record.duplicate_response_count);
|
|
5126
|
+
const summary = {
|
|
5127
|
+
pending: booleanValue(record.pending),
|
|
5128
|
+
accepted_response_count: accepted,
|
|
5129
|
+
rejected_response_count: rejected,
|
|
5130
|
+
ignored_response_count: ignored,
|
|
5131
|
+
duplicate_response_count: duplicate,
|
|
5132
|
+
latest_decision: stringValue(record.latest_decision),
|
|
5133
|
+
audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
|
|
5134
|
+
};
|
|
5135
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
5136
|
+
}
|
|
5137
|
+
function uniqueStrings(values) {
|
|
5138
|
+
return [...new Set(values.filter(Boolean))];
|
|
5139
|
+
}
|
|
5140
|
+
function summarizeRiddleProofPublicState(input) {
|
|
5141
|
+
const record = asRecord(input);
|
|
5142
|
+
const runCard = asRecord(record.run_card);
|
|
5143
|
+
const stopCondition = asRecord(runCard.stop_condition);
|
|
5144
|
+
const raw = asRecord(record.raw);
|
|
5145
|
+
const request = asRecord(record.request);
|
|
5146
|
+
const requestMetadata = asRecord(record.request_metadata);
|
|
5147
|
+
const prState = asRecord(record.pr_state);
|
|
5148
|
+
const handoff = asRecord(record.pr_handoff_policy);
|
|
5149
|
+
const handoffState = stringValue(handoff.state);
|
|
5150
|
+
const status = firstStringValue(record.status, stopCondition.status);
|
|
5151
|
+
const ok = booleanValue(record.ok) ?? null;
|
|
5152
|
+
const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
|
|
5153
|
+
const explicitShippingDisabled = firstBooleanValue(
|
|
5154
|
+
record.shipping_disabled,
|
|
5155
|
+
stopCondition.shipping_disabled,
|
|
5156
|
+
raw.shipping_disabled,
|
|
5157
|
+
handoff.shipping_disabled
|
|
5158
|
+
);
|
|
5159
|
+
const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
|
|
5160
|
+
const explicitShipAuthorized = firstBooleanValue(
|
|
5161
|
+
record.ship_authorized,
|
|
5162
|
+
stopCondition.ship_authorized,
|
|
5163
|
+
raw.ship_authorized
|
|
5164
|
+
);
|
|
5165
|
+
const authorizationEvidence = Boolean(
|
|
5166
|
+
status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
|
|
5167
|
+
);
|
|
5168
|
+
const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
|
|
5169
|
+
const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
|
|
5170
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
|
|
5171
|
+
const shipHeld = explicitShipHeld === true || inferredHeld;
|
|
5172
|
+
const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
|
|
5173
|
+
const proofComplete = Boolean(
|
|
5174
|
+
status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
|
|
5175
|
+
);
|
|
5176
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
5177
|
+
record.checkpoint_summary,
|
|
5178
|
+
stopCondition.checkpoint_summary,
|
|
5179
|
+
asRecord(record.details).checkpoint_summary,
|
|
5180
|
+
asRecord(raw.details).checkpoint_summary
|
|
5181
|
+
);
|
|
5182
|
+
const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
|
|
5183
|
+
const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
|
|
5184
|
+
const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
|
|
5185
|
+
const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
|
|
5186
|
+
const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
|
|
5187
|
+
const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
|
|
5188
|
+
const syncAllowed = mergeReady;
|
|
5189
|
+
let policyState = "unknown";
|
|
5190
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
|
|
5191
|
+
else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
|
|
5192
|
+
else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
|
|
5193
|
+
else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
|
|
5194
|
+
else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
|
|
5195
|
+
else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
|
|
5196
|
+
else if (shipAuthorized) policyState = "ship_authorized";
|
|
5197
|
+
else if (proofPassed) policyState = "proof_passed";
|
|
5198
|
+
else if (status === "running") policyState = "proof_in_progress";
|
|
5199
|
+
const requiredDisclosures = [];
|
|
5200
|
+
if (shipHeld) requiredDisclosures.push("ship_held");
|
|
5201
|
+
if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
|
|
5202
|
+
if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
|
|
5203
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
|
|
5204
|
+
const prohibitedClaims = [];
|
|
5205
|
+
if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
|
|
5206
|
+
if (!mergeReady) prohibitedClaims.push("merge_ready");
|
|
5207
|
+
if (!syncAllowed) prohibitedClaims.push("sync_allowed");
|
|
5208
|
+
if (blockedOrWaiting) {
|
|
5209
|
+
prohibitedClaims.push("proof_passed", "ready_to_ship");
|
|
5210
|
+
}
|
|
5211
|
+
if (checkpointSummary?.audit_disclosure_required) {
|
|
5212
|
+
prohibitedClaims.push("all_checkpoint_responses_accepted");
|
|
5213
|
+
}
|
|
5214
|
+
const resultLabel2 = policyState === "awaiting_checkpoint" ? "checkpoint required" : policyState === "proof_blocked" ? "blocked" : policyState === "proof_failed" ? "failed" : policyState === "proof_complete_ship_disabled" ? "proof complete; shipping disabled" : policyState === "proof_passed_ship_held" ? "proof passed; ship held" : policyState === "ship_authorized" ? status === "shipped" ? "shipped" : "ship authorized" : policyState === "proof_passed" ? "passed" : policyState === "proof_in_progress" ? "running" : status || "recorded";
|
|
5215
|
+
return {
|
|
5216
|
+
status,
|
|
5217
|
+
ok,
|
|
5218
|
+
policy_state: policyState,
|
|
5219
|
+
result_label: resultLabel2,
|
|
5220
|
+
proof_complete: proofComplete,
|
|
5221
|
+
proof_passed: proofPassed,
|
|
5222
|
+
ship_held: shipHeld,
|
|
5223
|
+
shipping_disabled: shippingDisabled,
|
|
5224
|
+
ship_authorized: shipAuthorized,
|
|
5225
|
+
merge_ready: mergeReady,
|
|
5226
|
+
sync_allowed: syncAllowed,
|
|
5227
|
+
checkpoint_summary: checkpointSummary,
|
|
5228
|
+
required_disclosures: uniqueStrings(requiredDisclosures),
|
|
5229
|
+
prohibited_claims: uniqueStrings(prohibitedClaims)
|
|
5230
|
+
};
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5080
5233
|
// src/runner.ts
|
|
5081
5234
|
init_proof_run_core();
|
|
5082
5235
|
function errorDetails(error) {
|
|
@@ -8300,12 +8453,12 @@ function truncateString(value, limit) {
|
|
|
8300
8453
|
function sortedKeys(value) {
|
|
8301
8454
|
return isRecord(value) ? Object.keys(value).sort() : [];
|
|
8302
8455
|
}
|
|
8303
|
-
function
|
|
8456
|
+
function stringValue3(value) {
|
|
8304
8457
|
if (typeof value !== "string") return void 0;
|
|
8305
8458
|
const trimmed = value.trim();
|
|
8306
8459
|
return trimmed ? trimmed : void 0;
|
|
8307
8460
|
}
|
|
8308
|
-
function
|
|
8461
|
+
function numberValue2(value) {
|
|
8309
8462
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
8310
8463
|
}
|
|
8311
8464
|
function artifactItems(value) {
|
|
@@ -8316,13 +8469,13 @@ function artifactSummary(item, source) {
|
|
|
8316
8469
|
const artifact = item;
|
|
8317
8470
|
const metadata = isRecord(artifact.metadata) ? artifact.metadata : void 0;
|
|
8318
8471
|
return {
|
|
8319
|
-
name:
|
|
8320
|
-
kind:
|
|
8321
|
-
role:
|
|
8322
|
-
url:
|
|
8323
|
-
path:
|
|
8324
|
-
content_type:
|
|
8325
|
-
size_bytes:
|
|
8472
|
+
name: stringValue3(artifact.name) || "",
|
|
8473
|
+
kind: stringValue3(artifact.kind),
|
|
8474
|
+
role: stringValue3(artifact.role),
|
|
8475
|
+
url: stringValue3(artifact.url),
|
|
8476
|
+
path: stringValue3(artifact.path),
|
|
8477
|
+
content_type: stringValue3(artifact.content_type),
|
|
8478
|
+
size_bytes: numberValue2(artifact.size_bytes),
|
|
8326
8479
|
metadata_keys: metadata ? Object.keys(metadata).sort() : void 0,
|
|
8327
8480
|
source
|
|
8328
8481
|
};
|
|
@@ -8620,7 +8773,7 @@ var TIME_DELTA_KEYS = [
|
|
|
8620
8773
|
"animation_delta_ms"
|
|
8621
8774
|
];
|
|
8622
8775
|
function isRiddleProofPlayabilityMode(mode) {
|
|
8623
|
-
return PLAYABILITY_MODES.has(
|
|
8776
|
+
return PLAYABILITY_MODES.has(stringValue4(mode).toLowerCase());
|
|
8624
8777
|
}
|
|
8625
8778
|
function extractPlayabilityEvidence(...sources) {
|
|
8626
8779
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8869,7 +9022,7 @@ function numericValue2(value) {
|
|
|
8869
9022
|
}
|
|
8870
9023
|
return null;
|
|
8871
9024
|
}
|
|
8872
|
-
function
|
|
9025
|
+
function stringValue4(value) {
|
|
8873
9026
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
8874
9027
|
}
|
|
8875
9028
|
function parseJson(value) {
|
|
@@ -9009,8 +9162,8 @@ function assessBasicGameplayRoute(route, options = {}) {
|
|
|
9009
9162
|
const continuedActionChange = changed(afterAction, afterContinue);
|
|
9010
9163
|
const cleanupBase = route.after_continue || route.afterContinue ? afterContinue : afterAction;
|
|
9011
9164
|
const cleanupActionChange = changed(cleanupBase, afterCleanup);
|
|
9012
|
-
const interactiveSurfaceVisible =
|
|
9013
|
-
const auditSurfaceVisible =
|
|
9165
|
+
const interactiveSurfaceVisible = numberValue3(initial.visible_canvas_count) > 0 || numberValue3(initial.enabled_clickable_count) > 0 || numberValue3(initial.visible_large_node_count) >= minSurfaceLargeNodes;
|
|
9166
|
+
const auditSurfaceVisible = numberValue3(initial.body_text_length) >= minBodyTextLength || numberValue3(initial.visible_large_node_count) >= minVisibleLargeNodes || numberValue3(initial.enabled_clickable_count) > 0 || numberValue3(initial.visible_canvas_count) > 0;
|
|
9014
9167
|
const surfaceVisible = auditAssessment ? auditSurfaceVisible : interactiveSurfaceVisible;
|
|
9015
9168
|
const actionResults = listValue2(route.action_results || route.actionResults);
|
|
9016
9169
|
const continuedActionResults = listValue2(route.continued_action_results || route.continuedActionResults);
|
|
@@ -9021,14 +9174,14 @@ function assessBasicGameplayRoute(route, options = {}) {
|
|
|
9021
9174
|
const actionFailed = [...primaryActionResults, ...continuedCleanupActionResults].some((result) => result.ok === false && result.action !== "wait");
|
|
9022
9175
|
const restartActionAttempted = restartActionResults.some((result) => result.ok === true && result.action !== "wait");
|
|
9023
9176
|
const stateChangeObserved = actionChange.changed || continuedActionChange.changed || cleanupActionChange.changed || timedChange.changed;
|
|
9024
|
-
const resetPathPresent =
|
|
9177
|
+
const resetPathPresent = numberValue3(initial.reset_control_count) > 0 || numberValue3(timed.reset_control_count) > 0 || numberValue3(afterAction.reset_control_count) > 0 || numberValue3(afterContinue.reset_control_count) > 0 || numberValue3(afterCleanup.reset_control_count) > 0 || restartActionAttempted;
|
|
9025
9178
|
const responseStatus = firstNumber(route.http_status, route.response_status, route.status);
|
|
9026
|
-
const pageErrorCount =
|
|
9027
|
-
const consoleErrorCount =
|
|
9179
|
+
const pageErrorCount = numberValue3(route.page_error_count);
|
|
9180
|
+
const consoleErrorCount = numberValue3(route.console_error_count);
|
|
9028
9181
|
const mobileOverflowPx = horizontalBoundsOverflowPx(mobile);
|
|
9029
9182
|
if (responseStatus !== null && responseStatus >= 400) failures.push("route_http_error");
|
|
9030
9183
|
if (pageErrorCount > 0) failures.push("fatal_page_error");
|
|
9031
|
-
if (
|
|
9184
|
+
if (numberValue3(initial.body_text_length) < minBodyTextLength && numberValue3(initial.visible_large_node_count) < minVisibleLargeNodes) {
|
|
9032
9185
|
failures.push("route_blank_or_thin");
|
|
9033
9186
|
}
|
|
9034
9187
|
if (!surfaceVisible) failures.push("no_game_surface");
|
|
@@ -9036,7 +9189,7 @@ function assessBasicGameplayRoute(route, options = {}) {
|
|
|
9036
9189
|
if (!auditAssessment && !actionAttempted && !timedChange.changed) failures.push("primary_control_missing");
|
|
9037
9190
|
if (!auditAssessment && actionAttempted && !stateChangeObserved) failures.push("primary_control_inert");
|
|
9038
9191
|
if (failOnConsoleError && consoleErrorCount > 0) failures.push("fatal_page_error");
|
|
9039
|
-
if (
|
|
9192
|
+
if (numberValue3(initial.visible_canvas_count) > 0 && actionAttempted && !timedChange.canvas_changed && !actionChange.canvas_changed && !actionChange.screenshot_changed) {
|
|
9040
9193
|
warnings.push("canvas_inert");
|
|
9041
9194
|
}
|
|
9042
9195
|
if (actionFailed) warnings.push("some_actions_failed");
|
|
@@ -9100,42 +9253,42 @@ function assessBasicGameplayProgressionCheck(check) {
|
|
|
9100
9253
|
let ok = hasExplicitResult ? check.ok === true : true;
|
|
9101
9254
|
let reason = check.reason ?? null;
|
|
9102
9255
|
if (type === "selector_count_increases") {
|
|
9103
|
-
ok =
|
|
9256
|
+
ok = numberValue3(after?.count) > numberValue3(before?.count);
|
|
9104
9257
|
reason = ok ? null : "selector_count_did_not_increase";
|
|
9105
9258
|
} else if (type === "selector_count_at_least") {
|
|
9106
9259
|
if (numericValue3(check.min) === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
|
|
9107
|
-
ok =
|
|
9260
|
+
ok = numberValue3(after?.count) >= numberValue3(check.min);
|
|
9108
9261
|
reason = ok ? null : "selector_count_below_min";
|
|
9109
9262
|
} else if (type === "selector_count_equals" || type === "selector_count_equal" || type === "selector_count_eq") {
|
|
9110
9263
|
const expected = numericValue3(check.expected ?? check.count ?? check.value);
|
|
9111
9264
|
if (expected === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
|
|
9112
|
-
ok = numericValue3(after?.count) !== null && expected !== null &&
|
|
9265
|
+
ok = numericValue3(after?.count) !== null && expected !== null && numberValue3(after?.count) === expected;
|
|
9113
9266
|
reason = ok ? null : "selector_count_did_not_equal_expected";
|
|
9114
9267
|
} else if (type === "selector_absent") {
|
|
9115
|
-
ok = !after?.present ||
|
|
9268
|
+
ok = !after?.present || numberValue3(after?.count) === 0;
|
|
9116
9269
|
reason = ok ? null : "selector_still_present";
|
|
9117
9270
|
} else if (type === "selector_text_matches") {
|
|
9118
9271
|
if (!check.pattern && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
|
|
9119
9272
|
ok = after?.pattern_matched === true || textMatches(after?.text, check.pattern, check.flags);
|
|
9120
9273
|
reason = ok ? null : "selector_text_did_not_match";
|
|
9121
9274
|
} else if (type === "number_increases") {
|
|
9122
|
-
ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null &&
|
|
9275
|
+
ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null && numberValue3(after?.number) > numberValue3(before?.number);
|
|
9123
9276
|
reason = ok ? null : "number_did_not_increase";
|
|
9124
9277
|
} else if (type === "number_decreases") {
|
|
9125
|
-
ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null &&
|
|
9278
|
+
ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null && numberValue3(after?.number) < numberValue3(before?.number);
|
|
9126
9279
|
reason = ok ? null : "number_did_not_decrease";
|
|
9127
9280
|
} else if (type === "number_at_least" || type === "number_gte") {
|
|
9128
9281
|
const min = numericValue3(check.min ?? check.expected ?? check.value);
|
|
9129
9282
|
if (min === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
|
|
9130
|
-
ok = numericValue3(after?.number) !== null && min !== null &&
|
|
9283
|
+
ok = numericValue3(after?.number) !== null && min !== null && numberValue3(after?.number) >= min;
|
|
9131
9284
|
reason = ok ? null : "number_below_minimum";
|
|
9132
9285
|
} else if (type === "number_unchanged" || type === "number_stays_equal") {
|
|
9133
|
-
ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null &&
|
|
9286
|
+
ok = numericValue3(before?.number) !== null && numericValue3(after?.number) !== null && numberValue3(after?.number) === numberValue3(before?.number);
|
|
9134
9287
|
reason = ok ? null : "number_changed";
|
|
9135
9288
|
} else if (type === "number_equals") {
|
|
9136
9289
|
const expected = numericValue3(check.expected ?? check.value);
|
|
9137
9290
|
if (expected === null && hasExplicitResult) return resolveBasicGameplayProgressionCheckWithArtifactScreenshots({ ...check, ok, reason });
|
|
9138
|
-
ok = numericValue3(after?.number) !== null && expected !== null &&
|
|
9291
|
+
ok = numericValue3(after?.number) !== null && expected !== null && numberValue3(after?.number) === expected;
|
|
9139
9292
|
reason = ok ? null : "number_did_not_equal_expected";
|
|
9140
9293
|
} else if (type === "canvas_hash_changes") {
|
|
9141
9294
|
ok = hashChanged(before, after, ["first_canvas_hash", "first_canvas_visual_sample_hash", "visual_sample_hash"]);
|
|
@@ -9195,8 +9348,8 @@ function augmentBasicGameplayAssessmentWithProgressionChecks(assessment, evidenc
|
|
|
9195
9348
|
function resolveBasicGameplayProgressionCheckWithArtifactScreenshots(check) {
|
|
9196
9349
|
if (check.ok !== false) return check;
|
|
9197
9350
|
if (!ARTIFACT_VISUAL_CHANGE_CHECKS.has(String(check.type || ""))) return check;
|
|
9198
|
-
const beforeHash =
|
|
9199
|
-
const afterHash =
|
|
9351
|
+
const beforeHash = stringValue5(metricValue(check.before)?.artifact_screenshot_hash);
|
|
9352
|
+
const afterHash = stringValue5(metricValue(check.after)?.artifact_screenshot_hash);
|
|
9200
9353
|
if (!beforeHash || !afterHash || beforeHash === afterHash) return check;
|
|
9201
9354
|
return {
|
|
9202
9355
|
...check,
|
|
@@ -9239,7 +9392,7 @@ function createBasicGameplayCatchRecords(assessment, evidence, options = {}) {
|
|
|
9239
9392
|
if (!run?.results?.length) return [];
|
|
9240
9393
|
const catches = [];
|
|
9241
9394
|
for (const route of run.results) {
|
|
9242
|
-
if (
|
|
9395
|
+
if (numberValue3(route.page_error_count) > 0) {
|
|
9243
9396
|
catches.push({
|
|
9244
9397
|
site: run.site || null,
|
|
9245
9398
|
route: route.name,
|
|
@@ -9248,12 +9401,12 @@ function createBasicGameplayCatchRecords(assessment, evidence, options = {}) {
|
|
|
9248
9401
|
label: "page runtime error",
|
|
9249
9402
|
type: "page_error",
|
|
9250
9403
|
selector: null,
|
|
9251
|
-
reason:
|
|
9404
|
+
reason: stringValue5(route.first_page_error) || "page_error",
|
|
9252
9405
|
page_errors: listValue2(route.page_errors),
|
|
9253
|
-
summary: `${route.name || route.path || "Route"}: page runtime error (${
|
|
9406
|
+
summary: `${route.name || route.path || "Route"}: page runtime error (${stringValue5(route.first_page_error) || "page_error"})`
|
|
9254
9407
|
});
|
|
9255
9408
|
}
|
|
9256
|
-
if (
|
|
9409
|
+
if (numberValue3(route.console_error_count) > 0) {
|
|
9257
9410
|
catches.push({
|
|
9258
9411
|
site: run.site || null,
|
|
9259
9412
|
route: route.name,
|
|
@@ -9262,9 +9415,9 @@ function createBasicGameplayCatchRecords(assessment, evidence, options = {}) {
|
|
|
9262
9415
|
label: "console error",
|
|
9263
9416
|
type: "console_error",
|
|
9264
9417
|
selector: null,
|
|
9265
|
-
reason:
|
|
9418
|
+
reason: stringValue5(route.first_console_error) || "console_error",
|
|
9266
9419
|
console_errors: listValue2(route.console_errors),
|
|
9267
|
-
summary: `${route.name || route.path || "Route"}: console error (${
|
|
9420
|
+
summary: `${route.name || route.path || "Route"}: console error (${stringValue5(route.first_console_error) || "console_error"})`
|
|
9268
9421
|
});
|
|
9269
9422
|
}
|
|
9270
9423
|
for (const [group, phase] of [
|
|
@@ -9275,8 +9428,8 @@ function createBasicGameplayCatchRecords(assessment, evidence, options = {}) {
|
|
|
9275
9428
|
]) {
|
|
9276
9429
|
for (const actionResult of listValue2(route[group])) {
|
|
9277
9430
|
if (!actionResult || actionResult.ok !== false) continue;
|
|
9278
|
-
const action =
|
|
9279
|
-
const reason =
|
|
9431
|
+
const action = stringValue5(actionResult.action) || group;
|
|
9432
|
+
const reason = stringValue5(actionResult.reason) || "action_failed";
|
|
9280
9433
|
catches.push({
|
|
9281
9434
|
site: run.site || null,
|
|
9282
9435
|
route: route.name,
|
|
@@ -9284,7 +9437,7 @@ function createBasicGameplayCatchRecords(assessment, evidence, options = {}) {
|
|
|
9284
9437
|
code: "action_failed",
|
|
9285
9438
|
label: action,
|
|
9286
9439
|
type: action,
|
|
9287
|
-
selector:
|
|
9440
|
+
selector: stringValue5(actionResult.selector),
|
|
9288
9441
|
reason,
|
|
9289
9442
|
phase,
|
|
9290
9443
|
action_result: actionResult,
|
|
@@ -9300,7 +9453,7 @@ function createBasicGameplayCatchRecords(assessment, evidence, options = {}) {
|
|
|
9300
9453
|
code: failure.code,
|
|
9301
9454
|
label: failure.label,
|
|
9302
9455
|
type: failure.action_result?.action || "responsive_setup",
|
|
9303
|
-
selector:
|
|
9456
|
+
selector: stringValue5(failure.action_result?.selector),
|
|
9304
9457
|
reason: failure.reason || "responsive_setup_failed",
|
|
9305
9458
|
phase: failure.viewport?.phase || void 0,
|
|
9306
9459
|
viewport: failure.viewport,
|
|
@@ -9517,12 +9670,12 @@ function responsiveSetupFailures(route) {
|
|
|
9517
9670
|
failures.push({
|
|
9518
9671
|
code: "responsive_setup_failed",
|
|
9519
9672
|
label: `${viewport.label || "responsive"} ${actionResult.action || "setup action"}`,
|
|
9520
|
-
reason:
|
|
9521
|
-
selector:
|
|
9673
|
+
reason: stringValue5(actionResult.reason) || "responsive_setup_failed",
|
|
9674
|
+
selector: stringValue5(actionResult.selector),
|
|
9522
9675
|
viewport: {
|
|
9523
9676
|
label: viewport.label || null,
|
|
9524
|
-
width:
|
|
9525
|
-
height:
|
|
9677
|
+
width: numberValue3(viewport.width) || null,
|
|
9678
|
+
height: numberValue3(viewport.height) || null,
|
|
9526
9679
|
phase: viewport.phase || null
|
|
9527
9680
|
},
|
|
9528
9681
|
action_result: actionResult
|
|
@@ -9545,8 +9698,8 @@ function responsiveBoundsFailures(route, maxOverflowPx) {
|
|
|
9545
9698
|
offenders: boundsOffendersForEvidence(viewport).slice(0, 10),
|
|
9546
9699
|
viewport: {
|
|
9547
9700
|
label: viewport.label || null,
|
|
9548
|
-
width:
|
|
9549
|
-
height:
|
|
9701
|
+
width: numberValue3(viewport.width) || null,
|
|
9702
|
+
height: numberValue3(viewport.height) || null,
|
|
9550
9703
|
phase: viewport.phase || null
|
|
9551
9704
|
}
|
|
9552
9705
|
});
|
|
@@ -9649,15 +9802,15 @@ function textMatches(text, pattern, flags) {
|
|
|
9649
9802
|
function hashChanged(before, after, keys) {
|
|
9650
9803
|
if (!before || !after) return false;
|
|
9651
9804
|
return keys.some((key) => {
|
|
9652
|
-
const beforeValue =
|
|
9653
|
-
const afterValue =
|
|
9805
|
+
const beforeValue = stringValue5(before[key]);
|
|
9806
|
+
const afterValue = stringValue5(after[key]);
|
|
9654
9807
|
return Boolean(beforeValue && afterValue && beforeValue !== afterValue);
|
|
9655
9808
|
});
|
|
9656
9809
|
}
|
|
9657
9810
|
function screenshotArtifactIndex(artifacts) {
|
|
9658
9811
|
const index = /* @__PURE__ */ new Map();
|
|
9659
9812
|
for (const artifact of artifacts || []) {
|
|
9660
|
-
const hash =
|
|
9813
|
+
const hash = stringValue5(artifact.sha256 || artifact.hash);
|
|
9661
9814
|
if (!hash) continue;
|
|
9662
9815
|
if (String(artifact.kind || "").toLowerCase() !== "screenshot" && !/\.png($|\?)/i.test(`${artifact.name || ""} ${artifact.path || ""} ${artifact.url || ""}`)) continue;
|
|
9663
9816
|
const filename = artifactBasename(artifact.path || artifact.name || artifact.url);
|
|
@@ -9691,7 +9844,7 @@ function routeArtifactSlug(routeEvidence, routeContract) {
|
|
|
9691
9844
|
return slug(routeContract.name || routeEvidence.name || routeContract.path || routeEvidence.path || "route");
|
|
9692
9845
|
}
|
|
9693
9846
|
function artifactBasename(value) {
|
|
9694
|
-
const raw =
|
|
9847
|
+
const raw = stringValue5(value);
|
|
9695
9848
|
if (!raw) return "";
|
|
9696
9849
|
try {
|
|
9697
9850
|
const url = new URL(raw);
|
|
@@ -9756,7 +9909,7 @@ function firstNumber(...values) {
|
|
|
9756
9909
|
}
|
|
9757
9910
|
return null;
|
|
9758
9911
|
}
|
|
9759
|
-
function
|
|
9912
|
+
function numberValue3(value) {
|
|
9760
9913
|
return numericValue3(value) ?? 0;
|
|
9761
9914
|
}
|
|
9762
9915
|
function numericValue3(value) {
|
|
@@ -9767,7 +9920,7 @@ function numericValue3(value) {
|
|
|
9767
9920
|
}
|
|
9768
9921
|
return null;
|
|
9769
9922
|
}
|
|
9770
|
-
function
|
|
9923
|
+
function stringValue5(value) {
|
|
9771
9924
|
return typeof value === "string" && value.length ? value : null;
|
|
9772
9925
|
}
|
|
9773
9926
|
function recordValue3(value) {
|
|
@@ -9913,7 +10066,7 @@ var DEFAULT_VIEWPORTS = [
|
|
|
9913
10066
|
function isRecord2(value) {
|
|
9914
10067
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
9915
10068
|
}
|
|
9916
|
-
function
|
|
10069
|
+
function stringValue6(value) {
|
|
9917
10070
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
9918
10071
|
}
|
|
9919
10072
|
function hasOwn(value, key) {
|
|
@@ -9934,10 +10087,10 @@ function valueFromOwn(input, ...keys) {
|
|
|
9934
10087
|
}
|
|
9935
10088
|
return void 0;
|
|
9936
10089
|
}
|
|
9937
|
-
function
|
|
10090
|
+
function numberValue4(value) {
|
|
9938
10091
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
9939
10092
|
}
|
|
9940
|
-
function
|
|
10093
|
+
function booleanValue2(value) {
|
|
9941
10094
|
return typeof value === "boolean" ? value : void 0;
|
|
9942
10095
|
}
|
|
9943
10096
|
function horizontalBoundsOverflowPx2(value) {
|
|
@@ -9979,10 +10132,10 @@ function horizontalOffenderOverflowPx2(value) {
|
|
|
9979
10132
|
));
|
|
9980
10133
|
}
|
|
9981
10134
|
const rect = isRecord2(value.rect || value.bounds || value.bounding_rect || value.boundingRect) ? value.rect || value.bounds || value.bounding_rect || value.boundingRect : void 0;
|
|
9982
|
-
const viewportWidth =
|
|
10135
|
+
const viewportWidth = numberValue4(value.viewport_width ?? value.viewportWidth);
|
|
9983
10136
|
if (isRecord2(rect) && viewportWidth !== void 0) {
|
|
9984
|
-
const left =
|
|
9985
|
-
const right =
|
|
10137
|
+
const left = numberValue4(rect.left);
|
|
10138
|
+
const right = numberValue4(rect.right);
|
|
9986
10139
|
if (left !== void 0 && left < 0) max = Math.max(max, Math.abs(left));
|
|
9987
10140
|
if (right !== void 0 && right > viewportWidth) max = Math.max(max, right - viewportWidth);
|
|
9988
10141
|
}
|
|
@@ -10005,7 +10158,7 @@ function boundsOffendersForEvidence2(value) {
|
|
|
10005
10158
|
function maxPositiveNumber2(...values) {
|
|
10006
10159
|
let max = 0;
|
|
10007
10160
|
for (const value of values) {
|
|
10008
|
-
const number =
|
|
10161
|
+
const number = numberValue4(value);
|
|
10009
10162
|
if (number !== void 0 && number > max) max = number;
|
|
10010
10163
|
}
|
|
10011
10164
|
return max;
|
|
@@ -10014,7 +10167,7 @@ function roundPixels2(value) {
|
|
|
10014
10167
|
return Math.round(value * 100) / 100;
|
|
10015
10168
|
}
|
|
10016
10169
|
function timeoutSecValue(value) {
|
|
10017
|
-
const number =
|
|
10170
|
+
const number = numberValue4(value);
|
|
10018
10171
|
return number && number > 0 ? Math.ceil(number) : void 0;
|
|
10019
10172
|
}
|
|
10020
10173
|
function jsonRecord(value) {
|
|
@@ -10334,9 +10487,9 @@ function profileSetupReturnSummaryFields(result) {
|
|
|
10334
10487
|
continue;
|
|
10335
10488
|
}
|
|
10336
10489
|
if (!isRecord2(item)) continue;
|
|
10337
|
-
const path6 =
|
|
10490
|
+
const path6 = stringValue6(item.path) ?? stringValue6(item.key) ?? stringValue6(item.json_path) ?? stringValue6(item.jsonPath);
|
|
10338
10491
|
if (!path6) continue;
|
|
10339
|
-
const label =
|
|
10492
|
+
const label = stringValue6(item.label) ?? stringValue6(item.name) ?? stringValue6(item.title);
|
|
10340
10493
|
fields.push(label ? { path: path6, label } : { path: path6 });
|
|
10341
10494
|
}
|
|
10342
10495
|
return fields;
|
|
@@ -10466,14 +10619,14 @@ function profileSetupCanvasSignatureStableHashGroups(results) {
|
|
|
10466
10619
|
const groups = /* @__PURE__ */ new Map();
|
|
10467
10620
|
for (const receipt of profileSetupCanvasSignatureReceipts(results)) {
|
|
10468
10621
|
if (receipt.ok === false) continue;
|
|
10469
|
-
const hash =
|
|
10622
|
+
const hash = stringValue6(receipt.hash);
|
|
10470
10623
|
if (!hash) continue;
|
|
10471
|
-
const selector =
|
|
10472
|
-
const frameSelector =
|
|
10624
|
+
const selector = stringValue6(receipt.selector) || "canvas";
|
|
10625
|
+
const frameSelector = stringValue6(receipt.frame_selector);
|
|
10473
10626
|
const key = String(frameSelector || "") + "\n" + selector;
|
|
10474
10627
|
const group = groups.get(key) || { selector, frame_selector: frameSelector, receipts: [] };
|
|
10475
|
-
const ordinal =
|
|
10476
|
-
const label =
|
|
10628
|
+
const ordinal = numberValue4(receipt.ordinal);
|
|
10629
|
+
const label = stringValue6(receipt.label) || (ordinal === void 0 ? `capture-${group.receipts.length + 1}` : `#${ordinal}`);
|
|
10477
10630
|
group.receipts.push({ hash, label, ordinal });
|
|
10478
10631
|
groups.set(key, group);
|
|
10479
10632
|
}
|
|
@@ -10509,12 +10662,12 @@ function profileSetupClickSequenceReceipts(clickedItems) {
|
|
|
10509
10662
|
const nthChildTemplatePattern = /:nth-child\(\d+\)/g;
|
|
10510
10663
|
const groups = /* @__PURE__ */ new Map();
|
|
10511
10664
|
for (const item of clickedItems) {
|
|
10512
|
-
const selector =
|
|
10665
|
+
const selector = stringValue6(item.selector);
|
|
10513
10666
|
if (!selector) continue;
|
|
10514
|
-
const frameSelector =
|
|
10515
|
-
const clickCountValue =
|
|
10667
|
+
const frameSelector = stringValue6(item.frame_selector);
|
|
10668
|
+
const clickCountValue = numberValue4(item.click_count);
|
|
10516
10669
|
const clickCount = clickCountValue === void 0 ? 1 : Math.max(1, Math.min(100, Math.floor(clickCountValue)));
|
|
10517
|
-
const ordinal =
|
|
10670
|
+
const ordinal = numberValue4(item.ordinal);
|
|
10518
10671
|
const match = nthChildPattern.exec(selector);
|
|
10519
10672
|
const selectorTemplate = match ? selector.replace(nthChildTemplatePattern, ":nth-child(*)") : selector;
|
|
10520
10673
|
const valueSource = match ? "nth-child" : "same-selector";
|
|
@@ -10716,7 +10869,7 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
10716
10869
|
});
|
|
10717
10870
|
}
|
|
10718
10871
|
function normalizeName(value, fallback) {
|
|
10719
|
-
const name =
|
|
10872
|
+
const name = stringValue6(value) || fallback;
|
|
10720
10873
|
return name.replace(/\s+/g, " ").trim();
|
|
10721
10874
|
}
|
|
10722
10875
|
function slugifyRiddleProofProfileName(value) {
|
|
@@ -10724,8 +10877,8 @@ function slugifyRiddleProofProfileName(value) {
|
|
|
10724
10877
|
}
|
|
10725
10878
|
function normalizeViewport(input, index) {
|
|
10726
10879
|
if (!isRecord2(input)) throw new Error(`target.viewports[${index}] must be an object.`);
|
|
10727
|
-
const width =
|
|
10728
|
-
const height =
|
|
10880
|
+
const width = numberValue4(input.width);
|
|
10881
|
+
const height = numberValue4(input.height);
|
|
10729
10882
|
if (!width || !height || width < 100 || height < 100) {
|
|
10730
10883
|
throw new Error(`target.viewports[${index}] requires numeric width and height >= 100.`);
|
|
10731
10884
|
}
|
|
@@ -10799,7 +10952,7 @@ function normalizeReturnSummaryFields(input, index) {
|
|
|
10799
10952
|
});
|
|
10800
10953
|
}
|
|
10801
10954
|
function normalizeSetupActionRepeat(input, index) {
|
|
10802
|
-
const repeat =
|
|
10955
|
+
const repeat = numberValue4(valueFromOwn(input, "repeat", "repeat_count", "repeatCount", "times"));
|
|
10803
10956
|
if (repeat === void 0) return void 0;
|
|
10804
10957
|
if (!Number.isInteger(repeat) || repeat < 1 || repeat > 100) {
|
|
10805
10958
|
throw new Error(`target.setup_actions[${index}].repeat must be an integer from 1 to 100.`);
|
|
@@ -10812,7 +10965,7 @@ function normalizeSetupActionClickCount(input, type, index) {
|
|
|
10812
10965
|
if (type !== "click") {
|
|
10813
10966
|
throw new Error(`target.setup_actions[${index}].click_count is only supported for click actions.`);
|
|
10814
10967
|
}
|
|
10815
|
-
const clickCount =
|
|
10968
|
+
const clickCount = numberValue4(clickCountInput);
|
|
10816
10969
|
if (clickCount === void 0 || !Number.isInteger(clickCount) || clickCount < 1 || clickCount > 10) {
|
|
10817
10970
|
throw new Error(`target.setup_actions[${index}].click_count must be an integer from 1 to 10.`);
|
|
10818
10971
|
}
|
|
@@ -10837,8 +10990,8 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
10837
10990
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
10838
10991
|
}
|
|
10839
10992
|
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
10840
|
-
const directFullPage =
|
|
10841
|
-
const viewportOnly =
|
|
10993
|
+
const directFullPage = booleanValue2(valueFromOwn(input, "full_page", "fullPage"));
|
|
10994
|
+
const viewportOnly = booleanValue2(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
10842
10995
|
if (type !== "screenshot") {
|
|
10843
10996
|
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
10844
10997
|
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
@@ -10881,7 +11034,7 @@ function normalizeSetupActionRandomQueue(input, index) {
|
|
|
10881
11034
|
throw new Error(`target.setup_actions[${index}].random_queue must be a non-empty array of numbers from 0 inclusive to 1 exclusive.`);
|
|
10882
11035
|
}
|
|
10883
11036
|
return rawQueue.map((item, queueIndex) => {
|
|
10884
|
-
const value =
|
|
11037
|
+
const value = numberValue4(item);
|
|
10885
11038
|
if (value === void 0 || value < 0 || value >= 1) {
|
|
10886
11039
|
throw new Error(`target.setup_actions[${index}].random_queue[${queueIndex}] must be a finite number from 0 inclusive to 1 exclusive.`);
|
|
10887
11040
|
}
|
|
@@ -10891,7 +11044,7 @@ function normalizeSetupActionRandomQueue(input, index) {
|
|
|
10891
11044
|
function normalizeSetupActionNonNegativeNumber(input, index, outputKey, ...keys) {
|
|
10892
11045
|
const rawValue = valueFromOwn(input, ...keys);
|
|
10893
11046
|
if (rawValue === void 0) return void 0;
|
|
10894
|
-
const value =
|
|
11047
|
+
const value = numberValue4(rawValue);
|
|
10895
11048
|
if (value === void 0 || value < 0) {
|
|
10896
11049
|
throw new Error(`target.setup_actions[${index}].${outputKey} must be a finite non-negative number.`);
|
|
10897
11050
|
}
|
|
@@ -10899,24 +11052,24 @@ function normalizeSetupActionNonNegativeNumber(input, index, outputKey, ...keys)
|
|
|
10899
11052
|
}
|
|
10900
11053
|
function normalizeSetupAction(input, index) {
|
|
10901
11054
|
if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
10902
|
-
const type = normalizeSetupActionType(
|
|
11055
|
+
const type = normalizeSetupActionType(stringValue6(input.type), index);
|
|
10903
11056
|
const rawType = String(input.type || "").trim().replace(/-/g, "_").toLowerCase();
|
|
10904
|
-
const selector =
|
|
11057
|
+
const selector = stringValue6(input.selector);
|
|
10905
11058
|
const frameSelector = stringFromOwn(input, "frame_selector", "frameSelector", "iframe_selector", "iframeSelector");
|
|
10906
|
-
const frameIndex =
|
|
11059
|
+
const frameIndex = numberValue4(valueFromOwn(input, "frame_index", "frameIndex", "iframe_index", "iframeIndex"));
|
|
10907
11060
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
10908
11061
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
10909
11062
|
}
|
|
10910
11063
|
if ((type === "click" || type === "tap" || type === "tap_until" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "canvas_signature" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
10911
11064
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
10912
11065
|
}
|
|
10913
|
-
const fromX = type === "click" || type === "tap" || type === "tap_until" ?
|
|
10914
|
-
const fromY = type === "click" || type === "tap" || type === "tap_until" ?
|
|
10915
|
-
const toX =
|
|
10916
|
-
const toY =
|
|
11066
|
+
const fromX = type === "click" || type === "tap" || type === "tap_until" ? numberValue4(valueFromOwn(input, "from_x", "fromX", "x", "click_x", "clickX", "start_x", "startX", "x1")) : numberValue4(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
11067
|
+
const fromY = type === "click" || type === "tap" || type === "tap_until" ? numberValue4(valueFromOwn(input, "from_y", "fromY", "y", "click_y", "clickY", "start_y", "startY", "y1")) : numberValue4(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
11068
|
+
const toX = numberValue4(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
11069
|
+
const toY = numberValue4(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
10917
11070
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
10918
11071
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
10919
|
-
const durationMs =
|
|
11072
|
+
const durationMs = numberValue4(input.duration_ms) ?? numberValue4(input.durationMs);
|
|
10920
11073
|
const holdMs = type === "press" ? normalizeSetupActionNonNegativeNumber(input, index, "hold_ms", "hold_ms", "holdMs", "key_down_ms", "keyDownMs", "down_ms", "downMs") ?? durationMs : void 0;
|
|
10921
11074
|
if (type === "press" && holdMs !== void 0 && (holdMs < 0 || holdMs > 3e4)) {
|
|
10922
11075
|
throw new Error(`target.setup_actions[${index}].hold_ms must be a finite number from 0 to 30000.`);
|
|
@@ -10962,13 +11115,13 @@ function normalizeSetupAction(input, index) {
|
|
|
10962
11115
|
throw new Error(`target.setup_actions[${index}] drag pixel coordinates must be non-negative.`);
|
|
10963
11116
|
}
|
|
10964
11117
|
}
|
|
10965
|
-
if (type === "wait_for_text" && !
|
|
11118
|
+
if (type === "wait_for_text" && !stringValue6(input.text) && !stringValue6(input.pattern)) {
|
|
10966
11119
|
throw new Error(`target.setup_actions[${index}] wait_for_text requires text or pattern.`);
|
|
10967
11120
|
}
|
|
10968
|
-
if ((type === "assert_text_visible" || type === "assert_text_absent") && !
|
|
11121
|
+
if ((type === "assert_text_visible" || type === "assert_text_absent") && !stringValue6(input.text) && !stringValue6(input.pattern)) {
|
|
10969
11122
|
throw new Error(`target.setup_actions[${index}] ${type} requires text or pattern.`);
|
|
10970
11123
|
}
|
|
10971
|
-
const expectedCount =
|
|
11124
|
+
const expectedCount = numberValue4(input.expected_count ?? input.expectedCount ?? input.count);
|
|
10972
11125
|
if (type === "assert_selector_count" && (expectedCount === void 0 || !Number.isInteger(expectedCount) || expectedCount < 0)) {
|
|
10973
11126
|
throw new Error(`target.setup_actions[${index}] ${type} requires non-negative integer expected_count.`);
|
|
10974
11127
|
}
|
|
@@ -10980,12 +11133,12 @@ function normalizeSetupAction(input, index) {
|
|
|
10980
11133
|
const randomQueue = type === "deterministic_runtime" ? normalizeSetupActionRandomQueue(input, index) : void 0;
|
|
10981
11134
|
const deterministicNow = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "now", "now", "date_now", "dateNow", "mock_now", "mockNow", "clock", "timestamp", "time_ms", "timeMs") : void 0;
|
|
10982
11135
|
const deterministicAdvanceMs = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "advance_ms", "advance_ms", "advanceMs", "tick_ms", "tickMs", "add_ms", "addMs") : void 0;
|
|
10983
|
-
const deterministicAppend = type === "deterministic_runtime" &&
|
|
10984
|
-
const deterministicRestore = type === "deterministic_runtime" &&
|
|
11136
|
+
const deterministicAppend = type === "deterministic_runtime" && booleanValue2(valueFromOwn(input, "append", "append_random", "appendRandom")) === true;
|
|
11137
|
+
const deterministicRestore = type === "deterministic_runtime" && booleanValue2(valueFromOwn(input, "restore", "reset", "restore_originals", "restoreOriginals")) === true;
|
|
10985
11138
|
if (type === "deterministic_runtime" && randomQueue === void 0 && deterministicNow === void 0 && deterministicAdvanceMs === void 0 && !deterministicRestore) {
|
|
10986
11139
|
throw new Error(`target.setup_actions[${index}] deterministic_runtime requires random_queue, now, advance_ms, or restore.`);
|
|
10987
11140
|
}
|
|
10988
|
-
const key =
|
|
11141
|
+
const key = stringValue6(input.key);
|
|
10989
11142
|
let dialogAccept;
|
|
10990
11143
|
if (type === "dialog_response") {
|
|
10991
11144
|
const acceptInput = valueFromOwn(input, "accept", "accepted", "should_accept", "shouldAccept");
|
|
@@ -11024,13 +11177,13 @@ function normalizeSetupAction(input, index) {
|
|
|
11024
11177
|
throw new Error(`target.setup_actions[${index}] ${type} requires expected_value.`);
|
|
11025
11178
|
}
|
|
11026
11179
|
const rawExpectedValue = valueFromOwn(input, "expected_value", "expectedValue", "expected", "expect_value", "expectValue", "expect");
|
|
11027
|
-
const minValue =
|
|
11028
|
-
const maxValue =
|
|
11180
|
+
const minValue = numberValue4(valueFromOwn(input, "min_value", "minValue", "minimum", "min", "at_least", "atLeast", "gte"));
|
|
11181
|
+
const maxValue = numberValue4(valueFromOwn(input, "max_value", "maxValue", "maximum", "max", "at_most", "atMost", "lte"));
|
|
11029
11182
|
if (type === "assert_window_number") {
|
|
11030
11183
|
if (!hasExpectedValue && minValue === void 0 && maxValue === void 0) {
|
|
11031
11184
|
throw new Error(`target.setup_actions[${index}] ${type} requires expected_value, min_value, or max_value.`);
|
|
11032
11185
|
}
|
|
11033
|
-
if (hasExpectedValue &&
|
|
11186
|
+
if (hasExpectedValue && numberValue4(rawExpectedValue) === void 0) {
|
|
11034
11187
|
throw new Error(`target.setup_actions[${index}] ${type} expected_value must be a finite number.`);
|
|
11035
11188
|
}
|
|
11036
11189
|
}
|
|
@@ -11061,23 +11214,23 @@ function normalizeSetupAction(input, index) {
|
|
|
11061
11214
|
throw new Error(`target.setup_actions[${index}] ${type} requires until_expected_value.`);
|
|
11062
11215
|
}
|
|
11063
11216
|
}
|
|
11064
|
-
const maxCalls =
|
|
11217
|
+
const maxCalls = numberValue4(valueFromOwn(input, "max_calls", "maxCalls", "max_attempts", "maxAttempts", "attempts", "max_taps", "maxTaps", "tap_limit", "tapLimit"));
|
|
11065
11218
|
if ((type === "window_call_until" || type === "tap_until") && (maxCalls === void 0 || !Number.isInteger(maxCalls) || maxCalls < 1 || maxCalls > 100)) {
|
|
11066
11219
|
throw new Error(`target.setup_actions[${index}].max_calls must be an integer from 1 to 100.`);
|
|
11067
11220
|
}
|
|
11068
|
-
const tapBurstSize = type === "tap_until" ?
|
|
11221
|
+
const tapBurstSize = type === "tap_until" ? numberValue4(valueFromOwn(input, "tap_burst_size", "tapBurstSize", "burst_size", "burstSize", "check_every_taps", "checkEveryTaps", "predicate_interval_taps", "predicateIntervalTaps")) : void 0;
|
|
11069
11222
|
if (type === "tap_until" && tapBurstSize !== void 0 && (!Number.isInteger(tapBurstSize) || tapBurstSize < 1 || tapBurstSize > 100)) {
|
|
11070
11223
|
throw new Error(`target.setup_actions[${index}].tap_burst_size must be an integer from 1 to 100.`);
|
|
11071
11224
|
}
|
|
11072
|
-
const settleMs = type === "tap_until" ?
|
|
11225
|
+
const settleMs = type === "tap_until" ? numberValue4(valueFromOwn(input, "settle_ms", "settleMs", "predicate_settle_ms", "predicateSettleMs", "post_burst_wait_ms", "postBurstWaitMs", "after_burst_ms", "afterBurstMs", "settle_after_tap_ms", "settleAfterTapMs")) : void 0;
|
|
11073
11226
|
if (type === "tap_until" && settleMs !== void 0 && (!Number.isInteger(settleMs) || settleMs < 0 || settleMs > 1e4)) {
|
|
11074
11227
|
throw new Error(`target.setup_actions[${index}].settle_ms must be an integer from 0 to 10000.`);
|
|
11075
11228
|
}
|
|
11076
|
-
const intervalMs =
|
|
11229
|
+
const intervalMs = numberValue4(valueFromOwn(input, "interval_ms", "intervalMs", "poll_ms", "pollMs", "call_interval_ms", "callIntervalMs"));
|
|
11077
11230
|
if ((type === "window_call_until" || type === "tap_until") && intervalMs !== void 0 && (!Number.isInteger(intervalMs) || intervalMs < 0 || intervalMs > 5e3)) {
|
|
11078
11231
|
throw new Error(`target.setup_actions[${index}].interval_ms must be an integer from 0 to 5000.`);
|
|
11079
11232
|
}
|
|
11080
|
-
const steps =
|
|
11233
|
+
const steps = numberValue4(input.steps);
|
|
11081
11234
|
if (type === "drag" && steps !== void 0 && (!Number.isInteger(steps) || steps < 1 || steps > 100)) {
|
|
11082
11235
|
throw new Error(`target.setup_actions[${index}].steps must be an integer from 1 to 100.`);
|
|
11083
11236
|
}
|
|
@@ -11116,7 +11269,7 @@ function normalizeSetupAction(input, index) {
|
|
|
11116
11269
|
capture_return: captureReturn,
|
|
11117
11270
|
return_summary_fields: normalizeReturnSummaryFields(input, index),
|
|
11118
11271
|
compare_to: stringFromOwn(input, "compare_to", "compareTo", "previous_signature_path", "previousSignaturePath", "previous_path", "previousPath", "changed_from", "changedFrom"),
|
|
11119
|
-
expect_changed:
|
|
11272
|
+
expect_changed: booleanValue2(valueFromOwn(input, "expect_changed", "expectChanged", "should_change", "shouldChange", "changed")),
|
|
11120
11273
|
until_path: untilPath,
|
|
11121
11274
|
until_expected_value: hasUntilExpectedValue ? toJsonValue(valueFromOwn(input, "until_expected_value", "untilExpectedValue", "until_expected", "untilExpected", "until_value", "untilValue", "expected_value", "expectedValue", "expected")) : void 0,
|
|
11122
11275
|
expected_path: stringFromOwn(input, "expected_path", "expectedPath", "expected_terminal_path", "expectedTerminalPath"),
|
|
@@ -11128,18 +11281,18 @@ function normalizeSetupAction(input, index) {
|
|
|
11128
11281
|
expected_value: hasExpectedValue ? toJsonValue(rawExpectedValue) : void 0,
|
|
11129
11282
|
min_value: minValue,
|
|
11130
11283
|
max_value: maxValue,
|
|
11131
|
-
text:
|
|
11132
|
-
pattern:
|
|
11133
|
-
flags:
|
|
11284
|
+
text: stringValue6(input.text),
|
|
11285
|
+
pattern: stringValue6(input.pattern),
|
|
11286
|
+
flags: stringValue6(input.flags),
|
|
11134
11287
|
accept: dialogAccept,
|
|
11135
11288
|
prompt_text: stringFromOwn(input, "prompt_text", "promptText", "prompt_value", "promptValue"),
|
|
11136
11289
|
message_text: stringFromOwn(input, "message_text", "messageText", "dialog_text", "dialogText"),
|
|
11137
11290
|
message_pattern: stringFromOwn(input, "message_pattern", "messagePattern", "dialog_pattern", "dialogPattern"),
|
|
11138
|
-
index:
|
|
11291
|
+
index: numberValue4(valueFromOwn(input, "index", "target_index", "targetIndex")),
|
|
11139
11292
|
expected_count: expectedCount,
|
|
11140
|
-
ms:
|
|
11141
|
-
timeout_ms:
|
|
11142
|
-
after_ms:
|
|
11293
|
+
ms: numberValue4(input.ms) ?? numberValue4(input.wait_ms) ?? numberValue4(input.waitMs),
|
|
11294
|
+
timeout_ms: numberValue4(input.timeout_ms) ?? numberValue4(input.timeoutMs),
|
|
11295
|
+
after_ms: numberValue4(input.after_ms) ?? numberValue4(input.afterMs),
|
|
11143
11296
|
repeat: normalizeSetupActionRepeat(input, index),
|
|
11144
11297
|
reload: input.reload === true,
|
|
11145
11298
|
storage: normalizeSetupActionStorage(input.storage, index),
|
|
@@ -11154,7 +11307,7 @@ function normalizeSetupActions(value) {
|
|
|
11154
11307
|
return value.map(normalizeSetupAction);
|
|
11155
11308
|
}
|
|
11156
11309
|
function normalizeTargetScreenshotFullPage(input) {
|
|
11157
|
-
const directFullPage =
|
|
11310
|
+
const directFullPage = booleanValue2(valueFromOwn(
|
|
11158
11311
|
input,
|
|
11159
11312
|
"screenshot_full_page",
|
|
11160
11313
|
"screenshotFullPage",
|
|
@@ -11163,7 +11316,7 @@ function normalizeTargetScreenshotFullPage(input) {
|
|
|
11163
11316
|
"full_page_screenshots",
|
|
11164
11317
|
"fullPageScreenshots"
|
|
11165
11318
|
));
|
|
11166
|
-
const viewportOnly =
|
|
11319
|
+
const viewportOnly = booleanValue2(valueFromOwn(
|
|
11167
11320
|
input,
|
|
11168
11321
|
"viewport_screenshots",
|
|
11169
11322
|
"viewportScreenshots",
|
|
@@ -11191,20 +11344,20 @@ function normalizeTargetScreenshotFullPage(input) {
|
|
|
11191
11344
|
}
|
|
11192
11345
|
function normalizeNetworkMock(input, index) {
|
|
11193
11346
|
if (!isRecord2(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
|
|
11194
|
-
const url =
|
|
11347
|
+
const url = stringValue6(input.url) || stringValue6(input.glob) || stringValue6(input.pattern);
|
|
11195
11348
|
if (!url) throw new Error(`target.network_mocks[${index}] requires url.`);
|
|
11196
11349
|
const payload = normalizeNetworkMockResponsePayload(input, `target.network_mocks[${index}]`);
|
|
11197
11350
|
const responsesInput = input.responses ?? input.sequence;
|
|
11198
11351
|
const responses = normalizeNetworkMockResponses(responsesInput, index, payload);
|
|
11199
11352
|
const requestBody = normalizeNetworkMockRequestBodyConstraints(input, `target.network_mocks[${index}]`);
|
|
11200
|
-
const requiredHitCount =
|
|
11353
|
+
const requiredHitCount = numberValue4(
|
|
11201
11354
|
input.required_hit_count ?? input.requiredHitCount ?? input.required_hits ?? input.requiredHits ?? input.min_hits ?? input.minHits
|
|
11202
11355
|
);
|
|
11203
11356
|
if (requiredHitCount !== void 0 && (!Number.isInteger(requiredHitCount) || requiredHitCount < 1)) {
|
|
11204
11357
|
throw new Error(`target.network_mocks[${index}].required_hit_count must be a positive integer.`);
|
|
11205
11358
|
}
|
|
11206
11359
|
const forbidden = input.forbidden === true || input.must_not_hit === true || input.mustNotHit === true || input.should_not_run === true || input.shouldNotRun === true;
|
|
11207
|
-
const configuredMaxHitCount =
|
|
11360
|
+
const configuredMaxHitCount = numberValue4(
|
|
11208
11361
|
input.max_hit_count ?? input.maxHitCount ?? input.max_hits ?? input.maxHits
|
|
11209
11362
|
);
|
|
11210
11363
|
if (configuredMaxHitCount !== void 0 && (!Number.isInteger(configuredMaxHitCount) || configuredMaxHitCount < 0)) {
|
|
@@ -11219,7 +11372,7 @@ function normalizeNetworkMock(input, index) {
|
|
|
11219
11372
|
if (maxHitCount !== void 0 && effectiveRequiredHitCount > maxHitCount) {
|
|
11220
11373
|
throw new Error(`target.network_mocks[${index}].max_hit_count cannot be less than its required hit count.`);
|
|
11221
11374
|
}
|
|
11222
|
-
const sequenceScopeInput =
|
|
11375
|
+
const sequenceScopeInput = stringValue6(
|
|
11223
11376
|
input.sequence_scope ?? input.sequenceScope ?? input.response_sequence_scope ?? input.responseSequenceScope
|
|
11224
11377
|
);
|
|
11225
11378
|
let sequenceScope;
|
|
@@ -11237,7 +11390,7 @@ function normalizeNetworkMock(input, index) {
|
|
|
11237
11390
|
...payload,
|
|
11238
11391
|
label: normalizeName(input.label || input.name, `network-mock-${index + 1}`),
|
|
11239
11392
|
url,
|
|
11240
|
-
method:
|
|
11393
|
+
method: stringValue6(input.method)?.toUpperCase(),
|
|
11241
11394
|
responses,
|
|
11242
11395
|
repeat_responses: input.repeat_responses === true || input.repeatResponses === true || input.cycle_responses === true || input.cycleResponses === true,
|
|
11243
11396
|
sequence_scope: sequenceScope,
|
|
@@ -11280,18 +11433,18 @@ function normalizeNetworkMockRequestBodyConstraints(input, label) {
|
|
|
11280
11433
|
};
|
|
11281
11434
|
}
|
|
11282
11435
|
function normalizeNetworkMockResponsePayload(input, label, defaults = {}) {
|
|
11283
|
-
const status =
|
|
11436
|
+
const status = numberValue4(input.status) ?? defaults.status ?? 200;
|
|
11284
11437
|
if (!Number.isInteger(status) || status < 100 || status > 599) {
|
|
11285
11438
|
throw new Error(`${label}.status must be an HTTP status code.`);
|
|
11286
11439
|
}
|
|
11287
|
-
const body =
|
|
11440
|
+
const body = stringValue6(input.body) ?? stringValue6(input.body_text) ?? stringValue6(input.bodyText) ?? defaults.body;
|
|
11288
11441
|
const hasJsonBody = Object.prototype.hasOwnProperty.call(input, "body_json") || Object.prototype.hasOwnProperty.call(input, "bodyJson") || Object.prototype.hasOwnProperty.call(input, "json");
|
|
11289
11442
|
const requestBody = normalizeNetworkMockRequestBodyConstraints(input, label);
|
|
11290
11443
|
const abort = normalizeNetworkMockAbort(input, label, defaults.abort, defaults.abort_error_code);
|
|
11291
11444
|
return {
|
|
11292
|
-
label:
|
|
11445
|
+
label: stringValue6(input.label) || stringValue6(input.name) || defaults.label,
|
|
11293
11446
|
status,
|
|
11294
|
-
content_type:
|
|
11447
|
+
content_type: stringValue6(input.content_type) || stringValue6(input.contentType) || defaults.content_type,
|
|
11295
11448
|
headers: stringRecord(input.headers) || defaults.headers,
|
|
11296
11449
|
body,
|
|
11297
11450
|
body_json: hasJsonBody ? toJsonValue(input.body_json ?? input.bodyJson ?? input.json) : defaults.body_json,
|
|
@@ -11310,7 +11463,7 @@ function normalizeNetworkMockAbort(input, label, defaultAbort, defaultErrorCode)
|
|
|
11310
11463
|
const explicitAbort = typeof abortInput === "string" ? abortInput.trim().length > 0 : abortInput === true;
|
|
11311
11464
|
const abort = explicitAbort || defaultAbort === true;
|
|
11312
11465
|
if (!abort) return {};
|
|
11313
|
-
const codeInput =
|
|
11466
|
+
const codeInput = stringValue6(
|
|
11314
11467
|
typeof abortInput === "string" ? abortInput : input.abort_error_code ?? input.abortErrorCode ?? input.abort_error ?? input.abortError ?? input.network_error ?? input.networkError
|
|
11315
11468
|
) || defaultErrorCode || "failed";
|
|
11316
11469
|
const abort_error_code = codeInput.toLowerCase();
|
|
@@ -11320,7 +11473,7 @@ function normalizeNetworkMockAbort(input, label, defaultAbort, defaultErrorCode)
|
|
|
11320
11473
|
return { abort: true, abort_error_code };
|
|
11321
11474
|
}
|
|
11322
11475
|
function normalizeNetworkMockDelay(input, label, defaultValue) {
|
|
11323
|
-
const value =
|
|
11476
|
+
const value = numberValue4(
|
|
11324
11477
|
input.delay_ms ?? input.delayMs ?? input.wait_ms ?? input.waitMs ?? input.latency_ms ?? input.latencyMs
|
|
11325
11478
|
) ?? defaultValue;
|
|
11326
11479
|
if (value === void 0) return void 0;
|
|
@@ -11435,7 +11588,7 @@ function collectRiddleProofProfileEnvironmentBlockedWarnings(profile, blocker) {
|
|
|
11435
11588
|
return warnings;
|
|
11436
11589
|
}
|
|
11437
11590
|
function normalizeRouteInventoryPath(value, label) {
|
|
11438
|
-
const path6 =
|
|
11591
|
+
const path6 = stringValue6(value);
|
|
11439
11592
|
if (!path6) throw new Error(`${label} requires path.`);
|
|
11440
11593
|
if (!path6.startsWith("/")) throw new Error(`${label}.path must start with /.`);
|
|
11441
11594
|
return normalizeRoutePath2(path6);
|
|
@@ -11444,7 +11597,7 @@ function normalizeRouteInventoryRoute(input, index) {
|
|
|
11444
11597
|
if (typeof input === "string") return { path: normalizeRouteInventoryPath(input, `checks route_inventory expected_routes[${index}]`) };
|
|
11445
11598
|
if (!isRecord2(input)) throw new Error(`checks route_inventory expected_routes[${index}] must be a string or object.`);
|
|
11446
11599
|
return {
|
|
11447
|
-
name:
|
|
11600
|
+
name: stringValue6(input.name),
|
|
11448
11601
|
path: normalizeRouteInventoryPath(input.path, `checks route_inventory expected_routes[${index}]`)
|
|
11449
11602
|
};
|
|
11450
11603
|
}
|
|
@@ -11479,7 +11632,7 @@ function normalizeStringList(value, label) {
|
|
|
11479
11632
|
}
|
|
11480
11633
|
function normalizeHttpStatus(value, label) {
|
|
11481
11634
|
if (value === void 0) return void 0;
|
|
11482
|
-
const status =
|
|
11635
|
+
const status = numberValue4(value);
|
|
11483
11636
|
if (status === void 0 || !Number.isInteger(status) || status < 100 || status > 599) {
|
|
11484
11637
|
throw new Error(`${label} must be an HTTP status code.`);
|
|
11485
11638
|
}
|
|
@@ -11494,7 +11647,7 @@ function normalizeHttpStatuses(value, label) {
|
|
|
11494
11647
|
}
|
|
11495
11648
|
function normalizePositiveInteger(value, label, max) {
|
|
11496
11649
|
if (value === void 0) return void 0;
|
|
11497
|
-
const number =
|
|
11650
|
+
const number = numberValue4(value);
|
|
11498
11651
|
if (number === void 0 || !Number.isInteger(number) || number < 1 || max !== void 0 && number > max) {
|
|
11499
11652
|
throw new Error(`${label} must be an integer from 1 to ${max ?? "unbounded"}.`);
|
|
11500
11653
|
}
|
|
@@ -11517,7 +11670,7 @@ function normalizeHttpStatusBodyJsonAssertions(value, label) {
|
|
|
11517
11670
|
return value.map((item, index) => {
|
|
11518
11671
|
const itemLabel = `${label}[${index}]`;
|
|
11519
11672
|
if (typeof item === "string") {
|
|
11520
|
-
const path7 =
|
|
11673
|
+
const path7 = stringValue6(item);
|
|
11521
11674
|
if (!path7) throw new Error(`${itemLabel} path must not be empty.`);
|
|
11522
11675
|
return { path: path7, exists: true };
|
|
11523
11676
|
}
|
|
@@ -11525,12 +11678,12 @@ function normalizeHttpStatusBodyJsonAssertions(value, label) {
|
|
|
11525
11678
|
const path6 = stringFromOwn(item, "path", "json_path", "jsonPath", "key");
|
|
11526
11679
|
if (!path6) throw new Error(`${itemLabel}.path is required.`);
|
|
11527
11680
|
const assertion = {
|
|
11528
|
-
label:
|
|
11681
|
+
label: stringValue6(item.label),
|
|
11529
11682
|
path: path6
|
|
11530
11683
|
};
|
|
11531
|
-
const exists =
|
|
11684
|
+
const exists = booleanValue2(valueFromOwn(item, "exists", "present"));
|
|
11532
11685
|
if (exists !== void 0) assertion.exists = exists;
|
|
11533
|
-
const type =
|
|
11686
|
+
const type = stringValue6(valueFromOwn(item, "type", "value_type", "valueType"));
|
|
11534
11687
|
if (type !== void 0) {
|
|
11535
11688
|
const allowedTypes = ["array", "boolean", "null", "number", "object", "string"];
|
|
11536
11689
|
if (!allowedTypes.includes(type)) {
|
|
@@ -11560,43 +11713,43 @@ function dialogCountFieldForCheckType(type) {
|
|
|
11560
11713
|
}
|
|
11561
11714
|
function normalizeCheck(input, index) {
|
|
11562
11715
|
if (!isRecord2(input)) throw new Error(`checks[${index}] must be an object.`);
|
|
11563
|
-
const type =
|
|
11716
|
+
const type = stringValue6(input.type);
|
|
11564
11717
|
if (!type) throw new Error(`checks[${index}].type is required.`);
|
|
11565
11718
|
if (!isSupportedCheckType(type)) {
|
|
11566
11719
|
throw new Error(`checks[${index}].type ${type} is not supported. Supported checks: ${RIDDLE_PROOF_PROFILE_CHECK_TYPES.join(", ")}`);
|
|
11567
11720
|
}
|
|
11568
11721
|
const isDialogCountCheck = isDialogCountCheckType(type);
|
|
11569
|
-
if ((type === "selector_visible" || type === "selector_absent" || type === "selector_count_at_least" || type === "selector_count_equals" || type === "selector_count_equal" || type === "selector_count_eq" || type === "selector_text_visible" || type === "selector_text_absent" || type === "observe_within" && !
|
|
11722
|
+
if ((type === "selector_visible" || type === "selector_absent" || type === "selector_count_at_least" || type === "selector_count_equals" || type === "selector_count_equal" || type === "selector_count_eq" || type === "selector_text_visible" || type === "selector_text_absent" || type === "observe_within" && !stringValue6(input.text) && !stringValue6(input.pattern)) && !stringValue6(input.selector)) {
|
|
11570
11723
|
throw new Error(`checks[${index}] ${type} requires selector.`);
|
|
11571
11724
|
}
|
|
11572
|
-
if ((type === "frame_text_visible" || type === "frame_url_equals" || type === "frame_url_matches" || type === "frame_no_horizontal_overflow") && !
|
|
11725
|
+
if ((type === "frame_text_visible" || type === "frame_url_equals" || type === "frame_url_matches" || type === "frame_no_horizontal_overflow") && !stringValue6(input.selector)) {
|
|
11573
11726
|
throw new Error(`checks[${index}] ${type} requires selector.`);
|
|
11574
11727
|
}
|
|
11575
|
-
if (type === "frame_text_visible" && !
|
|
11728
|
+
if (type === "frame_text_visible" && !stringValue6(input.text) && !stringValue6(input.pattern)) {
|
|
11576
11729
|
throw new Error(`checks[${index}] frame_text_visible requires text or pattern.`);
|
|
11577
11730
|
}
|
|
11578
11731
|
const expectedUrl = stringFromOwn(input, "expected_url", "expectedUrl", "url", "expected_value", "expectedValue", "value");
|
|
11579
11732
|
if (type === "frame_url_equals" && expectedUrl === void 0) {
|
|
11580
11733
|
throw new Error(`checks[${index}] frame_url_equals requires expected_url.`);
|
|
11581
11734
|
}
|
|
11582
|
-
if (type === "frame_url_matches" && !
|
|
11735
|
+
if (type === "frame_url_matches" && !stringValue6(input.pattern)) {
|
|
11583
11736
|
throw new Error(`checks[${index}] frame_url_matches requires pattern.`);
|
|
11584
11737
|
}
|
|
11585
|
-
if ((type === "text_visible" || type === "text_absent" || type === "selector_text_visible" || type === "selector_text_absent") && !
|
|
11738
|
+
if ((type === "text_visible" || type === "text_absent" || type === "selector_text_visible" || type === "selector_text_absent") && !stringValue6(input.text) && !stringValue6(input.pattern)) {
|
|
11586
11739
|
throw new Error(`checks[${index}] ${type} requires text or pattern.`);
|
|
11587
11740
|
}
|
|
11588
|
-
if ((type === "url_search_param_equals" || type === "url_search_param_absent") && !
|
|
11741
|
+
if ((type === "url_search_param_equals" || type === "url_search_param_absent") && !stringValue6(input.param) && !stringValue6(input.search_param) && !stringValue6(input.searchParam) && !stringValue6(input.key)) {
|
|
11589
11742
|
throw new Error(`checks[${index}] ${type} requires param.`);
|
|
11590
11743
|
}
|
|
11591
11744
|
const expectedValue = stringFromOwn(input, "expected_value", "expectedValue", "value");
|
|
11592
11745
|
if (type === "url_search_param_equals" && expectedValue === void 0) {
|
|
11593
11746
|
throw new Error(`checks[${index}] url_search_param_equals requires expected_value.`);
|
|
11594
11747
|
}
|
|
11595
|
-
const minCount =
|
|
11748
|
+
const minCount = numberValue4(input.min_count) ?? numberValue4(input.minCount);
|
|
11596
11749
|
if (type === "selector_count_at_least" && minCount === void 0) {
|
|
11597
11750
|
throw new Error(`checks[${index}] selector_count_at_least requires min_count.`);
|
|
11598
11751
|
}
|
|
11599
|
-
const expectedCount =
|
|
11752
|
+
const expectedCount = numberValue4(input.expected_count) ?? numberValue4(input.expectedCount) ?? numberValue4(input.count);
|
|
11600
11753
|
if ((type === "selector_count_equals" || type === "selector_count_equal" || type === "selector_count_eq" || isDialogCountCheck) && expectedCount === void 0) {
|
|
11601
11754
|
throw new Error(`checks[${index}] ${type} requires expected_count.`);
|
|
11602
11755
|
}
|
|
@@ -11605,7 +11758,7 @@ function normalizeCheck(input, index) {
|
|
|
11605
11758
|
}
|
|
11606
11759
|
const expectedTexts = normalizeExpectedTexts(input.expected_texts ?? input.expectedTexts, index);
|
|
11607
11760
|
if (type === "selector_text_order") {
|
|
11608
|
-
if (!
|
|
11761
|
+
if (!stringValue6(input.selector)) throw new Error(`checks[${index}] selector_text_order requires selector.`);
|
|
11609
11762
|
if (!expectedTexts?.length) throw new Error(`checks[${index}] selector_text_order requires expected_texts.`);
|
|
11610
11763
|
}
|
|
11611
11764
|
const expectedRoutes = normalizeRouteInventoryRoutes(input.expected_routes ?? input.expectedRoutes, index);
|
|
@@ -11631,7 +11784,7 @@ function normalizeCheck(input, index) {
|
|
|
11631
11784
|
) : void 0;
|
|
11632
11785
|
const maxLinks = isLinkStatusCheck ? normalizePositiveInteger(input.max_links ?? input.maxLinks ?? input.limit, `checks[${index}] max_links`, 500) : void 0;
|
|
11633
11786
|
const minBytes = isStatusCheck ? normalizePositiveInteger(input.min_bytes ?? input.minBytes ?? input.min_response_bytes ?? input.minResponseBytes, `checks[${index}] min_bytes`) : void 0;
|
|
11634
|
-
const expectedContentType = isStatusCheck ?
|
|
11787
|
+
const expectedContentType = isStatusCheck ? stringValue6(input.expected_content_type) || stringValue6(input.expectedContentType) || stringValue6(input.content_type) || stringValue6(input.contentType) : void 0;
|
|
11635
11788
|
const allowedContentTypes = isStatusCheck ? normalizeStringList(
|
|
11636
11789
|
input.allowed_content_types ?? input.allowedContentTypes ?? input.expected_content_types ?? input.expectedContentTypes,
|
|
11637
11790
|
`checks[${index}] allowed_content_types`
|
|
@@ -11663,33 +11816,33 @@ function normalizeCheck(input, index) {
|
|
|
11663
11816
|
}
|
|
11664
11817
|
return {
|
|
11665
11818
|
type,
|
|
11666
|
-
label:
|
|
11667
|
-
expected_path:
|
|
11668
|
-
param:
|
|
11819
|
+
label: stringValue6(input.label),
|
|
11820
|
+
expected_path: stringValue6(input.expected_path),
|
|
11821
|
+
param: stringValue6(input.param) || stringValue6(input.search_param) || stringValue6(input.searchParam) || stringValue6(input.key),
|
|
11669
11822
|
expected_value: expectedValue,
|
|
11670
11823
|
expected_url: expectedUrl,
|
|
11671
11824
|
expected_routes: expectedRoutes,
|
|
11672
|
-
selector:
|
|
11825
|
+
selector: stringValue6(input.selector),
|
|
11673
11826
|
url: isHttpStatusCheck ? requestUrl : void 0,
|
|
11674
11827
|
method: isHttpStatusCheck ? method || "GET" : void 0,
|
|
11675
11828
|
headers: isHttpStatusCheck ? stringRecord(input.headers) : void 0,
|
|
11676
|
-
body: isHttpStatusCheck ?
|
|
11829
|
+
body: isHttpStatusCheck ? stringValue6(input.body) : void 0,
|
|
11677
11830
|
body_json: isHttpStatusCheck && hasBodyJson ? toJsonValue(input.body_json ?? input.bodyJson ?? input.json) : void 0,
|
|
11678
11831
|
body_contains: bodyContains,
|
|
11679
11832
|
body_not_contains: bodyNotContains,
|
|
11680
11833
|
body_not_patterns: bodyNotPatterns,
|
|
11681
11834
|
body_json_assertions: bodyJsonAssertions,
|
|
11682
11835
|
expected_texts: expectedTexts,
|
|
11683
|
-
link_selector:
|
|
11684
|
-
source_selector:
|
|
11685
|
-
route_path_prefix:
|
|
11686
|
-
route_ready_selector:
|
|
11687
|
-
route_ready_text:
|
|
11688
|
-
route_ready_pattern:
|
|
11689
|
-
route_ready_flags:
|
|
11690
|
-
text:
|
|
11691
|
-
pattern:
|
|
11692
|
-
flags:
|
|
11836
|
+
link_selector: stringValue6(input.link_selector) || stringValue6(input.linkSelector),
|
|
11837
|
+
source_selector: stringValue6(input.source_selector) || stringValue6(input.sourceSelector),
|
|
11838
|
+
route_path_prefix: stringValue6(input.route_path_prefix) || stringValue6(input.routePathPrefix),
|
|
11839
|
+
route_ready_selector: stringValue6(input.route_ready_selector) || stringValue6(input.routeReadySelector),
|
|
11840
|
+
route_ready_text: stringValue6(input.route_ready_text) || stringValue6(input.routeReadyText),
|
|
11841
|
+
route_ready_pattern: stringValue6(input.route_ready_pattern) || stringValue6(input.routeReadyPattern),
|
|
11842
|
+
route_ready_flags: stringValue6(input.route_ready_flags) || stringValue6(input.routeReadyFlags),
|
|
11843
|
+
text: stringValue6(input.text),
|
|
11844
|
+
pattern: stringValue6(input.pattern),
|
|
11845
|
+
flags: stringValue6(input.flags),
|
|
11693
11846
|
viewports: normalizeStringList(input.viewports ?? input.viewport_names ?? input.viewportNames, `checks[${index}] viewports`),
|
|
11694
11847
|
allowed_console_texts: normalizeStringList(input.allowed_console_texts ?? input.allowedConsoleTexts ?? input.allow_console_texts ?? input.allowConsoleTexts, `checks[${index}] allowed_console_texts`),
|
|
11695
11848
|
allowed_console_patterns: normalizeStringList(input.allowed_console_patterns ?? input.allowedConsolePatterns ?? input.allow_console_patterns ?? input.allowConsolePatterns, `checks[${index}] allowed_console_patterns`),
|
|
@@ -11706,8 +11859,8 @@ function normalizeCheck(input, index) {
|
|
|
11706
11859
|
min_bytes: minBytes,
|
|
11707
11860
|
allowed_content_types: allowedContentTypes,
|
|
11708
11861
|
allow_get_fallback: isLinkStatusCheck ? input.allow_get_fallback === false || input.allowGetFallback === false ? false : true : void 0,
|
|
11709
|
-
max_overflow_px:
|
|
11710
|
-
timeout_ms:
|
|
11862
|
+
max_overflow_px: numberValue4(input.max_overflow_px),
|
|
11863
|
+
timeout_ms: numberValue4(input.timeout_ms) ?? numberValue4(input.timeoutMs) ?? numberValue4(input.within_ms) ?? numberValue4(input.withinMs),
|
|
11711
11864
|
run_direct_routes: input.run_direct_routes === false || input.runDirectRoutes === false ? false : true,
|
|
11712
11865
|
run_clickthroughs: input.run_clickthroughs === false || input.runClickthroughs === false ? false : true,
|
|
11713
11866
|
run_all_viewports: input.run_all_viewports === true || input.runAllViewports === true,
|
|
@@ -11736,15 +11889,15 @@ function normalizeFailurePolicy(input) {
|
|
|
11736
11889
|
}
|
|
11737
11890
|
function normalizeRiddleProofProfile(input, options = {}) {
|
|
11738
11891
|
if (!isRecord2(input)) throw new Error("profile must be a JSON object.");
|
|
11739
|
-
const version =
|
|
11892
|
+
const version = stringValue6(input.version) || RIDDLE_PROOF_PROFILE_VERSION;
|
|
11740
11893
|
if (version !== RIDDLE_PROOF_PROFILE_VERSION) {
|
|
11741
11894
|
throw new Error(`Unsupported profile version ${version}. Expected ${RIDDLE_PROOF_PROFILE_VERSION}.`);
|
|
11742
11895
|
}
|
|
11743
11896
|
const targetInput = isRecord2(input.target) ? input.target : {};
|
|
11744
11897
|
const checks = Array.isArray(input.checks) ? input.checks.map(normalizeCheck) : [];
|
|
11745
11898
|
if (!checks.length) throw new Error("profile.checks must contain at least one check.");
|
|
11746
|
-
const targetUrl =
|
|
11747
|
-
const route =
|
|
11899
|
+
const targetUrl = stringValue6(options.url) || stringValue6(targetInput.url);
|
|
11900
|
+
const route = stringValue6(options.route) || stringValue6(targetInput.route);
|
|
11748
11901
|
if (!targetUrl && !route) throw new Error("profile.target requires url or route, or pass --url.");
|
|
11749
11902
|
return {
|
|
11750
11903
|
version: RIDDLE_PROOF_PROFILE_VERSION,
|
|
@@ -11753,17 +11906,17 @@ function normalizeRiddleProofProfile(input, options = {}) {
|
|
|
11753
11906
|
url: targetUrl,
|
|
11754
11907
|
route,
|
|
11755
11908
|
viewports: options.viewports?.length ? options.viewports : normalizeViewports(targetInput.viewports),
|
|
11756
|
-
auth:
|
|
11909
|
+
auth: stringValue6(targetInput.auth) || "none",
|
|
11757
11910
|
timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
|
|
11758
|
-
wait_for_selector:
|
|
11759
|
-
wait_ms:
|
|
11911
|
+
wait_for_selector: stringValue6(targetInput.wait_for_selector) || stringValue6(targetInput.waitForSelector),
|
|
11912
|
+
wait_ms: numberValue4(targetInput.wait_ms) ?? numberValue4(targetInput.waitMs),
|
|
11760
11913
|
screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
|
|
11761
11914
|
setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
|
|
11762
11915
|
network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
|
|
11763
11916
|
},
|
|
11764
11917
|
checks,
|
|
11765
11918
|
artifacts: Array.isArray(input.artifacts) ? input.artifacts.map((item) => String(item)).filter(Boolean) : ["screenshot", "console", "dom_summary", "proof_json"],
|
|
11766
|
-
baseline_policy:
|
|
11919
|
+
baseline_policy: stringValue6(input.baseline_policy) || stringValue6(input.baselinePolicy) || "invariant_only",
|
|
11767
11920
|
failure_policy: normalizeFailurePolicy(input.failure_policy || input.failurePolicy),
|
|
11768
11921
|
metadata: jsonRecord(input.metadata)
|
|
11769
11922
|
};
|
|
@@ -11842,8 +11995,8 @@ function httpStatusIsAllowed(status, check) {
|
|
|
11842
11995
|
return allowed?.length ? allowed.includes(status) : status >= 200 && status < 400;
|
|
11843
11996
|
}
|
|
11844
11997
|
function linkStatusObservedBytes(result) {
|
|
11845
|
-
const bytes =
|
|
11846
|
-
const contentLength =
|
|
11998
|
+
const bytes = numberValue4(result.bytes);
|
|
11999
|
+
const contentLength = numberValue4(result.content_length);
|
|
11847
12000
|
return Math.max(bytes ?? 0, contentLength ?? 0) || void 0;
|
|
11848
12001
|
}
|
|
11849
12002
|
function normalizeLinkStatusContentType(value) {
|
|
@@ -11860,7 +12013,7 @@ function linkStatusContentTypesMatch(actual, expected) {
|
|
|
11860
12013
|
function linkStatusContentTypeOk(result, check) {
|
|
11861
12014
|
const expected = check.allowed_content_types;
|
|
11862
12015
|
if (!expected?.length) return true;
|
|
11863
|
-
const actual = normalizeLinkStatusContentType(
|
|
12016
|
+
const actual = normalizeLinkStatusContentType(stringValue6(result.content_type));
|
|
11864
12017
|
if (!actual) return false;
|
|
11865
12018
|
return expected.some((contentType) => {
|
|
11866
12019
|
const normalized = normalizeLinkStatusContentType(contentType);
|
|
@@ -11900,28 +12053,28 @@ function httpStatusBodyJsonAssertionFailures(result, check) {
|
|
|
11900
12053
|
}));
|
|
11901
12054
|
}
|
|
11902
12055
|
return result.body_json_assertions.filter((assertion) => isRecord2(assertion) && assertion.ok !== true).map((assertion) => ({
|
|
11903
|
-
label:
|
|
11904
|
-
path:
|
|
12056
|
+
label: stringValue6(assertion.label) || stringValue6(assertion.path) || "json assertion",
|
|
12057
|
+
path: stringValue6(assertion.path) || "",
|
|
11905
12058
|
ok: false,
|
|
11906
12059
|
exists: assertion.exists === true,
|
|
11907
12060
|
observed: hasOwn(assertion, "observed") ? toJsonValue(assertion.observed) : void 0,
|
|
11908
12061
|
observed_sample: hasOwn(assertion, "observed_sample") ? toJsonValue(assertion.observed_sample) : void 0,
|
|
11909
|
-
observed_length:
|
|
11910
|
-
observed_key_count:
|
|
11911
|
-
observed_omitted_count:
|
|
11912
|
-
observed_type:
|
|
11913
|
-
expected_exists:
|
|
12062
|
+
observed_length: numberValue4(assertion.observed_length),
|
|
12063
|
+
observed_key_count: numberValue4(assertion.observed_key_count),
|
|
12064
|
+
observed_omitted_count: numberValue4(assertion.observed_omitted_count),
|
|
12065
|
+
observed_type: stringValue6(assertion.observed_type) || "missing",
|
|
12066
|
+
expected_exists: booleanValue2(assertion.expected_exists),
|
|
11914
12067
|
equals: hasOwn(assertion, "equals") ? toJsonValue(assertion.equals) : void 0,
|
|
11915
12068
|
not_equals: hasOwn(assertion, "not_equals") ? toJsonValue(assertion.not_equals) : void 0,
|
|
11916
12069
|
contains: hasOwn(assertion, "contains") ? toJsonValue(assertion.contains) : void 0,
|
|
11917
|
-
type:
|
|
12070
|
+
type: stringValue6(assertion.type),
|
|
11918
12071
|
errors: Array.isArray(assertion.errors) ? assertion.errors.map(String) : void 0
|
|
11919
12072
|
}));
|
|
11920
12073
|
}
|
|
11921
12074
|
function linkStatusResultOk(result, check) {
|
|
11922
|
-
const status =
|
|
12075
|
+
const status = numberValue4(result.status);
|
|
11923
12076
|
if (!httpStatusIsAllowed(status, check)) return false;
|
|
11924
|
-
if (
|
|
12077
|
+
if (stringValue6(result.error)) return false;
|
|
11925
12078
|
if (result.ok === false) return false;
|
|
11926
12079
|
if (!linkStatusContentTypeOk(result, check)) return false;
|
|
11927
12080
|
if (check.require_nonzero_bytes) {
|
|
@@ -12036,12 +12189,12 @@ async function preflightHttpStatusCheck(check, index, targetUrl, fetchImpl) {
|
|
|
12036
12189
|
url,
|
|
12037
12190
|
method,
|
|
12038
12191
|
ok,
|
|
12039
|
-
status:
|
|
12192
|
+
status: numberValue4(result.status) ?? null,
|
|
12040
12193
|
status_text: statusText,
|
|
12041
12194
|
error,
|
|
12042
|
-
content_type:
|
|
12043
|
-
content_length:
|
|
12044
|
-
bytes:
|
|
12195
|
+
content_type: stringValue6(result.content_type) ?? null,
|
|
12196
|
+
content_length: numberValue4(result.content_length) ?? null,
|
|
12197
|
+
bytes: numberValue4(result.bytes) ?? null,
|
|
12045
12198
|
body_contains: isRecord2(result.body_contains) ? Object.fromEntries(Object.entries(result.body_contains).map(([key, value]) => [key, value === true])) : null,
|
|
12046
12199
|
body_contains_missing: bodyContainsMissing,
|
|
12047
12200
|
body_not_contains: isRecord2(result.body_not_contains) ? Object.fromEntries(Object.entries(result.body_not_contains).map(([key, value]) => [key, value === true])) : null,
|
|
@@ -12098,11 +12251,11 @@ function summarizeHttpStatusEvidence(viewport, check) {
|
|
|
12098
12251
|
if (!linkStatusResultOk(statusEvidence, check)) {
|
|
12099
12252
|
failures.push({
|
|
12100
12253
|
code: "http_status_failed",
|
|
12101
|
-
url:
|
|
12102
|
-
status:
|
|
12103
|
-
method:
|
|
12104
|
-
error:
|
|
12105
|
-
content_type:
|
|
12254
|
+
url: stringValue6(statusEvidence.url) ?? httpStatusRequestUrl(check, viewport.url),
|
|
12255
|
+
status: numberValue4(statusEvidence.status) ?? null,
|
|
12256
|
+
method: stringValue6(statusEvidence.method) ?? httpStatusMethod(check),
|
|
12257
|
+
error: stringValue6(statusEvidence.error) ?? null,
|
|
12258
|
+
content_type: stringValue6(statusEvidence.content_type) ?? null,
|
|
12106
12259
|
bytes: linkStatusObservedBytes(statusEvidence) ?? null,
|
|
12107
12260
|
allowed_statuses: httpStatusAllowedStatuses(check) ?? ["2xx", "3xx"],
|
|
12108
12261
|
min_bytes: check.min_bytes ?? null,
|
|
@@ -12115,20 +12268,20 @@ function summarizeHttpStatusEvidence(viewport, check) {
|
|
|
12115
12268
|
body_not_patterns_found: bodyNotPatternsFound,
|
|
12116
12269
|
body_json_assertions: check.body_json_assertions ?? null,
|
|
12117
12270
|
body_json_assertions_failed: bodyJsonAssertionsFailed.map((assertion) => toJsonValue(assertion)),
|
|
12118
|
-
body_sample:
|
|
12271
|
+
body_sample: stringValue6(statusEvidence.body_sample) ?? null
|
|
12119
12272
|
});
|
|
12120
12273
|
}
|
|
12121
12274
|
return {
|
|
12122
12275
|
viewport: viewport.name,
|
|
12123
12276
|
key,
|
|
12124
|
-
url:
|
|
12125
|
-
method:
|
|
12126
|
-
status:
|
|
12127
|
-
status_text:
|
|
12277
|
+
url: stringValue6(statusEvidence.url) ?? httpStatusRequestUrl(check, viewport.url),
|
|
12278
|
+
method: stringValue6(statusEvidence.method) ?? httpStatusMethod(check),
|
|
12279
|
+
status: numberValue4(statusEvidence.status) ?? null,
|
|
12280
|
+
status_text: stringValue6(statusEvidence.status_text) ?? null,
|
|
12128
12281
|
ok: failures.length === 0,
|
|
12129
|
-
error:
|
|
12130
|
-
content_type:
|
|
12131
|
-
content_length:
|
|
12282
|
+
error: stringValue6(statusEvidence.error) ?? null,
|
|
12283
|
+
content_type: stringValue6(statusEvidence.content_type) ?? null,
|
|
12284
|
+
content_length: numberValue4(statusEvidence.content_length) ?? null,
|
|
12132
12285
|
bytes: linkStatusObservedBytes(statusEvidence) ?? null,
|
|
12133
12286
|
body_contains: isRecord2(statusEvidence.body_contains) ? toJsonValue(statusEvidence.body_contains) : null,
|
|
12134
12287
|
body_contains_missing: bodyContainsMissing,
|
|
@@ -12138,7 +12291,7 @@ function summarizeHttpStatusEvidence(viewport, check) {
|
|
|
12138
12291
|
body_not_patterns_found: bodyNotPatternsFound,
|
|
12139
12292
|
body_json_assertions: Array.isArray(statusEvidence.body_json_assertions) ? toJsonValue(statusEvidence.body_json_assertions) : null,
|
|
12140
12293
|
body_json_assertions_failed: bodyJsonAssertionsFailed.map((assertion) => toJsonValue(assertion)),
|
|
12141
|
-
body_sample:
|
|
12294
|
+
body_sample: stringValue6(statusEvidence.body_sample) ?? null,
|
|
12142
12295
|
failures
|
|
12143
12296
|
};
|
|
12144
12297
|
}
|
|
@@ -12159,27 +12312,27 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
12159
12312
|
};
|
|
12160
12313
|
}
|
|
12161
12314
|
const results = Array.isArray(linkEvidence.results) ? linkEvidence.results.filter(isRecord2) : [];
|
|
12162
|
-
const totalCount =
|
|
12163
|
-
const resultCount =
|
|
12164
|
-
const storedResultCount =
|
|
12165
|
-
const omittedResultCount =
|
|
12166
|
-
const omittedSuccessCount =
|
|
12315
|
+
const totalCount = numberValue4(linkEvidence.total_count) ?? results.length;
|
|
12316
|
+
const resultCount = numberValue4(linkEvidence.result_count) ?? totalCount;
|
|
12317
|
+
const storedResultCount = numberValue4(linkEvidence.stored_result_count) ?? results.length;
|
|
12318
|
+
const omittedResultCount = numberValue4(linkEvidence.omitted_result_count) ?? Math.max(0, resultCount - storedResultCount);
|
|
12319
|
+
const omittedSuccessCount = numberValue4(linkEvidence.omitted_success_count) ?? 0;
|
|
12167
12320
|
const okCount = results.filter((result) => linkStatusResultOk(result, check)).length;
|
|
12168
12321
|
const failures = results.filter((result) => !linkStatusResultOk(result, check)).map((result) => ({
|
|
12169
12322
|
code: "link_status_failed",
|
|
12170
|
-
url:
|
|
12171
|
-
status:
|
|
12172
|
-
method:
|
|
12173
|
-
error:
|
|
12174
|
-
content_type:
|
|
12323
|
+
url: stringValue6(result.url) ?? null,
|
|
12324
|
+
status: numberValue4(result.status) ?? null,
|
|
12325
|
+
method: stringValue6(result.method) ?? null,
|
|
12326
|
+
error: stringValue6(result.error) ?? null,
|
|
12327
|
+
content_type: stringValue6(result.content_type) ?? null,
|
|
12175
12328
|
bytes: linkStatusObservedBytes(result) ?? null,
|
|
12176
12329
|
min_bytes: check.min_bytes ?? null,
|
|
12177
12330
|
allowed_content_types: check.allowed_content_types ?? null
|
|
12178
12331
|
}));
|
|
12179
|
-
if (
|
|
12180
|
-
failures.push({ code: "link_status_capture_failed", error:
|
|
12332
|
+
if (stringValue6(linkEvidence.error)) {
|
|
12333
|
+
failures.push({ code: "link_status_capture_failed", error: stringValue6(linkEvidence.error) ?? "" });
|
|
12181
12334
|
}
|
|
12182
|
-
const recordedFailedCount =
|
|
12335
|
+
const recordedFailedCount = numberValue4(linkEvidence.failed_count) ?? 0;
|
|
12183
12336
|
if (!failures.length && recordedFailedCount > 0) {
|
|
12184
12337
|
const recordedFailures = Array.isArray(linkEvidence.failures) ? linkEvidence.failures.slice(0, 20) : [];
|
|
12185
12338
|
failures.push({
|
|
@@ -12191,8 +12344,8 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
12191
12344
|
if (linkEvidence.truncated === true) {
|
|
12192
12345
|
failures.push({
|
|
12193
12346
|
code: "link_status_probe_truncated",
|
|
12194
|
-
discovered_count:
|
|
12195
|
-
max_links:
|
|
12347
|
+
discovered_count: numberValue4(linkEvidence.discovered_count) ?? totalCount,
|
|
12348
|
+
max_links: numberValue4(linkEvidence.max_links) ?? check.max_links ?? 100
|
|
12196
12349
|
});
|
|
12197
12350
|
}
|
|
12198
12351
|
if (check.expected_count !== void 0 && totalCount !== check.expected_count) {
|
|
@@ -12206,11 +12359,11 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
12206
12359
|
viewport: viewport.name,
|
|
12207
12360
|
selector: linkStatusSelector(check),
|
|
12208
12361
|
total_count: totalCount,
|
|
12209
|
-
discovered_count:
|
|
12210
|
-
ok_count:
|
|
12362
|
+
discovered_count: numberValue4(linkEvidence.discovered_count) ?? totalCount,
|
|
12363
|
+
ok_count: numberValue4(linkEvidence.ok_count) ?? okCount,
|
|
12211
12364
|
failed_count: failures.length,
|
|
12212
12365
|
truncated: linkEvidence.truncated === true,
|
|
12213
|
-
max_links:
|
|
12366
|
+
max_links: numberValue4(linkEvidence.max_links) ?? check.max_links ?? 100,
|
|
12214
12367
|
result_count: resultCount,
|
|
12215
12368
|
stored_result_count: storedResultCount,
|
|
12216
12369
|
omitted_result_count: omittedResultCount,
|
|
@@ -12285,13 +12438,13 @@ function frameTextSample(frame) {
|
|
|
12285
12438
|
function summarizeRouteInventory(viewport, inventory) {
|
|
12286
12439
|
const directRoutes = Array.isArray(inventory.direct_routes) ? inventory.direct_routes : [];
|
|
12287
12440
|
const clickthroughs = Array.isArray(inventory.clickthroughs) ? inventory.clickthroughs : [];
|
|
12288
|
-
const sourceLinkCount =
|
|
12289
|
-
const sourceUniqueLinkCount =
|
|
12290
|
-
const sourceCandidateCount =
|
|
12291
|
-
const sourceCandidateUniqueLinkCount =
|
|
12292
|
-
const sourceLinkScope =
|
|
12441
|
+
const sourceLinkCount = numberValue4(inventory.source_link_count) ?? numberValue4(inventory.home_game_link_count) ?? null;
|
|
12442
|
+
const sourceUniqueLinkCount = numberValue4(inventory.source_unique_link_count) ?? numberValue4(inventory.home_unique_game_link_count) ?? null;
|
|
12443
|
+
const sourceCandidateCount = numberValue4(inventory.source_candidate_count);
|
|
12444
|
+
const sourceCandidateUniqueLinkCount = numberValue4(inventory.source_candidate_unique_link_count);
|
|
12445
|
+
const sourceLinkScope = stringValue6(inventory.source_link_scope);
|
|
12293
12446
|
const duplicateSourceLinks = Array.isArray(inventory.duplicate_source_link_paths) ? inventory.duplicate_source_link_paths.map((path6) => String(path6)) : [];
|
|
12294
|
-
const duplicateSourceLinkCount =
|
|
12447
|
+
const duplicateSourceLinkCount = numberValue4(inventory.duplicate_source_link_count) ?? (sourceLinkCount !== null && sourceUniqueLinkCount !== null ? Math.max(0, sourceLinkCount - sourceUniqueLinkCount) : null);
|
|
12295
12448
|
const failures = Array.isArray(inventory.failures) ? inventory.failures : [];
|
|
12296
12449
|
return {
|
|
12297
12450
|
viewport,
|
|
@@ -12315,9 +12468,9 @@ function routeInventoryExpectedRouteSummaries(value, fallback) {
|
|
|
12315
12468
|
return path7 ? { path: path7 } : void 0;
|
|
12316
12469
|
}
|
|
12317
12470
|
if (!isRecord2(route)) return void 0;
|
|
12318
|
-
const path6 =
|
|
12471
|
+
const path6 = stringValue6(route.path);
|
|
12319
12472
|
if (!path6) return void 0;
|
|
12320
|
-
const name =
|
|
12473
|
+
const name = stringValue6(route.name);
|
|
12321
12474
|
return name ? { name, path: path6 } : { path: path6 };
|
|
12322
12475
|
}).filter((route) => Boolean(route));
|
|
12323
12476
|
}
|
|
@@ -12418,15 +12571,15 @@ function matchesAllowedMessage(input, texts, patterns) {
|
|
|
12418
12571
|
}
|
|
12419
12572
|
function consoleEventLocationUrl(input) {
|
|
12420
12573
|
if (!isRecord2(input) || !isRecord2(input.location)) return void 0;
|
|
12421
|
-
return
|
|
12574
|
+
return stringValue6(input.location.url);
|
|
12422
12575
|
}
|
|
12423
12576
|
function expectedFailedNetworkMockEvents(evidence) {
|
|
12424
12577
|
return (evidence.network_mocks || []).filter((event) => {
|
|
12425
12578
|
if (!isRecord2(event) || event.ok === false) return false;
|
|
12426
|
-
const status =
|
|
12579
|
+
const status = numberValue4(event.status);
|
|
12427
12580
|
const isHttpFailure = status !== void 0 && status >= 400;
|
|
12428
|
-
const isAbortedMock = event.abort === true && Boolean(
|
|
12429
|
-
return (isHttpFailure || isAbortedMock) && Boolean(
|
|
12581
|
+
const isAbortedMock = event.abort === true && Boolean(stringValue6(event.abort_error_code));
|
|
12582
|
+
return (isHttpFailure || isAbortedMock) && Boolean(stringValue6(event.url));
|
|
12430
12583
|
});
|
|
12431
12584
|
}
|
|
12432
12585
|
function matchingExpectedFailedNetworkMockConsoleEvent(event, evidence) {
|
|
@@ -12435,9 +12588,9 @@ function matchingExpectedFailedNetworkMockConsoleEvent(event, evidence) {
|
|
|
12435
12588
|
const eventUrl = consoleEventLocationUrl(event);
|
|
12436
12589
|
if (!eventUrl) return void 0;
|
|
12437
12590
|
return expectedFailedNetworkMockEvents(evidence).find((mockEvent) => {
|
|
12438
|
-
const status =
|
|
12439
|
-
const abortErrorCode =
|
|
12440
|
-
return
|
|
12591
|
+
const status = numberValue4(mockEvent.status);
|
|
12592
|
+
const abortErrorCode = stringValue6(mockEvent.abort_error_code);
|
|
12593
|
+
return stringValue6(mockEvent.url) === eventUrl && (status !== void 0 && sample.includes(String(status)) || Boolean(abortErrorCode) && /Failed to load resource/i.test(sample));
|
|
12441
12594
|
});
|
|
12442
12595
|
}
|
|
12443
12596
|
function isExpectedFailedNetworkMockConsoleEvent(event, evidence) {
|
|
@@ -12448,10 +12601,10 @@ function expectedFailedNetworkMockConsoleEventSummary(event, evidence) {
|
|
|
12448
12601
|
const sample = allowedMessageSample(event);
|
|
12449
12602
|
return {
|
|
12450
12603
|
url: consoleEventLocationUrl(event) ?? null,
|
|
12451
|
-
status: match ?
|
|
12452
|
-
abort_error_code: match ?
|
|
12453
|
-
label: match ?
|
|
12454
|
-
response_label: match ?
|
|
12604
|
+
status: match ? numberValue4(match.status) ?? null : null,
|
|
12605
|
+
abort_error_code: match ? stringValue6(match.abort_error_code) ?? null : null,
|
|
12606
|
+
label: match ? stringValue6(match.label) ?? null : null,
|
|
12607
|
+
response_label: match ? stringValue6(match.response_label) ?? null : null,
|
|
12455
12608
|
text: isRecord2(event) && typeof event.text === "string" ? event.text.slice(0, 300) : sample.slice(0, 300)
|
|
12456
12609
|
};
|
|
12457
12610
|
}
|
|
@@ -12579,7 +12732,7 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
12579
12732
|
if (isDialogCountCheckType(check.type)) {
|
|
12580
12733
|
const field = dialogCountFieldForCheckType(check.type);
|
|
12581
12734
|
const expectedCount = check.expected_count ?? 0;
|
|
12582
|
-
const actualCount =
|
|
12735
|
+
const actualCount = numberValue4(evidence.dom_summary?.[field]) ?? 0;
|
|
12583
12736
|
return {
|
|
12584
12737
|
type: check.type,
|
|
12585
12738
|
label: checkLabel(check),
|
|
@@ -12780,14 +12933,14 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
12780
12933
|
return {
|
|
12781
12934
|
viewport: viewport.name,
|
|
12782
12935
|
matched,
|
|
12783
|
-
elapsed_ms:
|
|
12784
|
-
timeout_ms:
|
|
12785
|
-
attempts:
|
|
12786
|
-
selector_count:
|
|
12787
|
-
visible_count:
|
|
12788
|
-
matched_count:
|
|
12789
|
-
sample:
|
|
12790
|
-
error:
|
|
12936
|
+
elapsed_ms: numberValue4(observation?.elapsed_ms) ?? null,
|
|
12937
|
+
timeout_ms: numberValue4(observation?.timeout_ms) ?? timeoutMs,
|
|
12938
|
+
attempts: numberValue4(observation?.attempts) ?? null,
|
|
12939
|
+
selector_count: numberValue4(observation?.selector_count) ?? null,
|
|
12940
|
+
visible_count: numberValue4(observation?.visible_count) ?? null,
|
|
12941
|
+
matched_count: numberValue4(observation?.matched_count) ?? null,
|
|
12942
|
+
sample: stringValue6(observation?.sample) ?? null,
|
|
12943
|
+
error: stringValue6(observation?.error) ?? null
|
|
12791
12944
|
};
|
|
12792
12945
|
});
|
|
12793
12946
|
const failed = results.filter((result) => !result.matched).length;
|
|
@@ -12945,7 +13098,7 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
12945
13098
|
body_not_patterns: check.body_not_patterns ?? [],
|
|
12946
13099
|
body_json_assertions: toJsonValue(check.body_json_assertions ?? []),
|
|
12947
13100
|
viewports: summaries.map((summary) => toJsonValue(summary)),
|
|
12948
|
-
failures: failed.flatMap((summary) => Array.isArray(summary.failures) ? summary.failures.map((failure) => toJsonValue({ viewport:
|
|
13101
|
+
failures: failed.flatMap((summary) => Array.isArray(summary.failures) ? summary.failures.map((failure) => toJsonValue({ viewport: stringValue6(summary.viewport) ?? null, failure })) : [])
|
|
12949
13102
|
},
|
|
12950
13103
|
message: failed.length ? `HTTP status failed in ${failed.length} viewport(s).` : void 0
|
|
12951
13104
|
};
|
|
@@ -12953,7 +13106,7 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
12953
13106
|
if (check.type === "link_status" || check.type === "artifact_link_status") {
|
|
12954
13107
|
const selector = linkStatusSelector(check);
|
|
12955
13108
|
const summaries = viewports.map((viewport) => summarizeLinkStatusEvidence(viewport, check));
|
|
12956
|
-
const failed = summaries.filter((summary) => (
|
|
13109
|
+
const failed = summaries.filter((summary) => (numberValue4(summary.failed_count) ?? 0) > 0);
|
|
12957
13110
|
return {
|
|
12958
13111
|
type: check.type,
|
|
12959
13112
|
label: checkLabel(check),
|
|
@@ -12967,7 +13120,7 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
12967
13120
|
min_bytes: check.min_bytes ?? null,
|
|
12968
13121
|
allowed_content_types: check.allowed_content_types ?? null,
|
|
12969
13122
|
viewports: summaries.map((summary) => toJsonValue(summary)),
|
|
12970
|
-
failures: failed.flatMap((summary) => Array.isArray(summary.failures) ? summary.failures.map((failure) => toJsonValue({ viewport:
|
|
13123
|
+
failures: failed.flatMap((summary) => Array.isArray(summary.failures) ? summary.failures.map((failure) => toJsonValue({ viewport: stringValue6(summary.viewport) ?? null, failure })) : [])
|
|
12971
13124
|
},
|
|
12972
13125
|
message: failed.length ? `Link status failed in ${failed.length} viewport(s).` : void 0
|
|
12973
13126
|
};
|
|
@@ -12991,13 +13144,13 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
12991
13144
|
const first = inventories[0]?.inventory;
|
|
12992
13145
|
const directRoutes = Array.isArray(first?.direct_routes) ? first.direct_routes : [];
|
|
12993
13146
|
const clickthroughs = Array.isArray(first?.clickthroughs) ? first.clickthroughs : [];
|
|
12994
|
-
const sourceLinkCount =
|
|
12995
|
-
const sourceUniqueLinkCount =
|
|
12996
|
-
const sourceCandidateCount =
|
|
12997
|
-
const sourceCandidateUniqueLinkCount =
|
|
12998
|
-
const sourceLinkScope =
|
|
13147
|
+
const sourceLinkCount = numberValue4(first?.source_link_count) ?? numberValue4(first?.home_game_link_count) ?? null;
|
|
13148
|
+
const sourceUniqueLinkCount = numberValue4(first?.source_unique_link_count) ?? numberValue4(first?.home_unique_game_link_count) ?? null;
|
|
13149
|
+
const sourceCandidateCount = numberValue4(first?.source_candidate_count);
|
|
13150
|
+
const sourceCandidateUniqueLinkCount = numberValue4(first?.source_candidate_unique_link_count);
|
|
13151
|
+
const sourceLinkScope = stringValue6(first?.source_link_scope);
|
|
12999
13152
|
const duplicateSourceLinks = Array.isArray(first?.duplicate_source_link_paths) ? first.duplicate_source_link_paths.map((path6) => String(path6)) : [];
|
|
13000
|
-
const duplicateSourceLinkCount =
|
|
13153
|
+
const duplicateSourceLinkCount = numberValue4(first?.duplicate_source_link_count) ?? (sourceLinkCount !== null && sourceUniqueLinkCount !== null ? Math.max(0, sourceLinkCount - sourceUniqueLinkCount) : null);
|
|
13001
13154
|
const expectedRoutes = routeInventoryExpectedRouteSummaries(first?.expected_routes, check.expected_routes);
|
|
13002
13155
|
return {
|
|
13003
13156
|
type: check.type,
|
|
@@ -13014,8 +13167,8 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
13014
13167
|
duplicate_source_link_count: duplicateSourceLinkCount,
|
|
13015
13168
|
duplicate_source_links: duplicateSourceLinks,
|
|
13016
13169
|
duplicates_allowed: check.require_unique_routes === false,
|
|
13017
|
-
homepage_link_count:
|
|
13018
|
-
homepage_unique_link_count:
|
|
13170
|
+
homepage_link_count: numberValue4(first?.home_game_link_count) ?? sourceLinkCount,
|
|
13171
|
+
homepage_unique_link_count: numberValue4(first?.home_unique_game_link_count) ?? sourceUniqueLinkCount,
|
|
13019
13172
|
direct_route_count: directRoutes.length,
|
|
13020
13173
|
clickthrough_count: clickthroughs.length,
|
|
13021
13174
|
viewport_count: inventories.length,
|
|
@@ -19250,9 +19403,9 @@ function collectRiddleProfileArtifactRefs(input) {
|
|
|
19250
19403
|
const priorities = /* @__PURE__ */ new Map();
|
|
19251
19404
|
function add(item, source) {
|
|
19252
19405
|
if (!isRecord2(item)) return;
|
|
19253
|
-
const url =
|
|
19254
|
-
const path6 =
|
|
19255
|
-
const rawName =
|
|
19406
|
+
const url = stringValue6(item.url);
|
|
19407
|
+
const path6 = stringValue6(item.path);
|
|
19408
|
+
const rawName = stringValue6(item.name) || stringValue6(item.filename) || artifactNameFromPath(url || path6) || "";
|
|
19256
19409
|
const name = normalizeRiddleProfileArtifactName(rawName);
|
|
19257
19410
|
if (!name && !url && !path6) return;
|
|
19258
19411
|
const key = profileArtifactDedupeKey(name, url || path6 || "");
|
|
@@ -19261,8 +19414,8 @@ function collectRiddleProfileArtifactRefs(input) {
|
|
|
19261
19414
|
name,
|
|
19262
19415
|
url,
|
|
19263
19416
|
path: path6,
|
|
19264
|
-
kind:
|
|
19265
|
-
content_type:
|
|
19417
|
+
kind: stringValue6(item.kind) || stringValue6(item.type),
|
|
19418
|
+
content_type: stringValue6(item.content_type) || stringValue6(item.contentType),
|
|
19266
19419
|
source
|
|
19267
19420
|
};
|
|
19268
19421
|
const existingIndex = indexes.get(key);
|
|
@@ -19922,21 +20075,28 @@ function createRiddleApiClient(config = {}) {
|
|
|
19922
20075
|
|
|
19923
20076
|
// src/pr-comment.ts
|
|
19924
20077
|
var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
|
|
19925
|
-
function
|
|
20078
|
+
function asRecord2(value) {
|
|
19926
20079
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
19927
20080
|
}
|
|
19928
20081
|
function asArray(value) {
|
|
19929
20082
|
return Array.isArray(value) ? value : [];
|
|
19930
20083
|
}
|
|
19931
|
-
function
|
|
20084
|
+
function stringValue7(value) {
|
|
19932
20085
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
19933
20086
|
}
|
|
19934
|
-
function
|
|
20087
|
+
function numberValue5(value) {
|
|
19935
20088
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
19936
20089
|
}
|
|
19937
|
-
function
|
|
20090
|
+
function booleanValue3(value) {
|
|
19938
20091
|
return typeof value === "boolean" ? value : void 0;
|
|
19939
20092
|
}
|
|
20093
|
+
function firstStringValue2(...values) {
|
|
20094
|
+
for (const value of values) {
|
|
20095
|
+
const text = stringValue7(value);
|
|
20096
|
+
if (text) return text;
|
|
20097
|
+
}
|
|
20098
|
+
return void 0;
|
|
20099
|
+
}
|
|
19940
20100
|
function artifactKind(name, url) {
|
|
19941
20101
|
const target = `${name} ${url}`.toLowerCase();
|
|
19942
20102
|
if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
|
|
@@ -19944,18 +20104,18 @@ function artifactKind(name, url) {
|
|
|
19944
20104
|
return "artifact";
|
|
19945
20105
|
}
|
|
19946
20106
|
function artifactDisplayName(value, fallback) {
|
|
19947
|
-
const raw =
|
|
20107
|
+
const raw = stringValue7(value);
|
|
19948
20108
|
if (raw) return raw;
|
|
19949
20109
|
return fallback;
|
|
19950
20110
|
}
|
|
19951
20111
|
function collectArtifacts(runResponse) {
|
|
19952
|
-
const proofResult =
|
|
20112
|
+
const proofResult = asRecord2(runResponse.proofResult);
|
|
19953
20113
|
const outputs = asArray(proofResult.outputs);
|
|
19954
20114
|
const artifacts = [];
|
|
19955
20115
|
const seen = /* @__PURE__ */ new Set();
|
|
19956
20116
|
for (const [index, item] of outputs.entries()) {
|
|
19957
|
-
const artifact =
|
|
19958
|
-
const url =
|
|
20117
|
+
const artifact = asRecord2(item);
|
|
20118
|
+
const url = stringValue7(artifact.url);
|
|
19959
20119
|
if (!url || seen.has(url)) continue;
|
|
19960
20120
|
seen.add(url);
|
|
19961
20121
|
const name = artifactDisplayName(artifact.name, `artifact-${index + 1}`);
|
|
@@ -19963,7 +20123,7 @@ function collectArtifacts(runResponse) {
|
|
|
19963
20123
|
name,
|
|
19964
20124
|
url,
|
|
19965
20125
|
kind: artifactKind(name, url),
|
|
19966
|
-
size_bytes:
|
|
20126
|
+
size_bytes: numberValue5(artifact.size)
|
|
19967
20127
|
});
|
|
19968
20128
|
}
|
|
19969
20129
|
return artifacts;
|
|
@@ -19971,9 +20131,9 @@ function collectArtifacts(runResponse) {
|
|
|
19971
20131
|
function pageSummaries(result) {
|
|
19972
20132
|
const pages = [];
|
|
19973
20133
|
for (const page of asArray(result.pages)) {
|
|
19974
|
-
const record =
|
|
19975
|
-
const route =
|
|
19976
|
-
const checks =
|
|
20134
|
+
const record = asRecord2(page);
|
|
20135
|
+
const route = stringValue7(record.route) || stringValue7(record.url) || "page";
|
|
20136
|
+
const checks = asRecord2(record.checks);
|
|
19977
20137
|
let passed = 0;
|
|
19978
20138
|
let failed = 0;
|
|
19979
20139
|
for (const value of Object.values(checks)) {
|
|
@@ -20013,27 +20173,74 @@ function selectPrimaryImage(artifacts) {
|
|
|
20013
20173
|
const images = artifacts.filter((artifact) => artifact.kind === "image");
|
|
20014
20174
|
return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
|
|
20015
20175
|
}
|
|
20176
|
+
function firstRecordValue2(...values) {
|
|
20177
|
+
for (const value of values) {
|
|
20178
|
+
const record = asRecord2(value);
|
|
20179
|
+
if (Object.keys(record).length) return record;
|
|
20180
|
+
}
|
|
20181
|
+
return void 0;
|
|
20182
|
+
}
|
|
20183
|
+
function checkpointSummaryFrom2(...values) {
|
|
20184
|
+
const record = firstRecordValue2(...values);
|
|
20185
|
+
if (!record) return void 0;
|
|
20186
|
+
const summary = {
|
|
20187
|
+
pending: booleanValue3(record.pending),
|
|
20188
|
+
response_count: numberValue5(record.response_count),
|
|
20189
|
+
rejected_response_count: numberValue5(record.rejected_response_count),
|
|
20190
|
+
ignored_response_count: numberValue5(record.ignored_response_count),
|
|
20191
|
+
duplicate_response_count: numberValue5(record.duplicate_response_count),
|
|
20192
|
+
latest_decision: stringValue7(record.latest_decision),
|
|
20193
|
+
latest_packet_id: stringValue7(record.latest_packet_id),
|
|
20194
|
+
latest_resume_token: stringValue7(record.latest_resume_token)
|
|
20195
|
+
};
|
|
20196
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
20197
|
+
}
|
|
20016
20198
|
function summarizeRiddleProofPrComment(input) {
|
|
20017
|
-
const runResponse =
|
|
20018
|
-
const result =
|
|
20019
|
-
const proofResult =
|
|
20020
|
-
const preview =
|
|
20199
|
+
const runResponse = asRecord2(input.runResponse);
|
|
20200
|
+
const result = asRecord2(input.result);
|
|
20201
|
+
const proofResult = asRecord2(runResponse.proofResult);
|
|
20202
|
+
const preview = asRecord2(runResponse.preview);
|
|
20203
|
+
const resultRunCard = asRecord2(result.run_card);
|
|
20204
|
+
const stopCondition = asRecord2(resultRunCard.stop_condition);
|
|
20205
|
+
const resultDetails = asRecord2(result.details);
|
|
20206
|
+
const resultRaw = asRecord2(result.raw);
|
|
20207
|
+
const rawDetails = asRecord2(resultRaw.details);
|
|
20021
20208
|
const artifacts = collectArtifacts(runResponse);
|
|
20022
20209
|
const pages = pageSummaries(result);
|
|
20023
20210
|
const checkSource = { ...result };
|
|
20024
20211
|
delete checkSource.ok;
|
|
20025
20212
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
20026
|
-
const ok =
|
|
20213
|
+
const ok = booleanValue3(result.ok) ?? booleanValue3(runResponse.ok) ?? null;
|
|
20214
|
+
const checkpointSummary = checkpointSummaryFrom2(
|
|
20215
|
+
result.checkpoint_summary,
|
|
20216
|
+
stopCondition.checkpoint_summary,
|
|
20217
|
+
resultDetails.checkpoint_summary,
|
|
20218
|
+
rawDetails.checkpoint_summary,
|
|
20219
|
+
proofResult.checkpoint_summary
|
|
20220
|
+
);
|
|
20221
|
+
const publicState = summarizeRiddleProofPublicState({
|
|
20222
|
+
...result,
|
|
20223
|
+
status: firstStringValue2(result.status, stopCondition.status),
|
|
20224
|
+
checkpoint_summary: checkpointSummary || result.checkpoint_summary
|
|
20225
|
+
});
|
|
20027
20226
|
return {
|
|
20028
20227
|
ok,
|
|
20029
|
-
status:
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20228
|
+
status: stringValue7(proofResult.status),
|
|
20229
|
+
result_status: publicState.status,
|
|
20230
|
+
job_id: stringValue7(proofResult.job_id),
|
|
20231
|
+
duration_ms: numberValue5(proofResult.duration_ms),
|
|
20232
|
+
proof_url: stringValue7(runResponse.proofUrl),
|
|
20233
|
+
preview_id: stringValue7(preview.id),
|
|
20234
|
+
preview_url: stringValue7(preview.preview_url) || stringValue7(preview.url),
|
|
20235
|
+
preview_publish_recovered: booleanValue3(preview.publish_recovered),
|
|
20236
|
+
preview_publish_error: stringValue7(preview.publish_error),
|
|
20237
|
+
ship_held: publicState.ship_held,
|
|
20238
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
20239
|
+
ship_authorized: publicState.ship_authorized,
|
|
20240
|
+
proof_decision: firstStringValue2(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
|
|
20241
|
+
merge_recommendation: firstStringValue2(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
|
|
20242
|
+
checkpoint_summary: checkpointSummary,
|
|
20243
|
+
public_state: publicState,
|
|
20037
20244
|
passed_checks: nestedChecks.passed,
|
|
20038
20245
|
failed_checks: nestedChecks.failed,
|
|
20039
20246
|
pages,
|
|
@@ -20052,9 +20259,16 @@ function markdownLink(label, url) {
|
|
|
20052
20259
|
return `[${label.replace(/\]/g, "\\]")}](${url})`;
|
|
20053
20260
|
}
|
|
20054
20261
|
function resultLabel(summary) {
|
|
20055
|
-
if (summary.
|
|
20262
|
+
if (summary.public_state?.result_label) return summary.public_state.result_label;
|
|
20263
|
+
if (summary.ok === true) {
|
|
20264
|
+
if (summary.result_status === "shipped") return "shipped";
|
|
20265
|
+
if (summary.result_status === "completed") return "completed";
|
|
20266
|
+
if (summary.ship_held === true) return "proof passed; ship held";
|
|
20267
|
+
if (summary.ship_authorized === true) return "passed; ship authorized";
|
|
20268
|
+
return "passed";
|
|
20269
|
+
}
|
|
20056
20270
|
if (summary.ok === false) return "failed";
|
|
20057
|
-
return summary.status || "recorded";
|
|
20271
|
+
return summary.result_status || summary.status || "recorded";
|
|
20058
20272
|
}
|
|
20059
20273
|
function artifactRank(artifact) {
|
|
20060
20274
|
const name = artifact.name.toLowerCase();
|
|
@@ -20066,6 +20280,25 @@ function artifactRank(artifact) {
|
|
|
20066
20280
|
if (artifact.kind === "image") return 20;
|
|
20067
20281
|
return 30;
|
|
20068
20282
|
}
|
|
20283
|
+
function formatBool(value) {
|
|
20284
|
+
return typeof value === "boolean" ? String(value) : "unknown";
|
|
20285
|
+
}
|
|
20286
|
+
function hasShipControl(summary) {
|
|
20287
|
+
return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
|
|
20288
|
+
}
|
|
20289
|
+
function checkpointSummaryLine(summary) {
|
|
20290
|
+
const accepted = summary.response_count ?? 0;
|
|
20291
|
+
const rejected = summary.rejected_response_count ?? 0;
|
|
20292
|
+
const ignored = summary.ignored_response_count ?? 0;
|
|
20293
|
+
const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
|
|
20294
|
+
if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
|
|
20295
|
+
const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
|
|
20296
|
+
return [
|
|
20297
|
+
parts.join(" / "),
|
|
20298
|
+
state,
|
|
20299
|
+
summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
|
|
20300
|
+
].filter(Boolean).join("; ");
|
|
20301
|
+
}
|
|
20069
20302
|
function buildRiddleProofPrCommentMarkdown(input) {
|
|
20070
20303
|
const summary = summarizeRiddleProofPrComment(input);
|
|
20071
20304
|
const title = input.title?.trim() || "Riddle Proof Evidence";
|
|
@@ -20077,9 +20310,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
20077
20310
|
];
|
|
20078
20311
|
if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
|
|
20079
20312
|
if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
|
|
20313
|
+
if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
|
|
20080
20314
|
if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
|
|
20081
20315
|
if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
|
|
20082
20316
|
if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
|
|
20317
|
+
if (hasShipControl(summary)) {
|
|
20318
|
+
lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
|
|
20319
|
+
}
|
|
20320
|
+
if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
|
|
20321
|
+
if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
|
|
20322
|
+
if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
|
|
20083
20323
|
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
20084
20324
|
if (summary.preview_id || summary.preview_url) {
|
|
20085
20325
|
const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
|
|
@@ -20253,6 +20493,7 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
20253
20493
|
summarizeCaptureArtifacts,
|
|
20254
20494
|
summarizeRiddleProofPrComment,
|
|
20255
20495
|
summarizeRiddleProofProfileResult,
|
|
20496
|
+
summarizeRiddleProofPublicState,
|
|
20256
20497
|
visualSessionFingerprint,
|
|
20257
20498
|
visualSessionFingerprintBasis
|
|
20258
20499
|
});
|