cdk-real-drift 0.9.3 → 0.9.5
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 +4 -1
- package/dist/cli.js +179 -19
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -404,7 +404,10 @@ error (they select which comparison runs, so a combination is contradictory).
|
|
|
404
404
|
### Interactive prompts (TTY only, CI is never prompted)
|
|
405
405
|
|
|
406
406
|
Every option runs exactly the same code as the standalone commands. Prompts are
|
|
407
|
-
skipped under `--json`, `--show-all`, `--pre-deploy`,
|
|
407
|
+
skipped under `--json`, `--show-all`, `--pre-deploy`, `--fail`, and the scope
|
|
408
|
+
filters `--declared-only` / `--undeclared-only` (a filtered finding set must never
|
|
409
|
+
become a snapshot-complete baseline via the inline Record — use the standalone
|
|
410
|
+
`record` verb, which sees the unfiltered state, #779). A non-TTY run
|
|
408
411
|
never prompts: a required write decision without `--yes` errors with exit 2 (the
|
|
409
412
|
safe side). "Interactive" requires **both** a TTY stdin and a TTY stdout — so
|
|
410
413
|
**redirecting or piping the output** (`cdkrd check > report.txt`, `| tee`) is also
|
package/dist/cli.js
CHANGED
|
@@ -2208,7 +2208,10 @@ const KNOWN_DEFAULTS = {
|
|
|
2208
2208
|
Domain: "vpc"
|
|
2209
2209
|
},
|
|
2210
2210
|
"AWS::EC2::TransitGateway": { SecurityGroupReferencingSupport: "disable" },
|
|
2211
|
-
"AWS::EC2::FlowLog": {
|
|
2211
|
+
"AWS::EC2::FlowLog": {
|
|
2212
|
+
MaxAggregationInterval: 600,
|
|
2213
|
+
LogFormat: "${version} ${account-id} ${interface-id} ${srcaddr} ${dstaddr} ${srcport} ${dstport} ${protocol} ${packets} ${bytes} ${start} ${end} ${action} ${log-status}"
|
|
2214
|
+
},
|
|
2212
2215
|
"AWS::EC2::PlacementGroup": { SpreadLevel: "rack" },
|
|
2213
2216
|
"AWS::EC2::IPAM": { MeteredAccount: "ipam-owner" },
|
|
2214
2217
|
"AWS::EC2::ClientVpnEndpoint": {
|
|
@@ -2811,7 +2814,9 @@ const GENERATED_LOGICALID_PREFIX_PATHS = {
|
|
|
2811
2814
|
"AWS::Cognito::IdentityPool": new Set(["IdentityPoolName"]),
|
|
2812
2815
|
"AWS::Cognito::UserPool": new Set(["UserPoolName"]),
|
|
2813
2816
|
"AWS::Batch::JobDefinition": new Set(["JobDefinitionName"]),
|
|
2814
|
-
"AWS::EC2::LaunchTemplate": new Set(["LaunchTemplateName"])
|
|
2817
|
+
"AWS::EC2::LaunchTemplate": new Set(["LaunchTemplateName"]),
|
|
2818
|
+
"AWS::WAFv2::WebACL": new Set(["Name"]),
|
|
2819
|
+
"AWS::WAFv2::RegexPatternSet": new Set(["Name"])
|
|
2815
2820
|
};
|
|
2816
2821
|
const CFN_LOGICALID_RANDOM = /[-_][0-9A-Za-z]{12,}$/;
|
|
2817
2822
|
function isLogicalIdPrefixedGeneratedName(value, logicalId) {
|
|
@@ -2947,6 +2952,8 @@ function ebOptionSettingTier(namespace, optionName, value, envType) {
|
|
|
2947
2952
|
}
|
|
2948
2953
|
const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
2949
2954
|
"AWS::ElasticLoadBalancingV2::LoadBalancer": new Set(["SecurityGroups"]),
|
|
2955
|
+
"AWS::ApiGateway::ApiKey": new Set(["Value"]),
|
|
2956
|
+
"AWS::Backup::BackupVault": new Set(["EncryptionKeyArn"]),
|
|
2950
2957
|
"AWS::Batch::JobQueue": new Set(["JobQueueType"]),
|
|
2951
2958
|
"AWS::ECS::Service": new Set(["AvailabilityZoneRebalancing", "PlatformVersion"]),
|
|
2952
2959
|
"AWS::KinesisAnalyticsV2::Application": new Set(["ApplicationMaintenanceConfiguration"]),
|
|
@@ -3004,8 +3011,16 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3004
3011
|
"ClusterVersion"
|
|
3005
3012
|
]),
|
|
3006
3013
|
"AWS::OpenSearchService::Domain": new Set(["OffPeakWindowOptions"]),
|
|
3007
|
-
"AWS::AmazonMQ::Broker": new Set([
|
|
3008
|
-
|
|
3014
|
+
"AWS::AmazonMQ::Broker": new Set([
|
|
3015
|
+
"MaintenanceWindowStartTime",
|
|
3016
|
+
"SecurityGroups",
|
|
3017
|
+
"SubnetIds"
|
|
3018
|
+
]),
|
|
3019
|
+
"AWS::EC2::Instance": new Set([
|
|
3020
|
+
"PrivateIpAddress",
|
|
3021
|
+
"CpuOptions",
|
|
3022
|
+
"SubnetId"
|
|
3023
|
+
]),
|
|
3009
3024
|
"AWS::EC2::NetworkInterface": new Set([
|
|
3010
3025
|
"PrivateIpAddress",
|
|
3011
3026
|
"PrivateIpAddresses",
|
|
@@ -4970,6 +4985,15 @@ function twinOverlapEchoes(source, twin) {
|
|
|
4970
4985
|
}
|
|
4971
4986
|
return true;
|
|
4972
4987
|
}
|
|
4988
|
+
function applyDefinitionSubstitutions(definitionString, substitutions) {
|
|
4989
|
+
let out = definitionString;
|
|
4990
|
+
for (const [key, value] of Object.entries(substitutions)) {
|
|
4991
|
+
if (value === null || typeof value === "object") continue;
|
|
4992
|
+
const token = `\${${key}}`;
|
|
4993
|
+
out = out.split(token).join(String(value));
|
|
4994
|
+
}
|
|
4995
|
+
return out;
|
|
4996
|
+
}
|
|
4973
4997
|
const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
|
|
4974
4998
|
"Roles",
|
|
4975
4999
|
"Users",
|
|
@@ -5359,7 +5383,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
5359
5383
|
});
|
|
5360
5384
|
const twinSources = {};
|
|
5361
5385
|
for (const src of Object.values(SHAPE_ECHO_TWIN[resourceType] ?? {})) if (isNestedObject(declared[src])) twinSources[src] = declared[src];
|
|
5386
|
+
const sfnDefinitionObject = resourceType === "AWS::StepFunctions::StateMachine" && isNestedObject(declared["Definition"]) ? declared["Definition"] : void 0;
|
|
5387
|
+
const sfnDefinitionSubstitutions = resourceType === "AWS::StepFunctions::StateMachine" && isNestedObject(declared["DefinitionSubstitutions"]) ? declared["DefinitionSubstitutions"] : void 0;
|
|
5362
5388
|
deepStripPaths(declared, schema.writeOnlyPaths);
|
|
5389
|
+
if (sfnDefinitionSubstitutions !== void 0 && typeof declared["DefinitionString"] === "string") declared["DefinitionString"] = applyDefinitionSubstitutions(declared["DefinitionString"], sfnDefinitionSubstitutions);
|
|
5363
5390
|
const sibling = resource.siblingPolicyNames;
|
|
5364
5391
|
if (sibling !== void 0 && sibling !== "unresolved" && Array.isArray(live.Policies)) {
|
|
5365
5392
|
const names = new Set(sibling);
|
|
@@ -5624,6 +5651,26 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
5624
5651
|
});
|
|
5625
5652
|
continue;
|
|
5626
5653
|
}
|
|
5654
|
+
if (resourceType === "AWS::StepFunctions::StateMachine" && k === "DefinitionString" && typeof v === "string" && typeof live[k] === "string") {
|
|
5655
|
+
let declaredParsed;
|
|
5656
|
+
let liveParsed;
|
|
5657
|
+
try {
|
|
5658
|
+
declaredParsed = JSON.parse(v);
|
|
5659
|
+
liveParsed = JSON.parse(live[k]);
|
|
5660
|
+
} catch {
|
|
5661
|
+
declaredParsed = void 0;
|
|
5662
|
+
}
|
|
5663
|
+
if (declaredParsed !== void 0 && deepEqual(declaredParsed, liveParsed)) continue;
|
|
5664
|
+
findings.push({
|
|
5665
|
+
tier: "declared",
|
|
5666
|
+
logicalId,
|
|
5667
|
+
resourceType,
|
|
5668
|
+
path: k,
|
|
5669
|
+
desired: v,
|
|
5670
|
+
actual: live[k]
|
|
5671
|
+
});
|
|
5672
|
+
continue;
|
|
5673
|
+
}
|
|
5627
5674
|
const jsonFills = JSON_STRING_DEFAULT_FILLS[resourceType]?.[k];
|
|
5628
5675
|
if (jsonFills !== void 0 && typeof v === "string" && typeof live[k] === "string") try {
|
|
5629
5676
|
const dvParsed = JSON.parse(v);
|
|
@@ -6099,6 +6146,24 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6099
6146
|
});
|
|
6100
6147
|
continue;
|
|
6101
6148
|
}
|
|
6149
|
+
if (sfnDefinitionObject !== void 0 && k === "DefinitionString" && typeof v === "string") {
|
|
6150
|
+
let liveDefParsed;
|
|
6151
|
+
try {
|
|
6152
|
+
liveDefParsed = JSON.parse(v);
|
|
6153
|
+
} catch {
|
|
6154
|
+
liveDefParsed = void 0;
|
|
6155
|
+
}
|
|
6156
|
+
if (liveDefParsed !== void 0 && deepEqual(liveDefParsed, sfnDefinitionObject)) {
|
|
6157
|
+
findings.push({
|
|
6158
|
+
tier: "atDefault",
|
|
6159
|
+
logicalId,
|
|
6160
|
+
resourceType,
|
|
6161
|
+
path: k,
|
|
6162
|
+
actual: v
|
|
6163
|
+
});
|
|
6164
|
+
continue;
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6102
6167
|
const twinSourceKey = SHAPE_ECHO_TWIN[resourceType]?.[k];
|
|
6103
6168
|
const twinSource = twinSourceKey !== void 0 ? twinSources[twinSourceKey] ?? declared[twinSourceKey] : void 0;
|
|
6104
6169
|
if (isNestedObject(v) && isNestedObject(twinSource) && twinOverlapEchoes(twinSource, v)) {
|
|
@@ -11002,22 +11067,40 @@ async function writeBaselineFile(b) {
|
|
|
11002
11067
|
* be read this run (#795), so undeclared values hidden behind that gap were NOT
|
|
11003
11068
|
* captured — the resource must not claim completeness, else a later cdkrd that
|
|
11004
11069
|
* closes the read gap would surface those newly-visible values as false "appeared
|
|
11005
|
-
* since record" drift.
|
|
11006
|
-
*
|
|
11070
|
+
* since record" drift.
|
|
11071
|
+
*
|
|
11072
|
+
* #1078: an `ignored`-tier value whose path is ABSENT from `recorded` also blocks
|
|
11073
|
+
* completeness (and — unlike the other blocks — DEMOTES a previously-complete
|
|
11074
|
+
* resource, overriding monotonicity). An ignore rule re-tags an undeclared finding
|
|
11075
|
+
* `ignored`, so `buildRecorded` drops it and this value never enters the snapshot;
|
|
11076
|
+
* marking the resource complete anyway would treat that value as "known-absent". But
|
|
11077
|
+
* an ignore rule can be DELETED (the documented un-ignore) — and when it dies the
|
|
11078
|
+
* value (unchanged all along) would then read as false CONFIRMED "appeared since
|
|
11079
|
+
* record" drift against a complete resource, instead of returning to `unrecorded`
|
|
11080
|
+
* `[Potential Drift]`. So an ignored-and-unrecorded path keeps its resource
|
|
11081
|
+
* INCOMPLETE, so un-ignoring lands the untouched value back at `unrecorded`. This
|
|
11082
|
+
* pairs with `carryForwardIgnored` (WRITE side): a value with a PRIOR recorded entry
|
|
11083
|
+
* IS carried into `recorded`, so its path IS present, so it does NOT block here — a
|
|
11084
|
+
* previously-endorsed value survives an ignore-era record and stays complete. Only a
|
|
11085
|
+
* NEVER-recorded ignored path (no entry to carry) demotes completeness.
|
|
11007
11086
|
* Monotonic via `previousComplete`: once complete, a resource stays complete
|
|
11008
11087
|
* (declining to record an appeared-since-record value keeps it drift, instead of
|
|
11009
|
-
* demoting it back to unrecorded) — pruned to ids still in the template.
|
|
11088
|
+
* demoting it back to unrecorded) — pruned to ids still in the template. The #1078
|
|
11089
|
+
* ignored-and-unrecorded demotion is the one deliberate exception (the un-ignore
|
|
11090
|
+
* lifecycle must round-trip).
|
|
11010
11091
|
*/
|
|
11011
11092
|
function computeCompleteResources(allLogicalIds, findings, recorded, previousComplete = []) {
|
|
11012
11093
|
const recordedKeys = new Set(recorded.map(recordedKey));
|
|
11013
11094
|
const blocked = /* @__PURE__ */ new Set();
|
|
11095
|
+
const blockedByIgnore = /* @__PURE__ */ new Set();
|
|
11014
11096
|
for (const f of findings) {
|
|
11015
11097
|
if (f.tier === "skipped" || f.tier === "deleted" || f.tier === "readGap") blocked.add(f.logicalId);
|
|
11016
11098
|
if (f.tier === "undeclared" && !recordedKeys.has(recordedKey(f))) blocked.add(f.logicalId);
|
|
11099
|
+
if (f.tier === "ignored" && !recordedKeys.has(recordedKey(f))) blockedByIgnore.add(f.logicalId);
|
|
11017
11100
|
}
|
|
11018
11101
|
const all = new Set(allLogicalIds);
|
|
11019
|
-
const complete = new Set(previousComplete.filter((id) => all.has(id)));
|
|
11020
|
-
for (const id of allLogicalIds) if (!blocked.has(id)) complete.add(id);
|
|
11102
|
+
const complete = new Set(previousComplete.filter((id) => all.has(id) && !blockedByIgnore.has(id)));
|
|
11103
|
+
for (const id of allLogicalIds) if (!blocked.has(id) && !blockedByIgnore.has(id)) complete.add(id);
|
|
11021
11104
|
return [...complete].sort();
|
|
11022
11105
|
}
|
|
11023
11106
|
/** Write a baseline for a stack from a check run's findings + raw template.
|
|
@@ -11137,6 +11220,37 @@ function carryForwardUnreadable(recorded, existing, findings) {
|
|
|
11137
11220
|
return preserved.length === 0 ? recorded : [...recorded, ...preserved];
|
|
11138
11221
|
}
|
|
11139
11222
|
/**
|
|
11223
|
+
* #1078: carry forward a previously-recorded entry for a path that is CURRENTLY
|
|
11224
|
+
* suppressed by an ignore rule (tier `ignored` this run), so an ignore-era `record`
|
|
11225
|
+
* does not silently PRUNE a value the user already endorsed.
|
|
11226
|
+
*
|
|
11227
|
+
* The `findings` reaching `record` are `applyIgnores`'d first (record.ts /
|
|
11228
|
+
* interactive-resolve.ts), so a value with a live ignore rule arrives tier `ignored`
|
|
11229
|
+
* — and `buildRecorded` keeps only `undeclared`/`added`, so it produces NO entry.
|
|
11230
|
+
* Because `writeBaseline` full-replaces `recorded`, the endorsed entry for that path
|
|
11231
|
+
* would vanish from the git-committed baseline (an unexplained deletion to the PR
|
|
11232
|
+
* reviewer). Then, when the user later DELETES the rule (the documented un-ignore),
|
|
11233
|
+
* the value — unchanged all along — would false-surface as confirmed drift.
|
|
11234
|
+
*
|
|
11235
|
+
* So for every ignored finding whose path already has an entry in the EXISTING
|
|
11236
|
+
* baseline, carry that entry forward. While the rule lives the entry is inert
|
|
11237
|
+
* (`applyIgnores` runs AFTER `applyBaseline` everywhere, so ignore keeps winning — the
|
|
11238
|
+
* value is never reported); when the rule dies, watching resumes against the real,
|
|
11239
|
+
* preserved snapshot (a later genuine change still correctly reports "changed since
|
|
11240
|
+
* record"). Only carries an EXISTING entry — a never-recorded ignored path has none to
|
|
11241
|
+
* carry, and its completeness demotion (see `computeCompleteResources`) makes the
|
|
11242
|
+
* un-ignore land at `unrecorded`, not false "appeared since record".
|
|
11243
|
+
*/
|
|
11244
|
+
function carryForwardIgnored(recorded, existing, findings) {
|
|
11245
|
+
const prior = existing?.recorded;
|
|
11246
|
+
if (!prior || prior.length === 0) return recorded;
|
|
11247
|
+
const ignoredKeys = new Set(findings.filter((f) => f.tier === "ignored").map((f) => recordedKey(f)));
|
|
11248
|
+
if (ignoredKeys.size === 0) return recorded;
|
|
11249
|
+
const present = new Set(recorded.map(recordedKey));
|
|
11250
|
+
const preserved = prior.filter((e) => ignoredKeys.has(recordedKey(e)) && !present.has(recordedKey(e)));
|
|
11251
|
+
return preserved.length === 0 ? recorded : [...recorded, ...preserved];
|
|
11252
|
+
}
|
|
11253
|
+
/**
|
|
11140
11254
|
* The single source of truth for "is this baseline value equal to the current
|
|
11141
11255
|
* value?". `applyBaseline` (suppress vs surface) and `splitRecordedByBaseline`
|
|
11142
11256
|
* (unchanged vs changed) MUST share this exact predicate. BOTH sides are
|
|
@@ -13599,6 +13713,9 @@ function isManagedPolicyAttachmentMember(f) {
|
|
|
13599
13713
|
function isNestedSdkWritable(f) {
|
|
13600
13714
|
return SDK_NESTED_WRITERS[f.resourceType]?.match(f.path) ?? false;
|
|
13601
13715
|
}
|
|
13716
|
+
function isContractOp(op) {
|
|
13717
|
+
return op.contract === true;
|
|
13718
|
+
}
|
|
13602
13719
|
function nullHuskRemovalOps(model) {
|
|
13603
13720
|
const ops = [];
|
|
13604
13721
|
const walk = (value, pointer) => {
|
|
@@ -13607,6 +13724,7 @@ function nullHuskRemovalOps(model) {
|
|
|
13607
13724
|
if (pointer !== "") ops.push({
|
|
13608
13725
|
op: "remove",
|
|
13609
13726
|
path: pointer,
|
|
13727
|
+
contract: true,
|
|
13610
13728
|
human: `strip null array husk at ${pointer}`
|
|
13611
13729
|
});
|
|
13612
13730
|
return;
|
|
@@ -14472,6 +14590,7 @@ function recordOutcomeMessage(stackName, path, count, refreshedOnly, hadPriorBas
|
|
|
14472
14590
|
function revertSelectOptions(plan) {
|
|
14473
14591
|
const options = [];
|
|
14474
14592
|
for (const item of plan.items) for (const op of item.ops) {
|
|
14593
|
+
if (isContractOp(op)) continue;
|
|
14475
14594
|
const marker = item.kind === "delete" ? " (DELETE)" : op.op === "remove" ? " (REMOVE)" : "";
|
|
14476
14595
|
options.push({
|
|
14477
14596
|
value: revertOpKey(item, op),
|
|
@@ -14485,13 +14604,31 @@ function revertOpKey(item, op) {
|
|
|
14485
14604
|
const attr = op.attributeKey !== void 0 ? `${op.attributeKey}` : "";
|
|
14486
14605
|
return `${item.logicalId}${item.kind}${op.path}${attr}`;
|
|
14487
14606
|
}
|
|
14488
|
-
/**
|
|
14607
|
+
/**
|
|
14608
|
+
* Keep only the selected ops; items left with no REAL op drop out. Pure + exported.
|
|
14609
|
+
*
|
|
14610
|
+
* #967: a CONTRACT op (null-husk strip) is never a selectable row, so it is never in
|
|
14611
|
+
* `picked` — but it is coupled to its item's real revert ops (without the strip, the CC
|
|
14612
|
+
* patch hard-fails model validation, #641). So it is NOT filtered by the pick set: it
|
|
14613
|
+
* ALWAYS rides along an item that retains ≥1 real (non-contract) selected op, and is
|
|
14614
|
+
* DROPPED with the whole item when the user selected none of that item's real ops.
|
|
14615
|
+
* This keeps both invariants: a real revert op can never be sent without its coupled
|
|
14616
|
+
* husk strip, and a husk strip can never be sent alone as a user-chosen write.
|
|
14617
|
+
*/
|
|
14489
14618
|
function filterRevertPlan(plan, picked) {
|
|
14490
14619
|
return {
|
|
14491
|
-
items: plan.items.map((item) =>
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14620
|
+
items: plan.items.map((item) => {
|
|
14621
|
+
const realSelected = item.ops.filter((op) => !isContractOp(op) && picked.has(revertOpKey(item, op)));
|
|
14622
|
+
if (realSelected.length === 0) return {
|
|
14623
|
+
...item,
|
|
14624
|
+
ops: []
|
|
14625
|
+
};
|
|
14626
|
+
const contract = item.ops.filter(isContractOp);
|
|
14627
|
+
return {
|
|
14628
|
+
...item,
|
|
14629
|
+
ops: [...contract, ...realSelected]
|
|
14630
|
+
};
|
|
14631
|
+
}).filter((item) => item.ops.length > 0),
|
|
14495
14632
|
notRevertable: plan.notRevertable
|
|
14496
14633
|
};
|
|
14497
14634
|
}
|
|
@@ -14499,6 +14636,16 @@ function revertSelectMessage(stackName, region) {
|
|
|
14499
14636
|
return `${stackLabel$1(stackName, region)}: select the op(s) to revert (unselected are not written)`;
|
|
14500
14637
|
}
|
|
14501
14638
|
/**
|
|
14639
|
+
* #967: the op count SHOWN to the user (confirm prompt + --dry-run preview) counts only
|
|
14640
|
+
* REAL revert ops — a CONTRACT op (null-husk strip) is plumbing coupled to a real op,
|
|
14641
|
+
* not a distinct write the user chose, so counting it would inflate the number the user
|
|
14642
|
+
* consents to. The full augmented patch (contract ops included) is still what is SENT to
|
|
14643
|
+
* AWS; this is purely the user-facing intent count. Pure + exported for unit tests.
|
|
14644
|
+
*/
|
|
14645
|
+
function realOpCount(plan) {
|
|
14646
|
+
return plan.items.reduce((n, i) => n + i.ops.filter((op) => !isContractOp(op)).length, 0);
|
|
14647
|
+
}
|
|
14648
|
+
/**
|
|
14502
14649
|
* Record the current undeclared state into the baseline file. In an interactive run
|
|
14503
14650
|
* (no --yes) the user picks WHICH undeclared values to record (selective record, R14).
|
|
14504
14651
|
* When an existing baseline is present the multiselect shows only the DELTA from it
|
|
@@ -14515,7 +14662,7 @@ async function recordStack(p) {
|
|
|
14515
14662
|
const existing = await loadBaseline(stackName, desired.accountId, region);
|
|
14516
14663
|
if (existing) checkBaselineAccount(existing, desired.accountId, stackName);
|
|
14517
14664
|
if (!yes && existing) console.error(`note: ${stackLabel$1(stackName, region)}: will overwrite the existing baseline file on confirm (nothing written yet; it is git-tracked — review the diff afterwards). Pass --yes to silence.`);
|
|
14518
|
-
let recorded = carryForwardUnreadable(buildRecorded(findings), existing, findings);
|
|
14665
|
+
let recorded = carryForwardIgnored(carryForwardUnreadable(buildRecorded(findings), existing, findings), existing, findings);
|
|
14519
14666
|
const dropCandidates = baselineOnlyEntries(recorded, existing, findings, {
|
|
14520
14667
|
declaredByLogical: declaredKeysByLogical(desired.resources),
|
|
14521
14668
|
allLogicalIds: desired.resources.map((r) => r.logicalId)
|
|
@@ -14728,7 +14875,7 @@ function formatPlan(stackName, region, plan, opts = {}) {
|
|
|
14728
14875
|
const planByResource = /* @__PURE__ */ new Map();
|
|
14729
14876
|
for (const item of plan.items) {
|
|
14730
14877
|
const g = planByResource.get(item.logicalId);
|
|
14731
|
-
const humans = item.ops.map((op) => op.human);
|
|
14878
|
+
const humans = item.ops.filter((op) => !isContractOp(op)).map((op) => op.human);
|
|
14732
14879
|
if (g) g.humans.push(...humans);
|
|
14733
14880
|
else planByResource.set(item.logicalId, {
|
|
14734
14881
|
displayId: item.displayId,
|
|
@@ -14881,7 +15028,7 @@ async function revertStack(p) {
|
|
|
14881
15028
|
}
|
|
14882
15029
|
if (dryRun) {
|
|
14883
15030
|
const augmented = augment(plan);
|
|
14884
|
-
const opCount = augmented
|
|
15031
|
+
const opCount = realOpCount(augmented);
|
|
14885
15032
|
out(`\n(dry-run) would apply ${opCount} op(s) to ${augmented.items.length} resource(s). No changes made.`);
|
|
14886
15033
|
return {
|
|
14887
15034
|
exit: 0,
|
|
@@ -14919,7 +15066,7 @@ async function revertStack(p) {
|
|
|
14919
15066
|
}
|
|
14920
15067
|
}
|
|
14921
15068
|
const confirmPlan = augment(plan);
|
|
14922
|
-
const opCount = confirmPlan
|
|
15069
|
+
const opCount = realOpCount(confirmPlan);
|
|
14923
15070
|
const deleteCount = confirmPlan.items.filter((i) => i.kind === "delete").length;
|
|
14924
15071
|
const ok = await confirm({
|
|
14925
15072
|
message: revertConfirmMessage(stackName, region, opCount, plan.notRevertable.length, deleteCount),
|
|
@@ -16255,6 +16402,19 @@ function finalCheckExit(code, fail) {
|
|
|
16255
16402
|
* who can make the decision. It is gated OUT of every machine/automation mode:
|
|
16256
16403
|
* - --json / --show-all / --pre-deploy — machine output or baseline-untouched contracts,
|
|
16257
16404
|
* - --fail — the CI drift-exit path,
|
|
16405
|
+
* - #779: --declared-only / --undeclared-only — a SCOPE filter is active, so `findings`
|
|
16406
|
+
* has been reduced to one tier (declared-only drops the whole undeclared/added/atDefault
|
|
16407
|
+
* tier; undeclared-only drops declared plus its readGap/unresolved byproducts). The
|
|
16408
|
+
* interactive menu's Record path feeds THAT filtered set into writeBaseline, and
|
|
16409
|
+
* computeCompleteResources — which only blocks snapshot-completeness on the tiers that
|
|
16410
|
+
* were just filtered out (skipped/deleted/readGap/unrecorded-undeclared) — then stamps
|
|
16411
|
+
* every readable resource snapshot-complete with an INCOMPLETE `recorded` list. A later
|
|
16412
|
+
* plain `check` reads the genuinely-undeclared values on those "complete" resources as
|
|
16413
|
+
* "appeared since record" -> a false confirmed-drift storm (exit 1 under --fail). Under
|
|
16414
|
+
* --declared-only the HELP/in-run note also PROMISES the baseline is untouched, which the
|
|
16415
|
+
* Record offer would violate. A filtered finding set must never become a snapshot-complete
|
|
16416
|
+
* baseline, so no interactive Record/Revert is offered under either scope flag; the
|
|
16417
|
+
* standalone `record` verb (unfiltered) remains the way to establish one.
|
|
16258
16418
|
* - #1054: --yes — `--yes` has NO documented `check` contract (HELP scopes it to record /
|
|
16259
16419
|
* ignore / revert; check's automation flag is --fail / non-TTY). In the menu the USER is
|
|
16260
16420
|
* the decision-maker, but `--yes` means "no decision needed" in the record/ignore/revert
|
|
@@ -16264,7 +16424,7 @@ function finalCheckExit(code, fail) {
|
|
|
16264
16424
|
* Pure + exported for tests.
|
|
16265
16425
|
*/
|
|
16266
16426
|
function shouldOfferInteractiveResolve(a, ctx) {
|
|
16267
|
-
return (ctx.code === 1 || ctx.hasUnrecorded || !ctx.hasBaseline) && !a.json && !a.showAll && !a.preDeploy && !a.fail && !a.yes && ctx.interactive;
|
|
16427
|
+
return (ctx.code === 1 || ctx.hasUnrecorded || !ctx.hasBaseline) && !a.json && !a.showAll && !a.preDeploy && !a.fail && !a.yes && !a.declaredOnly && !a.undeclaredOnly && ctx.interactive;
|
|
16268
16428
|
}
|
|
16269
16429
|
/**
|
|
16270
16430
|
* #781: does a committed baseline exist for this stack IN THE REGION being checked?
|