cdk-real-drift 0.2.16 → 0.2.17

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/dist/cli.js CHANGED
@@ -11337,6 +11337,7 @@ async function revertStack(p) {
11337
11337
  const cc = new CloudControlClient({ region });
11338
11338
  const byLogical = new Map(gathered.desired.resources.map((res) => [res.logicalId, res]));
11339
11339
  const failedDeleteIds = /* @__PURE__ */ new Set();
11340
+ const failedUpdateIds = /* @__PURE__ */ new Set();
11340
11341
  const applied = [];
11341
11342
  const clock = waitNow ?? Date.now;
11342
11343
  const buildRetryOpts = (displayId) => ({
@@ -11401,6 +11402,7 @@ async function revertStack(p) {
11401
11402
  ...r.hint !== void 0 && { hint: r.hint }
11402
11403
  });
11403
11404
  if (!r.ok) worst = Math.max(worst, 2);
11405
+ if (!r.ok && item.kind !== "delete") failedUpdateIds.add(item.logicalId);
11404
11406
  }
11405
11407
  for (const s of summarizeRevertResults(applied)) if (s.ok) console.log(style.ok(` reverted: ${s.displayId}`));
11406
11408
  else {
@@ -11425,14 +11427,35 @@ async function revertStack(p) {
11425
11427
  }
11426
11428
  const remainingDrift = post.filter(isDrift);
11427
11429
  const remaining = remainingDrift.length;
11430
+ const okIds = new Set(applied.filter((a) => a.ok).map((a) => a.logicalId));
11431
+ const preActual = /* @__PURE__ */ new Map();
11432
+ for (const f of gathered.findings) preActual.set(`${f.logicalId}\0${f.path}`, f.actual);
11433
+ const noOpRemovals = [];
11434
+ for (const item of plan.items) {
11435
+ if (item.kind === "delete" || !okIds.has(item.logicalId)) continue;
11436
+ for (const op of item.ops) {
11437
+ if (op.op !== "remove") continue;
11438
+ const dotted = op.path.replace(/^\//, "").replace(/\//g, ".");
11439
+ const key = `${item.logicalId}\0${dotted}`;
11440
+ if (!preActual.has(key)) continue;
11441
+ const pre = preActual.get(key);
11442
+ if (post.some((f) => f.logicalId === item.logicalId && f.path === dotted && !isDrift(f) && deepEqual(f.actual, pre))) noOpRemovals.push({
11443
+ displayId: item.displayId,
11444
+ path: dotted
11445
+ });
11446
+ }
11447
+ }
11428
11448
  const unverified = post.filter((f) => touched.has(f.logicalId) && f.tier === "skipped").length;
11429
- const unconfirmed = unverified + failedDeleteIds.size;
11430
- console.log(remaining === 0 && unconfirmed === 0 ? style.clean(`${stackName}: CLEAN after revert.`) : remaining > 0 ? style.drift(`${stackName}: ${remaining} drift(s) remain.`) : style.drift(`${stackName}: revert applied, but ${unconfirmed} resource(s) could not be confirmed converged (see above).`));
11449
+ const unconfirmed = unverified + failedDeleteIds.size + failedUpdateIds.size;
11450
+ const converged = remaining === 0 && unconfirmed === 0 && noOpRemovals.length === 0;
11451
+ for (const n of noOpRemovals) console.log(style.fail(` NOT reverted: ${n.displayId}.${n.path} — removal was a no-op (the provider ignored the omitted property; it needs an explicit default write — see #597 / REVERT_SET_DEFAULT_PATHS)`));
11452
+ const notConverged = unconfirmed + noOpRemovals.length;
11453
+ console.log(converged ? style.clean(`${stackName}: CLEAN after revert.`) : remaining > 0 ? style.drift(`${stackName}: ${remaining} drift(s) remain.`) : style.drift(`${stackName}: revert applied, but ${notConverged} value(s) could not be confirmed converged (see above).`));
11431
11454
  const unrecordedLeft = unrecordedCount(post);
11432
11455
  if (unrecordedLeft > 0) console.log(style.note(` (${unrecordedLeft} unrecorded value(s) still await a baseline — run cdkrd record)`));
11433
11456
  if (unverified > 0) console.log(style.note(` (${unverified} resource(s) could not be re-read to verify — re-run cdkrd check to confirm)`));
11434
11457
  for (const line of formatSurvivingDrift(remainingDrift, stackName)) console.log(line);
11435
- if (remaining > 0 || unverified > 0) worst = Math.max(worst, 1);
11458
+ if (remaining > 0 || unverified > 0 || noOpRemovals.length > 0) worst = Math.max(worst, 1);
11436
11459
  return {
11437
11460
  exit: worst,
11438
11461
  aborted: false