@go-to-k/cdkd 0.280.44 → 0.280.46

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.
@@ -12915,7 +12915,7 @@ var CloudControlProvider = class {
12915
12915
  if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
12916
12916
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
12917
12917
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
12918
- const { ASGProvider } = await import("./asg-provider-BBKdxCVP.js").then((n) => n.n);
12918
+ const { ASGProvider } = await import("./asg-provider-DGHuyUA8.js").then((n) => n.n);
12919
12919
  await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
12920
12920
  return;
12921
12921
  }
@@ -13653,14 +13653,41 @@ const CR_TRANSIENT_AUTHZ_LOG_SIGNALS = [
13653
13653
  ];
13654
13654
  /**
13655
13655
  * Cap for the backing function's log tail when it is surfaced in an EPHEMERAL
13656
- * warning (the `FunctionError` arm). Deliberately far larger than
13657
- * `truncateReason`'s 200-char default — a crashed handler's real cause is often
13658
- * several lines above the last one (a Python traceback) — but not unbounded:
13659
- * this lands in CI logs and terminal scrollback. Lambda caps the tail at 4 KB
13660
- * regardless, so this only trims the extreme case.
13656
+ * warning the `FunctionError` arm and the unexplained-FAILED arm. Deliberately
13657
+ * far larger than `truncateReason`'s 200-char default — a crashed handler's real
13658
+ * cause is often several lines above the last one (a Python traceback) — but not
13659
+ * unbounded: this lands in CI logs and terminal scrollback. Lambda caps the tail
13660
+ * at 4 KB regardless, so this only trims the extreme case.
13661
13661
  */
13662
13662
  const CR_LOG_TAIL_WARN_MAX_CHARS = 2e3;
