@go-to-k/cdkd 0.289.6 → 0.289.8

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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as isVersionOnlyInvocation, t as getCdkdVersion } from "./version-DCxqZhgp.js";
2
+ import { n as isVersionOnlyInvocation, t as getCdkdVersion } from "./version-DWnjHtUC.js";
3
3
 
4
4
  //#region src/cli/pipe-close-handler.ts
5
5
  /**
@@ -74,7 +74,7 @@ async function main() {
74
74
  console.log(getCdkdVersion());
75
75
  return;
76
76
  }
77
- const { buildProgram } = await import("./program-B3I46yaG.js");
77
+ const { buildProgram } = await import("./program-BJxsQ7qM.js");
78
78
  const program = buildProgram();
79
79
  const args = reorderArgs(process.argv);
80
80
  await program.parseAsync(args);
@@ -1,6 +1,6 @@
1
- import { d as applyDefaultNameForFallback, f as explicitNamePropertyFor, g as looksLikeCdkdGeneratedName, h as getCurrentStackName, m as generateResourceNameWithFallback, n as getLogger, p as generateResourceName, r as isStdoutReservedForPayload, s as getLiveRenderer, v as withStackName, y as displaySafe } from "./logger-BK-B0slT.js";
1
+ import { b as displaySafe, d as applyDefaultNameForFallback, f as explicitNamePropertyFor, g as looksLikeCdkdGeneratedName, h as getCurrentStackName, m as generateResourceNameWithFallback, n as getLogger, p as generateResourceName, r as isStdoutReservedForPayload, s as getLiveRenderer, v as withStackName, y as UNRENDERABLE } from "./logger-DTEUzYP_.js";
2
2
  import { t as awsClientDefaults } from "./aws-client-defaults-D-iYiIJ6.js";
3
- import { t as getCdkdVersion } from "./version-DCxqZhgp.js";
3
+ import { t as getCdkdVersion } from "./version-DWnjHtUC.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
  import { CreateBucketCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetBucketReplicationCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchKey, PutBucketEncryptionCommand, PutBucketPolicyCommand, PutObjectCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -1082,8 +1082,8 @@ var ResourceTimeoutError = class ResourceTimeoutError extends CdkdError {
1082
1082
  operation;
1083
1083
  timeoutMs;
1084
1084
  constructor(logicalId, resourceType, region, elapsedMs, operation, timeoutMs) {
1085
- const elapsedLabel = formatDuration(elapsedMs);
1086
- const timeoutLabel = formatDuration(timeoutMs);
1085
+ const elapsedLabel = formatDuration$1(elapsedMs);
1086
+ const timeoutLabel = formatDuration$1(timeoutMs);
1087
1087
  super(`Resource ${logicalId} (${resourceType}) in ${region} timed out after ${timeoutLabel} during ${operation} (elapsed ${elapsedLabel}).\nThis may indicate a stuck Cloud Control polling loop, hung Custom Resource, or
1088
1088
  slow ENI provisioning. Re-run with --resource-timeout ${resourceType}=<DURATION>\nto bump the budget for this resource type only, or --verbose to see the
1089
1089
  underlying provider activity.`, "RESOURCE_TIMEOUT");
@@ -1102,7 +1102,7 @@ underlying provider activity.`, "RESOURCE_TIMEOUT");
1102
1102
  * (`30m`, `1h30m`, `45s`). Used by {@link ResourceTimeoutError} so the
1103
1103
  * error message stays compact.
1104
1104
  */
