cdk-real-drift 0.2.59 → 0.2.60

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
@@ -3250,7 +3250,10 @@ function parseCfnTemplate(text) {
3250
3250
  const body = text.charCodeAt(0) === 65279 ? text.slice(1) : text;
3251
3251
  let parsed;
3252
3252
  if (format === "json") parsed = JSON.parse(body);
3253
- else parsed = parse(body, { customTags: CUSTOM_TAGS });
3253
+ else parsed = parse(body, {
3254
+ version: "1.1",
3255
+ customTags: CUSTOM_TAGS
3256
+ });
3254
3257
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Template root is not an object.");
3255
3258
  return parsed;
3256
3259
  }
@@ -8346,152 +8349,6 @@ const SDK_SUPPLEMENTS = {
8346
8349
  "AWS::RedshiftServerless::Workgroup": supplementRedshiftServerlessWorkgroup
8347
8350
  };
8348
8351
 
8349
- //#endregion
8350
- //#region src/read/router.ts
8351
- const CC_IDENTIFIER_ADAPTERS = {
8352
- "AWS::AppSync::GraphQLApi": (pid) => pid.startsWith("arn:") ? pid.split("/").pop() : pid,
8353
- "AWS::Batch::JobDefinition": (pid) => {
8354
- return (pid.startsWith("arn:") ? pid.split("/").pop() ?? pid : pid).replace(/:\d+$/, "");
8355
- },
8356
- "AWS::ECR::RepositoryCreationTemplate": (pid) => pid.replace(/\/$/, ""),
8357
- "AWS::Cognito::UserPoolClient": compositeWith("UserPoolId"),
8358
- "AWS::Cognito::UserPoolGroup": compositeWith("UserPoolId"),
8359
- "AWS::Cognito::UserPoolIdentityProvider": compositeWith("UserPoolId"),
8360
- "AWS::Cognito::UserPoolUser": compositeWith("UserPoolId"),
8361
- "AWS::ApiGatewayV2::Stage": compositeWith("ApiId"),
8362
- "AWS::ApiGatewayV2::Route": compositeWith("ApiId"),
8363
- "AWS::ApiGatewayV2::Integration": compositeWith("ApiId"),
8364
- "AWS::ApiGatewayV2::Authorizer": (pid, declared) => {
8365
- if (pid.includes("|")) return pid;
8366
- const apiId = declared.ApiId;
8367
- return typeof apiId === "string" && apiId.length > 0 ? `${pid}|${apiId}` : void 0;
8368
- },
8369
- "AWS::AppConfig::Environment": compositeWith("ApplicationId"),
8370
- "AWS::AppConfig::ConfigurationProfile": compositeWith("ApplicationId"),
8371
- "AWS::AppConfig::HostedConfigurationVersion": (pid, declared) => {
8372
- if (pid.includes("|")) return pid;
8373
- const appId = declared.ApplicationId;
8374
- const profileId = declared.ConfigurationProfileId;
8375
- return typeof appId === "string" && appId.length > 0 && typeof profileId === "string" && profileId.length > 0 ? `${appId}|${profileId}|${pid}` : void 0;
8376
- },
8377
- "AWS::AppConfig::Deployment": (pid, declared) => {
8378
- if (pid.includes("|")) return pid;
8379
- const appId = declared.ApplicationId;
8380
- const envId = declared.EnvironmentId;
8381
- return typeof appId === "string" && appId.length > 0 && typeof envId === "string" && envId.length > 0 ? `${appId}|${envId}|${pid}` : void 0;
8382
- },
8383
- "AWS::ApiGateway::Model": compositeWith("RestApiId"),
8384
- "AWS::ApiGateway::RequestValidator": compositeWith("RestApiId"),
8385
- "AWS::ApiGateway::Resource": compositeWith("RestApiId"),
8386
- "AWS::ApiGateway::Stage": compositeWith("RestApiId"),
8387
- "AWS::ApiGateway::Authorizer": compositeWith("RestApiId"),
8388
- "AWS::Cognito::UserPoolDomain": compositeWith("UserPoolId"),
8389
- "AWS::Cognito::UserPoolResourceServer": compositeWith("UserPoolId"),
8390
- "AWS::AutoScaling::LifecycleHook": compositeWith("AutoScalingGroupName"),
8391
- "AWS::CodeDeploy::DeploymentGroup": compositeWith("ApplicationName"),
8392
- "AWS::ElasticBeanstalk::ConfigurationTemplate": compositeWith("ApplicationName"),
8393
- "AWS::ElasticBeanstalk::ApplicationVersion": compositeWith("ApplicationName"),
8394
- "AWS::AutoScaling::ScheduledAction": (pid, declared) => {
8395
- if (pid.includes("|")) return pid;
8396
- const asg = declared.AutoScalingGroupName;
8397
- return typeof asg === "string" && asg.length > 0 ? `${pid}|${asg}` : void 0;
8398
- },
8399
- "AWS::ApiGateway::Deployment": (pid, declared) => {
8400
- if (pid.includes("|")) return pid;
8401
- const restApiId = declared.RestApiId;
8402
- return typeof restApiId === "string" && restApiId.length > 0 ? `${pid}|${restApiId}` : void 0;
8403
- },
8404
- "AWS::ApiGateway::DocumentationPart": (pid, declared) => {
8405
- if (pid.includes("|")) return pid;
8406
- const restApiId = declared.RestApiId;
8407
- return typeof restApiId === "string" && restApiId.length > 0 ? `${pid}|${restApiId}` : void 0;
8408
- },
8409
- "AWS::ApplicationAutoScaling::ScalingPolicy": scalingPolicyComposite,
8410
- "AWS::ECS::Service": (pid, declared) => {
8411
- if (pid.includes("|")) return pid;
8412
- const cluster = declared.Cluster;
8413
- return typeof cluster === "string" && cluster.length > 0 ? `${pid}|${cluster}` : void 0;
8414
- },
8415
- "AWS::Logs::SubscriptionFilter": (pid, declared) => {
8416
- if (pid.includes("|")) return pid;
8417
- const lg = declared.LogGroupName;
8418
- return typeof lg === "string" && lg.length > 0 ? `${pid}|${lg}` : void 0;
8419
- },
8420
- "AWS::Logs::LogStream": compositeWith("LogGroupName"),
8421
- "AWS::SSM::MaintenanceWindowTarget": compositeWith("WindowId"),
8422
- "AWS::SSM::MaintenanceWindowTask": compositeWith("WindowId"),
8423
- "AWS::EC2::TransitGatewayRouteTablePropagation": (pid, declared) => {
8424
- if (pid.includes("|")) return pid;
8425
- const rtb = declared.TransitGatewayRouteTableId;
8426
- const att = declared.TransitGatewayAttachmentId;
8427
- return typeof rtb === "string" && rtb.length > 0 && typeof att === "string" && att.length > 0 ? `${rtb}|${att}` : void 0;
8428
- },
8429
- "AWS::EC2::VPCCidrBlock": (pid, declared) => {
8430
- if (pid.includes("|")) return pid;
8431
- const vpcId = declared.VpcId;
8432
- return typeof vpcId === "string" && vpcId.length > 0 ? `${pid}|${vpcId}` : void 0;
8433
- },
8434
- "AWS::ApiGatewayV2::RouteResponse": (pid, declared) => {
8435
- if (pid.includes("|")) return pid;
8436
- const apiId = declared.ApiId;
8437
- const routeId = declared.RouteId;
8438
- return typeof apiId === "string" && apiId.length > 0 && typeof routeId === "string" && routeId.length > 0 ? `${apiId}|${routeId}|${pid}` : void 0;
8439
- }
8440
- };
8441
- function scalingPolicyComposite(pid, declared) {
8442
- if (pid.includes("|")) return pid;
8443
- const targetId = declared.ScalingTargetId;
8444
- if (typeof targetId !== "string") return void 0;
8445
- const dimension = targetId.split("|")[1];
8446
- return dimension ? `${pid}|${dimension}` : void 0;
8447
- }
8448
- function compositeWith(parentKey) {
8449
- return (pid, declared) => {
8450
- if (pid.includes("|")) return pid;
8451
- const parent = declared[parentKey];
8452
- return typeof parent === "string" && parent.length > 0 ? `${parent}|${pid}` : void 0;
8453
- };
8454
- }
8455
- async function readLive(cc, resource, region, accountId) {
8456
- const { resourceType, physicalId, declared } = resource;
8457
- if (resourceType.startsWith("Custom::") || resourceType === "AWS::CloudFormation::CustomResource") return { skippedReason: "custom resource — no cloud-side model to read" };
8458
- const override = SDK_OVERRIDES[resourceType];
8459
- if (override) try {
8460
- const live = await override({
8461
- physicalId: physicalId ?? "",
8462
- declared,
8463
- region,
8464
- accountId
8465
- });
8466
- return live ? { live } : { skippedReason: "SDK override: target not resolvable from template" };
8467
- } catch (e) {
8468
- if (isResourceNotFoundError(e)) return { deleted: true };
8469
- return { skippedReason: `SDK override (${resourceType}): ${e.name}` };
8470
- }
8471
- try {
8472
- const identifier = CC_IDENTIFIER_ADAPTERS[resourceType]?.(physicalId ?? "", declared) ?? physicalId ?? "";
8473
- const g = await cc.send(new GetResourceCommand({
8474
- TypeName: resourceType,
8475
- Identifier: identifier
8476
- }));
8477
- const live = JSON.parse(g.ResourceDescription?.Properties ?? "{}");
8478
- const supplement = SDK_SUPPLEMENTS[resourceType];
8479
- if (supplement) try {
8480
- const extra = await supplement({
8481
- physicalId: physicalId ?? "",
8482
- declared,
8483
- region,
8484
- accountId
8485
- });
8486
- if (extra) Object.assign(live, extra);
8487
- } catch {}
8488
- return { live };
8489
- } catch (e) {
8490
- if (isResourceNotFoundError(e)) return { deleted: true };
8491
- return { skippedReason: `CC API: ${e.name}` };
8492
- }
8493
- }
8494
-
8495
8352
  //#endregion
