@vaultcompass/conductor 0.2.2 → 0.2.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.
@@ -23,6 +23,7 @@
23
23
  // everywhere is worth more here than a nicer-looking terminal.
24
24
  import { compareFindings } from './envelope.js';
25
25
  import { EXIT_BLOCKED, EXIT_COULD_NOT_RUN } from './exit-codes.js';
26
+ import { isLegacyContractPath } from './intent-prepare.js';
26
27
  function subjectLabel(finding) {
27
28
  const subject = finding.subject;
28
29
  switch (subject.kind) {
@@ -96,7 +97,10 @@ function contractLine(gate) {
96
97
  }
97
98
  const source = gate.intent.contractSource;
98
99
  const where = source.kind === 'native'
99
- ? `the repository's own frozen ${source.path}`
100
+ ? // The path already names the directory, and the aside says what a
101
+ // reader who has not followed intent-guard's releases cannot get from
102
+ // the path alone: that this is the old name and a newer gate moves it.
103
+ `the repository's own frozen ${source.path}${isLegacyContractPath(source.path) ? ' (pre-1.3 directory, still read)' : ''}`
100
104
  : source.kind === 'imported'
101
105
  ? `spec ${source.spec}${source.plan === null ? '' : ` plus plan ${source.plan}`}`
102
106
  : 'none';
@@ -413,9 +417,15 @@ function summaryLine(result) {
413
417
  // is the easiest of the three to lose: a --gate run is usually somebody
414
418
  // narrowing a run on purpose, and a log of it that says nothing about the
415
419
  // narrowing is the log that gets uploaded and read as a full run later.
420
+ // Counted even at zero for the same suppression reason as the enforcement
421
+ // count above: a gate the command line dropped had no vote, and "0 gate(s)
422
+ // left out by --gate" says the run was not narrowed.
416
423
  if (result.excluded.length > 0) {
417
424
  const names = result.excluded.map((gate) => `${gate.role} (${gate.product})`).join(', ');
418
- parts.push(`Left out by --gate: ${names}.`);
425
+ parts.push(`${result.excluded.length} gate(s) left out by --gate: ${names}.`);
426
+ }
427
+ else {
428
+ parts.push('0 gate(s) left out by --gate.');
419
429
  }
420
430
  // A gate that ran with enforce: false could not have failed this run
421
431
  // whatever it found. Naming it among the gates that ran and then saying
@@ -424,10 +434,19 @@ function summaryLine(result) {
424
434
  // full report says this in the line under that gate's findings; on a clean
425
435
  // run there are no findings, so the summary line is the only place left to
426
436
  // say it.
437
+ //
438
+ // Printed as a count even when it is zero. This is the family suppression
439
+ // rule: a gate that can be turned off is the user's decision, and a clean
440
+ // line that says nothing about enforcement lets a repository read as fully
441
+ // gated when a gate's result did not move the exit code. "0 gate(s) not
442
+ // enforced" is the umbrella saying every gate that ran had a vote.
427
443
  const unenforced = result.gates.filter((gate) => !gate.enforce);
428
444
  if (unenforced.length > 0) {
429
445
  const names = unenforced.map((gate) => `${gate.role} (${gate.product})`).join(', ');
430
- parts.push(`Could not have blocked, enforce: false in .guardrails.yaml: ${names}.`);
446
+ parts.push(`${unenforced.length} gate(s) not enforced, could not have blocked, enforce: false in .guardrails.yaml: ${names}.`);
447
+ }
448
+ else {
449
+ parts.push('0 gate(s) not enforced.');
431
450
  }
432
451
  // Non-blocking findings are counted rather than hidden, for the same reason
433
452
  // the full report prints the suppressed and ignored counts at zero: they
@@ -444,6 +463,21 @@ function summaryLine(result) {
444
463
  if (counts.length > 0) {
445
464
  parts.push(`${counts.join(', ')}.`);
446
465
  }
466
+ // The suppressed and ignored counts the gates reported, summed across them
467
+ // and printed even at zero. The full report prints these per gate for the
468
+ // same reason, so a quiet report is not mistaken for a clean one; the clean
469
+ // summary line is the one a hook and a pull request comment actually print,
470
+ // and it is where a repository baselining findings without saying so would
471
+ // otherwise read as clean. Suppressed always shows because it is always a
472
+ // number the gate reported. Ignored shows only when every gate that ran
473
+ // reported it: a gate that drops ignored files before its own output has no
474
+ // count to give, and "0 ignored" there would state a fact no gate stated.
475
+ const suppressed = result.gates.reduce((total, gate) => total + gate.run.suppressed, 0);
476
+ const gatesReportingIgnored = result.gates.filter((gate) => gate.run.details.ignoredReported !== false);
477
+ const ignored = gatesReportingIgnored.reduce((total, gate) => total + gate.run.ignored, 0);
478
+ parts.push(gatesReportingIgnored.length === result.gates.length
479
+ ? `${suppressed} suppressed, ${ignored} ignored across all gates.`
480
+ : `${suppressed} suppressed across all gates.`);
447
481
  parts.push('Re-run with --verbose for the full report.');
448
482
  return parts.join(' ');
449
483
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaultcompass/conductor",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Umbrella installer and combined report over the independently installable guardrail gates.",
6
6
  "license": "MIT",