13663
13663
  /**
13664
+ * Lines Lambda emits for EVERY invocation regardless of what the handler logged.
13665
+ * A tail consisting only of these carries no diagnostic value, and it is the
13666
+ * COMMON case — `LogResult` is never absent on a `LogType: 'Tail'` invoke, so a
13667
+ * bare `!== undefined` check filters nothing and would dump boilerplate on every
13668
+ * unexplained failure.
13669
+ *
13670
+ * The COLD-START platform lines (`INIT_START` / `INIT_REPORT`, the SnapStart
13671
+ * `RESTORE_*` pair, `EXTENSION`) matter as much as the per-invoke ones here, and
13672
+ * arguably more: the IAM-propagation race this whole mechanism exists for IS a
13673
+ * cold-start phenomenon, so those lines are present precisely when this arm
13674
+ * fires. Omitting them would have left the filter inert in its own main case.
13675
+ *
13676
+ * The trailing space is load-bearing: a handler's `print("REPORT: no bucket")`
13677
+ * emits `REPORT:` and must NOT be classified as boilerplate.
13678
+ */
13679
+ const CR_LOG_TAIL_BOILERPLATE = /^(START|END|REPORT|XRAY|INIT_START|INIT_REPORT|RESTORE_START|RESTORE_REPORT|EXTENSION) /;
13680
+ /**
13681
+ * `true` when the tail contains at least one line the HANDLER produced.
13682
+ *
13683
+ * Deliberately a positive test for handler output rather than a length check:
13684
+ * the boilerplate lines carry a RequestId and a duration, so a tail of nothing
13685
+ * but boilerplate is several hundred characters and passes any size threshold.
13686
+ */
13687
+ function hasHandlerLogOutput(logTail) {
13688
+ return logTail.split("\n").some((line) => line.trim().length > 0 && !CR_LOG_TAIL_BOILERPLATE.test(line.trimStart()));
13689
+ }
13690
+ /**
13664
13691
  * Custom Resource Provider
13665
13692
  *
13666
13693
  * Implements Lambda-backed custom resources by invoking the Lambda function
@@ -14027,7 +14054,8 @@ var CustomResourceProvider = class CustomResourceProvider {
14027
14054
  this.logger.debug(`Sending custom resource ${operation.toLowerCase()} request: ${serviceToken}`);
14028
14055
  const { response: cfnResponse, logResult } = await this.sendRequest(serviceToken, request, invocation.responseKey, logicalId, operation);
14029
14056
  const reasonIsAuthz = cfnResponse.Status === "FAILED" && this.isTransientAuthzFailure(cfnResponse.Reason);
14030
- const logAuthzMatch = cfnResponse.Status === "FAILED" && !reasonIsAuthz ? this.findTransientAuthzLogLine(decodeInvokeLogTail(logResult)) : void 0;
14057
+ const logTail = cfnResponse.Status === "FAILED" && !reasonIsAuthz ? decodeInvokeLogTail(logResult) : void 0;
14058
+ const logAuthzMatch = logTail === void 0 ? void 0 : this.findTransientAuthzLogLine(logTail);
14031
14059
  if (cfnResponse.Status === "FAILED" && attempt < this.transientAuthzMaxRetries && (reasonIsAuthz || logAuthzMatch !== void 0)) {
14032
14060
  this.logger.warn(`Custom resource ${operation} for ${logicalId} returned a transient IAM-authorization FAILED (attempt ${attempt + 1}/${this.transientAuthzMaxRetries + 1}): ${this.truncateReason(cfnResponse.Reason)}. ` + (logAuthzMatch === void 0 ? "" : `The handler's reason carried no authorization wording; the denial was found in the backing function's log: ${this.truncateReason(logAuthzMatch.line)}. `) + `Recycling the backing function's execution environment and retrying so its next cold start picks up the propagated policy.`);
14033
14061
  await this.recycleBackingFunctionExecEnv(serviceToken, logicalId);
@@ -14037,6 +14065,7 @@ var CustomResourceProvider = class CustomResourceProvider {
14037
14065
  ...cfnResponse,
14038
14066
  Reason: `${cfnResponse.Reason ?? "Unknown reason"} [cdkd: the reason carried no authorization wording, but the backing function's invocation log matched the IAM-authorization signal "${logAuthzMatch.signal}" — see the cdkd warning for the log line, or the function's CloudWatch log group]`
14039
14067
  };
14068
+ if (logTail !== void 0 && hasHandlerLogOutput(logTail)) this.logger.warn(`Custom resource ${operation} for ${logicalId} failed and cdkd could not classify the reason. Log tail from the DISPATCH invocation (for the CDK Provider framework's async pattern the failure may have occurred in a later execution, whose log this is not):\n` + this.truncateReason(logTail, CR_LOG_TAIL_WARN_MAX_CHARS));
14040
14069
  return cfnResponse;
14041
14070
  }
14042
14071
  }
@@ -14245,7 +14274,7 @@ var CustomResourceProvider = class CustomResourceProvider {
14245
14274
  if (lambdaResponse.FunctionError) {
14246
14275
  const errorPayload = lambdaResponse.Payload ? Buffer.from(lambdaResponse.Payload).toString() : "Unknown";
14247
14276
  const logTail = decodeInvokeLogTail(lambdaResponse.LogResult);
14248
- if (logTail !== void 0) this.logger.warn(`Backing function log tail for ${logicalId} (${operation}):\n` + this.truncateReason(logTail, CR_LOG_TAIL_WARN_MAX_CHARS));
14277
+ if (logTail !== void 0 && hasHandlerLogOutput(logTail)) this.logger.warn(`Backing function log tail for ${logicalId} (${operation}):\n` + this.truncateReason(logTail, CR_LOG_TAIL_WARN_MAX_CHARS));
14249
14278
  throw new Error(`Lambda function error (${lambdaResponse.FunctionError}): ${errorPayload}`);
14250
14279
  }
14251
14280
  let hasDirectPayload = false;
@@ -19236,6 +19265,35 @@ function recordAfterRollbackUpdate(restored, result) {
19236
19265
  properties: { ...result.effectiveProperties }
19237
19266
  } : restored;
19238
19267
  }
19268
+ /**
19269
+ * The `properties` override to merge into the state record rebuilt after the
19270
+ * reverse-replacement replay-CREATE (issue #1682) — the create-side twin of
19271
+ * {@link recordAfterRollbackUpdate}.
19272
+ *
19273
+ * The bag handed to `create()` on both arms of that path IS `prev.properties`,
19274
+ * so — exactly as on the UPDATE side — a returned `effectiveProperties` is its
19275
+ * complete replacement and no per-key delta is needed. Without this the arm
19276
+ * rebuilt the record from `prev.properties` unconditionally, so a provider that
19277
+ * deliberately SUBSTITUTED a malformed block on a replay (the `replayWarn`
19278
+ * downgrade of issue #1544) announced the substitution into a void and the
19279
+ * phantom drift it exists to close survived the rollback.
19280
+ *
19281
+ * Falls back to the restored record's own `properties` when the provider
19282
+ * reported nothing — the pre-#1682 behavior — rather than blanking the record.
19283
+ * An empty object is a legitimate COMPLETE answer (a provider that sent
19284
+ * nothing), so the gate is an explicit PRESENCE test rather than truthiness —
19285
+ * matching the `??` the contract in `.claude/rules/providers.md` prescribes,
19286
+ * and saying so at the one place a future reader would otherwise have to
19287
+ * re-derive that `{}` must not fall back.
19288
+ *
19289
+ * Applied on the name-idempotent ADOPT path too (`adoptedLiveNewResource`).
19290
+ * That arm's warning says state records "the pre-replacement properties", and
19291
+ * it still does: a substitution repairs an unusable field of that same
19292
+ * pre-replacement bag, it does not swap in the new generation's values.
19293
+ */
19294
+ function recordedPropertiesAfterReplayCreate(restored, result) {
19295
+ return result.effectiveProperties === void 0 ? restored.properties : { ...result.effectiveProperties };
19296
+ }
19239
19297
  async function replaySingle(op, stateResources, stackName, ctx, orphanLogicalIds, result, afterOp, isInterrupted) {
19240
19298
  const action = classifyRollbackOp(op, stateResources, orphanLogicalIds);
19241
19299
  const { logger } = ctx;
@@ -19421,7 +19479,8 @@ async function replaySingle(op, stateResources, stackName, ctx, orphanLogicalIds
19421
19479
  stateResources[op.logicalId] = {
19422
19480
  ...prevRecord,
19423
19481
  physicalId: createResult.physicalId,
19424
- attributes: createResult.attributes ?? {}
19482
+ attributes: createResult.attributes ?? {},
19483
+ properties: recordedPropertiesAfterReplayCreate(prevRecord, createResult)
19425
19484
  };
19426
19485
  await afterOp?.(op.logicalId);
19427
19486
  if (!deletedNewFirst && !adoptedLiveNewResource) try {
@@ -19732,7 +19791,7 @@ const FLUSH_INTERVAL_MS = 2e3;
19732
19791
  const FLUSH_EVENT_THRESHOLD = 50;
19733
19792
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
19734
19793
  function getCdkdVersion() {
19735
- return "0.280.44";
19794
+ return "0.280.46";
19736
19795
  }
19737
19796
  /**
19738
19797
  * Generate a time-sortable unique run id, e.g.
@@ -21898,4 +21957,4 @@ var DeployEngine = class {
21898
21957
 
21899
21958
  //#endregion
21900
21959
  export { requireConfigArray as $, expectedOwnerParam as $t, green as A, withErrorHandling as An, getDockerCmd as At, slowCcOperationTimeoutMs as B, resolveAutoAssetStorage as Bt, MULTI_REGION_RECREATE_BLOCKED_TYPES as C, StackHasActiveImportsError as Cn, ensureAssetStorage as Ct, bold as D, formatError as Dn, validateContainerRepoName as Dt, formatResourceLine as E, SynthesisError as En, validateAssetBucketName as Et, clearOnUpdateRemoval as F, Synthesizer as Ft, refStateLookupFromResource as G, resolveUseCdkBootstrapAssets as Gt, isTerminationProtectionPropagationError as H, resolveSkipPrefix as Ht, ProviderRegistry as I, synthesisStatusMessage as It, resolveExplicitPhysicalId as J, CFN_TEMPLATE_BODY_LIMIT as Jt, WAFv2WebACLProvider as K, stateBucketExistenceConfirmed as Kt, findActionableSilentDrops as L, getDefaultStateBucketName as Lt, yellow as M, runDockerStreaming as Mt, IAMRoleProvider as N, AssetManifestLoader as Nt, cyan as O, isCdkdError as On, buildDockerImage as Ot, collectInlinePolicyNamesManagedBySiblings as P, getDockerImageBySourceHash as Pt, replayWarn as Q, uploadCfnTemplate as Qt, findSilentDropProperties as R, getLegacyStateBucketName as Rt, extractDeploymentEventError as S, ResourceUpdateNotSupportedError as Sn, BOOTSTRAP_MARKER_PREFIX as St, renderStatefulReason as T, StateError as Tn, parseBootstrapMarker as Tt, IntrinsicFunctionResolver as U, resolveStateBucketWithDefault as Ut, disableInstanceApiTermination as V, resolveCaptureObservedState as Vt, cfnRefValueFromPhysicalId as W, resolveStateBucketWithDefaultAndSource as Wt, configStringRefusal as X, MIGRATE_TMP_PREFIX as Xt, assertRegionMatch as Y, CFN_TEMPLATE_URL_LIMIT as Yt, readConfigString as Z, findLargeInlineResources as Zt, createPreDeleteFinalSnapshot as _, MissingCdkCliError as _n, buildAssetRedirectMap as _t, DeploymentEventsStore as a, getAwsClients as an, withRetry as at, unsupportedFinalSnapshotError as b, ProvisioningError as bn, rewriteTemplateAssetReferences as bt, replayFailedOperations as c, AssetError as cn, DagBuilder as ct, IMPLICIT_DELETE_DEPENDENCIES as d, DependencyError as dn, S3StateBackend as dt, AssemblyReader as en, requireConfigObject as et, computeImplicitDeleteEdges as f, DeployCancelledError as fn, rebuildClientForBucketRegion as ft, ccRoutedFinalSnapshotError as g, LockError as gn, WorkGraph as gt, buildFinalSnapshotIdentifier as h, LocalStartServiceError as hn, stringifyValue as ht, DeploymentEventsReader as i, AwsClients as in, describeTypeWithThrottleRetry as it, red as j, __exportAll as jn, runDockerForeground as jt, gray as k, normalizeAwsError as kn, formatDockerLoginError as kt, replayRollback as l, CdkdError as ln, TemplateParser as lt, PRE_DELETE_SNAPSHOT_TYPES as m, LocalMigrateError as mn, AssetPublisher as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, clearBucketRegionCache as nn, applyRoleArnIfSet as nt, planFailedOps as o, resetAwsClients as on, isRetryableTransientError as ot, ATOMIC_FINAL_SNAPSHOT_TYPES as p, LocalInvokeBuildError as pn, shouldRetainResource as pt, normalizeAwsTagsToCfn as q, warnDeprecatedNoPrefixCliFlag as qt, DeployEngine as r, resolveBucketRegion as rn, DiffCalculator as rt, planRollback as s, setAwsClients as sn, isThrottlingError as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, processStackMessages as tn, requireConfigString as tt, withResourceDeadline as u, ConfigError as un, LockManager as ut, isFinalSnapshotError as v, NestedStackChildDirectDestroyError as vn, createAssetRedirectResolver as vt, isStatefulRecreateTargetSync as w, StackTerminationProtectionError as wn, getBootstrapMarkerKey as wt, makeCanonicalizePropertiesFn as x, ResourceTimeoutError as xn, AssetModeResolver as xt, refusesFinalSnapshot as y, PartialFailureError as yn, loadPublishableAssetManifest as yt, CloudControlProvider as z, resolveApp as zt };
21901
- //# sourceMappingURL=deploy-engine-nEjymkij.js.map
21960
+ //# sourceMappingURL=deploy-engine-E_JV4UqE.js.map