@allenpan2026/harshjudge 0.4.2 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harshjudge",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "AI-native E2E testing orchestration for Claude Code",
5
5
  "author": {
6
6
  "name": "Allen Pan"
package/dist/cli.js CHANGED
@@ -1471,7 +1471,7 @@ function extractScenarioSlug(runPath) {
1471
1471
  const parts = runPath.split("/");
1472
1472
  const scenariosIdx = parts.indexOf("scenarios");
1473
1473
  if (scenariosIdx >= 0 && parts.length > scenariosIdx + 1) {
1474
- return parts[scenariosIdx + 1];
1474
+ return parts[scenariosIdx + 1] ?? "unknown";
1475
1475
  }
1476
1476
  return "unknown";
1477
1477
  }
@@ -1488,7 +1488,9 @@ async function handleCompleteRun(params, fs = new FileSystemService()) {
1488
1488
  const resultPath = `${runPath}/${RESULT_FILE4}`;
1489
1489
  let existingResult = null;
1490
1490
  if (await fs.exists(resultPath)) {
1491
- existingResult = await fs.readJson(resultPath);
1491
+ existingResult = await fs.readJson(
1492
+ resultPath
1493
+ );
1492
1494
  if (existingResult.status !== "running") {
1493
1495
  throw new Error(`Run "${validated.runId}" is already completed.`);
1494
1496
  }
@@ -1506,7 +1508,8 @@ async function handleCompleteRun(params, fs = new FileSystemService()) {
1506
1508
  duration: 0,
1507
1509
  // Unknown for v1 compat
1508
1510
  error: validated.failedStep === se.stepId ? validated.errorMessage ?? null : null,
1509
- evidenceFiles: se.evidenceFiles
1511
+ evidenceFiles: se.evidenceFiles,
1512
+ summary: null
1510
1513
  }));
1511
1514
  }
1512
1515
  let startedAt;
@@ -1520,11 +1523,21 @@ async function handleCompleteRun(params, fs = new FileSystemService()) {
1520
1523
  startedAt = runData.startedAt;
1521
1524
  }
1522
1525
  }
1526
+ let effectiveStatus = validated.status;
1527
+ let warning;
1528
+ if (steps.length > 0) {
1529
+ const anyFailed = steps.some((s) => s.status === "fail");
1530
+ const derivedStatus = anyFailed ? "fail" : "pass";
1531
+ if (derivedStatus !== validated.status) {
1532
+ warning = `Status mismatch: --status "${validated.status}" contradicts step results (derived: "${derivedStatus}"). Using derived status.`;
1533
+ effectiveStatus = derivedStatus;
1534
+ }
1535
+ }
1523
1536
  const scenarioSlug = extractScenarioSlug(runPath);
1524
1537
  const result = {
1525
1538
  runId: validated.runId,
1526
1539
  scenarioSlug,
1527
- status: validated.status,
1540
+ status: effectiveStatus,
1528
1541
  startedAt: startedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
1529
1542
  completedAt: (/* @__PURE__ */ new Date()).toISOString(),
1530
1543
  duration: validated.duration,
@@ -1539,16 +1552,16 @@ async function handleCompleteRun(params, fs = new FileSystemService()) {
1539
1552
  existingMeta = await fs.readYaml(metaPath);
1540
1553
  }
1541
1554
  const currentStats = {
1542
- totalRuns: existingMeta.totalRuns ?? 0,
1543
- passCount: existingMeta.passCount ?? 0,
1544
- failCount: existingMeta.failCount ?? 0,
1545
- lastRun: existingMeta.lastRun ?? null,
1546
- lastResult: existingMeta.lastResult ?? null,
1547
- avgDuration: existingMeta.avgDuration ?? 0
1555
+ totalRuns: existingMeta["totalRuns"] ?? 0,
1556
+ passCount: existingMeta["passCount"] ?? 0,
1557
+ failCount: existingMeta["failCount"] ?? 0,
1558
+ lastRun: existingMeta["lastRun"] ?? null,
1559
+ lastResult: existingMeta["lastResult"] ?? null,
1560
+ avgDuration: existingMeta["avgDuration"] ?? 0
1548
1561
  };
1549
1562
  const newTotalRuns = currentStats.totalRuns + 1;
1550
- const newPassCount = currentStats.passCount + (validated.status === "pass" ? 1 : 0);
1551
- const newFailCount = currentStats.failCount + (validated.status === "fail" ? 1 : 0);
1563
+ const newPassCount = currentStats.passCount + (effectiveStatus === "pass" ? 1 : 0);
1564
+ const newFailCount = currentStats.failCount + (effectiveStatus === "fail" ? 1 : 0);
1552
1565
  const totalDuration = currentStats.avgDuration * currentStats.totalRuns + validated.duration;
1553
1566
  const newAvgDuration = Math.round(totalDuration / newTotalRuns);
1554
1567
  const updatedMeta = {
@@ -1557,7 +1570,7 @@ async function handleCompleteRun(params, fs = new FileSystemService()) {
1557
1570
  passCount: newPassCount,
1558
1571
  failCount: newFailCount,
1559
1572
  lastRun: (/* @__PURE__ */ new Date()).toISOString(),
1560
- lastResult: validated.status,
1573
+ lastResult: effectiveStatus,
1561
1574
  avgDuration: newAvgDuration
1562
1575
  };
1563
1576
  await fs.writeYaml(metaPath, updatedMeta);
@@ -1569,7 +1582,8 @@ async function handleCompleteRun(params, fs = new FileSystemService()) {
1569
1582
  passCount: newPassCount,
1570
1583
  failCount: newFailCount,
1571
1584
  avgDuration: newAvgDuration
1572
- }
1585
+ },
1586
+ ...warning !== void 0 ? { warning } : {}
1573
1587
  };
1574
1588
  }
1575
1589