findReplacements in packages/@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack.ts decides whether a change set contains a replacement from ResourceChange.PolicyAction alone, never consulting ResourceChange.Replacement. It has been that way since the initial commit. That predicate gates the --no-rollback replacement prompt and the Express Mode guard in #1969, so a replacement reported without a policy action would not be gated.
The gap is theoretical so far: no real change set with Replacement: "True" and no PolicyAction has been observed. Describing a real change set for the replacing change in #1931 gives both fields, so existing detection covered #1931 — which is why widening it was left out of #1969.
"PolicyAction": "ReplaceAndDelete",
"LogicalResourceId": "TaskDef54694570",
"ResourceType": "AWS::ECS::TaskDefinition",
"Replacement": "True"
Worth establishing whether such a change set can be produced at all — an explicit DeletionPolicy: Retain, or a resource type without a deletion policy, are the candidates. If it can, widen to || change.Replacement === 'True'. Any fix must keep Replacement: "Conditional" excluded: CDKMetadata reports it on essentially every CDK deployment, so gating it would gate almost every express deployment.
#NNNN here means aws/aws-cdk-cli; note aws/aws-cdk#1931 is an unrelated closed issue.
findReplacementsinpackages/@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack.tsdecides whether a change set contains a replacement fromResourceChange.PolicyActionalone, never consultingResourceChange.Replacement. It has been that way since the initial commit. That predicate gates the--no-rollbackreplacement prompt and the Express Mode guard in #1969, so a replacement reported without a policy action would not be gated.The gap is theoretical so far: no real change set with
Replacement: "True"and noPolicyActionhas been observed. Describing a real change set for the replacing change in #1931 gives both fields, so existing detection covered #1931 — which is why widening it was left out of #1969.Worth establishing whether such a change set can be produced at all — an explicit
DeletionPolicy: Retain, or a resource type without a deletion policy, are the candidates. If it can, widen to|| change.Replacement === 'True'. Any fix must keepReplacement: "Conditional"excluded:CDKMetadatareports it on essentially every CDK deployment, so gating it would gate almost every express deployment.#NNNNhere meansaws/aws-cdk-cli; noteaws/aws-cdk#1931is an unrelated closed issue.