8496
8353
  //#region src/schema/schema-strip.ts
8497
8354
  const cache = /* @__PURE__ */ new Map();
@@ -8711,6 +8568,165 @@ function parseSchema(schemaJson) {
8711
8568
  };
8712
8569
  }
8713
8570
 
8571
+ //#endregion
8572
+ //#region src/read/router.ts
8573
+ const CC_IDENTIFIER_ADAPTERS = {
8574
+ "AWS::AppSync::GraphQLApi": (pid) => pid.startsWith("arn:") ? pid.split("/").pop() : pid,
8575
+ "AWS::Batch::JobDefinition": (pid) => {
8576
+ return (pid.startsWith("arn:") ? pid.split("/").pop() ?? pid : pid).replace(/:\d+$/, "");
8577
+ },
8578
+ "AWS::ECR::RepositoryCreationTemplate": (pid) => pid.replace(/\/$/, ""),
8579
+ "AWS::Cognito::UserPoolClient": compositeWith("UserPoolId"),
8580
+ "AWS::Cognito::UserPoolGroup": compositeWith("UserPoolId"),
8581
+ "AWS::Cognito::UserPoolIdentityProvider": compositeWith("UserPoolId"),
8582
+ "AWS::Cognito::UserPoolUser": compositeWith("UserPoolId"),
8583
+ "AWS::ApiGatewayV2::Stage": compositeWith("ApiId"),
8584
+ "AWS::ApiGatewayV2::Route": compositeWith("ApiId"),
8585
+ "AWS::ApiGatewayV2::Integration": compositeWith("ApiId"),
8586
+ "AWS::ApiGatewayV2::Authorizer": (pid, declared) => {
8587
+ if (pid.includes("|")) return pid;
8588
+ const apiId = declared.ApiId;
8589
+ return typeof apiId === "string" && apiId.length > 0 ? `${pid}|${apiId}` : void 0;
8590
+ },
8591
+ "AWS::AppConfig::Environment": compositeWith("ApplicationId"),
8592
+ "AWS::AppConfig::ConfigurationProfile": compositeWith("ApplicationId"),
8593
+ "AWS::AppConfig::HostedConfigurationVersion": (pid, declared) => {
8594
+ if (pid.includes("|")) return pid;
8595
+ const appId = declared.ApplicationId;
8596
+ const profileId = declared.ConfigurationProfileId;
8597
+ return typeof appId === "string" && appId.length > 0 && typeof profileId === "string" && profileId.length > 0 ? `${appId}|${profileId}|${pid}` : void 0;
8598
+ },
8599
+ "AWS::AppConfig::Deployment": (pid, declared) => {
8600
+ if (pid.includes("|")) return pid;
8601
+ const appId = declared.ApplicationId;
8602
+ const envId = declared.EnvironmentId;
8603
+ return typeof appId === "string" && appId.length > 0 && typeof envId === "string" && envId.length > 0 ? `${appId}|${envId}|${pid}` : void 0;
8604
+ },
8605
+ "AWS::ApiGateway::Model": compositeWith("RestApiId"),
8606
+ "AWS::ApiGateway::RequestValidator": compositeWith("RestApiId"),
8607
+ "AWS::ApiGateway::Resource": compositeWith("RestApiId"),
8608
+ "AWS::ApiGateway::Stage": compositeWith("RestApiId"),
8609
+ "AWS::ApiGateway::Authorizer": compositeWith("RestApiId"),
8610
+ "AWS::Cognito::UserPoolDomain": compositeWith("UserPoolId"),
8611
+ "AWS::Cognito::UserPoolResourceServer": compositeWith("UserPoolId"),
8612
+ "AWS::AutoScaling::LifecycleHook": compositeWith("AutoScalingGroupName"),
8613
+ "AWS::CodeDeploy::DeploymentGroup": compositeWith("ApplicationName"),
8614
+ "AWS::ElasticBeanstalk::ConfigurationTemplate": compositeWith("ApplicationName"),
8615
+ "AWS::ElasticBeanstalk::ApplicationVersion": compositeWith("ApplicationName"),
8616
+ "AWS::AutoScaling::ScheduledAction": (pid, declared) => {
8617
+ if (pid.includes("|")) return pid;
8618
+ const asg = declared.AutoScalingGroupName;
8619
+ return typeof asg === "string" && asg.length > 0 ? `${pid}|${asg}` : void 0;
8620
+ },
8621
+ "AWS::ApiGateway::Deployment": (pid, declared) => {
8622
+ if (pid.includes("|")) return pid;
8623
+ const restApiId = declared.RestApiId;
8624
+ return typeof restApiId === "string" && restApiId.length > 0 ? `${pid}|${restApiId}` : void 0;
8625
+ },
8626
+ "AWS::ApiGateway::DocumentationPart": (pid, declared) => {
8627
+ if (pid.includes("|")) return pid;
8628
+ const restApiId = declared.RestApiId;
8629
+ return typeof restApiId === "string" && restApiId.length > 0 ? `${pid}|${restApiId}` : void 0;
8630
+ },
8631
+ "AWS::ApplicationAutoScaling::ScalingPolicy": scalingPolicyComposite,
8632
+ "AWS::ECS::Service": (pid, declared) => {
8633
+ if (pid.includes("|")) return pid;
8634
+ const cluster = declared.Cluster;
8635
+ return typeof cluster === "string" && cluster.length > 0 ? `${pid}|${cluster}` : void 0;
8636
+ },
8637
+ "AWS::Logs::SubscriptionFilter": (pid, declared) => {
8638
+ if (pid.includes("|")) return pid;
8639
+ const lg = declared.LogGroupName;
8640
+ return typeof lg === "string" && lg.length > 0 ? `${pid}|${lg}` : void 0;
8641
+ },
8642
+ "AWS::Logs::LogStream": compositeWith("LogGroupName"),
8643
+ "AWS::SSM::MaintenanceWindowTarget": compositeWith("WindowId"),
8644
+ "AWS::SSM::MaintenanceWindowTask": compositeWith("WindowId"),
8645
+ "AWS::EC2::TransitGatewayRouteTablePropagation": (pid, declared) => {
8646
+ if (pid.includes("|")) return pid;
8647
+ const rtb = declared.TransitGatewayRouteTableId;
8648
+ const att = declared.TransitGatewayAttachmentId;
8649
+ return typeof rtb === "string" && rtb.length > 0 && typeof att === "string" && att.length > 0 ? `${rtb}|${att}` : void 0;
8650
+ },
8651
+ "AWS::EC2::VPCCidrBlock": (pid, declared) => {
8652
+ if (pid.includes("|")) return pid;
8653
+ const vpcId = declared.VpcId;
8654
+ return typeof vpcId === "string" && vpcId.length > 0 ? `${pid}|${vpcId}` : void 0;
8655
+ },
8656
+ "AWS::ApiGatewayV2::RouteResponse": (pid, declared) => {
8657
+ if (pid.includes("|")) return pid;
8658
+ const apiId = declared.ApiId;
8659
+ const routeId = declared.RouteId;
8660
+ return typeof apiId === "string" && apiId.length > 0 && typeof routeId === "string" && routeId.length > 0 ? `${apiId}|${routeId}|${pid}` : void 0;
8661
+ }
8662
+ };
8663
+ function scalingPolicyComposite(pid, declared) {
8664
+ if (pid.includes("|")) return pid;
8665
+ const targetId = declared.ScalingTargetId;
8666
+ if (typeof targetId !== "string") return void 0;
8667
+ const dimension = targetId.split("|")[1];
8668
+ return dimension ? `${pid}|${dimension}` : void 0;
8669
+ }
8670
+ function compositeWith(parentKey) {
8671
+ return (pid, declared) => {
8672
+ if (pid.includes("|")) return pid;
8673
+ const parent = declared[parentKey];
8674
+ return typeof parent === "string" && parent.length > 0 ? `${parent}|${pid}` : void 0;
8675
+ };
8676
+ }
8677
+ function restoreSupplementReadGaps(resourceType, declared, live, error) {
8678
+ const exempt = OVERRIDE_READABLE_WRITEONLY[resourceType];
8679
+ const restored = [];
8680
+ for (const path of exempt ?? []) if (path in declared && !(path in live)) {
8681
+ live[path] = declared[path];
8682
+ restored.push(path);
8683
+ }
8684
+ const call = error?.name || "unknown error";
8685
+ const gap = restored.length ? ` — treating ${restored.join(", ")} as an unverifiable read-gap (declared value assumed unchanged; grant the missing read permission to detect out-of-band drift on it)` : "";
8686
+ process.stderr.write(`[cdkrd] warning: supplement read for ${resourceType} failed (${call})${gap}\n`);
8687
+ }
8688
+ async function readLive(cc, resource, region, accountId) {
8689
+ const { resourceType, physicalId, declared } = resource;
8690
+ if (resourceType.startsWith("Custom::") || resourceType === "AWS::CloudFormation::CustomResource") return { skippedReason: "custom resource — no cloud-side model to read" };
8691
+ const override = SDK_OVERRIDES[resourceType];
8692
+ if (override) try {
8693
+ const live = await override({
8694
+ physicalId: physicalId ?? "",
8695
+ declared,
8696
+ region,
8697
+ accountId
8698
+ });
8699
+ return live ? { live } : { skippedReason: "SDK override: target not resolvable from template" };
8700
+ } catch (e) {
8701
+ if (isResourceNotFoundError(e)) return { deleted: true };
8702
+ return { skippedReason: `SDK override (${resourceType}): ${e.name}` };
8703
+ }
8704
+ try {
8705
+ const identifier = CC_IDENTIFIER_ADAPTERS[resourceType]?.(physicalId ?? "", declared) ?? physicalId ?? "";
8706
+ const g = await cc.send(new GetResourceCommand({
8707
+ TypeName: resourceType,
8708
+ Identifier: identifier
8709
+ }));
8710
+ const live = JSON.parse(g.ResourceDescription?.Properties ?? "{}");
8711
+ const supplement = SDK_SUPPLEMENTS[resourceType];
8712
+ if (supplement) try {
8713
+ const extra = await supplement({
8714
+ physicalId: physicalId ?? "",
8715
+ declared,
8716
+ region,
8717
+ accountId
8718
+ });
8719
+ if (extra) Object.assign(live, extra);
8720
+ } catch (e) {
8721
+ restoreSupplementReadGaps(resourceType, declared, live, e);
8722
+ }
8723
+ return { live };
8724
+ } catch (e) {
8725
+ if (isResourceNotFoundError(e)) return { deleted: true };
8726
+ return { skippedReason: `CC API: ${e.name}` };
8727
+ }
8728
+ }
8729
+
8714
8730
  //#endregion
