blastproof 0.28.0 → 0.29.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.
package/README.md CHANGED
@@ -255,7 +255,7 @@ blastproof run # any failure exits 1 (strict, the default)
255
255
  blastproof run --min-score 80 # one failing P2 is tolerated
256
256
  ```
257
257
 
258
- `--min-score` **replaces** the all-must-pass rule rather than adding to it. Only executed tests count: filtered and unrouted tests are neither numerator nor denominator, and a run that executed nothing scores 100, so a docs-only PR is never blocked. JUnit carries the score as a `<property name="score">`, and unrouted tests appear as `<skipped/>` so the coverage gap shows up in CI rather than vanishing.
258
+ `--min-score` **replaces** the all-must-pass rule rather than adding to it. Only executed tests count: filtered and unrouted tests are neither numerator nor denominator, and a run that executed nothing scores 100, so a docs-only PR is never blocked. JUnit carries the score as a `<property name="score">`, and unrouted tests appear as `<skipped/>` so the coverage gap shows up in CI rather than vanishing. The warnings the run prints (uncommitted work, route drift, a step that names no value) are in both reports too: JUnit counts them in `<property name="warnings">` with their text in `<system-err>`, and the HTML report shows them right after the score.
259
259
 
260
260
  **The verdict behind that number is pinned, and that is not the same as reproducible.** The model call that decides whether a step passed runs at temperature 0, so the same page and the same expectation are not re-sampled into a different answer — a gate that flips on identical input teaches people to re-run until green, which is worse than no gate. What pinning does not survive: provider-side batching, floating point, and a gateway routing two calls to different providers or quantizations. Expect far less variance, not a guarantee of the same output twice.
261
261
 
package/dist/cli.js CHANGED
@@ -1782,23 +1782,38 @@ function mapImpact(changedFiles, routes, ignore = []) {
1782
1782
  };
1783
1783
  }
1784
1784
 
1785
+ // src/report/warnings.ts
1786
+ function emitWarning(warning, into) {
1787
+ if (!warning) return;
1788
+ console.error(`${warning.spaced ? "\n" : ""}${warning.title}`);
1789
+ for (const line of warning.lines) console.error(line);
1790
+ into?.push(warning);
1791
+ }
1792
+ function warningText(warning) {
1793
+ return [warning.title, ...warning.lines].join("\n");
1794
+ }
1795
+
1785
1796
  // src/report/uncommitted.ts
1786
- function printUncommitted(uncommitted, changedFiles, config, baseRef) {
1797
+ function printUncommitted(uncommitted, changedFiles, config, baseRef, into) {
1798
+ emitWarning(uncommittedWarning(uncommitted, changedFiles, config, baseRef), into);
1799
+ }
1800
+ function uncommittedWarning(uncommitted, changedFiles, config, baseRef) {
1787
1801
  const inDiff = new Set(changedFiles.map((file) => file.replace(/\\/g, "/")));
1788
1802
  const routes = config.routes ?? {};
1789
1803
  const ignore = config.ignore ?? [];
1790
1804
  const findings = uncommitted.filter((file) => !inDiff.has(file)).map((file) => ({ file, impact: mapImpact([file], routes, ignore) })).filter(({ impact }) => impact.ignoredFiles.length === 0);
1791
- if (findings.length === 0) return;
1792
- console.error(
1793
- `
1794
- warning: ${findings.length} file(s) changed in the working tree are not in the diff against '${baseRef}':`
1795
- );
1796
- for (const { file, impact } of findings) {
1797
- console.error(
1798
- impact.affectedRoutes.length > 0 ? ` ${file} -> ${impact.affectedRoutes.join(", ")}` : ` ${file} (matched by no routes: or ignore: glob)`
1799
- );
1800
- }
1801
- console.error("Nothing above was considered. Commit or stash them to include them.");
1805
+ if (findings.length === 0) return void 0;
1806
+ return {
1807
+ kind: "uncommitted",
1808
+ title: `warning: ${findings.length} file(s) changed in the working tree are not in the diff against '${baseRef}':`,
1809
+ lines: [
1810
+ ...findings.map(
1811
+ ({ file, impact }) => impact.affectedRoutes.length > 0 ? ` ${file} -> ${impact.affectedRoutes.join(", ")}` : ` ${file} (matched by no routes: or ignore: glob)`
1812
+ ),
1813
+ "Nothing above was considered. Commit or stash them to include them."
1814
+ ],
1815
+ spaced: true
1816
+ };
1802
1817
  }
1803
1818
 
1804
1819
  // src/llm/brain.ts
@@ -2724,10 +2739,10 @@ async function embedScreenshot(file) {
2724
2739
  }
2725
2740
  var STYLES = `
