cdk-real-drift 0.2.16 → 0.2.18

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
@@ -2751,6 +2751,7 @@ const UNORDERED_OBJECT_ARRAY_IDENTITY = {
2751
2751
  const UNORDERED_NESTED_OBJECT_ARRAY_PATHS = {
2752
2752
  "AWS::CloudFront::CachePolicy": new Set(["CachePolicyConfig.ParametersInCacheKeyAndForwardedToOrigin.HeadersConfig.Headers"]),
2753
2753
  "AWS::CloudFront::Distribution": new Set(["DistributionConfig.Aliases"]),
2754
+ "AWS::IoT::ThingType": new Set(["ThingTypeProperties.SearchableAttributes"]),
2754
2755
  "AWS::Bedrock::Guardrail": new Set([
2755
2756
  "ContentPolicyConfig.FiltersConfig",
2756
2757
  "TopicPolicyConfig.TopicsConfig",
@@ -11337,6 +11338,7 @@ async function revertStack(p) {
11337
11338
  const cc = new CloudControlClient({ region });
11338
11339
  const byLogical = new Map(gathered.desired.resources.map((res) => [res.logicalId, res]));
11339
11340
  const failedDeleteIds = /* @__PURE__ */ new Set();
11341
+ const failedUpdateIds = /* @__PURE__ */ new Set();
11340
11342
  const applied = [];
11341
11343
  const clock = waitNow ?? Date.now;
11342
11344
  const buildRetryOpts = (displayId) => ({
@@ -11401,6 +11403,7 @@ async function revertStack(p) {
11401
11403
  ...r.hint !== void 0 && { hint: r.hint }
11402
11404
  });
11403
11405
  if (!r.ok) worst = Math.max(worst, 2);
11406
+ if (!r.ok && item.kind !== "delete") failedUpdateIds.add(item.logicalId);
11404
11407
  }
11405
11408
  for (const s of summarizeRevertResults(applied)) if (s.ok) console.log(style.ok(` reverted: ${s.displayId}`));
11406
11409
  else {
@@ -11425,14 +11428,35 @@ async function revertStack(p) {
11425
11428
  }
11426
11429
  const remainingDrift = post.filter(isDrift);
11427
11430
  const remaining = remainingDrift.length;
11431
+ const okIds = new Set(applied.filter((a) => a.ok).map((a) => a.logicalId));
11432
+ const preActual = /* @__PURE__ */ new Map();
11433
+ for (const f of gathered.findings) preActual.set(`${f.logicalId}\0${f.path}`, f.actual);
11434
+ const noOpRemovals = [];
11435
+ for (const item of plan.items) {
11436
+ if (item.kind === "delete" || !okIds.has(item.logicalId)) continue;
11437
+ for (const op of item.ops) {
11438
+ if (op.op !== "remove") continue;
11439
+ const dotted = op.path.replace(/^\//, "").replace(/\//g, ".");
11440
+ const key = `${item.logicalId}\0${dotted}`;
11441
+ if (!preActual.has(key)) continue;
11442
+ const pre = preActual.get(key);
11443
+ if (post.some((f) => f.logicalId === item.logicalId && f.path === dotted && !isDrift(f) && deepEqual(f.actual, pre))) noOpRemovals.push({
11444
+ displayId: item.displayId,
11445
+ path: dotted
11446
+ });
11447
+ }
11448
+ }
11428
11449
  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).`));
11450
+ const unconfirmed = unverified + failedDeleteIds.size + failedUpdateIds.size;
11451
+ const converged = remaining === 0 && unconfirmed === 0 && noOpRemovals.length === 0;
11452
+ 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)`));
11453
+ const notConverged = unconfirmed + noOpRemovals.length;
11454
+ 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
11455
  const unrecordedLeft = unrecordedCount(post);
11432
11456
  if (unrecordedLeft > 0) console.log(style.note(` (${unrecordedLeft} unrecorded value(s) still await a baseline — run cdkrd record)`));
11433
11457
  if (unverified > 0) console.log(style.note(` (${unverified} resource(s) could not be re-read to verify — re-run cdkrd check to confirm)`));
11434
11458
  for (const line of formatSurvivingDrift(remainingDrift, stackName)) console.log(line);
11435
- if (remaining > 0 || unverified > 0) worst = Math.max(worst, 1);
11459
+ if (remaining > 0 || unverified > 0 || noOpRemovals.length > 0) worst = Math.max(worst, 1);
11436
11460
  return {
11437
11461
  exit: worst,
11438
11462
  aborted: false