cdk-real-drift 0.7.0 → 0.7.1

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
@@ -5000,6 +5000,19 @@ function isSelfEchoTrivialEmpty(v, physicalId) {
5000
5000
  const rest = entries.filter(([, val]) => val !== physicalId);
5001
5001
  return rest.length < entries.length && rest.every(([, val]) => isTrivialEmpty(val));
5002
5002
  }
5003
+ const RDS_OPTION_SETTING_DEFAULTS = {
5004
+ SERVER_AUDIT: "FORCE_PLUS_PERMANENT",
5005
+ SERVER_AUDIT_LOGGING: "ON",
5006
+ SERVER_AUDIT_FILE_PATH: "/rdsdbdata/log/audit/"
5007
+ };
5008
+ function isIdentityOnlyHusk(el, idField) {
5009
+ return Object.entries(el).every(([k, v]) => k === idField || isTrivialEmpty(v));
5010
+ }
5011
+ function isRdsOptionSettingDefault(resourceType, el, name, value) {
5012
+ if (resourceType !== "AWS::RDS::OptionGroup") return false;
5013
+ if (isIdentityOnlyHusk(el, "Name")) return true;
5014
+ return name in RDS_OPTION_SETTING_DEFAULTS && value === RDS_OPTION_SETTING_DEFAULTS[name];
5015
+ }
5003
5016
  function isEmptyPolicyShell(v) {
5004
5017
  if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
5005
5018
  const o = v;
@@ -5682,8 +5695,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5682
5695
  const loName = String(loRec[nvSubsetSpec.nameField]);
5683
5696
  const loValue = loRec[nvSubsetSpec.valueField];
5684
5697
  const isFirehoseRetriesDefault = resourceType === "AWS::KinesisFirehose::DeliveryStream" && loName === "NumberOfRetries" && loValue === "3";
5698
+ const isRdsOptionDefault = isRdsOptionSettingDefault(resourceType, loRec, loName, loValue);
5685
5699
  findings.push({
5686
- tier: isFirehoseRetriesDefault ? "atDefault" : "undeclared",
5700
+ tier: isFirehoseRetriesDefault || isRdsOptionDefault ? "atDefault" : "undeclared",
5687
5701
  logicalId,
5688
5702
  resourceType,
5689
5703
  path: `${d.path}[${loName}]`,
@@ -15848,6 +15862,24 @@ function finalCheckExit(code, fail) {
15848
15862
  return fail || code !== 1 ? code : 0;
15849
15863
  }
15850
15864
  /**
15865
+ * Whether `check` should open its interactive after-report resolve menu (Record / Revert /
15866
+ * Ignore / Decide-per-finding). It fires only when there is something to act on (drift,
15867
+ * unrecorded values, or no baseline yet — R141's day-1 establish) AND the run is a TTY human
15868
+ * who can make the decision. It is gated OUT of every machine/automation mode:
15869
+ * - --json / --show-all / --pre-deploy — machine output or baseline-untouched contracts,
15870
+ * - --fail — the CI drift-exit path,
15871
+ * - #1054: --yes — `--yes` has NO documented `check` contract (HELP scopes it to record /
15872
+ * ignore / revert; check's automation flag is --fail / non-TTY). In the menu the USER is
15873
+ * the decision-maker, but `--yes` means "no decision needed" in the record/ignore/revert
15874
+ * sub-actions it threads into — so a `check --yes` in a TTY silently overrode explicit
15875
+ * per-finding choices (recorded / ignored / reverted values the user declined, including
15876
+ * folded values never shown in the report). Under --yes, check just reports.
15877
+ * Pure + exported for tests.
15878
+ */
15879
+ function shouldOfferInteractiveResolve(a, ctx) {
15880
+ return (ctx.code === 1 || ctx.hasUnrecorded || !ctx.hasBaseline) && !a.json && !a.showAll && !a.preDeploy && !a.fail && !a.yes && ctx.interactive;
15881
+ }
15882
+ /**
15851
15883
  * #781: does a committed baseline exist for this stack IN THE REGION being checked?
15852
15884
  * A committed baseline is named `<stackName>.<accountId>.<region>.json` under
15853
15885
  * `.cdkrd/baselines/`. The gone stack's ACCOUNT is unknown without an STS call, so it
@@ -16092,7 +16124,12 @@ async function runCheck(args) {
16092
16124
  expandAtDefault: a.showAll
16093
16125
  });
16094
16126
  const hasUnrecorded = reconciled.some((f) => f.unrecorded === true);
16095
- if ((code === 1 || hasUnrecorded || !baseline) && !a.json && !a.showAll && !a.preDeploy && !a.fail && isInteractive()) code = await resolveInteractively({
16127
+ if (shouldOfferInteractiveResolve(a, {
16128
+ code,
16129
+ hasUnrecorded,
16130
+ hasBaseline: baseline !== void 0,
16131
+ interactive: isInteractive()
16132
+ })) code = await resolveInteractively({
16096
16133
  stackName,
16097
16134
  region,
16098
16135
  desired,