cdk-real-drift 0.2.51 → 0.2.53

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
@@ -473,9 +473,19 @@ ignore:
473
473
  non-CDK stack). Rules written with the older full `<stack>/<constructPath>.<path>`
474
474
  form still match. Widening a stamped scope to a `*` glob (to intentionally ignore a
475
475
  path across every stack/account/region) stays a hand-edit.
476
- - All four fields accept the same `*` / `?` glob, and a parent `path` covers child
477
- paths. The three scope axes — **stack, account, region** — are exactly the
478
- baseline file's identity axes. **Account** keeps a `stack: "Prod*"` rule from
476
+ - All four fields accept `*` / `?` globs, but the `path` axis is **segment-aware**
477
+ while the scope axes are not. In `path`, `*` / `?` match within a single `.`-delimited
478
+ segment (`*.DesiredCount` matches `<anyId>.DesiredCount`, not a deeper
479
+ `Tbl.Config.DesiredCount`) — a parent `path` still covers child paths via the subtree
480
+ walk, so the segment bound does not under-match. Inside a `[...]` bracket key a `*` /
481
+ `?` is **unbounded within that bracket** (the brackets delimit the key, so a `.`
482
+ between them is data): `Alb.LoadBalancerAttributes[*]` and
483
+ `Alb.LoadBalancerAttributes[routing.*]` both match the dotted key
484
+ `[routing.http2.enabled]`. On **stack / account / region**, `*` / `?` are unbounded
485
+ (those names carry no `.`). The three scope axes are exactly the
486
+ baseline file's identity axes; each is **omitted to leave that axis unscoped**
487
+ (match-all) — a present-but-empty `""` is rejected (it would match nothing).
488
+ **Account** keeps a `stack: "Prod*"` rule from
479
489
  leaking into a same-named stack in another account (stack-name uniqueness only
480
490
  holds within one account / App); **region** is independent the same way — the same
481
491
  stack in several accounts or regions may drift in only one.
package/dist/cli.js CHANGED
@@ -76,6 +76,10 @@ function classifyStackStatus(status) {
76
76
  kind: "skip",
77
77
  message: "is being deleted (DELETE_IN_PROGRESS) — nothing stable to check"
78
78
  };
79
+ if (s === "ROLLBACK_COMPLETE") return {
80
+ kind: "skip",
81
+ message: "in ROLLBACK_COMPLETE — the initial create failed and rolled back, deleting every resource, so there is no deployed state to check; delete and re-deploy"
82
+ };
79
83
  if (s.endsWith("_IN_PROGRESS")) return {
80
84
  kind: "warn",
81
85
  message: `stack is mid-operation (${s}) — live state is in flux, so drift results may be transient`
@@ -349,12 +353,24 @@ function matchesGlob(pattern, name) {
349
353
  * (`X.Policies` covering `X.Policies[Mp].Name`) is handled separately by the ancestor
350
354
  * walk in `pathMatches`, so bounding `*` here does not under-match. The stack/region
351
355
  * axes keep `matchesGlob` (their names contain no `.`/`[`, so it is equivalent there).
356
+ *
357
+ * INSIDE a `[...]` bracket segment a `*` / `?` is UNBOUNDED within that bracket: the
358
+ * brackets already delimit the key, so a `.` between them is DATA, not a segment
359
+ * boundary — cdkrd's own canonical paths carry dotted bracket keys such as
360
+ * `Alb.LoadBalancerAttributes[routing.http2.enabled]`. So `...[*]` and `...[routing.*]`
361
+ * match those keys, while `.` OUTSIDE brackets stays a hard segment boundary. A `*`/`?`
362
+ * inside a bracket may not cross the closing `]` (still one bracket segment).
352
363
  */
353
364
  function matchesPathGlob(pattern, target) {
354
365
  let out = "^";
355
- for (const ch of pattern.replace(/\*+/g, "*")) if (ch === "*") out += "[^.[]*";
356
- else if (ch === "?") out += "[^.[]";
357
- else out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
366
+ let inBracket = false;
367
+ for (const ch of pattern.replace(/\*+/g, "*")) if (ch === "*") out += inBracket ? "[^\\]]*" : "[^.[]*";
368
+ else if (ch === "?") out += inBracket ? "[^\\]]" : "[^.[]";
369
+ else {
370
+ if (ch === "[") inBracket = true;
371
+ else if (ch === "]") inBracket = false;
372
+ out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
373
+ }
358
374
  out += "$";
359
375
  return new RegExp(out).test(target);
360
376
  }
@@ -430,7 +446,10 @@ function validateIgnoreEntry(entry, index) {
430
446
  "stack",
431
447
  "account",
432
448
  "region"
433
- ]) if (obj[k] !== void 0 && typeof obj[k] !== "string") throw new Error(`${at}: "${k}" must be a string`);
449
+ ]) {
450
+ if (obj[k] !== void 0 && typeof obj[k] !== "string") throw new Error(`${at}: "${k}" must be a string`);
451
+ if (obj[k] === "") throw new Error(`${at}: "${k}" must not be empty (omit it to leave the axis unscoped)`);
452
+ }
434
453
  }
435
454
  /**
436
455
  * The exact ignore rule the `ignore` verb (and check's inline ignore) writes for a