@moda-ai/cli 1.28.3 → 1.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +26 -1
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -896,6 +896,7 @@ async function runFixVerify(context, profileOptions, tenantId) {
|
|
|
896
896
|
verdict: verdict || null,
|
|
897
897
|
gateResult,
|
|
898
898
|
...gateResult?.baselineFidelity ? { baselineFidelity: gateResult.baselineFidelity } : {},
|
|
899
|
+
...gateResult?.counterfactual ? { counterfactual: gateResult.counterfactual } : {},
|
|
899
900
|
...cases.length > 0 ? { cases } : {}
|
|
900
901
|
}, {
|
|
901
902
|
status: envelopeStatus,
|
|
@@ -1111,9 +1112,14 @@ async function runFixDetail(context, profileOptions, tenantId, fixId) {
|
|
|
1111
1112
|
});
|
|
1112
1113
|
}
|
|
1113
1114
|
const fidelityCopy = fixVerifiedFidelityCopy(fix);
|
|
1115
|
+
const detailCf = counterfactualBlock(fix.gateResult ?? null);
|
|
1114
1116
|
if (context.outputMode === "human") {
|
|
1115
1117
|
process.stderr.write(`MODA-FIX-${fix.shortRef} ${fix.status} ${fix.fixType}${fidelityCopy ? ` — ${fidelityCopy}` : ""}${fix.statusReason ? ` — ${fix.statusReason}` : ""}
|
|
1116
1118
|
`);
|
|
1119
|
+
if (detailCf) {
|
|
1120
|
+
process.stderr.write(`${counterfactualHumanLine(detailCf)}
|
|
1121
|
+
`);
|
|
1122
|
+
}
|
|
1117
1123
|
}
|
|
1118
1124
|
context.output.writeData(fix, {
|
|
1119
1125
|
summary: {
|
|
@@ -1342,6 +1348,20 @@ function verifiedFidelityCopy(gate) {
|
|
|
1342
1348
|
const descriptor = baselineFidelityDescriptor(gate);
|
|
1343
1349
|
return descriptor ? `Verified — ${descriptor}` : null;
|
|
1344
1350
|
}
|
|
1351
|
+
function counterfactualBlock(gate) {
|
|
1352
|
+
if (!gate || gate.pending === true)
|
|
1353
|
+
return null;
|
|
1354
|
+
const cf = gate.counterfactual;
|
|
1355
|
+
if (!cf || typeof cf !== "object" || typeof cf.verdict !== "string" || !cf.verdict)
|
|
1356
|
+
return null;
|
|
1357
|
+
return cf;
|
|
1358
|
+
}
|
|
1359
|
+
function counterfactualSentence(cf) {
|
|
1360
|
+
return `prevented ${cf.wins ?? 0} of ${cf.informative ?? 0} replayed production failures (control still failed in ${cf.informative ?? 0}; regressions ${cf.losses ?? 0})`;
|
|
1361
|
+
}
|
|
1362
|
+
function counterfactualHumanLine(cf) {
|
|
1363
|
+
return `Counterfactual: ${cf.verdict} — ${counterfactualSentence(cf)}; anchors ${cf.anchors ?? 0}, abstained ${cf.abstained ?? 0}`;
|
|
1364
|
+
}
|
|
1345
1365
|
function fixVerifiedFidelityCopy(fix) {
|
|
1346
1366
|
if (fix.status !== "VERIFIED")
|
|
1347
1367
|
return null;
|
|
@@ -1353,13 +1373,14 @@ function gateFindings(fix) {
|
|
|
1353
1373
|
return [];
|
|
1354
1374
|
const verdict = gateResult.verdict ?? fix.status;
|
|
1355
1375
|
const fidelity = baselineFidelityDescriptor(gateResult);
|
|
1376
|
+
const cf = counterfactualBlock(gateResult);
|
|
1356
1377
|
return [
|
|
1357
1378
|
{
|
|
1358
1379
|
id: "fix:gate",
|
|
1359
1380
|
title: `gate ${verdict}: ${gateResult.reason ?? fix.statusReason ?? ""}`.trim(),
|
|
1360
1381
|
status: verdict,
|
|
1361
1382
|
severity: verdict === "pass" ? "info" : verdict === "fail" ? "error" : "warning",
|
|
1362
|
-
description: `${formatGateScoreboard(gateResult)}${fidelity ? `; baseline fidelity: ${fidelity}` : ""}`
|
|
1383
|
+
description: `${formatGateScoreboard(gateResult)}${fidelity ? `; baseline fidelity: ${fidelity}` : ""}` + `${cf ? `; counterfactual ${cf.verdict}: ${counterfactualSentence(cf)} (anchors ${cf.anchors ?? 0}, abstained ${cf.abstained ?? 0})` : ""}`
|
|
1363
1384
|
}
|
|
1364
1385
|
];
|
|
1365
1386
|
}
|
|
@@ -1384,6 +1405,10 @@ function printHumanGateVerdict(fix, gateRunId, gateResult, cases) {
|
|
|
1384
1405
|
if (gateResult) {
|
|
1385
1406
|
w(`Score: ${formatGateScoreboard(gateResult)}`);
|
|
1386
1407
|
}
|
|
1408
|
+
const cf = counterfactualBlock(gateResult);
|
|
1409
|
+
if (cf) {
|
|
1410
|
+
w(counterfactualHumanLine(cf));
|
|
1411
|
+
}
|
|
1387
1412
|
if (cases.length > 0) {
|
|
1388
1413
|
w("");
|
|
1389
1414
|
w("Per-case (holdout is the verdict; repair rows are training cases):");
|
package/package.json
CHANGED