cdk-real-drift 0.4.32 → 0.4.34

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
@@ -797,20 +797,33 @@ function parseIgnoreRule(entry) {
797
797
  *
798
798
  * `wholeResource` marks an atomic, whole-resource target (an `added` finding — empty property
799
799
  * path, so the target is just `<parentLogicalId>/<CC-identifier>`). Such a target has NO
800
- * property subtree: the `.` / `[` inside it are DATA within the CC identifier
801
- * (`example.com`, an ARN, `a[0]`), never property separators. Trimming there would walk into
802
- * a DIFFERENT sibling resource whose identifier is this one extended by `.` / `[`
803
- * (`MyApi/a` wrongly swallowing `MyApi/a.b`, `MyApi/a[0]`) — a silent over-suppression of the
804
- * `added` out-of-band feature (issue #990). So in this mode the ancestor walk trims ONLY at
805
- * `/` boundaries, which alone mark a resource boundary: a bare PARENT-resource rule (`MyLb`)
806
- * still covers its added children across `/` (e.g. a listener child whose id is an ARN full
807
- * of `/`, issue #903), while a rule for one whole resource can no longer reach a sibling.
800
+ * property subtree: everything after the FIRST `/` is the OPAQUE CC identifier — and it may
801
+ * itself contain `.`, `[`, `|`, OR `/` (a Cognito ResourceServer URI identifier
802
+ * `https://api.example.com/v2`, an ARN, a log-group name). None of those are property or
803
+ * resource separators; they are DATA inside one atomic id, so the segment-bounded ancestor
804
+ * walk below MUST NOT run — an intermediate `.` / `[` / `/`-prefix is a truncation of the
805
+ * identifier that reaches a DIFFERENT sibling (`MyApi/a` swallowing `MyApi/a.b` or
806
+ * `MyApi/a[0]` — #990; a LITERAL rule `.../api.example.com` swallowing the extended sibling
807
+ * `.../api.example.com/v2` — #1061). Instead we test exactly two things, both with the
808
+ * identifier treated ATOMICALLY (the UNBOUNDED `matchesGlob`, whose `*` / `?` span `/`, since
809
+ * a `/` inside the identifier is data, not a boundary):
810
+ * 1. the FULL target — a LITERAL rule (what `ignoreRuleFor` writes, metachars escaped) then
811
+ * matches ONLY its own exact id, never a `/`-extended sibling; a user-authored parent
812
+ * glob (`MyLb/*`) still spans the whole atomic identifier of a child; and
813
+ * 2. the BARE PARENT logical id — the single segment BEFORE the first `/` — so a bare
814
+ * parent-RESOURCE rule (`MyLb`, issue #903) still covers a child whose id is an ARN full
815
+ * of `/`.
808
816
  */
809
817
  function pathMatches(pattern, target, wholeResource = false) {
810
818
  if (matchesPathGlob(pattern, target)) return true;
819
+ if (wholeResource) {
820
+ if (matchesGlob(pattern, target)) return true;
821
+ const firstSlash = target.indexOf("/");
822
+ return firstSlash > 0 && matchesGlob(pattern, target.slice(0, firstSlash));
823
+ }
811
824
  let t = target;
812
825
  while (true) {
813
- const cut = wholeResource ? t.lastIndexOf("/") : Math.max(t.lastIndexOf("."), t.lastIndexOf("["), t.lastIndexOf("/"));
826
+ const cut = Math.max(t.lastIndexOf("."), t.lastIndexOf("["), t.lastIndexOf("/"));
814
827
  if (cut <= 0) break;
815
828
  t = t.slice(0, cut);
816
829
  if (matchesPathGlob(pattern, t)) return true;
@@ -9539,6 +9552,7 @@ function parseSchema(schemaJson) {
9539
9552
  const unorderedArrayPaths = collectUnorderedArrayPaths(definitions, schema.properties ?? {});
9540
9553
  const freeFormMapPaths = collectFreeFormMapPaths(definitions, schema.properties ?? {});
9541
9554
  const updatable = schema.handlers === void 0 ? void 0 : Object.hasOwn(schema.handlers, "update");
9555
+ const hasHandlers = schema.handlers !== void 0;
9542
9556
  const propertyTransforms = {};
9543
9557
  for (const [ptr, expr] of Object.entries(schema.propertyTransform ?? {})) if (typeof expr === "string") propertyTransforms[pointerToDotted$1(ptr)] = expr;
9544
9558
  return {
@@ -9554,7 +9568,8 @@ function parseSchema(schemaJson) {
9554
9568
  unorderedObjectArrayPaths: unorderedArrayPaths.object,
9555
9569
  freeFormMapPaths,
9556
9570
  ...Object.keys(propertyTransforms).length > 0 && { propertyTransforms },
9557
- updatable
9571
+ updatable,
9572
+ hasHandlers
9558
9573
  };
9559
9574
  }
9560
9575
 
@@ -12952,12 +12967,14 @@ function buildRevertPlan(findings, baseline, opts = {}) {
12952
12967
  });
12953
12968
  continue;
12954
12969
  }
12955
- if (schema?.updatable === false && !SDK_WRITERS[f.resourceType] && !propScoped && !nestedScoped) {
12970
+ const noUpdateHandler = schema?.updatable === false;
12971
+ const legacyNoHandlers = schema?.hasHandlers === false && !!SDK_OVERRIDES[f.resourceType];
12972
+ if ((noUpdateHandler || legacyNoHandlers) && !SDK_WRITERS[f.resourceType] && !propScoped && !nestedScoped) {
12956
12973
  notRevertable.push({
12957
12974
  displayId,
12958
12975
  resourceType: f.resourceType,
12959
12976
  path: f.path,
12960
- reason: "type has no update handler — detect/record only"
12977
+ reason: legacyNoHandlers ? "CFn-legacy type has no update handler block — detect/record only" : "type has no update handler — detect/record only"
12961
12978
  });
12962
12979
  continue;
12963
12980
  }