@riddledc/riddle-proof 0.8.73 → 0.8.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/advanced/index.d.cts +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/proof-run-engine.d.cts +1 -1
- package/dist/advanced/proof-run-engine.d.ts +1 -1
- package/dist/change-proof.cjs +193 -0
- package/dist/change-proof.d.cts +74 -0
- package/dist/change-proof.d.ts +74 -0
- package/dist/change-proof.js +11 -0
- package/dist/chunk-6S7DZWVC.js +167 -0
- package/dist/{chunk-ICIJTEHD.js → chunk-AK2EPEVO.js} +215 -9
- package/dist/cli/index.js +4 -3
- package/dist/cli.cjs +369 -5
- package/dist/cli.js +4 -3
- package/dist/index.cjs +168 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -15
- package/dist/{proof-run-engine-DpChFR5H.d.cts → proof-run-engine-Baiv6l3A.d.cts} +3 -3
- package/dist/{proof-run-engine-BqRoA3Do.d.ts → proof-run-engine-MiKZt9oY.d.ts} +3 -3
- package/dist/proof-run-engine.d.cts +1 -1
- package/dist/proof-run-engine.d.ts +1 -1
- package/package.json +7 -2
|
@@ -30,6 +30,13 @@ import {
|
|
|
30
30
|
resolveRiddleProofProfileTargetUrl,
|
|
31
31
|
resolveRiddleProofProfileTimeoutSec
|
|
32
32
|
} from "./chunk-GG2D3MFZ.js";
|
|
33
|
+
import {
|
|
34
|
+
assessRiddleProofChange
|
|
35
|
+
} from "./chunk-6S7DZWVC.js";
|
|
36
|
+
import {
|
|
37
|
+
createCodexExecAgentAdapter,
|
|
38
|
+
runCodexExecAgentDoctor
|
|
39
|
+
} from "./chunk-KXLEN4SA.js";
|
|
33
40
|
import {
|
|
34
41
|
createDisabledRiddleProofAgentAdapter,
|
|
35
42
|
readRiddleProofRunStatus,
|
|
@@ -38,10 +45,6 @@ import {
|
|
|
38
45
|
import {
|
|
39
46
|
createCheckpointResponseTemplate
|
|
40
47
|
} from "./chunk-DYE3URAQ.js";
|
|
41
|
-
import {
|
|
42
|
-
createCodexExecAgentAdapter,
|
|
43
|
-
runCodexExecAgentDoctor
|
|
44
|
-
} from "./chunk-KXLEN4SA.js";
|
|
45
48
|
|
|
46
49
|
// src/cli.ts
|
|
47
50
|
import { spawnSync } from "child_process";
|
|
@@ -57,8 +60,13 @@ var KNOWN_CLI_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
57
60
|
"attempts",
|
|
58
61
|
"balancePreflight",
|
|
59
62
|
"baseUrl",
|
|
63
|
+
"afterResult",
|
|
64
|
+
"afterUrl",
|
|
65
|
+
"beforeResult",
|
|
66
|
+
"beforeUrl",
|
|
60
67
|
"candidateJson",
|
|
61
68
|
"candidatesJson",
|
|
69
|
+
"changeContract",
|
|
62
70
|
"checkpointMode",
|
|
63
71
|
"checkpointVisibility",
|
|
64
72
|
"changedFiles",
|
|
@@ -165,6 +173,7 @@ function usage() {
|
|
|
165
173
|
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--base-url <base-url>] [--runner riddle] [--viewport-name <name[,name...]>] [--strict true|false; default false] [--split-viewports true|false; default false] [--balance-preflight true|false; default true] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
166
174
|
" riddle-proof-loop run-profile aggregate --profile <file|json|-> --url <base-url> [--base-url <base-url>] --input-dir <dir>|--inputs <path[,path...]> [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
167
175
|
" riddle-proof-loop run-profile recover --profile <file|json|-> --url <base-url> [--base-url <base-url>] --job <job-id> [--viewport-name <name[,name...]>] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
176
|
+
" riddle-proof-loop run-change-proof --profile <file|json|-> --change-contract <file|json|-> (--before-url <url> --after-url <url> | --before-result <file> --after-result <file>) [--viewport-name <name[,name...]>] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json]",
|
|
168
177
|
" riddle-proof-loop profile-suggest --route /path|--url <url> [--changed-files a,b] [--selectors .a,.b] [--changed-text-json <file|json|->] [--format json|profile]",
|
|
169
178
|
" riddle-proof-loop regression-pack run [--pack oc-flow-regression|--pack-file <file>] [--local-core true|false; default true] [--hosted-riddle true|false; default false] [--format json|markdown|compact-json; default json] [--output <dir>|--output-dir <dir>]",
|
|
170
179
|
" riddle-proof-loop pr-comment --proof-dir <dir>|--run-response <file> [--result-json <file>] --pr <number|url> [--repo owner/name] [--dry-run] [--body-file <file>] [--comment-mode update|append]",
|
|
@@ -1230,14 +1239,19 @@ function parseProfileViewports(value) {
|
|
|
1230
1239
|
};
|
|
1231
1240
|
});
|
|
1232
1241
|
}
|
|
1233
|
-
function
|
|
1234
|
-
|
|
1242
|
+
function readProfileRecordForCli(options) {
|
|
1243
|
+
return readJsonValue(optionString(options, "profile"), "--profile");
|
|
1244
|
+
}
|
|
1245
|
+
function normalizeProfileRecordForCli(rawProfile, options) {
|
|
1235
1246
|
return normalizeRiddleProofProfile(rawProfile, {
|
|
1236
1247
|
url: optionString(options, "url") ?? optionString(options, "baseUrl"),
|
|
1237
1248
|
route: optionString(options, "route"),
|
|
1238
1249
|
viewports: parseProfileViewports(optionString(options, "viewports") || optionString(options, "viewport"))
|
|
1239
1250
|
});
|
|
1240
1251
|
}
|
|
1252
|
+
function normalizeProfileForCli(options) {
|
|
1253
|
+
return normalizeProfileRecordForCli(readProfileRecordForCli(options), options);
|
|
1254
|
+
}
|
|
1241
1255
|
function profileHttpStatusPreflightSummary(result) {
|
|
1242
1256
|
const lines = [
|
|
1243
1257
|
result.summary,
|
|
@@ -3909,6 +3923,136 @@ function writeProfileOutput(outputDir, result) {
|
|
|
3909
3923
|
if (result.evidence?.dom_summary) writeFileSync(path.join(outputDir, "dom-summary.json"), `${JSON.stringify(result.evidence.dom_summary, null, 2)}
|
|
3910
3924
|
`);
|
|
3911
3925
|
}
|
|
3926
|
+
function readChangeContractForCli(options) {
|
|
3927
|
+
const parsed = readJsonValue(optionString(options, "changeContract"), "--change-contract");
|
|
3928
|
+
if (parsed.version !== void 0 && parsed.version !== "riddle-proof.change-contract.v1") {
|
|
3929
|
+
throw new Error(`Unsupported change contract version ${parsed.version}. Expected riddle-proof.change-contract.v1.`);
|
|
3930
|
+
}
|
|
3931
|
+
if (typeof parsed.name !== "string" || !parsed.name.trim()) {
|
|
3932
|
+
throw new Error("--change-contract must include a non-empty name.");
|
|
3933
|
+
}
|
|
3934
|
+
if (!Array.isArray(parsed.deltas) || !parsed.deltas.length) {
|
|
3935
|
+
throw new Error("--change-contract must include at least one delta.");
|
|
3936
|
+
}
|
|
3937
|
+
return parsed;
|
|
3938
|
+
}
|
|
3939
|
+
function changeProofSideOutputDir(outputDir, side) {
|
|
3940
|
+
return outputDir ? path.join(outputDir, side) : void 0;
|
|
3941
|
+
}
|
|
3942
|
+
function profileOptionsForChangeProofSide(options, url, outputDir) {
|
|
3943
|
+
const next = {
|
|
3944
|
+
...options,
|
|
3945
|
+
url,
|
|
3946
|
+
baseUrl: url
|
|
3947
|
+
};
|
|
3948
|
+
if (outputDir) {
|
|
3949
|
+
next.output = outputDir;
|
|
3950
|
+
next.outputDir = outputDir;
|
|
3951
|
+
} else {
|
|
3952
|
+
delete next.output;
|
|
3953
|
+
delete next.outputDir;
|
|
3954
|
+
}
|
|
3955
|
+
return next;
|
|
3956
|
+
}
|
|
3957
|
+
function compactChangeProofResult(run, options) {
|
|
3958
|
+
const outputDir = profileOutputDirOption(options);
|
|
3959
|
+
return {
|
|
3960
|
+
version: "riddle-proof.change-compact-result.v1",
|
|
3961
|
+
contract_name: run.result.contract_name,
|
|
3962
|
+
profile_name: run.profile.name,
|
|
3963
|
+
status: run.result.status,
|
|
3964
|
+
summary: run.result.summary,
|
|
3965
|
+
before: {
|
|
3966
|
+
source: run.beforeSource,
|
|
3967
|
+
profile_name: run.beforeResult.profile_name,
|
|
3968
|
+
status: run.beforeResult.status,
|
|
3969
|
+
summary: run.beforeResult.summary
|
|
3970
|
+
},
|
|
3971
|
+
after: {
|
|
3972
|
+
source: run.afterSource,
|
|
3973
|
+
profile_name: run.afterResult.profile_name,
|
|
3974
|
+
status: run.afterResult.status,
|
|
3975
|
+
summary: run.afterResult.summary
|
|
3976
|
+
},
|
|
3977
|
+
deltas: run.result.deltas.map((delta) => ({
|
|
3978
|
+
type: delta.type,
|
|
3979
|
+
label: delta.label,
|
|
3980
|
+
status: delta.status,
|
|
3981
|
+
before_observed: delta.before_observed,
|
|
3982
|
+
after_observed: delta.after_observed,
|
|
3983
|
+
message: delta.message
|
|
3984
|
+
})),
|
|
3985
|
+
metadata: run.result.metadata,
|
|
3986
|
+
output_dir: outputDir,
|
|
3987
|
+
output_files: outputDir ? {
|
|
3988
|
+
change_proof_result: "change-proof-result.json",
|
|
3989
|
+
summary: "summary.md",
|
|
3990
|
+
before_profile_result: "before/profile-result.json",
|
|
3991
|
+
after_profile_result: "after/profile-result.json"
|
|
3992
|
+
} : void 0
|
|
3993
|
+
};
|
|
3994
|
+
}
|
|
3995
|
+
function changeProofResultMarkdown(run) {
|
|
3996
|
+
const lines = [
|
|
3997
|
+
"# Riddle Proof Change Proof",
|
|
3998
|
+
"",
|
|
3999
|
+
`Contract: ${run.result.contract_name}`,
|
|
4000
|
+
`Profile: ${run.profile.name}`,
|
|
4001
|
+
`Status: ${run.result.status}`,
|
|
4002
|
+
"",
|
|
4003
|
+
run.result.summary,
|
|
4004
|
+
"",
|
|
4005
|
+
"## Before",
|
|
4006
|
+
"",
|
|
4007
|
+
`- source: ${markdownInlineCode(run.beforeSource, 160)}`,
|
|
4008
|
+
`- profile: ${run.beforeResult.profile_name}`,
|
|
4009
|
+
`- status: ${run.beforeResult.status}`,
|
|
4010
|
+
`- summary: ${run.beforeResult.summary}`,
|
|
4011
|
+
"",
|
|
4012
|
+
"## After",
|
|
4013
|
+
"",
|
|
4014
|
+
`- source: ${markdownInlineCode(run.afterSource, 160)}`,
|
|
4015
|
+
`- profile: ${run.afterResult.profile_name}`,
|
|
4016
|
+
`- status: ${run.afterResult.status}`,
|
|
4017
|
+
`- summary: ${run.afterResult.summary}`,
|
|
4018
|
+
"",
|
|
4019
|
+
"## Deltas",
|
|
4020
|
+
""
|
|
4021
|
+
];
|
|
4022
|
+
for (const delta of run.result.deltas) {
|
|
4023
|
+
const observed = [
|
|
4024
|
+
delta.before_observed !== void 0 ? `before ${markdownInlineCode(String(delta.before_observed))}` : "",
|
|
4025
|
+
delta.after_observed !== void 0 ? `after ${markdownInlineCode(String(delta.after_observed))}` : ""
|
|
4026
|
+
].filter(Boolean).join(" -> ");
|
|
4027
|
+
lines.push(`- ${delta.status}: ${delta.label}${observed ? ` (${observed})` : ""}${delta.message ? ` - ${delta.message}` : ""}`);
|
|
4028
|
+
}
|
|
4029
|
+
return `${lines.join("\n")}
|
|
4030
|
+
`;
|
|
4031
|
+
}
|
|
4032
|
+
function writeChangeProofOutput(outputDir, run) {
|
|
4033
|
+
if (!outputDir) return;
|
|
4034
|
+
mkdirSync(outputDir, { recursive: true });
|
|
4035
|
+
writeFileSync(path.join(outputDir, "change-proof-result.json"), `${JSON.stringify(run.result, null, 2)}
|
|
4036
|
+
`);
|
|
4037
|
+
writeFileSync(path.join(outputDir, "summary.md"), changeProofResultMarkdown(run));
|
|
4038
|
+
writeProfileOutput(changeProofSideOutputDir(outputDir, "before"), run.beforeResult);
|
|
4039
|
+
writeProfileOutput(changeProofSideOutputDir(outputDir, "after"), run.afterResult);
|
|
4040
|
+
}
|
|
4041
|
+
function writeRunChangeProofResult(run, options) {
|
|
4042
|
+
const format = runProfileResultFormatOption(options);
|
|
4043
|
+
if (format === "none") return;
|
|
4044
|
+
if (format === "summary") {
|
|
4045
|
+
process.stdout.write(changeProofResultMarkdown(run));
|
|
4046
|
+
return;
|
|
4047
|
+
}
|
|
4048
|
+
if (format === "compact-json") {
|
|
4049
|
+
process.stdout.write(`${JSON.stringify(compactChangeProofResult(run, options), null, 2)}
|
|
4050
|
+
`);
|
|
4051
|
+
return;
|
|
4052
|
+
}
|
|
4053
|
+
process.stdout.write(`${JSON.stringify(run.result, null, 2)}
|
|
4054
|
+
`);
|
|
4055
|
+
}
|
|
3912
4056
|
function writeRiddleJobReceipt(outputDir, input) {
|
|
3913
4057
|
if (!outputDir) return;
|
|
3914
4058
|
mkdirSync(outputDir, { recursive: true });
|
|
@@ -4214,13 +4358,16 @@ function runProfileAggregateInputPathsOption(options) {
|
|
|
4214
4358
|
}
|
|
4215
4359
|
return uniquePaths;
|
|
4216
4360
|
}
|
|
4217
|
-
function
|
|
4218
|
-
const parsed = readJsonValue(resultPath,
|
|
4361
|
+
function readProfileResultForCli(resultPath, label = resultPath) {
|
|
4362
|
+
const parsed = readJsonValue(resultPath, label);
|
|
4219
4363
|
if (parsed.version !== "riddle-proof.profile-result.v1" || !Array.isArray(parsed.checks)) {
|
|
4220
|
-
throw new Error(
|
|
4364
|
+
throw new Error(`${label} is not a riddle-proof.profile-result.v1 result: ${resultPath}`);
|
|
4221
4365
|
}
|
|
4222
4366
|
return parsed;
|
|
4223
4367
|
}
|
|
4368
|
+
function readProfileResultForAggregate(resultPath) {
|
|
4369
|
+
return readProfileResultForCli(resultPath, resultPath);
|
|
4370
|
+
}
|
|
4224
4371
|
function profileResultIsAggregateParent(result) {
|
|
4225
4372
|
const mode = cliString(cliRecord(result.riddle)?.mode);
|
|
4226
4373
|
return (mode === "split-viewports" || mode === "named-viewport-aggregate") && (result.evidence?.viewports?.length || 0) > 1;
|
|
@@ -4751,6 +4898,58 @@ async function runProfileForCli(profile, options) {
|
|
|
4751
4898
|
}
|
|
4752
4899
|
return runSingleRiddleProfileForCli(profile, options, { client, runner, outputDir: profileOutputDirOption(options) });
|
|
4753
4900
|
}
|
|
4901
|
+
async function runChangeProofForCli(rawProfile, options) {
|
|
4902
|
+
const contract = readChangeContractForCli(options);
|
|
4903
|
+
const beforeResultPath = optionString(options, "beforeResult");
|
|
4904
|
+
const afterResultPath = optionString(options, "afterResult");
|
|
4905
|
+
const beforeUrl = optionString(options, "beforeUrl");
|
|
4906
|
+
const afterUrl = optionString(options, "afterUrl");
|
|
4907
|
+
const hasResultInputs = Boolean(beforeResultPath || afterResultPath);
|
|
4908
|
+
const hasUrlInputs = Boolean(beforeUrl || afterUrl);
|
|
4909
|
+
if (hasResultInputs && hasUrlInputs) {
|
|
4910
|
+
throw new Error("run-change-proof accepts either --before-result/--after-result or --before-url/--after-url, not both.");
|
|
4911
|
+
}
|
|
4912
|
+
if (hasResultInputs && (!beforeResultPath || !afterResultPath)) {
|
|
4913
|
+
throw new Error("run-change-proof requires both --before-result and --after-result.");
|
|
4914
|
+
}
|
|
4915
|
+
if (!hasResultInputs && (!beforeUrl || !afterUrl)) {
|
|
4916
|
+
throw new Error("run-change-proof requires both --before-url and --after-url unless saved results are provided.");
|
|
4917
|
+
}
|
|
4918
|
+
const outputDir = profileOutputDirOption(options);
|
|
4919
|
+
let profile;
|
|
4920
|
+
let beforeResult;
|
|
4921
|
+
let afterResult;
|
|
4922
|
+
let beforeSource;
|
|
4923
|
+
let afterSource;
|
|
4924
|
+
if (hasResultInputs) {
|
|
4925
|
+
if (!beforeResultPath || !afterResultPath) {
|
|
4926
|
+
throw new Error("run-change-proof requires both --before-result and --after-result.");
|
|
4927
|
+
}
|
|
4928
|
+
profile = profileWithSelectedViewportNamesForCli(normalizeProfileRecordForCli(rawProfile, options), options);
|
|
4929
|
+
beforeResult = readProfileResultForCli(beforeResultPath, "--before-result");
|
|
4930
|
+
afterResult = readProfileResultForCli(afterResultPath, "--after-result");
|
|
4931
|
+
beforeSource = beforeResultPath;
|
|
4932
|
+
afterSource = afterResultPath;
|
|
4933
|
+
} else {
|
|
4934
|
+
if (!beforeUrl || !afterUrl) {
|
|
4935
|
+
throw new Error("run-change-proof requires both --before-url and --after-url unless saved results are provided.");
|
|
4936
|
+
}
|
|
4937
|
+
const beforeOptions = profileOptionsForChangeProofSide(options, beforeUrl, changeProofSideOutputDir(outputDir, "before"));
|
|
4938
|
+
const afterOptions = profileOptionsForChangeProofSide(options, afterUrl, changeProofSideOutputDir(outputDir, "after"));
|
|
4939
|
+
const beforeProfile = profileWithSelectedViewportNamesForCli(normalizeProfileRecordForCli(rawProfile, beforeOptions), beforeOptions);
|
|
4940
|
+
const afterProfile = profileWithSelectedViewportNamesForCli(normalizeProfileRecordForCli(rawProfile, afterOptions), afterOptions);
|
|
4941
|
+
profile = beforeProfile;
|
|
4942
|
+
beforeResult = await runProfileForCli(beforeProfile, beforeOptions);
|
|
4943
|
+
afterResult = await runProfileForCli(afterProfile, afterOptions);
|
|
4944
|
+
beforeSource = beforeUrl;
|
|
4945
|
+
afterSource = afterUrl;
|
|
4946
|
+
}
|
|
4947
|
+
const result = assessRiddleProofChange(contract, {
|
|
4948
|
+
before_result: beforeResult,
|
|
4949
|
+
after_result: afterResult
|
|
4950
|
+
});
|
|
4951
|
+
return { profile, contract, beforeResult, afterResult, result, beforeSource, afterSource };
|
|
4952
|
+
}
|
|
4754
4953
|
function requestForRun(options) {
|
|
4755
4954
|
const statePath = optionString(options, "statePath");
|
|
4756
4955
|
const withEngineModuleUrl = (request) => {
|
|
@@ -4811,6 +5010,13 @@ async function main() {
|
|
|
4811
5010
|
process.exitCode = profileStatusExitCode(profile, result.status);
|
|
4812
5011
|
return;
|
|
4813
5012
|
}
|
|
5013
|
+
if (command === "run-change-proof") {
|
|
5014
|
+
const run = await runChangeProofForCli(readProfileRecordForCli(options), options);
|
|
5015
|
+
writeChangeProofOutput(profileOutputDirOption(options), run);
|
|
5016
|
+
writeRunChangeProofResult(run, options);
|
|
5017
|
+
process.exitCode = run.result.status === "passed" ? 0 : 1;
|
|
5018
|
+
return;
|
|
5019
|
+
}
|
|
4814
5020
|
if (command === "regression-pack") {
|
|
4815
5021
|
const action = positional[1] || "run";
|
|
4816
5022
|
if (action !== "run") throw new Error("Only `regression-pack run` is supported.");
|
package/dist/cli/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-AK2EPEVO.js";
|
|
2
2
|
import "../chunk-B2DP2LET.js";
|
|
3
|
+
import "../chunk-JFQXAJH2.js";
|
|
3
4
|
import "../chunk-CWRIXP5H.js";
|
|
4
5
|
import "../chunk-UE4I7RTI.js";
|
|
5
6
|
import "../chunk-GG2D3MFZ.js";
|
|
7
|
+
import "../chunk-6S7DZWVC.js";
|
|
8
|
+
import "../chunk-KXLEN4SA.js";
|
|
6
9
|
import "../chunk-WLUMLHII.js";
|
|
7
10
|
import "../chunk-CGJX7LJO.js";
|
|
8
11
|
import "../chunk-UTCL7FEZ.js";
|
|
9
12
|
import "../chunk-EKZXU6MU.js";
|
|
10
13
|
import "../chunk-DYE3URAQ.js";
|
|
11
|
-
import "../chunk-JFQXAJH2.js";
|
|
12
|
-
import "../chunk-KXLEN4SA.js";
|
|
13
14
|
import "../chunk-NKHZASNQ.js";
|
|
14
15
|
import "../chunk-ZAR7BWMN.js";
|
|
15
16
|
import "../chunk-MLKGABMK.js";
|