cdk-real-drift 0.9.1 → 0.9.2

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
@@ -643,7 +643,16 @@ If the whole invocation fails before any stack is reached (bad config, an
643
643
  un-synthesizable app, or a zero-stack app), stdout is still a valid empty array
644
644
  `[]` (exit code non-zero, the reason on stderr) — never empty bytes.
645
645
 
646
- Each stack element is `{ "stack": "<name> (<region>)", "drifted": <n>, "findings": [...] }`
646
+ Every successfully-checked stack element carries a `"baseline": <bool>` flag —
647
+ `true` when the stack has a committed `.cdkrd` baseline (its undeclared dimension is
648
+ **watched**), `false` when it has never been recorded. Without a baseline the
649
+ classification shifts: appeared-since-record out-of-band values read as `unrecorded`
650
+ and are excluded from `drifted`, so a QUIET never-recorded stack emits the
651
+ byte-identical `"drifted": 0` of a watched-clean one. A consumer summing `drifted`
652
+ uses `baseline` to tell an UNWATCHED stack from a watched-clean one (#1095). It is
653
+ omitted on the `error` / `stackDeleted` shapes (never reconciled against a baseline).
654
+
655
+ Each stack element is `{ "stack": "<name> (<region>)", "drifted": <n>, "baseline": <bool>, "findings": [...] }`
647
656
  (`error` added only on a pre-check failure; `stackDeleted: true` only on a deleted
648
657
  stack). Each **finding** has a stable shape:
649
658
 
package/dist/cli.js CHANGED
@@ -15491,7 +15491,7 @@ function deletedStackReport(label) {
15491
15491
  stackDeleted: true
15492
15492
  };
15493
15493
  }
15494
- function buildStackJson(rawFindings, header) {
15494
+ function buildStackJson(rawFindings, header, hasBaseline) {
15495
15495
  const findings = annotateHints(rawFindings);
15496
15496
  const isDriftHere = (f) => DRIFT_TIERS.includes(f.tier) && !f.unrecorded;
15497
15497
  const drifted = findings.filter(isDriftHere).length;
@@ -15499,7 +15499,8 @@ function buildStackJson(rawFindings, header) {
15499
15499
  json: {
15500
15500
  stack: header,
15501
15501
  drifted,
15502
- findings
15502
+ findings,
15503
+ baseline: hasBaseline === true
15503
15504
  },
15504
15505
  code: drifted === 0 ? 0 : 1
15505
15506
  };
@@ -16527,7 +16528,7 @@ async function runCheck(args) {
16527
16528
  const reportHeader = `${posPrefix}${stackName} (${region})`;
16528
16529
  let code;
16529
16530
  if (a.json) {
16530
- const { json, code: jsonCode } = buildStackJson(reconciled, reportHeader);
16531
+ const { json, code: jsonCode } = buildStackJson(reconciled, reportHeader, baseline !== void 0);
16531
16532
  jsonReports.push(json);
16532
16533
  code = jsonCode;
16533
16534
  } else code = report(reconciled, reportHeader, {
@@ -16556,7 +16557,7 @@ async function runCheck(args) {
16556
16557
  verbose: a.verbose,
16557
16558
  positionPrefix: posPrefix
16558
16559
  });
16559
- else if (!baseline && !hasUnrecorded && !a.json && !a.showAll && !a.preDeploy) console.error(`note: ${stackName}: no .cdkrd baseline yet — run \`cdkrd record\` to establish one (future out-of-band changes then report as drift).`);
16560
+ else if (!baseline && !hasUnrecorded && !a.showAll && !a.preDeploy) console.error(`note: ${stackName}: no .cdkrd baseline yet — run \`cdkrd record\` to establish one (future out-of-band changes then report as drift).`);
16560
16561
  if (code === 1) anyDrift = true;
16561
16562
  worst = Math.max(worst, finalCheckExit(code, a.fail));
16562
16563
  worst = Math.max(worst, strictCoverageExit(a.strict, gathered.findings, desired.resources));