@riddledc/riddle-proof 0.8.67 → 0.8.68
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-VSP4K5LR.js → chunk-AF3KFD4A.js} +10 -5
- package/dist/{chunk-RZ3GXSXQ.js → chunk-DTFSHRV5.js} +76 -7
- package/dist/cli/index.js +2 -2
- package/dist/cli.cjs +85 -11
- package/dist/cli.js +2 -2
- package/dist/index.cjs +76 -7
- package/dist/index.js +1 -1
- package/dist/pr-comment.cjs +76 -7
- package/dist/pr-comment.js +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
9
9
|
buildRiddleProofPrCommentMarkdown,
|
|
10
10
|
summarizeRiddleProofPrComment
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DTFSHRV5.js";
|
|
12
12
|
import {
|
|
13
13
|
suggestRiddleProofProfileChecks
|
|
14
14
|
} from "./chunk-5Y4V2IXI.js";
|
|
@@ -4713,12 +4713,17 @@ async function main() {
|
|
|
4713
4713
|
}
|
|
4714
4714
|
if (command === "pr-comment") {
|
|
4715
4715
|
const proofDir = optionString(options, "proofDir") || optionString(options, "outputDir") || positional[1];
|
|
4716
|
-
const
|
|
4717
|
-
const
|
|
4716
|
+
const explicitRunResponsePath = optionString(options, "runResponse");
|
|
4717
|
+
const explicitResultJsonPath = optionString(options, "resultJson");
|
|
4718
|
+
const runResponsePath = explicitRunResponsePath || defaultProofDirJsonPath(proofDir, "riddle-run-response.json");
|
|
4719
|
+
const resultJsonPaths = explicitResultJsonPath ? [explicitResultJsonPath] : [
|
|
4720
|
+
defaultProofDirJsonPath(proofDir, "result.json"),
|
|
4721
|
+
defaultProofDirJsonPath(proofDir, "profile-result.json")
|
|
4722
|
+
];
|
|
4718
4723
|
const runResponse = readJsonFileIfExists(runResponsePath);
|
|
4719
|
-
const result = readJsonFileIfExists(
|
|
4724
|
+
const result = resultJsonPaths.map((candidate) => readJsonFileIfExists(candidate)).find(Boolean);
|
|
4720
4725
|
if (!runResponse && !result) {
|
|
4721
|
-
throw new Error("pr-comment requires --proof-dir with riddle-run-response.json
|
|
4726
|
+
throw new Error("pr-comment requires --proof-dir with riddle-run-response.json, result.json, or profile-result.json, or explicit --run-response/--result-json.");
|
|
4722
4727
|
}
|
|
4723
4728
|
const body = buildRiddleProofPrCommentMarkdown({
|
|
4724
4729
|
title: optionString(options, "title"),
|
|
@@ -59,6 +59,36 @@ function collectArtifacts(runResponse) {
|
|
|
59
59
|
}
|
|
60
60
|
return artifacts;
|
|
61
61
|
}
|
|
62
|
+
function collectProfileArtifacts(result) {
|
|
63
|
+
const resultArtifacts = asRecord(result.artifacts);
|
|
64
|
+
const artifacts = [];
|
|
65
|
+
const seen = /* @__PURE__ */ new Set();
|
|
66
|
+
for (const [index, item] of asArray(resultArtifacts.riddle_artifacts).entries()) {
|
|
67
|
+
const artifact = asRecord(item);
|
|
68
|
+
const url = stringValue(artifact.url);
|
|
69
|
+
if (!url || seen.has(url)) continue;
|
|
70
|
+
seen.add(url);
|
|
71
|
+
const fallbackName = stringValue(artifact.kind) || `artifact-${index + 1}`;
|
|
72
|
+
const name = artifactDisplayName(artifact.name, fallbackName);
|
|
73
|
+
artifacts.push({
|
|
74
|
+
name,
|
|
75
|
+
url,
|
|
76
|
+
kind: artifactKind(name, url),
|
|
77
|
+
size_bytes: numberValue(artifact.size_bytes) ?? numberValue(artifact.size)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return artifacts;
|
|
81
|
+
}
|
|
82
|
+
function mergeArtifacts(...artifactLists) {
|
|
83
|
+
const artifacts = [];
|
|
84
|
+
const seen = /* @__PURE__ */ new Set();
|
|
85
|
+
for (const artifact of artifactLists.flat()) {
|
|
86
|
+
if (seen.has(artifact.url)) continue;
|
|
87
|
+
seen.add(artifact.url);
|
|
88
|
+
artifacts.push(artifact);
|
|
89
|
+
}
|
|
90
|
+
return artifacts;
|
|
91
|
+
}
|
|
62
92
|
function pageSummaries(result) {
|
|
63
93
|
const pages = [];
|
|
64
94
|
for (const page of asArray(result.pages)) {
|
|
@@ -75,6 +105,35 @@ function pageSummaries(result) {
|
|
|
75
105
|
}
|
|
76
106
|
return pages;
|
|
77
107
|
}
|
|
108
|
+
function profileCheckCounts(result) {
|
|
109
|
+
const checks = asArray(result.checks);
|
|
110
|
+
if (checks.length) {
|
|
111
|
+
let passed2 = 0;
|
|
112
|
+
let failed2 = 0;
|
|
113
|
+
for (const item of checks) {
|
|
114
|
+
const status = stringValue(asRecord(item).status);
|
|
115
|
+
if (status === "passed") passed2 += 1;
|
|
116
|
+
if (status === "failed") failed2 += 1;
|
|
117
|
+
}
|
|
118
|
+
return { passed: passed2, failed: failed2 };
|
|
119
|
+
}
|
|
120
|
+
const checkCounts = asRecord(result.check_counts);
|
|
121
|
+
const passed = numberValue(checkCounts.passed);
|
|
122
|
+
const failed = numberValue(checkCounts.failed);
|
|
123
|
+
if (typeof passed === "number" || typeof failed === "number") {
|
|
124
|
+
return { passed: passed ?? 0, failed: failed ?? 0 };
|
|
125
|
+
}
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
function profilePageSummaries(result, counts) {
|
|
129
|
+
if (!counts) return [];
|
|
130
|
+
const route = asRecord(result.route);
|
|
131
|
+
return [{
|
|
132
|
+
route: firstStringValue(route.observed, route.expected_path, route.requested, result.profile_name) || "profile",
|
|
133
|
+
passed: counts.passed,
|
|
134
|
+
failed: counts.failed
|
|
135
|
+
}];
|
|
136
|
+
}
|
|
78
137
|
function summarizeExplicitChecks(value) {
|
|
79
138
|
let passed = 0;
|
|
80
139
|
let failed = 0;
|
|
@@ -126,18 +185,28 @@ function checkpointSummaryFrom(...values) {
|
|
|
126
185
|
};
|
|
127
186
|
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
128
187
|
}
|
|
188
|
+
function isProfileResult(result) {
|
|
189
|
+
const version = stringValue(result.version);
|
|
190
|
+
return version === "riddle-proof.profile-result.v1" || version === "riddle-proof.profile-compact-result.v1";
|
|
191
|
+
}
|
|
129
192
|
function summarizeRiddleProofPrComment(input) {
|
|
130
193
|
const runResponse = asRecord(input.runResponse);
|
|
131
194
|
const result = asRecord(input.result);
|
|
132
195
|
const proofResult = asRecord(runResponse.proofResult);
|
|
196
|
+
const profileResult = isProfileResult(result);
|
|
197
|
+
const profileRiddle = asRecord(result.riddle);
|
|
133
198
|
const preview = asRecord(runResponse.preview);
|
|
134
199
|
const resultRunCard = asRecord(result.run_card);
|
|
135
200
|
const stopCondition = asRecord(resultRunCard.stop_condition);
|
|
136
201
|
const resultDetails = asRecord(result.details);
|
|
137
202
|
const resultRaw = asRecord(result.raw);
|
|
138
203
|
const rawDetails = asRecord(resultRaw.details);
|
|
139
|
-
const
|
|
140
|
-
const
|
|
204
|
+
const profileChecks = profileResult ? profileCheckCounts(result) : void 0;
|
|
205
|
+
const artifacts = mergeArtifacts(
|
|
206
|
+
collectArtifacts(runResponse),
|
|
207
|
+
profileResult ? collectProfileArtifacts(result) : []
|
|
208
|
+
);
|
|
209
|
+
const pages = profileResult ? profilePageSummaries(result, profileChecks) : pageSummaries(result);
|
|
141
210
|
const checkSource = { ...result };
|
|
142
211
|
delete checkSource.ok;
|
|
143
212
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
@@ -160,10 +229,10 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
160
229
|
);
|
|
161
230
|
return {
|
|
162
231
|
ok,
|
|
163
|
-
status:
|
|
232
|
+
status: firstStringValue(proofResult.status, profileRiddle.status),
|
|
164
233
|
result_status: publicState.status,
|
|
165
|
-
job_id:
|
|
166
|
-
duration_ms: numberValue(proofResult.duration_ms),
|
|
234
|
+
job_id: firstStringValue(proofResult.job_id, profileRiddle.job_id),
|
|
235
|
+
duration_ms: numberValue(proofResult.duration_ms) ?? numberValue(profileRiddle.elapsed_ms),
|
|
167
236
|
proof_url: stringValue(runResponse.proofUrl),
|
|
168
237
|
preview_id: stringValue(preview.id),
|
|
169
238
|
preview_url: stringValue(preview.preview_url) || stringValue(preview.url),
|
|
@@ -178,8 +247,8 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
178
247
|
merge_recommendation: mergeRecommendation,
|
|
179
248
|
checkpoint_summary: checkpointSummary,
|
|
180
249
|
public_state: publicState,
|
|
181
|
-
passed_checks: nestedChecks.passed,
|
|
182
|
-
failed_checks: nestedChecks.failed,
|
|
250
|
+
passed_checks: profileChecks?.passed ?? nestedChecks.passed,
|
|
251
|
+
failed_checks: profileChecks?.failed ?? nestedChecks.failed,
|
|
183
252
|
pages,
|
|
184
253
|
artifacts,
|
|
185
254
|
primary_image: selectPrimaryImage(artifacts)
|
package/dist/cli/index.js
CHANGED
package/dist/cli.cjs
CHANGED
|
@@ -18034,6 +18034,36 @@ function collectArtifacts(runResponse) {
|
|
|
18034
18034
|
}
|
|
18035
18035
|
return artifacts;
|
|
18036
18036
|
}
|
|
18037
|
+
function collectProfileArtifacts(result) {
|
|
18038
|
+
const resultArtifacts = asRecord2(result.artifacts);
|
|
18039
|
+
const artifacts = [];
|
|
18040
|
+
const seen = /* @__PURE__ */ new Set();
|
|
18041
|
+
for (const [index, item] of asArray(resultArtifacts.riddle_artifacts).entries()) {
|
|
18042
|
+
const artifact = asRecord2(item);
|
|
18043
|
+
const url = stringValue4(artifact.url);
|
|
18044
|
+
if (!url || seen.has(url)) continue;
|
|
18045
|
+
seen.add(url);
|
|
18046
|
+
const fallbackName = stringValue4(artifact.kind) || `artifact-${index + 1}`;
|
|
18047
|
+
const name = artifactDisplayName(artifact.name, fallbackName);
|
|
18048
|
+
artifacts.push({
|
|
18049
|
+
name,
|
|
18050
|
+
url,
|
|
18051
|
+
kind: artifactKind(name, url),
|
|
18052
|
+
size_bytes: numberValue3(artifact.size_bytes) ?? numberValue3(artifact.size)
|
|
18053
|
+
});
|
|
18054
|
+
}
|
|
18055
|
+
return artifacts;
|
|
18056
|
+
}
|
|
18057
|
+
function mergeArtifacts(...artifactLists) {
|
|
18058
|
+
const artifacts = [];
|
|
18059
|
+
const seen = /* @__PURE__ */ new Set();
|
|
18060
|
+
for (const artifact of artifactLists.flat()) {
|
|
18061
|
+
if (seen.has(artifact.url)) continue;
|
|
18062
|
+
seen.add(artifact.url);
|
|
18063
|
+
artifacts.push(artifact);
|
|
18064
|
+
}
|
|
18065
|
+
return artifacts;
|
|
18066
|
+
}
|
|
18037
18067
|
function pageSummaries(result) {
|
|
18038
18068
|
const pages = [];
|
|
18039
18069
|
for (const page of asArray(result.pages)) {
|
|
@@ -18050,6 +18080,35 @@ function pageSummaries(result) {
|
|
|
18050
18080
|
}
|
|
18051
18081
|
return pages;
|
|
18052
18082
|
}
|
|
18083
|
+
function profileCheckCounts(result) {
|
|
18084
|
+
const checks = asArray(result.checks);
|
|
18085
|
+
if (checks.length) {
|
|
18086
|
+
let passed2 = 0;
|
|
18087
|
+
let failed2 = 0;
|
|
18088
|
+
for (const item of checks) {
|
|
18089
|
+
const status = stringValue4(asRecord2(item).status);
|
|
18090
|
+
if (status === "passed") passed2 += 1;
|
|
18091
|
+
if (status === "failed") failed2 += 1;
|
|
18092
|
+
}
|
|
18093
|
+
return { passed: passed2, failed: failed2 };
|
|
18094
|
+
}
|
|
18095
|
+
const checkCounts = asRecord2(result.check_counts);
|
|
18096
|
+
const passed = numberValue3(checkCounts.passed);
|
|
18097
|
+
const failed = numberValue3(checkCounts.failed);
|
|
18098
|
+
if (typeof passed === "number" || typeof failed === "number") {
|
|
18099
|
+
return { passed: passed ?? 0, failed: failed ?? 0 };
|
|
18100
|
+
}
|
|
18101
|
+
return void 0;
|
|
18102
|
+
}
|
|
18103
|
+
function profilePageSummaries(result, counts) {
|
|
18104
|
+
if (!counts) return [];
|
|
18105
|
+
const route = asRecord2(result.route);
|
|
18106
|
+
return [{
|
|
18107
|
+
route: firstStringValue2(route.observed, route.expected_path, route.requested, result.profile_name) || "profile",
|
|
18108
|
+
passed: counts.passed,
|
|
18109
|
+
failed: counts.failed
|
|
18110
|
+
}];
|
|
18111
|
+
}
|
|
18053
18112
|
function summarizeExplicitChecks(value) {
|
|
18054
18113
|
let passed = 0;
|
|
18055
18114
|
let failed = 0;
|
|
@@ -18101,18 +18160,28 @@ function checkpointSummaryFrom2(...values) {
|
|
|
18101
18160
|
};
|
|
18102
18161
|
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
18103
18162
|
}
|
|
18163
|
+
function isProfileResult(result) {
|
|
18164
|
+
const version = stringValue4(result.version);
|
|
18165
|
+
return version === "riddle-proof.profile-result.v1" || version === "riddle-proof.profile-compact-result.v1";
|
|
18166
|
+
}
|
|
18104
18167
|
function summarizeRiddleProofPrComment(input) {
|
|
18105
18168
|
const runResponse = asRecord2(input.runResponse);
|
|
18106
18169
|
const result = asRecord2(input.result);
|
|
18107
18170
|
const proofResult = asRecord2(runResponse.proofResult);
|
|
18171
|
+
const profileResult = isProfileResult(result);
|
|
18172
|
+
const profileRiddle = asRecord2(result.riddle);
|
|
18108
18173
|
const preview = asRecord2(runResponse.preview);
|
|
18109
18174
|
const resultRunCard = asRecord2(result.run_card);
|
|
18110
18175
|
const stopCondition = asRecord2(resultRunCard.stop_condition);
|
|
18111
18176
|
const resultDetails = asRecord2(result.details);
|
|
18112
18177
|
const resultRaw = asRecord2(result.raw);
|
|
18113
18178
|
const rawDetails = asRecord2(resultRaw.details);
|
|
18114
|
-
const
|
|
18115
|
-
const
|
|
18179
|
+
const profileChecks = profileResult ? profileCheckCounts(result) : void 0;
|
|
18180
|
+
const artifacts = mergeArtifacts(
|
|
18181
|
+
collectArtifacts(runResponse),
|
|
18182
|
+
profileResult ? collectProfileArtifacts(result) : []
|
|
18183
|
+
);
|
|
18184
|
+
const pages = profileResult ? profilePageSummaries(result, profileChecks) : pageSummaries(result);
|
|
18116
18185
|
const checkSource = { ...result };
|
|
18117
18186
|
delete checkSource.ok;
|
|
18118
18187
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
@@ -18135,10 +18204,10 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
18135
18204
|
);
|
|
18136
18205
|
return {
|
|
18137
18206
|
ok,
|
|
18138
|
-
status:
|
|
18207
|
+
status: firstStringValue2(proofResult.status, profileRiddle.status),
|
|
18139
18208
|
result_status: publicState.status,
|
|
18140
|
-
job_id:
|
|
18141
|
-
duration_ms: numberValue3(proofResult.duration_ms),
|
|
18209
|
+
job_id: firstStringValue2(proofResult.job_id, profileRiddle.job_id),
|
|
18210
|
+
duration_ms: numberValue3(proofResult.duration_ms) ?? numberValue3(profileRiddle.elapsed_ms),
|
|
18142
18211
|
proof_url: stringValue4(runResponse.proofUrl),
|
|
18143
18212
|
preview_id: stringValue4(preview.id),
|
|
18144
18213
|
preview_url: stringValue4(preview.preview_url) || stringValue4(preview.url),
|
|
@@ -18153,8 +18222,8 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
18153
18222
|
merge_recommendation: mergeRecommendation,
|
|
18154
18223
|
checkpoint_summary: checkpointSummary,
|
|
18155
18224
|
public_state: publicState,
|
|
18156
|
-
passed_checks: nestedChecks.passed,
|
|
18157
|
-
failed_checks: nestedChecks.failed,
|
|
18225
|
+
passed_checks: profileChecks?.passed ?? nestedChecks.passed,
|
|
18226
|
+
failed_checks: profileChecks?.failed ?? nestedChecks.failed,
|
|
18158
18227
|
pages,
|
|
18159
18228
|
artifacts,
|
|
18160
18229
|
primary_image: selectPrimaryImage(artifacts)
|
|
@@ -23125,12 +23194,17 @@ async function main() {
|
|
|
23125
23194
|
}
|
|
23126
23195
|
if (command === "pr-comment") {
|
|
23127
23196
|
const proofDir = optionString(options, "proofDir") || optionString(options, "outputDir") || positional[1];
|
|
23128
|
-
const
|
|
23129
|
-
const
|
|
23197
|
+
const explicitRunResponsePath = optionString(options, "runResponse");
|
|
23198
|
+
const explicitResultJsonPath = optionString(options, "resultJson");
|
|
23199
|
+
const runResponsePath = explicitRunResponsePath || defaultProofDirJsonPath(proofDir, "riddle-run-response.json");
|
|
23200
|
+
const resultJsonPaths = explicitResultJsonPath ? [explicitResultJsonPath] : [
|
|
23201
|
+
defaultProofDirJsonPath(proofDir, "result.json"),
|
|
23202
|
+
defaultProofDirJsonPath(proofDir, "profile-result.json")
|
|
23203
|
+
];
|
|
23130
23204
|
const runResponse = readJsonFileIfExists(runResponsePath);
|
|
23131
|
-
const result = readJsonFileIfExists(
|
|
23205
|
+
const result = resultJsonPaths.map((candidate) => readJsonFileIfExists(candidate)).find(Boolean);
|
|
23132
23206
|
if (!runResponse && !result) {
|
|
23133
|
-
throw new Error("pr-comment requires --proof-dir with riddle-run-response.json
|
|
23207
|
+
throw new Error("pr-comment requires --proof-dir with riddle-run-response.json, result.json, or profile-result.json, or explicit --run-response/--result-json.");
|
|
23134
23208
|
}
|
|
23135
23209
|
const body = buildRiddleProofPrCommentMarkdown({
|
|
23136
23210
|
title: optionString(options, "title"),
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-AF3KFD4A.js";
|
|
3
3
|
import "./chunk-B2DP2LET.js";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-DTFSHRV5.js";
|
|
5
5
|
import "./chunk-5Y4V2IXI.js";
|
|
6
6
|
import "./chunk-EX7TO4I5.js";
|
|
7
7
|
import "./chunk-P4BHU5NM.js";
|
package/dist/index.cjs
CHANGED
|
@@ -20501,6 +20501,36 @@ function collectArtifacts(runResponse) {
|
|
|
20501
20501
|
}
|
|
20502
20502
|
return artifacts;
|
|
20503
20503
|
}
|
|
20504
|
+
function collectProfileArtifacts(result) {
|
|
20505
|
+
const resultArtifacts = asRecord2(result.artifacts);
|
|
20506
|
+
const artifacts = [];
|
|
20507
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20508
|
+
for (const [index, item] of asArray(resultArtifacts.riddle_artifacts).entries()) {
|
|
20509
|
+
const artifact = asRecord2(item);
|
|
20510
|
+
const url = stringValue7(artifact.url);
|
|
20511
|
+
if (!url || seen.has(url)) continue;
|
|
20512
|
+
seen.add(url);
|
|
20513
|
+
const fallbackName = stringValue7(artifact.kind) || `artifact-${index + 1}`;
|
|
20514
|
+
const name = artifactDisplayName(artifact.name, fallbackName);
|
|
20515
|
+
artifacts.push({
|
|
20516
|
+
name,
|
|
20517
|
+
url,
|
|
20518
|
+
kind: artifactKind(name, url),
|
|
20519
|
+
size_bytes: numberValue5(artifact.size_bytes) ?? numberValue5(artifact.size)
|
|
20520
|
+
});
|
|
20521
|
+
}
|
|
20522
|
+
return artifacts;
|
|
20523
|
+
}
|
|
20524
|
+
function mergeArtifacts(...artifactLists) {
|
|
20525
|
+
const artifacts = [];
|
|
20526
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20527
|
+
for (const artifact of artifactLists.flat()) {
|
|
20528
|
+
if (seen.has(artifact.url)) continue;
|
|
20529
|
+
seen.add(artifact.url);
|
|
20530
|
+
artifacts.push(artifact);
|
|
20531
|
+
}
|
|
20532
|
+
return artifacts;
|
|
20533
|
+
}
|
|
20504
20534
|
function pageSummaries(result) {
|
|
20505
20535
|
const pages = [];
|
|
20506
20536
|
for (const page of asArray(result.pages)) {
|
|
@@ -20517,6 +20547,35 @@ function pageSummaries(result) {
|
|
|
20517
20547
|
}
|
|
20518
20548
|
return pages;
|
|
20519
20549
|
}
|
|
20550
|
+
function profileCheckCounts(result) {
|
|
20551
|
+
const checks = asArray(result.checks);
|
|
20552
|
+
if (checks.length) {
|
|
20553
|
+
let passed2 = 0;
|
|
20554
|
+
let failed2 = 0;
|
|
20555
|
+
for (const item of checks) {
|
|
20556
|
+
const status = stringValue7(asRecord2(item).status);
|
|
20557
|
+
if (status === "passed") passed2 += 1;
|
|
20558
|
+
if (status === "failed") failed2 += 1;
|
|
20559
|
+
}
|
|
20560
|
+
return { passed: passed2, failed: failed2 };
|
|
20561
|
+
}
|
|
20562
|
+
const checkCounts = asRecord2(result.check_counts);
|
|
20563
|
+
const passed = numberValue5(checkCounts.passed);
|
|
20564
|
+
const failed = numberValue5(checkCounts.failed);
|
|
20565
|
+
if (typeof passed === "number" || typeof failed === "number") {
|
|
20566
|
+
return { passed: passed ?? 0, failed: failed ?? 0 };
|
|
20567
|
+
}
|
|
20568
|
+
return void 0;
|
|
20569
|
+
}
|
|
20570
|
+
function profilePageSummaries(result, counts) {
|
|
20571
|
+
if (!counts) return [];
|
|
20572
|
+
const route = asRecord2(result.route);
|
|
20573
|
+
return [{
|
|
20574
|
+
route: firstStringValue2(route.observed, route.expected_path, route.requested, result.profile_name) || "profile",
|
|
20575
|
+
passed: counts.passed,
|
|
20576
|
+
failed: counts.failed
|
|
20577
|
+
}];
|
|
20578
|
+
}
|
|
20520
20579
|
function summarizeExplicitChecks(value) {
|
|
20521
20580
|
let passed = 0;
|
|
20522
20581
|
let failed = 0;
|
|
@@ -20568,18 +20627,28 @@ function checkpointSummaryFrom2(...values) {
|
|
|
20568
20627
|
};
|
|
20569
20628
|
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
20570
20629
|
}
|
|
20630
|
+
function isProfileResult(result) {
|
|
20631
|
+
const version = stringValue7(result.version);
|
|
20632
|
+
return version === "riddle-proof.profile-result.v1" || version === "riddle-proof.profile-compact-result.v1";
|
|
20633
|
+
}
|
|
20571
20634
|
function summarizeRiddleProofPrComment(input) {
|
|
20572
20635
|
const runResponse = asRecord2(input.runResponse);
|
|
20573
20636
|
const result = asRecord2(input.result);
|
|
20574
20637
|
const proofResult = asRecord2(runResponse.proofResult);
|
|
20638
|
+
const profileResult = isProfileResult(result);
|
|
20639
|
+
const profileRiddle = asRecord2(result.riddle);
|
|
20575
20640
|
const preview = asRecord2(runResponse.preview);
|
|
20576
20641
|
const resultRunCard = asRecord2(result.run_card);
|
|
20577
20642
|
const stopCondition = asRecord2(resultRunCard.stop_condition);
|
|
20578
20643
|
const resultDetails = asRecord2(result.details);
|
|
20579
20644
|
const resultRaw = asRecord2(result.raw);
|
|
20580
20645
|
const rawDetails = asRecord2(resultRaw.details);
|
|
20581
|
-
const
|
|
20582
|
-
const
|
|
20646
|
+
const profileChecks = profileResult ? profileCheckCounts(result) : void 0;
|
|
20647
|
+
const artifacts = mergeArtifacts(
|
|
20648
|
+
collectArtifacts(runResponse),
|
|
20649
|
+
profileResult ? collectProfileArtifacts(result) : []
|
|
20650
|
+
);
|
|
20651
|
+
const pages = profileResult ? profilePageSummaries(result, profileChecks) : pageSummaries(result);
|
|
20583
20652
|
const checkSource = { ...result };
|
|
20584
20653
|
delete checkSource.ok;
|
|
20585
20654
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
@@ -20602,10 +20671,10 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
20602
20671
|
);
|
|
20603
20672
|
return {
|
|
20604
20673
|
ok,
|
|
20605
|
-
status:
|
|
20674
|
+
status: firstStringValue2(proofResult.status, profileRiddle.status),
|
|
20606
20675
|
result_status: publicState.status,
|
|
20607
|
-
job_id:
|
|
20608
|
-
duration_ms: numberValue5(proofResult.duration_ms),
|
|
20676
|
+
job_id: firstStringValue2(proofResult.job_id, profileRiddle.job_id),
|
|
20677
|
+
duration_ms: numberValue5(proofResult.duration_ms) ?? numberValue5(profileRiddle.elapsed_ms),
|
|
20609
20678
|
proof_url: stringValue7(runResponse.proofUrl),
|
|
20610
20679
|
preview_id: stringValue7(preview.id),
|
|
20611
20680
|
preview_url: stringValue7(preview.preview_url) || stringValue7(preview.url),
|
|
@@ -20620,8 +20689,8 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
20620
20689
|
merge_recommendation: mergeRecommendation,
|
|
20621
20690
|
checkpoint_summary: checkpointSummary,
|
|
20622
20691
|
public_state: publicState,
|
|
20623
|
-
passed_checks: nestedChecks.passed,
|
|
20624
|
-
failed_checks: nestedChecks.failed,
|
|
20692
|
+
passed_checks: profileChecks?.passed ?? nestedChecks.passed,
|
|
20693
|
+
failed_checks: profileChecks?.failed ?? nestedChecks.failed,
|
|
20625
20694
|
pages,
|
|
20626
20695
|
artifacts,
|
|
20627
20696
|
primary_image: selectPrimaryImage(artifacts)
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
61
61
|
buildRiddleProofPrCommentMarkdown,
|
|
62
62
|
summarizeRiddleProofPrComment
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-DTFSHRV5.js";
|
|
64
64
|
import {
|
|
65
65
|
RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
|
|
66
66
|
suggestRiddleProofProfileChecks
|
package/dist/pr-comment.cjs
CHANGED
|
@@ -242,6 +242,36 @@ function collectArtifacts(runResponse) {
|
|
|
242
242
|
}
|
|
243
243
|
return artifacts;
|
|
244
244
|
}
|
|
245
|
+
function collectProfileArtifacts(result) {
|
|
246
|
+
const resultArtifacts = asRecord2(result.artifacts);
|
|
247
|
+
const artifacts = [];
|
|
248
|
+
const seen = /* @__PURE__ */ new Set();
|
|
249
|
+
for (const [index, item] of asArray(resultArtifacts.riddle_artifacts).entries()) {
|
|
250
|
+
const artifact = asRecord2(item);
|
|
251
|
+
const url = stringValue2(artifact.url);
|
|
252
|
+
if (!url || seen.has(url)) continue;
|
|
253
|
+
seen.add(url);
|
|
254
|
+
const fallbackName = stringValue2(artifact.kind) || `artifact-${index + 1}`;
|
|
255
|
+
const name = artifactDisplayName(artifact.name, fallbackName);
|
|
256
|
+
artifacts.push({
|
|
257
|
+
name,
|
|
258
|
+
url,
|
|
259
|
+
kind: artifactKind(name, url),
|
|
260
|
+
size_bytes: numberValue2(artifact.size_bytes) ?? numberValue2(artifact.size)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return artifacts;
|
|
264
|
+
}
|
|
265
|
+
function mergeArtifacts(...artifactLists) {
|
|
266
|
+
const artifacts = [];
|
|
267
|
+
const seen = /* @__PURE__ */ new Set();
|
|
268
|
+
for (const artifact of artifactLists.flat()) {
|
|
269
|
+
if (seen.has(artifact.url)) continue;
|
|
270
|
+
seen.add(artifact.url);
|
|
271
|
+
artifacts.push(artifact);
|
|
272
|
+
}
|
|
273
|
+
return artifacts;
|
|
274
|
+
}
|
|
245
275
|
function pageSummaries(result) {
|
|
246
276
|
const pages = [];
|
|
247
277
|
for (const page of asArray(result.pages)) {
|
|
@@ -258,6 +288,35 @@ function pageSummaries(result) {
|
|
|
258
288
|
}
|
|
259
289
|
return pages;
|
|
260
290
|
}
|
|
291
|
+
function profileCheckCounts(result) {
|
|
292
|
+
const checks = asArray(result.checks);
|
|
293
|
+
if (checks.length) {
|
|
294
|
+
let passed2 = 0;
|
|
295
|
+
let failed2 = 0;
|
|
296
|
+
for (const item of checks) {
|
|
297
|
+
const status = stringValue2(asRecord2(item).status);
|
|
298
|
+
if (status === "passed") passed2 += 1;
|
|
299
|
+
if (status === "failed") failed2 += 1;
|
|
300
|
+
}
|
|
301
|
+
return { passed: passed2, failed: failed2 };
|
|
302
|
+
}
|
|
303
|
+
const checkCounts = asRecord2(result.check_counts);
|
|
304
|
+
const passed = numberValue2(checkCounts.passed);
|
|
305
|
+
const failed = numberValue2(checkCounts.failed);
|
|
306
|
+
if (typeof passed === "number" || typeof failed === "number") {
|
|
307
|
+
return { passed: passed ?? 0, failed: failed ?? 0 };
|
|
308
|
+
}
|
|
309
|
+
return void 0;
|
|
310
|
+
}
|
|
311
|
+
function profilePageSummaries(result, counts) {
|
|
312
|
+
if (!counts) return [];
|
|
313
|
+
const route = asRecord2(result.route);
|
|
314
|
+
return [{
|
|
315
|
+
route: firstStringValue2(route.observed, route.expected_path, route.requested, result.profile_name) || "profile",
|
|
316
|
+
passed: counts.passed,
|
|
317
|
+
failed: counts.failed
|
|
318
|
+
}];
|
|
319
|
+
}
|
|
261
320
|
function summarizeExplicitChecks(value) {
|
|
262
321
|
let passed = 0;
|
|
263
322
|
let failed = 0;
|
|
@@ -309,18 +368,28 @@ function checkpointSummaryFrom2(...values) {
|
|
|
309
368
|
};
|
|
310
369
|
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
311
370
|
}
|
|
371
|
+
function isProfileResult(result) {
|
|
372
|
+
const version = stringValue2(result.version);
|
|
373
|
+
return version === "riddle-proof.profile-result.v1" || version === "riddle-proof.profile-compact-result.v1";
|
|
374
|
+
}
|
|
312
375
|
function summarizeRiddleProofPrComment(input) {
|
|
313
376
|
const runResponse = asRecord2(input.runResponse);
|
|
314
377
|
const result = asRecord2(input.result);
|
|
315
378
|
const proofResult = asRecord2(runResponse.proofResult);
|
|
379
|
+
const profileResult = isProfileResult(result);
|
|
380
|
+
const profileRiddle = asRecord2(result.riddle);
|
|
316
381
|
const preview = asRecord2(runResponse.preview);
|
|
317
382
|
const resultRunCard = asRecord2(result.run_card);
|
|
318
383
|
const stopCondition = asRecord2(resultRunCard.stop_condition);
|
|
319
384
|
const resultDetails = asRecord2(result.details);
|
|
320
385
|
const resultRaw = asRecord2(result.raw);
|
|
321
386
|
const rawDetails = asRecord2(resultRaw.details);
|
|
322
|
-
const
|
|
323
|
-
const
|
|
387
|
+
const profileChecks = profileResult ? profileCheckCounts(result) : void 0;
|
|
388
|
+
const artifacts = mergeArtifacts(
|
|
389
|
+
collectArtifacts(runResponse),
|
|
390
|
+
profileResult ? collectProfileArtifacts(result) : []
|
|
391
|
+
);
|
|
392
|
+
const pages = profileResult ? profilePageSummaries(result, profileChecks) : pageSummaries(result);
|
|
324
393
|
const checkSource = { ...result };
|
|
325
394
|
delete checkSource.ok;
|
|
326
395
|
const nestedChecks = summarizeExplicitChecks(checkSource);
|
|
@@ -343,10 +412,10 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
343
412
|
);
|
|
344
413
|
return {
|
|
345
414
|
ok,
|
|
346
|
-
status:
|
|
415
|
+
status: firstStringValue2(proofResult.status, profileRiddle.status),
|
|
347
416
|
result_status: publicState.status,
|
|
348
|
-
job_id:
|
|
349
|
-
duration_ms: numberValue2(proofResult.duration_ms),
|
|
417
|
+
job_id: firstStringValue2(proofResult.job_id, profileRiddle.job_id),
|
|
418
|
+
duration_ms: numberValue2(proofResult.duration_ms) ?? numberValue2(profileRiddle.elapsed_ms),
|
|
350
419
|
proof_url: stringValue2(runResponse.proofUrl),
|
|
351
420
|
preview_id: stringValue2(preview.id),
|
|
352
421
|
preview_url: stringValue2(preview.preview_url) || stringValue2(preview.url),
|
|
@@ -361,8 +430,8 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
361
430
|
merge_recommendation: mergeRecommendation,
|
|
362
431
|
checkpoint_summary: checkpointSummary,
|
|
363
432
|
public_state: publicState,
|
|
364
|
-
passed_checks: nestedChecks.passed,
|
|
365
|
-
failed_checks: nestedChecks.failed,
|
|
433
|
+
passed_checks: profileChecks?.passed ?? nestedChecks.passed,
|
|
434
|
+
failed_checks: profileChecks?.failed ?? nestedChecks.failed,
|
|
366
435
|
pages,
|
|
367
436
|
artifacts,
|
|
368
437
|
primary_image: selectPrimaryImage(artifacts)
|
package/dist/pr-comment.js
CHANGED