8715
8731
  //#region src/commands/gather.ts
8716
8732
  function liveModelMap(reads) {
@@ -9189,9 +9205,14 @@ async function writeBaselineFile(b) {
9189
9205
  /**
9190
9206
  * Which resources the record snapshot covered COMPLETELY (R62): every undeclared
9191
9207
  * finding of the resource is in `recorded` (zero undeclared findings = trivially
9192
- * complete), and the resource was actually observed — a `skipped` (unread) or
9193
- * `deleted` resource cannot be snapshot. Ignored-tier values do not block
9194
- * completeness: they were visible and deliberately ruled out.
9208
+ * complete), and the resource was actually observed — a `skipped` (unread),
9209
+ * `deleted`, or `readGap` (part of its live model UNREAD) resource cannot be
9210
+ * snapshot. A `readGap` finding means some of the resource's live state could not
9211
+ * be read this run (#795), so undeclared values hidden behind that gap were NOT
9212
+ * captured — the resource must not claim completeness, else a later cdkrd that
9213
+ * closes the read gap would surface those newly-visible values as false "appeared
9214
+ * since record" drift. Ignored-tier values do not block completeness: they were
9215
+ * visible and deliberately ruled out.
9195
9216
  * Monotonic via `previousComplete`: once complete, a resource stays complete
9196
9217
  * (declining to record an appeared-since-record value keeps it drift, instead of
9197
9218
  * demoting it back to unrecorded) — pruned to ids still in the template.
@@ -9200,7 +9221,7 @@ function computeCompleteResources(allLogicalIds, findings, recorded, previousCom
9200
9221
  const recordedKeys = new Set(recorded.map(recordedKey));
9201
9222
  const blocked = /* @__PURE__ */ new Set();
9202
9223
  for (const f of findings) {
9203
- if (f.tier === "skipped" || f.tier === "deleted") blocked.add(f.logicalId);
9224
+ if (f.tier === "skipped" || f.tier === "deleted" || f.tier === "readGap") blocked.add(f.logicalId);
9204
9225
  if (f.tier === "undeclared" && !recordedKeys.has(recordedKey(f))) blocked.add(f.logicalId);
9205
9226
  }
9206
9227
  const all = new Set(allLogicalIds);
@@ -11847,6 +11868,31 @@ async function applyRevertItem(cc, item, identifier = item.physicalId, retry = {
11847
11868
  }
11848
11869
  }, retry);
11849
11870
  }