2726
2741
  :root { color-scheme: light dark; --bg:#fff; --fg:#111; --muted:#666; --line:#e3e3e3;
2727
- --pass:#137333; --fail:#c5221f; --card:#fafafa; }
2742
+ --pass:#137333; --fail:#c5221f; --warn:#b06000; --card:#fafafa; }
2728
2743
  @media (prefers-color-scheme: dark) {
2729
2744
  :root { --bg:#15171a; --fg:#e8e8e8; --muted:#9aa0a6; --line:#2c2f34;
2730
- --pass:#5bb974; --fail:#f28b82; --card:#1c1f23; }
2745
+ --pass:#5bb974; --fail:#f28b82; --warn:#fdd663; --card:#1c1f23; }
2731
2746
  }
2732
2747
  * { box-sizing: border-box; }
2733
2748
  body { margin:0; padding:2rem 1.25rem; background:var(--bg); color:var(--fg);
@@ -2742,6 +2757,11 @@ h1 { font-size:1.35rem; margin:0 0 .25rem; }
2742
2757
  .verdict { font-weight:600; }
2743
2758
  .verdict.pass { color:var(--pass); } .verdict.fail { color:var(--fail); }
2744
2759
  .counts { color:var(--muted); font-size:.9rem; }
2760
+ .warnings { padding:1rem 1.25rem; border:1px solid var(--warn); border-radius:10px;
2761
+ background:color-mix(in srgb, var(--warn) 8%, transparent); margin-bottom:1.5rem; }
2762
+ .warnings h2 { font-size:1rem; margin:0 0 .5rem; color:var(--warn); }
2763
+ .warnings h3 { font-size:.9rem; margin:.75rem 0 .25rem; }
2764
+ .warnings pre { margin:0; white-space:pre-wrap; font-size:.82rem; }
2745
2765
  .incomplete { padding:1rem 1.25rem; border:1px solid var(--fail); border-radius:10px;
2746
2766
  background:color-mix(in srgb, var(--fail) 10%, transparent); margin-bottom:1.5rem; font-weight:600; }
2747
2767
  table { width:100%; border-collapse:collapse; margin-bottom:1.5rem; }
@@ -2827,6 +2847,13 @@ async function renderHtml(results, skipped, meta) {
2827
2847
  const banner = meta.incomplete === void 0 ? "" : ` <section class="incomplete">Run stopped: ${escapeHtml(meta.incomplete)}</section>
2828
2848
 
2829
2849
  `;
2850
+ const warnings = meta.warnings ?? [];
2851
+ const warningsSection = warnings.length === 0 ? "" : ` <section class="warnings">
2852
+ <h2>Warnings (${warnings.length})</h2>
2853
+ ` + warnings.map(
2854
+ (w) => ` <h3>${escapeHtml(w.title)}</h3>` + (w.lines.length > 0 ? `
2855
+ <pre>${escapeHtml(w.lines.join("\n"))}</pre>` : "")
2856
+ ).join("\n") + "\n </section>\n\n";
2830
2857
  const rows = results.map((r) => {
2831
2858
  const file = meta.cwd ? path8.relative(meta.cwd, r.file) : r.file;
2832
2859
  const tagClass = r.status === "failed" ? "fail" : r.status === "not-run" ? "skip" : "pass";
@@ -2857,7 +2884,7 @@ ${banner} <section class="score">
2857
2884
  <span class="counts">${passed} passed \xB7 ${failures.length} failed${notRun.length > 0 ? ` \xB7 ${notRun.length} not run` : ""}${skipped.length > 0 ? ` \xB7 ${skipped.length} skipped` : ""}</span>
2858
2885
  </section>
2859
2886
 
2860
- <table>
2887
+ ${warningsSection} <table>
2861
2888
  <thead><tr><th>Status</th><th>Priority</th><th>Test</th><th>File</th><th class="num">Time</th></tr></thead>
2862
2889
  <tbody>
2863
2890
  ${rows}${rows && skippedRows ? "\n" : ""}${skippedRows}
@@ -2902,6 +2929,7 @@ function seconds2(ms) {
2902
2929
  }
2903
2930
  function renderJUnit(results, skipped, meta) {
2904
2931
  const relative = (file) => meta.cwd ? path9.relative(meta.cwd, file) : file;
2932
+ const warnings = meta.warnings ?? [];
2905
2933
  const failures = results.filter((result) => result.status === "failed").length;
2906
2934
  const notRun = results.filter((result) => result.status === "not-run");
2907
2935
  const lines = [
@@ -2921,6 +2949,9 @@ function renderJUnit(results, skipped, meta) {
2921
2949
  ' <property name="incomplete" value="true"/>',
2922
2950
  ` <property name="incomplete_reason" value="${escapeXml(meta.incomplete)}"/>`
2923
2951
  ] : [],
2952
+ // Emitted as 0 too (design D2): unlike a token count nobody reported, 0 is
2953
+ // a true claim here, that the run printed no warning.
2954
+ ` <property name="warnings" value="${warnings.length}"/>`,
2924
2955
  " </properties>"
2925
2956
  ];
2926
2957
  for (const result of results) {
@@ -2951,6 +2982,9 @@ ${reason}` : reason;
2951
2982
  " </testcase>"
2952
2983
  );
2953
2984
  }
2985
+ if (warnings.length > 0) {
2986
+ lines.push(` <system-err>${escapeXml(warnings.map(warningText).join("\n\n"))}</system-err>`);
2987
+ }
2954
2988
  lines.push("</testsuite>", "");
2955
2989
  return lines.join("\n");
2956
2990
  }
@@ -3216,16 +3250,21 @@ function printImpactReport(impact, selection, cwd) {
3216
3250
  }
3217
3251
  console.log("---------------------------------------------------------------");
3218
3252
  }
3219
- function reportNearMissedSecrets(variables) {
3253
+ function reportNearMissedSecrets(variables, warnings) {
3220
3254
  for (const variable of variables) {
3221
- console.error(
3222
- `warning: the application returned ${variable} in a different form than the value supplied (case or spacing). It was redacted, but a form this tool cannot recognise \u2014 an encoding, a hash \u2014 would not have been. Check what that page does with the value.`
3255
+ emitWarning(
3256
+ {
3257
+ kind: "reformatted-secret",
3258
+ title: `warning: the application returned ${variable} in a different form than the value supplied (case or spacing). It was redacted, but a form this tool cannot recognise \u2014 an encoding, a hash \u2014 would not have been. Check what that page does with the value.`,
3259
+ lines: []
3260
+ },
3261
+ warnings
3223
3262
  );
3224
3263
  }
3225
3264
  }
3226
- async function finalize(results, skipped, options, sessionDir, secretsHeld, nearMissedSecrets, durationMs, impact, incomplete, spend, firstJudgeLog) {
3265
+ async function finalize(results, skipped, options, sessionDir, secretsHeld, nearMissedSecrets, warnings, durationMs, impact, incomplete, spend, firstJudgeLog) {
3227
3266
  if (results.length > 0) printSummary(results);
3228
- reportNearMissedSecrets(nearMissedSecrets);
3267
+ reportNearMissedSecrets(nearMissedSecrets, warnings);
3229
3268
  if (spend) console.log(formatSpendLine(spend));
3230
3269
  if (firstJudgeLog) console.log(firstJudgeLog.summaryLine());
3231
3270
  const score = scoreOf(results, incomplete !== void 0);
@@ -3239,7 +3278,8 @@ async function finalize(results, skipped, options, sessionDir, secretsHeld, near
3239
3278
  durationMs,
3240
3279
  cwd: options.cwd,
3241
3280
  incomplete: incomplete?.message,
3242
- spend
3281
+ spend,
3282
+ warnings
3243
3283
  });
3244
3284
  await writeJUnit(target, xml);
3245
3285
  console.log(`JUnit report: ${path10.relative(options.cwd, target)}`);
@@ -3253,6 +3293,7 @@ async function finalize(results, skipped, options, sessionDir, secretsHeld, near
3253
3293
  cwd: options.cwd,
3254
3294
  incomplete: incomplete?.message,
3255
3295
  spend,
3296
+ warnings,
3256
3297
  // A screenshot cannot be masked, so a run that held any `{{env.*}}` value
3257
3298
  // links to it instead of carrying it (design
3258
3299
  // withhold-a-screenshot-that-saw-a-secret, D1): the run's mask, not the
@@ -3286,29 +3327,36 @@ function declaredConfigRoutes(config) {
3286
3327
  const routes = config.routes ? Object.values(config.routes) : [];
3287
3328
  return [...new Set(routes.flat())].sort();
3288
3329
  }
3289
- function printRouteDrift(drift, cwd) {
3290
- if (drift.drifted.length === 0) return;
3291
- console.error(
3292
- "Route drift (test routes declared by no routes: mapping \u2014 contribute nothing to --impacted selection):"
3293
- );
3294
- for (const { test, routes } of drift.drifted) {
3295
- console.error(` ${test.summary} (${path10.relative(cwd, test.path)}): ${routes.join(", ")}`);
3296
- }
3297
- console.error("Fix the route typo, or add the route to a routes: mapping in .blastproof/config.yaml.");
3330
+ function routeDriftWarning(drift, cwd) {
3331
+ if (drift.drifted.length === 0) return void 0;
3332
+ return {
3333
+ kind: "route-drift",
3334
+ title: "Route drift (test routes declared by no routes: mapping \u2014 contribute nothing to --impacted selection):",
3335
+ lines: [
3336
+ ...drift.drifted.map(({ test, routes }) => ` ${test.summary} (${path10.relative(cwd, test.path)}): ${routes.join(", ")}`),
3337
+ "Fix the route typo, or add the route to a routes: mapping in .blastproof/config.yaml."
3338
+ ]
3339
+ };
3298
3340
  }
3299
- function printAuthoring(result, cwd) {
3300
- if (result.findings.length === 0) return;
3301
- console.error("\nAuthoring (a step enters a value but names none):");
3302
- for (const { test, origin, index, step } of result.findings) {
3303
- const where = origin === "setup" ? `setup step ${index}` : `step ${index}`;
3304
- console.error(` ${test.summary} (${path10.relative(cwd, test.path)}) ${where}:`);
3305
- console.error(` ${step}`);
3306
- console.error(` \u2192 ${suggestValueClause(step)}`);
3307
- }
3308
- console.error(
3309
- "The runner is forbidden from inventing values and enforces it: one it cannot trace to the step, the page or an {{env.*}} placeholder is refused, so a step supplying none fails at run time. Naming the value here is what makes it run."
3310
- );
3311
- console.error("Steps are inspected in English only; steps in other languages are not checked.");
3341
+ function authoringWarning(result, cwd) {
3342
+ if (result.findings.length === 0) return void 0;
3343
+ return {
3344
+ kind: "authoring",
3345
+ title: "Authoring (a step enters a value but names none):",
3346
+ lines: [
3347
+ ...result.findings.flatMap(({ test, origin, index, step }) => {
3348
+ const where = origin === "setup" ? `setup step ${index}` : `step ${index}`;
3349
+ return [
3350
+ ` ${test.summary} (${path10.relative(cwd, test.path)}) ${where}:`,
3351
+ ` ${step}`,
3352
+ ` \u2192 ${suggestValueClause(step)}`
3353
+ ];
3354
+ }),
3355
+ "The runner is forbidden from inventing values and enforces it: one it cannot trace to the step, the page or an {{env.*}} placeholder is refused, so a step supplying none fails at run time. Naming the value here is what makes it run.",
3356
+ "Steps are inspected in English only; steps in other languages are not checked."
3357
+ ],
3358
+ spaced: true
3359
+ };
3312
3360
  }
3313
3361
  function printDryRun(selected, config, cwd) {
3314
3362
  console.log(`
@@ -3344,6 +3392,7 @@ async function runCommand(options) {
3344
3392
  }
3345
3393
  throw error;
3346
3394
  }
3395
+ const warnings = [];
3347
3396
  const impacted = options.impacted ?? false;
3348
3397
  const base = options.base ?? "main";
3349
3398
  if (options.failOnUnmapped && !impacted) {
@@ -3365,7 +3414,7 @@ async function runCommand(options) {
3365
3414
  throw error;
3366
3415
  }
3367
3416
  impact = mapImpact(changedFiles, config.routes ?? {}, config.ignore ?? []);
3368
- printUncommitted(await getUncommittedFiles(options.cwd), changedFiles, config, base);
3417
+ printUncommitted(await getUncommittedFiles(options.cwd), changedFiles, config, base, warnings);
3369
3418
  }
3370
3419
  const testsDir = path10.join(options.cwd, TESTS_RELATIVE_DIR);
3371
3420
  let files;
@@ -3398,9 +3447,9 @@ async function runCommand(options) {
3398
3447
  }
3399
3448
  }
3400
3449
  const drift = detectRouteDrift(parsed, declaredConfigRoutes(config));
3401
- printRouteDrift(drift, options.cwd);
3450
+ emitWarning(routeDriftWarning(drift, options.cwd), warnings);
3402
3451
  const authoring = detectMissingValues(parsed);
3403
- printAuthoring(authoring, options.cwd);
3452
+ emitWarning(authoringWarning(authoring, options.cwd), warnings);
3404
3453
  if (options.failOnAuthoring && authoring.findings.length > 0) {
3405
3454
  console.error(
3406
3455
  `error: --fail-on-authoring: ${authoring.findings.length} step(s) enter a value but name none.`
@@ -3432,7 +3481,7 @@ ${results.length} test file(s) could not be parsed:`);
3432
3481
  console.log(
3433
3482
  impact ? "No impacted tests to run." : "No tests matched the given filters."
3434
3483
  );
3435
- return finalize(results, selection.unroutedSkipped, options, sessionDir, false, [], Date.now() - startedAt, impact);
3484
+ return finalize(results, selection.unroutedSkipped, options, sessionDir, false, [], warnings, Date.now() - startedAt, impact);
3436
3485
  }
3437
3486
  let decide;
3438
3487
  try {
@@ -3557,6 +3606,7 @@ ${results.length} test file(s) could not be parsed:`);
3557
3606
  sessionDir,
3558
3607
  !runMask.isEmpty(),
3559
3608
  runMask.nearMissedVariables(),
3609
+ warnings,
3560
3610
  Date.now() - startedAt,
3561
3611
  impact,
3562
3612
  incomplete,
@@ -3892,7 +3942,7 @@ function parsePositiveNumber(flag) {
3892
3942
  };
3893
3943
  }
3894
3944
  var program = new Command();
3895
- program.name("blastproof").description("Open-source AI testing agent: plain-English YAML tests executed agentically on a real browser.").version("0.28.0");
3945
+ program.name("blastproof").description("Open-source AI testing agent: plain-English YAML tests executed agentically on a real browser.").version("0.29.1");
3896
3946
  program.command("init").description("Scaffold .blastproof/ (config, tests, sample tests) in the current directory").action(async () => {
3897
3947
  try {
3898
3948
  const result = await initProject(process.cwd());