donobu 5.57.0 → 5.57.1

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,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { type DonobuReport } from '../reporter/model';
2
3
  declare function hasReporterArg(args: string[]): boolean;
3
4
  declare function injectJsonReporterIntoArgs(args: string[]): {
4
5
  /** True when the args contained any `--reporter` / `-r` flag. */
@@ -11,8 +12,15 @@ declare function ensureReporterValueHasJson(value: string): {
11
12
  value: string;
12
13
  changed: boolean;
13
14
  };
15
+ /**
16
+ * Read the count of still-failing tests from a merged report's stats. Returns
17
+ * `undefined` when the report lacks a numeric `unexpected` stat, signalling the
18
+ * caller to fall back to the rerun's own exit code rather than assume success.
19
+ */
20
+ declare function countUnexpectedTests(report: DonobuReport): number | undefined;
14
21
  /** @internal Exposed for unit tests only — not part of the public API. */
15
22
  export declare const _forTesting: {
23
+ countUnexpectedTests: typeof countUnexpectedTests;
16
24
  ensureReporterValueHasJson: typeof ensureReporterValueHasJson;
17
25
  hasReporterArg: typeof hasReporterArg;
18
26
  injectJsonReporterIntoArgs: typeof injectJsonReporterIntoArgs;
@@ -1416,6 +1416,18 @@ async function attemptAutoHealRun(params) {
1416
1416
  if (mergedReport) {
1417
1417
  await regenerateDonobuReports(mergedReport);
1418
1418
  await writeAutoHealPullRequestBody(mergedReport, params.playwrightOutputDir);
1419
+ // The heal rerun only re-runs the grep-filtered subset of healable
1420
+ // tests, so `healExitCode` is blind to failures triage declined to
1421
+ // retry (e.g. real product bugs). Re-derive the status from the merged
1422
+ // report so those remaining failures still fail CI. We only escalate
1423
+ // (never downgrade a non-zero heal exit) to preserve infra/crash codes.
1424
+ const remainingFailures = countUnexpectedTests(mergedReport);
1425
+ if (healExitCode === 0 &&
1426
+ remainingFailures !== undefined &&
1427
+ remainingFailures > 0) {
1428
+ Logger_1.appLogger.warn(`Auto-heal rerun passed for the healed subset, but ${remainingFailures} test(s) remain failing in the merged report. Exiting non-zero.`);
1429
+ healExitCode = 1;
1430
+ }
1419
1431
  }
1420
1432
  }
1421
1433
  }
@@ -1424,6 +1436,16 @@ async function attemptAutoHealRun(params) {
1424
1436
  }
1425
1437
  return { attempted: true, exitCode: healExitCode };
1426
1438
  }
1439
+ /**
1440
+ * Read the count of still-failing tests from a merged report's stats. Returns
1441
+ * `undefined` when the report lacks a numeric `unexpected` stat, signalling the
1442
+ * caller to fall back to the rerun's own exit code rather than assume success.
1443
+ */
1444
+ function countUnexpectedTests(report) {
1445
+ const stats = report.stats;
1446
+ const unexpected = stats?.unexpected;
1447
+ return typeof unexpected === 'number' ? unexpected : undefined;
1448
+ }
1427
1449
  /**
1428
1450
  * Filename of the auto-heal PR body artifact. Lands in the Playwright output
1429
1451
  * directory alongside the merged JSON / HTML / Markdown reports so the
@@ -2135,6 +2157,7 @@ main().catch((error) => {
2135
2157
  });
2136
2158
  /** @internal Exposed for unit tests only — not part of the public API. */
2137
2159
  exports._forTesting = {
2160
+ countUnexpectedTests,
2138
2161
  ensureReporterValueHasJson,
2139
2162
  hasReporterArg,
2140
2163
  injectJsonReporterIntoArgs,
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { type DonobuReport } from '../reporter/model';
2
3
  declare function hasReporterArg(args: string[]): boolean;
3
4
  declare function injectJsonReporterIntoArgs(args: string[]): {
4
5
  /** True when the args contained any `--reporter` / `-r` flag. */
@@ -11,8 +12,15 @@ declare function ensureReporterValueHasJson(value: string): {
11
12
  value: string;
12
13
  changed: boolean;
13
14
  };
15
+ /**
16
+ * Read the count of still-failing tests from a merged report's stats. Returns
17
+ * `undefined` when the report lacks a numeric `unexpected` stat, signalling the
18
+ * caller to fall back to the rerun's own exit code rather than assume success.
19
+ */
20
+ declare function countUnexpectedTests(report: DonobuReport): number | undefined;
14
21
  /** @internal Exposed for unit tests only — not part of the public API. */
15
22
  export declare const _forTesting: {
23
+ countUnexpectedTests: typeof countUnexpectedTests;
16
24
  ensureReporterValueHasJson: typeof ensureReporterValueHasJson;
17
25
  hasReporterArg: typeof hasReporterArg;
18
26
  injectJsonReporterIntoArgs: typeof injectJsonReporterIntoArgs;
@@ -1416,6 +1416,18 @@ async function attemptAutoHealRun(params) {
1416
1416
  if (mergedReport) {
1417
1417
  await regenerateDonobuReports(mergedReport);
1418
1418
  await writeAutoHealPullRequestBody(mergedReport, params.playwrightOutputDir);
1419
+ // The heal rerun only re-runs the grep-filtered subset of healable
1420
+ // tests, so `healExitCode` is blind to failures triage declined to
1421
+ // retry (e.g. real product bugs). Re-derive the status from the merged
1422
+ // report so those remaining failures still fail CI. We only escalate
1423
+ // (never downgrade a non-zero heal exit) to preserve infra/crash codes.
1424
+ const remainingFailures = countUnexpectedTests(mergedReport);
1425
+ if (healExitCode === 0 &&
1426
+ remainingFailures !== undefined &&
1427
+ remainingFailures > 0) {
1428
+ Logger_1.appLogger.warn(`Auto-heal rerun passed for the healed subset, but ${remainingFailures} test(s) remain failing in the merged report. Exiting non-zero.`);
1429
+ healExitCode = 1;
1430
+ }
1419
1431
  }
1420
1432
  }
1421
1433
  }
@@ -1424,6 +1436,16 @@ async function attemptAutoHealRun(params) {
1424
1436
  }
1425
1437
  return { attempted: true, exitCode: healExitCode };
1426
1438
  }
1439
+ /**
1440
+ * Read the count of still-failing tests from a merged report's stats. Returns
1441
+ * `undefined` when the report lacks a numeric `unexpected` stat, signalling the
1442
+ * caller to fall back to the rerun's own exit code rather than assume success.
1443
+ */
1444
+ function countUnexpectedTests(report) {
1445
+ const stats = report.stats;
1446
+ const unexpected = stats?.unexpected;
1447
+ return typeof unexpected === 'number' ? unexpected : undefined;
1448
+ }
1427
1449
  /**
1428
1450
  * Filename of the auto-heal PR body artifact. Lands in the Playwright output
1429
1451
  * directory alongside the merged JSON / HTML / Markdown reports so the
@@ -2135,6 +2157,7 @@ main().catch((error) => {
2135
2157
  });
2136
2158
  /** @internal Exposed for unit tests only — not part of the public API. */
2137
2159
  exports._forTesting = {
2160
+ countUnexpectedTests,
2138
2161
  ensureReporterValueHasJson,
2139
2162
  hasReporterArg,
2140
2163
  injectJsonReporterIntoArgs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "5.57.0",
3
+ "version": "5.57.1",
4
4
  "description": "Create browser automations with an LLM agent and replay them as Playwright scripts.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/esm/main.js",