1105
- function formatDuration(ms) {
1105
+ function formatDuration$1(ms) {
1106
1106
  if (ms < 6e4) return `${Math.round(ms / 1e3)}s`;
1107
1107
  const totalMinutes = Math.round(ms / 6e4);
1108
1108
  if (totalMinutes < 60) return `${totalMinutes}m`;
@@ -9134,29 +9134,44 @@ var UnknownRollbackJournalVersionError = class extends Error {
9134
9134
  foundVersion;
9135
9135
  stackName;
9136
9136
  constructor(foundVersion, stackName) {
9137
- super(`Rollback journal for '${stackName}' has journalVersion ${foundVersion}, but this cdkd only understands up to ${1}. Upgrade cdkd to roll this stack back.`);
9137
+ super(`Rollback journal for '${safeJournalText(stackName)}' has journalVersion ${foundVersion}, but this cdkd only understands up to ${1}. Upgrade cdkd to roll this stack back.`);
9138
9138
  this.name = "UnknownRollbackJournalVersionError";
9139
9139
  this.foundVersion = foundVersion;
9140
9140
  this.stackName = stackName;
9141
9141
  }
9142
9142
  };
9143
9143
  /**
9144
+ * One spelling of "this value came from an S3 key or a rollback-journal record,
9145
+ * and is about to be interpolated into a message a terminal will render"
9146
+ * (issue #3064). Call it for a stack name, a parse detail, or a journal field.
9147
+ * `grep safeJournalText` answers the scope; this comment does not.
9148
+ */
9149
+ function safeJournalText(value) {
9150
+ return displaySafe(value, { asciiOnly: true }) || "<unrenderable>";
9151
+ }
9152
+ /**
9144
9153
  * Parse + validate a journal body. Throws
9145
9154
  * {@link UnknownRollbackJournalVersionError} on a newer version, and a plain
9146
9155
  * Error on a structurally-invalid body.
9147
9156
  */
9148
9157
  function parseRollbackJournal(bodyString, stackName) {
9158
+ const shownStack = safeJournalText(stackName);
9149
9159
  let parsed;
9150
9160
  try {
9151
9161
  parsed = JSON.parse(bodyString);
9152
9162
  } catch (err) {
9153
- throw new Error(`Rollback journal for '${stackName}' is not valid JSON: ${err instanceof Error ? err.message : String(err)}`);
9163
+ const detail = safeJournalText(err instanceof Error ? err.message : String(err));
9164
+ throw new Error(`Rollback journal for '${shownStack}' is not valid JSON: ${detail}`);
9154
9165
  }
9155
- if (typeof parsed !== "object" || parsed === null) throw new Error(`Rollback journal for '${stackName}' is malformed (not an object).`);
9166
+ if (typeof parsed !== "object" || parsed === null) throw new Error(`Rollback journal for '${shownStack}' is malformed (not an object).`);
9156
9167
  const j = parsed;
9157
- if (typeof j.journalVersion !== "number" || j.journalVersion < 1) throw new Error(`Rollback journal for '${stackName}' has an invalid 'journalVersion' (${String(j.journalVersion)}).`);
9168
+ if (typeof j.journalVersion !== "number" || j.journalVersion < 1) {
9169
+ const raw = j.journalVersion;
9170
+ const shown = safeJournalText(raw === null ? "null" : raw === void 0 ? "undefined" : raw);
9171
+ throw new Error(`Rollback journal for '${shownStack}' has an invalid 'journalVersion' (${shown}).`);
9172
+ }
9158
9173
  if (j.journalVersion > 1) throw new UnknownRollbackJournalVersionError(j.journalVersion, stackName);
9159
- if (!Array.isArray(j.segments)) throw new Error(`Rollback journal for '${stackName}' is missing a 'segments' array.`);
9174
+ if (!Array.isArray(j.segments)) throw new Error(`Rollback journal for '${shownStack}' is missing a 'segments' array.`);
9160
9175
  return {
9161
9176
  journalVersion: j.journalVersion,
9162
9177
  stackName: j.stackName ?? stackName,
@@ -9225,18 +9240,38 @@ const CUSTOM_RESOURCE_RESPONSE_PREFIX = "custom-resource-responses";
9225
9240
  * two of three. `subject` now varies only the noun.
9226
9241
  */
9227
9242
  /**
9228
- * Stand-in for a value with nothing renderable left after sanitization. Named
9229
- * rather than inlined so the message and the command-suppression branch cannot
9230
- * disagree about what "unrenderable" looks like.
9231
- */
9232
- const UNRENDERABLE = "<unrenderable>";
9233
- /** Render `expiresIn` without implying more precision than a clock skew allows. */
9234
- function formatRemaining(ms) {
9235
- if (!Number.isFinite(ms)) return "at an unknown time";
9236
- if (ms <= 0) return "already expired";
9237
- const minutes = Math.round(ms / 6e4);
9238
- if (minutes < 1) return "in under a minute";
9239
- return `in ~${minutes}m`;
9243
+ * The ONE rendering of a lock's deadline: `expires in 1m23s` / `expired 45s
9244
+ * ago` for a finite `expiresAt`, `expires at an unknown time` otherwise
9245
+ * (issue #3085). Consumed by this module's contention refusal, by
9246
+ * `LockManager`'s three sites (the expired-lock takeover warning, the acquire
9247
+ * retry line, the final `LockError`) and by `cdkd state show`'s lock row, so
9248
+ * a record renders the same everywhere it is shown.
9249
+ *
9250
+ * Takes the RAW `expiresAt`, never a difference: the field is an unchecked
9251
+ * cast, and `Number.isFinite` on the raw value is the test `isLockExpired`
9252
+ * makes, so what this SAYS agrees with what the expiry check DOES. Subtracting
9253
+ * first (the previous `formatRemaining(info.expiresAt - Date.now())`) coerced
9254
+ * a numeric string to a real deadline here while the check called it expired
9255
+ * — the one input that still split the renderers after issue #3083. `{}`,
9256
+ * `"soon"`, an absent field, and the `NaN` that `getLockRecord` substitutes
9257
+ * for a coercion that throws (go-to-k/cdkd#2947) all land on the unknown arm.
9258
+ *
9259
+ * Seconds precision, deliberately: this module used to round to `in ~12m`
9260
+ * "without implying more precision than a clock skew allows", but the
9261
+ * `LockError` refusal that advises the same force-unlock decision already
9262
+ * printed `expires in 4m12s`, so the coarser form was a second spelling of the
9263
+ * same fact rather than a guard against skew.
9264
+ */
9265
+ function formatLockExpiry(expiresAt) {
9266
+ if (!Number.isFinite(expiresAt)) return "expires at an unknown time";
9267
+ const remainingMs = expiresAt - Date.now();
9268
+ return remainingMs > 0 ? `expires in ${formatDuration(remainingMs)}` : `expired ${formatDuration(-remainingMs)} ago`;
9269
+ }
9270
+ /** `1m23s` / `45s` from a non-negative millisecond count. */
9271
+ function formatDuration(ms) {
9272
+ const seconds = Math.floor(ms / 1e3);
9273
+ if (seconds < 60) return `${seconds}s`;
9274
+ return `${Math.floor(seconds / 60)}m${seconds % 60}s`;
9240
9275
  }
9241
9276
  /**
9242
9277
  * Quote a value for a pasteable shell command.
@@ -9307,10 +9342,10 @@ async function buildLockContentionMessage(args) {
9307
9342
  const info = await lockManager.getLockInfo(stackName, region);
9308
9343
  if (info) {
9309
9344
  const operation = info.operation ? `, operation: ${displaySafe(info.operation)}` : "";
9310
- const expires = formatRemaining(info.expiresAt - Date.now());
9345
+ const expires = formatLockExpiry(info.expiresAt);
9311
9346
  const owner = displaySafe(info.owner);
9312
9347
  const holder = owner ? `held by ${owner}${operation}` : `held by an unnamed holder`;
9313
- held = `${heldClause ? `${heldClause} — ` : ""}${holder}, expires ${expires}`;
9348
+ held = `${heldClause ? `${heldClause} — ` : ""}${holder}, ${expires}`;
9314
9349
  if (owner) sawHolder = true;
9315
9350
  }
9316
9351
  } catch {}
@@ -10544,7 +10579,8 @@ var LockManager = class {
10544
10579
  return false;
10545
10580
  } else throw deleteError;
10546
10581
  }
10547
- this.logger.warn(`Took over an EXPIRED lock for stack: ${stackName} (${region}, owner: ${existing.info.owner}, expired ${this.formatDuration(now - existing.info.expiresAt)} ago). A live cdkd process renews its lock well inside the TTL, so this normally means the previous owner crashed or was suspended -- if it is in fact still running, both processes are now writing to the same stack.`);
10582
+ const why = Number.isFinite(existing.info.expiresAt) ? "A live cdkd process renews its lock well inside the TTL, so this normally means the previous owner crashed or was suspended" : `Its expiresAt is not a finite number, which cdkd treats as already expired`;
10583
+ this.logger.warn(`Took over an EXPIRED lock for stack: ${stackName} (${region}, owner: ${existing.info.owner}, ${formatLockExpiry(existing.info.expiresAt)}). ${why} -- if it is in fact still running, both processes are now writing to the same stack.`);
10548
10584
  try {
10549
10585
  const retryEtag = await this.putLockObject(key, lockInfo);
10550
10586
  this.logger.debug(`Lock acquired for stack: ${stackName} (${region}) after expired lock cleanup, owner: ${lockOwner}`);
@@ -11140,21 +11176,20 @@ var LockManager = class {
11140
11176
  if (await this.acquireLock(stackName, region, owner, operation)) return;
11141
11177
  const lockInfo = await this.getLockInfo(stackName, region);
11142
11178
  if (lockInfo) {
11143
- const remainingMs = lockInfo.expiresAt - Date.now();
11144
11179
  if (attempt < maxRetries) {
11145
- this.logger.info(`Stack '${safeSegment(stackName)}' (${safeSegment(region)}) is locked by ${lockInfo.owner}${lockInfo.operation ? ` (operation: ${lockInfo.operation})` : ""}. Lock expires in ${this.formatDuration(remainingMs)}. Retrying in ${this.formatDuration(retryDelay)}... (attempt ${attempt + 1}/${maxRetries})`);
11180
+ this.logger.info(`Stack '${safeSegment(stackName)}' (${safeSegment(region)}) is locked by ${lockInfo.owner}${lockInfo.operation ? ` (operation: ${lockInfo.operation})` : ""}. Lock ${formatLockExpiry(lockInfo.expiresAt)}. Retrying in ${this.formatDuration(retryDelay)}... (attempt ${attempt + 1}/${maxRetries})`);
11146
11181
  await new Promise((resolve) => setTimeout(resolve, retryDelay));
11147
11182
  continue;
11148
11183
  }
11149
11184
  }
11150
11185
  }
11151
11186
  const lockInfo = await this.getLockInfo(stackName, region);
11152
- const expiresIn = lockInfo ? this.formatDuration(lockInfo.expiresAt - Date.now()) : "unknown";
11187
+ const expiry = lockInfo ? formatLockExpiry(lockInfo.expiresAt) : void 0;
11153
11188
  const forceUnlockCommand = buildForceUnlockCommand(stackName, region);
11154
11189
  const recovery = forceUnlockCommand ? `If you are certain no other process is active, run: ${forceUnlockCommand}` : `If you are certain no other process is active, ${UNREPRODUCIBLE_LOCK_CLAUSE.charAt(0).toLowerCase()}${UNREPRODUCIBLE_LOCK_CLAUSE.slice(1)}`;
11155
11190
  const safeStack = safeSegment(stackName);
11156
11191
  const safeRegion = safeSegment(region);
11157
- throw new LockError(`Failed to acquire lock for stack '${safeStack}' (${safeRegion}) after ${maxRetries + 1} attempts. ` + (lockInfo ? `Locked by: ${lockInfo.owner}${lockInfo.operation ? `, operation: ${lockInfo.operation}` : ""}, expires in: ${expiresIn}. ` + recovery : `Lock exists but could not read lock info. ${recovery}`));
11192
+ throw new LockError(`Failed to acquire lock for stack '${safeStack}' (${safeRegion}) after ${maxRetries + 1} attempts. ` + (lockInfo ? `Locked by: ${lockInfo.owner}${lockInfo.operation ? `, operation: ${lockInfo.operation}` : ""}, ${expiry}. ` + recovery : `Lock exists but could not read lock info. ${recovery}`));
11158
11193
  }
11159
11194
  };
11160
11195
  /**
@@ -12052,7 +12087,11 @@ function recordCrossStackExpression(secrets, key, expression, plaintext) {
12052
12087
  *
12053
12088
  * The `isSingleDynamicReferenceToken` shape invariant is deliberately NOT here:
12054
12089
  * it belongs to each writer, which is where the parameters are named and where
12055
- * a swap could be introduced.
12090
+ * a swap could be introduced. One writer stores a NON-token on purpose:
12091
+ * {@link recordNestedStackParameterExpressions}'s sub-floor carry records a
12092
+ * parameter's literal FRAME (`port:{{resolve:...}}`, issue #3079), the same
12093
+ * string its whole-value entry writes, so a reader returning it persists what
12094
+ * the entry would have.
12056
12095
  */
12057
12096
  function storeAssociation(associations, key, expression, plaintext) {
12058
12097
  const seen = associations.get(key);
@@ -12147,18 +12186,28 @@ const UNFRAMED_SPELLING = Symbol("cdkd.nested-parameter.unframed-spelling");
12147
12186
  * and the same generation the bag was resolved from one statement earlier. That
12148
12187
  * is the identical pairing `redactRollbackRecord` already makes for the record
12149
12188
  * it positions, so the two replay walks now agree about what their source is.
12189
+ * Since issue #3090 the `trustAnyExpression` half of that claim no longer
12190
+ * changes what THIS recorder writes for a reference the pass resolved:
12191
+ * refusal 5 asks the pair table under both rule sets, and a resolved unpinned
12192
+ * `ssm` reference has a pair (only its pin is withheld), so either ruleset
12193
+ * positions it through the span arm's empty frame. What the constants still
12194
+ * decide here is `sourceIsSameGeneration`, which a token-shaped plaintext
12195
+ * reaches (fenced by the replay call sites' own file).
12150
12196
  *
12151
12197
  * "No public expressions" carries the carve-out {@link PathSourceRules} states
12152
12198
  * and this note must not restate without it: `cdkd import` warns and persists
12153
12199
  * the RAW template intrinsic, so a public `ssm:` token CAN sit in a record. The
12154
- * replay then CERTIFIES one the deploy default would refuse, at a cost bounded
12155
- * to the issue #1901 class — a spurious UPDATE over a value state should hold
12156
- * resolved, never a disclosure, since an expression is what gets persisted
12157
- * either way. See the replay call sites for why gating on
12158
- * {@link isKnownSecretExpression} is the wrong way to close it.
12159
- *
12160
- * FOUR REFUSALS, each degrading to today's behaviour (the child leaf falls to
12161
- * the plaintext-keyed value scan):
12200
+ * replay's POSITION pass then certifies one the deploy default would refuse;
12201
+ * since issue #3090 refusal 5 refuses to RECORD it under either ruleset (a
12202
+ * token resolved as public is never paired), so the child's leaf falls to the
12203
+ * value scan. Before that the cost was bounded to the issue #1901 class — a
12204
+ * spurious UPDATE over a value state should hold resolved, never a
12205
+ * disclosure, since an expression is what gets persisted either way. See the
12206
+ * replay call sites for why gating on {@link isKnownSecretExpression} is the
12207
+ * wrong way to close it.
12208
+ *
12209
+ * FIVE REFUSALS, each degrading to today's behaviour (the child leaf falls to
12210
+ * the plaintext-keyed value scan); the fifth is stated at its line:
12162
12211
  *
12163
12212
  * 1. REFUSAL — the resolved parameter value is not a WHOLE recorded plaintext.
12164
12213
  * A parameter the parent built with an `Fn::Sub` merely EMBEDS the secret,
@@ -12220,14 +12269,21 @@ const UNFRAMED_SPELLING = Symbol("cdkd.nested-parameter.unframed-spelling");
12220
12269
  * only refusal a test can see: the others coincide with (i) or with
12221
12270
  * the map's own entry, as a whole-token source's would).
12222
12271
  * (iii) `secrets.get(middle) === token` -- the token IS the map's survivor
12223
- * for the middle. Load-bearing: two framed parameters over ONE middle
12224
- * (`pin::` and `pin:AWSCURRENT:`) keep their own tokens on this row's
12225
- * record today because each reaches the span arm with the scan
12226
- * silent; once a `'port:q7'` entry exists the scan answers for the
12227
- * whole leaf and the arm's bound (`scanned === prefix + survivor +
12228
- * suffix`) decides. Recording only the frame whose token is the
12229
- * middle's survivor makes every parent leaf keep its own token by
12230
- * construction rather than by recording order.
12272
+ * for the middle -- OR every framed spelling of the value in the row
12273
+ * carries this token (issue #3079). Load-bearing: two framed
12274
+ * parameters over ONE middle (`pin::` and `pin:AWSCURRENT:`) keep
12275
+ * their own tokens on this row's record today because each reaches
12276
+ * the span arm with the scan silent; once a `'port:q7'` entry exists
12277
+ * the scan answers for the whole leaf and the arm's bound (`scanned
12278
+ * === prefix + survivor + suffix`) decides. With the survivor's
12279
+ * frame as the entry every same-frame leaf passes the bound and
12280
+ * writes its own token; with a loser's, a same-frame sibling around
12281
+ * another token would fail it and take the loser's frame -- so a
12282
+ * loser's frame is the entry only when no such sibling exists, and
12283
+ * then its own leaf reads the entry from the value scan after the
12284
+ * bound refuses, which is its frame. Either way every parent leaf
12285
+ * keeps its own token by construction rather than by recording
12286
+ * order.
12231
12287
  * (iv) ONE FRAME per VALUE, across the whole row. Once the entry exists
12232
12288
  * the scan is no longer silent on the value, so on the parent's
12233
12289
  * record every leaf holding it answers against the entry through the
@@ -12280,19 +12336,43 @@ const UNFRAMED_SPELLING = Symbol("cdkd.nested-parameter.unframed-spelling");
12280
12336
  * refuses a middle that is itself a token, which is what a bag equal to its
12281
12337
  * source has.
12282
12338
  *
12339
+ * THE PER-NAME ASSOCIATION (issue #3079). The entry is keyed by VALUE, so over
12340
+ * one middle with TWO tokens in one frame it names one of them, and every
12341
+ * child leaf holding the value would take that one -- the loser's `{Ref}`
12342
+ * persisting the survivor's frame, which is the wrong reference the three
12343
+ * consumers below re-resolve after the sibling rotates. So beside the entry,
12344
+ * every leaf passing (i), (ii), the pair gate between (ii) and (iv), (iv)
12345
+ * and (v) -- the survivor's and the loser's alike, and whether or not (iii)
12346
+ * let its entry through -- is recorded BY NAME into {@link nestedStackParameterExpressions}, the table
12347
+ * the whole-token walk above fills, as `name -> (its own frame, the value)`.
12348
+ * The child inherits it ({@link inheritNestedStackParameterAssociations})
12349
+ * and reads it through {@link certifiedExpressionForLeaf} at all three
12350
+ * sites: the carry (`recordInheritedParameterSecrets` asks per plaintext),
12351
+ * the persist walk (`positionByCrossStackSource` on the `{Ref}` source) and
12352
+ * the diff side (`redactParametersForDiff`). Each requires the bag to HOLD
12353
+ * the value, which the entry provides -- or the child's OWN resolution of
12354
+ * the same plaintext, in which case the association answers with the leaf's
12355
+ * own frame, the right reference for it. So a FRAMED association whose value
12356
+ * (iii) refused is inert or correct, never wrong -- a claim the whole-token
12357
+ * walk's STRING-source half now earns the same way, through refusal 5 (issue
12358
+ * #3090); its intrinsic-source half rests on the reader's condition 3, less
12359
+ * the skeleton arm's own unpinned-`ssm` residual (stated on that arm).
12360
+ * The association's expression is
12361
+ * the FRAME, not a token -- the one writer into that table that stores a
12362
+ * non-token, said so on {@link storeAssociation}; its readers return it to be
12363
+ * persisted, which is exactly what the entry would have written.
12364
+ *
12283
12365
  * WHAT STAYS OPEN, weighed against the three live consumers named on
12284
12366
  * {@link positionByIntrinsicFrame} (`cdkd rollback`, `drift --revert`, a
12285
- * consumer's cross-stack read). (a) Over one middle with TWO tokens, (iii)
12286
- * records the survivor's frames only, never a loser's, so the loser's child
12287
- * leaf takes the survivor's frame when the two frames MATCH (`port:` + either
12288
- * token: the survivor's entry is the loser's whole value too) and stays
12289
- * PLAINTEXT when they differ (`port:` + A beside `url:` + B: no entry names
12290
- * `port:q7`). Either is the pre-#2291 answer for this shape; on a match it is
12291
- * the wrong reference those consumers re-resolve -- after the sibling
12292
- * rotates, a rollback or `--revert` of the child hands the sibling's
12293
- * plaintext to the loser's live property. The PARENT's record stays per leaf
12294
- * by (iii) and (iv). One token framed two ways (`port:` + T and `url:` + T)
12295
- * is two values and two entries, not this shape. (b) The framed
12367
+ * consumer's cross-stack read). (a) CLOSED by the association above (was:
12368
+ * the loser's child leaf took the survivor's frame, or stayed plaintext
12369
+ * under a different frame -- the second half closed by (iii)'s second arm).
12370
+ * What remains of it: one child RESOURCE consuming BOTH parameters holds
12371
+ * ONE plaintext-keyed slot for the value, and a leaf of it the association
12372
+ * cannot reach by name -- an `Fn::Sub` EMBEDDING the `{Ref}`, positioned by
12373
+ * the value scan -- reads that slot's frame, whichever `{Ref}` resolved
12374
+ * last; a bare `{Ref}` leaf of the same resource is positioned by name and
12375
+ * is unaffected (pinned). (b) The framed
12296
12376
  * value is a SUBSTRING needle (7 characters here) in every child resource
12297
12377
  * that consumed the parameter, so an unrelated literal there containing it
12298
12378
  * is spliced -- the #2087 class, bounded to resources whose own resolution
@@ -12336,6 +12416,7 @@ function recordNestedStackParameterExpressions(secrets, resourceType, resolvedPr
12336
12416
  if (expression === resolvedValue) continue;
12337
12417
  const seenResolvingTo = plaintextIndexOf(secrets).get(expression);
12338
12418
  if (seenResolvingTo !== void 0 && seenResolvingTo !== resolvedValue) continue;
12419
+ if (typeof sourceLeaf === "string" && resolvedPlaintextOf(secrets, expression) !== resolvedValue) continue;
12339
12420
  if (table === void 0) {
12340
12421
  table = /* @__PURE__ */ new Map();
12341
12422
  nestedStackParameterExpressions.set(secrets, table);
@@ -12343,25 +12424,33 @@ function recordNestedStackParameterExpressions(secrets, resourceType, resolvedPr
12343
12424
  storeAssociation(table, name, expression, resolvedValue);
12344
12425
  }
12345
12426
  const framesByValue = /* @__PURE__ */ new Map();
12427
+ const tokensOf = /* @__PURE__ */ new Map();
12346
12428
  for (const [name, resolvedValue] of Object.entries(resolvedParameters)) {
12347
12429
  if (typeof resolvedValue !== "string") continue;
12348
12430
  const sourceLeaf = sourceParameters[name];
12349
12431
  const frame = typeof sourceLeaf === "string" ? singleSpanFrame(resolvedValue, sourceLeaf) : void 0;
12350
12432
  const frames = framesByValue.get(resolvedValue) ?? /* @__PURE__ */ new Set();
12351
- frames.add(frame === void 0 || resolvedPlaintextOf(secrets, frame.token) !== frame.middle ? UNFRAMED_SPELLING : `${frame.prefix.length}:${frame.prefix}${frame.suffix}`);
12433
+ const unframed = frame === void 0 || resolvedPlaintextOf(secrets, frame.token) !== frame.middle;
12434
+ frames.add(unframed ? UNFRAMED_SPELLING : `${frame.prefix.length}:${frame.prefix}${frame.suffix}`);
12352
12435
  framesByValue.set(resolvedValue, frames);
12436
+ if (!unframed) {
12437
+ const tokens = tokensOf.get(resolvedValue) ?? /* @__PURE__ */ new Set();
12438
+ tokens.add(frame.token);
12439
+ tokensOf.set(resolvedValue, tokens);
12440
+ }
12353
12441
  }
12354
12442
  const rowWithoutParameters = {};
12355
12443
  for (const [key, value] of Object.entries(resolvedProperties)) if (key !== "Parameters") rowWithoutParameters[key] = value;
12356
12444
  const outsideLeaves = wholeStringLeavesOf(rowWithoutParameters);
12357
12445
  const framed = /* @__PURE__ */ new Map();
12446
+ const framedByName = [];
12358
12447
  for (const [name, resolvedValue] of Object.entries(resolvedParameters)) {
12359
12448
  const sourceLeaf = sourceParameters[name];
12360
12449
  if (typeof resolvedValue !== "string" || typeof sourceLeaf !== "string") continue;
12361
12450
  if (positioned[name] !== sourceLeaf) continue;
12362
12451
  if (redactSecretsForState(resolvedValue, secrets) !== resolvedValue) continue;
12363
12452
  const frame = singleSpanFrame(resolvedValue, sourceLeaf);
12364
- if (frame === void 0 || secrets.get(frame.middle) !== frame.token) continue;
12453
+ if (frame === void 0 || resolvedPlaintextOf(secrets, frame.token) !== frame.middle) continue;
12365
12454
  if (framesByValue.get(resolvedValue)?.size !== 1) continue;
12366
12455
  const isNeedle = resolvedValue.length >= 4;
12367
12456
  const rewrites = (leaf) => leaf === resolvedValue || isNeedle && leaf.includes(resolvedValue);
@@ -12382,9 +12471,22 @@ function recordNestedStackParameterExpressions(secrets, resourceType, resolvedPr
12382
12471
  }
12383
12472
  }
12384
12473
  if (embedded) continue;
12474
+ framedByName.push([
12475
+ name,
12476
+ sourceLeaf,
12477
+ resolvedValue
12478
+ ]);
12479
+ if (secrets.get(frame.middle) !== frame.token && tokensOf.get(resolvedValue)?.size !== 1) continue;
12385
12480
  framed.set(resolvedValue, sourceLeaf);
12386
12481
  }
12387
12482
  for (const [plaintext, expression] of framed) secrets.set(plaintext, expression);
12483
+ for (const [name, expression, plaintext] of framedByName) {
12484
+ if (table === void 0) {
12485
+ table = /* @__PURE__ */ new Map();
12486
+ nestedStackParameterExpressions.set(secrets, table);
12487
+ }
12488
+ storeAssociation(table, name, expression, plaintext);
12489
+ }
12388
12490
  }
12389
12491
  /**
12390
12492
  * Copy a parent pass's per-PARAMETER associations onto a nested-stack CHILD
@@ -28325,7 +28427,7 @@ var CloudControlProvider = class {
28325
28427
  const indeterminateGuard = await this.confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context);
28326
28428
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
28327
28429
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
28328
- const { ASGProvider } = await import("./asg-provider-eIVYMrmW.js").then((n) => n.n);
28430
+ const { ASGProvider } = await import("./asg-provider-D2lf-Qdo.js").then((n) => n.n);
28329
28431
  const asgProvider = new ASGProvider();
28330
28432
  return withIndeterminateGuard(await asgProvider.delete(logicalId, physicalId, resourceType, _properties, context), indeterminateGuard);
28331
28433
  }
@@ -40771,5 +40873,5 @@ var DeployEngine = class DeployEngine {
40771
40873
  };
40772
40874
 
40773
40875
  //#endregion
40774
- export { collectInlinePolicyNamesManagedBySiblings as $, buildDenyExternalAccessPolicy as $n, DynamicReferenceRegionAmbiguousError as $r, describeTypeWithThrottleRetry as $t, isStatefulRecreateTargetForReplace as A, exportNamesCarriedFrom as An, CFN_TEMPLATE_URL_LIMIT as Ar, coerceCfnBoolean as At, gray as B, createAssetRedirectResolver as Bn, processStackMessages as Br, classifyReplaySecretRegion as Bt, refusesFinalSnapshot as C, retryClassificationText as Ci, UNRENDERABLE as Cn, resolveSkipPrefix as Cr, isUnboundTemplateParameter as Ct, makeSiblingClaimReader as D, shellQuote as Dn, stateBucketExistenceConfirmed as Dr, normalizeAwsTagsToCfn as Dt, extractDeploymentEventError as E, forceQuitRecoveryClause as En, resolveUseCdkBootstrapAssets as Er, WAFv2WebACLProvider as Et, isWarmThroughputDecrease as F, shouldRetainResource as Fn, expectedOwnerParam as Fr, readConfigString as Ft, collectPublishedOutputNames as G, assertAssetBucketRegion as Gn, resetAwsClients as Gr, s3BucketDualStackDomainName as Gt, red as H, rewriteTemplateAssetReferences as Hn, resolveBucketRegion as Hr, withSharedDrainBudget as Ht, toFiniteNumber as I, AssetPublisher as In, PARTITION_TABLE as Ir, replayWarn as It, secretBearing as J, isCrossRegionRedirect as Jn, CdkdError as Jr, applyRoleArnIfSet as Jt, exportAliasCollisionScrubWarning as K, ensureAssetStorage as Kn, setAwsClients as Kr, s3BucketRegionalDomainName as Kt, formatResourceLine as L, stringifyValue as Ln, canonicalizeRegion as Lr, requireConfigArray as Lt, renderStatefulReason as M, importableOutputs as Mn, findLargeInlineResources as Mr, configBooleanRefusal as Mt, WARM_THROUGHPUT_MEMBERS as N, orphansAfterRollback as Nn, uploadCfnTemplate as Nr, configIntegerRefusal as Nt, planOrphanAdoption as O, CUSTOM_RESOURCE_RESPONSE_PREFIX as On, warnDeprecatedNoPrefixCliFlag as Or, resolveExplicitPhysicalId as Ot, coerceWarmThroughput as P, orphansCarriedFrom as Pn, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Pr, configStringRefusal as Pt, IAMRoleProvider as Q, validateContainerRepoName as Qn, DeployCancelledError as Qr, findSilentDropProperties as Qt, bold as R, WorkGraph as Rn, derivePartitionAndUrlSuffix as Rr, requireConfigObject as Rt, isFinalSnapshotError as S, markRedactedCause as Si, rebuildClientForBucketRegion as Sn, resolveCaptureObservedState as Sr, getAccountInfo as St, makeCanonicalizePropertiesFn as T, buildLockContentionMessage as Tn, resolveStateBucketWithDefaultAndSource as Tr, refStateLookupFromResource as Tt, yellow as U, AssetModeResolver as Un, AwsClients as Ur, s3BucketArn as Ut, green as V, loadPublishableAssetManifest as Vn, clearBucketRegionCache as Vr, producerRegionsFromState as Vt, collectDeclaredOutputNames as W, BOOTSTRAP_MARKER_PREFIX as Wn, getAwsClients as Wr, s3BucketDomainName as Wt, secretSafeKeyDisplay as X, readBootstrapMarkerBody as Xn, CrossAccountSecretRefusalError as Xr, INTRINSIC_KEYS as Xt, secretBearingStateKeyWarning as Y, parseBootstrapMarker as Yn, ConfigError as Yr, DiffCalculator as Yt, getCurrentResourceSecrets as Z, validateAssetBucketName as Zn, DependencyError as Zr, findActionableSilentDrops as Zt, ATOMIC_FINAL_SNAPSHOT_TYPES as _, isMarkedNonRetryable as _i, recoverMaskedOutput as _n, synthesisStatusMessage as _r, isTerminationProtectionPropagationError as _t, DeploymentEventsStore as a, PartialFailureError as ai, STATE_SOURCED_READBACK_RULES as an, dockerSpawnEnvWithSensitive as ar, maskerOrIdentity as at, ccRoutedFinalSnapshotError as b, isTransientServerError as bi, LockManager as bn, resolveApp as br, cfnRefValueFromPhysicalId as bt, replayFailedOperations as c, ResourceUpdateNotSupportedError as ci, createSecretMasker as cn, partitionSensitiveEnv as cr, interruptWatchListenerCount as ct, updatePartialReason as d, StateError as di, identityKeyFor as dn, runDockerStreaming as dr, CloudControlProvider as dt, IntrinsicResolutionRefusalError as ei, withRetry as en, describeAwsFailure as er, clearOnUpdateRemoval as et, withResourceDeadline as f, SynthesisError as fi, isSingleDynamicReferenceToken as fn, escapeRegExp$1 as fr, slowCcOperationTimeoutMs as ft, bindingSkippedOutputs as g, withErrorHandling as gi, recordMaskOnlyValue as gn, Synthesizer as gr, disableInstanceApiTermination as gt, computeImplicitDeleteEdges as h, normalizeAwsError as hi, maskSecretsInText as hn, getDockerImageBySourceHash as hr, deleteSkipReason as ht, DeploymentEventsReader as i, NestedStackChildDirectDestroyError as ii, STATE_SOURCED_CROSS_GENERATION_RULES as in, describeDockerFailure as ir, maskDeep as it, isStatefulRecreateTargetSync as j, importableOutputKeys as jn, MIGRATE_TMP_PREFIX as jr, coerceCfnInteger as jt, MULTI_REGION_RECREATE_BLOCKED_TYPES as k, DEFAULT_STATE_PREFIX as kn, CFN_TEMPLATE_BODY_LIMIT as kr, assertRegionMatch as kt, replayRollback as l, StackHasActiveImportsError as li, dynamicReferenceTokens as ln, redactDockerArgvValues as lr, isInterruptedWaitError as lt, IMPLICIT_DELETE_DEPENDENCIES as m, isCdkdError as mi, maskSecretsInError as mn, AssetManifestLoader as mr, deleteIndeterminateGuards as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, LocalStartServiceError as ni, TemplateParser as nn, describeDockerCapturedOutput as nr, wouldReturnToSdkProvider as nt, planFailedOps as o, ProvisioningError as oi, TEMPLATE_SOURCED_RULES as on, formatDockerLoginError as or, beginCommandInterruptScope as ot, maskingRetryLogger as p, formatError as pi, markSameGenerationBag as pn, stripControlChars as pr, UNSPECIFIED_SKIP_REASON as pt, isExportAliasCollision as q, getBootstrapMarkerKey as qn, AssetError as qr, s3BucketWebsiteUrl as qt, DeployEngine as r, LockError as ri, STATE_SOURCED_BASELINE_RULES as rn, describeDockerExecFailure as rr, createMaskedRetryLogger as rt, planRollback as s, ResourceTimeoutError as si, carriesSecretMask as sn, getDockerCmd as sr, endCommandInterruptScope as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, LocalInvokeBuildError as ti, DagBuilder as tn, buildDockerImage as tr, ProviderRegistry as tt, updatePartialMessage as u, StackTerminationProtectionError as ui, errorCauseChain as un, runDockerForeground as ur, startInterruptWatch as ut, PRE_DELETE_SNAPSHOT_TYPES as v, isRetryableTransientError as vi, redactSecretsForState as vn, getDefaultStateBucketName as vr, IntrinsicFunctionResolver as vt, unsupportedFinalSnapshotError as w, __exportAll as wi, buildForceUnlockCommand as wn, resolveStateBucketWithDefault as wr, parameterTypeMayLoseSecretIdentity as wt, createPreDeleteFinalSnapshot as x, markNonRetryable as xi, S3StateBackend as xn, resolveAutoAssetStorage as xr, coerceParameterTypedValue as xt, buildFinalSnapshotIdentifier as y, isThrottlingError as yi, scrubResourceRecord as yn, getLegacyStateBucketName as yr, carriesDynamicReference as yt, cyan as z, buildAssetRedirectMap as zn, AssemblyReader as zr, requireConfigString as zt };
40775
- //# sourceMappingURL=deploy-engine-CpmvgRtm.js.map
40876
+ export { collectInlinePolicyNamesManagedBySiblings as $, buildDenyExternalAccessPolicy as $n, DynamicReferenceRegionAmbiguousError as $r, describeTypeWithThrottleRetry as $t, isStatefulRecreateTargetForReplace as A, exportNamesCarriedFrom as An, CFN_TEMPLATE_URL_LIMIT as Ar, coerceCfnBoolean as At, gray as B, createAssetRedirectResolver as Bn, processStackMessages as Br, classifyReplaySecretRegion as Bt, refusesFinalSnapshot as C, retryClassificationText as Ci, buildForceUnlockCommand as Cn, resolveSkipPrefix as Cr, isUnboundTemplateParameter as Ct, makeSiblingClaimReader as D, shellQuote as Dn, stateBucketExistenceConfirmed as Dr, normalizeAwsTagsToCfn as Dt, extractDeploymentEventError as E, formatLockExpiry as En, resolveUseCdkBootstrapAssets as Er, WAFv2WebACLProvider as Et, isWarmThroughputDecrease as F, shouldRetainResource as Fn, expectedOwnerParam as Fr, readConfigString as Ft, collectPublishedOutputNames as G, assertAssetBucketRegion as Gn, resetAwsClients as Gr, s3BucketDualStackDomainName as Gt, red as H, rewriteTemplateAssetReferences as Hn, resolveBucketRegion as Hr, withSharedDrainBudget as Ht, toFiniteNumber as I, AssetPublisher as In, PARTITION_TABLE as Ir, replayWarn as It, secretBearing as J, isCrossRegionRedirect as Jn, CdkdError as Jr, applyRoleArnIfSet as Jt, exportAliasCollisionScrubWarning as K, ensureAssetStorage as Kn, setAwsClients as Kr, s3BucketRegionalDomainName as Kt, formatResourceLine as L, stringifyValue as Ln, canonicalizeRegion as Lr, requireConfigArray as Lt, renderStatefulReason as M, importableOutputs as Mn, findLargeInlineResources as Mr, configBooleanRefusal as Mt, WARM_THROUGHPUT_MEMBERS as N, orphansAfterRollback as Nn, uploadCfnTemplate as Nr, configIntegerRefusal as Nt, planOrphanAdoption as O, CUSTOM_RESOURCE_RESPONSE_PREFIX as On, warnDeprecatedNoPrefixCliFlag as Or, resolveExplicitPhysicalId as Ot, coerceWarmThroughput as P, orphansCarriedFrom as Pn, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Pr, configStringRefusal as Pt, IAMRoleProvider as Q, validateContainerRepoName as Qn, DeployCancelledError as Qr, findSilentDropProperties as Qt, bold as R, WorkGraph as Rn, derivePartitionAndUrlSuffix as Rr, requireConfigObject as Rt, isFinalSnapshotError as S, markRedactedCause as Si, rebuildClientForBucketRegion as Sn, resolveCaptureObservedState as Sr, getAccountInfo as St, makeCanonicalizePropertiesFn as T, forceQuitRecoveryClause as Tn, resolveStateBucketWithDefaultAndSource as Tr, refStateLookupFromResource as Tt, yellow as U, AssetModeResolver as Un, AwsClients as Ur, s3BucketArn as Ut, green as V, loadPublishableAssetManifest as Vn, clearBucketRegionCache as Vr, producerRegionsFromState as Vt, collectDeclaredOutputNames as W, BOOTSTRAP_MARKER_PREFIX as Wn, getAwsClients as Wr, s3BucketDomainName as Wt, secretSafeKeyDisplay as X, readBootstrapMarkerBody as Xn, CrossAccountSecretRefusalError as Xr, INTRINSIC_KEYS as Xt, secretBearingStateKeyWarning as Y, parseBootstrapMarker as Yn, ConfigError as Yr, DiffCalculator as Yt, getCurrentResourceSecrets as Z, validateAssetBucketName as Zn, DependencyError as Zr, findActionableSilentDrops as Zt, ATOMIC_FINAL_SNAPSHOT_TYPES as _, isMarkedNonRetryable as _i, recoverMaskedOutput as _n, synthesisStatusMessage as _r, isTerminationProtectionPropagationError as _t, DeploymentEventsStore as a, PartialFailureError as ai, STATE_SOURCED_READBACK_RULES as an, dockerSpawnEnvWithSensitive as ar, maskerOrIdentity as at, ccRoutedFinalSnapshotError as b, isTransientServerError as bi, LockManager as bn, resolveApp as br, cfnRefValueFromPhysicalId as bt, replayFailedOperations as c, ResourceUpdateNotSupportedError as ci, createSecretMasker as cn, partitionSensitiveEnv as cr, interruptWatchListenerCount as ct, updatePartialReason as d, StateError as di, identityKeyFor as dn, runDockerStreaming as dr, CloudControlProvider as dt, IntrinsicResolutionRefusalError as ei, withRetry as en, describeAwsFailure as er, clearOnUpdateRemoval as et, withResourceDeadline as f, SynthesisError as fi, isSingleDynamicReferenceToken as fn, escapeRegExp$1 as fr, slowCcOperationTimeoutMs as ft, bindingSkippedOutputs as g, withErrorHandling as gi, recordMaskOnlyValue as gn, Synthesizer as gr, disableInstanceApiTermination as gt, computeImplicitDeleteEdges as h, normalizeAwsError as hi, maskSecretsInText as hn, getDockerImageBySourceHash as hr, deleteSkipReason as ht, DeploymentEventsReader as i, NestedStackChildDirectDestroyError as ii, STATE_SOURCED_CROSS_GENERATION_RULES as in, describeDockerFailure as ir, maskDeep as it, isStatefulRecreateTargetSync as j, importableOutputKeys as jn, MIGRATE_TMP_PREFIX as jr, coerceCfnInteger as jt, MULTI_REGION_RECREATE_BLOCKED_TYPES as k, DEFAULT_STATE_PREFIX as kn, CFN_TEMPLATE_BODY_LIMIT as kr, assertRegionMatch as kt, replayRollback as l, StackHasActiveImportsError as li, dynamicReferenceTokens as ln, redactDockerArgvValues as lr, isInterruptedWaitError as lt, IMPLICIT_DELETE_DEPENDENCIES as m, isCdkdError as mi, maskSecretsInError as mn, AssetManifestLoader as mr, deleteIndeterminateGuards as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, LocalStartServiceError as ni, TemplateParser as nn, describeDockerCapturedOutput as nr, wouldReturnToSdkProvider as nt, planFailedOps as o, ProvisioningError as oi, TEMPLATE_SOURCED_RULES as on, formatDockerLoginError as or, beginCommandInterruptScope as ot, maskingRetryLogger as p, formatError as pi, markSameGenerationBag as pn, stripControlChars as pr, UNSPECIFIED_SKIP_REASON as pt, isExportAliasCollision as q, getBootstrapMarkerKey as qn, AssetError as qr, s3BucketWebsiteUrl as qt, DeployEngine as r, LockError as ri, STATE_SOURCED_BASELINE_RULES as rn, describeDockerExecFailure as rr, createMaskedRetryLogger as rt, planRollback as s, ResourceTimeoutError as si, carriesSecretMask as sn, getDockerCmd as sr, endCommandInterruptScope as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, LocalInvokeBuildError as ti, DagBuilder as tn, buildDockerImage as tr, ProviderRegistry as tt, updatePartialMessage as u, StackTerminationProtectionError as ui, errorCauseChain as un, runDockerForeground as ur, startInterruptWatch as ut, PRE_DELETE_SNAPSHOT_TYPES as v, isRetryableTransientError as vi, redactSecretsForState as vn, getDefaultStateBucketName as vr, IntrinsicFunctionResolver as vt, unsupportedFinalSnapshotError as w, __exportAll as wi, buildLockContentionMessage as wn, resolveStateBucketWithDefault as wr, parameterTypeMayLoseSecretIdentity as wt, createPreDeleteFinalSnapshot as x, markNonRetryable as xi, S3StateBackend as xn, resolveAutoAssetStorage as xr, coerceParameterTypedValue as xt, buildFinalSnapshotIdentifier as y, isThrottlingError as yi, scrubResourceRecord as yn, getLegacyStateBucketName as yr, carriesDynamicReference as yt, cyan as z, buildAssetRedirectMap as zn, AssemblyReader as zr, requireConfigString as zt };
40877
+ //# sourceMappingURL=deploy-engine-zEwQVCh8.js.map