11871
+ async function applyRevertDeletes(deleteItems, applyOne) {
11872
+ const results = /* @__PURE__ */ new Map();
11873
+ let pending = deleteItems.map((item, index) => ({
11874
+ item,
11875
+ index
11876
+ }));
11877
+ const maxPasses = Math.max(1, deleteItems.length);
11878
+ for (let pass = 0; pass < maxPasses && pending.length > 0; pass++) {
11879
+ const stillFailed = [];
11880
+ for (const p of pending) {
11881
+ const r = await applyOne(p.item);
11882
+ results.set(p.index, r);
11883
+ if (!r.ok) stillFailed.push(p);
11884
+ }
11885
+ if (stillFailed.length === pending.length) break;
11886
+ pending = stillFailed;
11887
+ }
11888
+ return deleteItems.map((item, index) => ({
11889
+ item,
11890
+ result: results.get(index) ?? {
11891
+ ok: false,
11892
+ error: "delete not attempted"
11893
+ }
11894
+ }));
11895
+ }
11850
11896
  async function applyRevertDelete(cc, item, identifier = item.physicalId, retry = {}) {
11851
11897
  return retryTransient(async () => {
11852
11898
  try {
@@ -12367,12 +12413,11 @@ async function revertStack(p) {
12367
12413
  console.log(style.note(` ↻ ${displayId}: ${reason} — retry ${attempt} (next in ${secs}s)…`));
12368
12414
  }
12369
12415
  });
12416
+ const deleteItems = plan.items.filter((i) => i.kind === "delete");
12370
12417
  for (const item of plan.items) {
12418
+ if (item.kind === "delete") continue;
12371
12419
  let r;
12372
- if (item.kind === "delete") {
12373
- r = await applyRevertDelete(cc, item, item.physicalId, buildRetryOpts(item.displayId));
12374
- if (!r.ok) failedDeleteIds.add(item.logicalId);
12375
- } else if (item.kind === "sdk") {
12420
+ if (item.kind === "sdk") {
12376
12421
  const res = byLogical.get(item.logicalId);
12377
12422
  r = await retryTransient(async () => {
12378
12423
  try {
@@ -12419,7 +12464,19 @@ async function revertStack(p) {
12419
12464
  ...r.hint !== void 0 && { hint: r.hint }
12420
12465
  });
12421
12466
  if (!r.ok) worst = Math.max(worst, 2);
12422
- if (!r.ok && item.kind !== "delete") failedUpdateIds.add(item.logicalId);
12467
+ if (!r.ok) failedUpdateIds.add(item.logicalId);
12468
+ }
12469
+ const deleteOutcomes = await applyRevertDeletes(deleteItems, (item) => applyRevertDelete(cc, item, item.physicalId, buildRetryOpts(item.displayId)));
12470
+ for (const { item, result: r } of deleteOutcomes) {
12471
+ if (!r.ok) failedDeleteIds.add(item.logicalId);
12472
+ applied.push({
12473
+ logicalId: item.logicalId,
12474
+ displayId: item.displayId,
12475
+ ok: r.ok,
12476
+ ...r.error !== void 0 && { error: r.error },
12477
+ ...r.hint !== void 0 && { hint: r.hint }
12478
+ });
12479
+ if (!r.ok) worst = Math.max(worst, 2);
12423
12480
  }
12424
12481
  for (const s of summarizeRevertResults(applied)) if (s.ok) console.log(style.ok(` reverted: ${s.displayId}`));
12425
12482
  else {