fix(cli): signal unknown extended-support lifecycle instead of silent false by cristim · Pull Request #2138 · LeanerCloud/cloud-commitments-cli · GitHub
Skip to content

fix(cli): signal unknown extended-support lifecycle instead of silent false - #2138

Merged
cristim merged 1 commit into
mainfrom
fix/extended-support-unknown-lifecycle
Oct 7, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/extended-support-unknown-lifecycle

Conversation

@cristim

@cristim cristim commented Oct 7, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #1313.

isInExtendedSupport silently returned false when the engine:majorVersion key was missing from the lifecycle map. On the money path through adjustRecommendationForExcludedVersions, a partial DescribeDBMajorEngineVersions response or an unmapped engine turned the extended-support exclusion into a silent no-op: instances accruing extended-support fees stayed in the RI/SP purchase count.

Changes

  • isInExtendedSupport now returns (extended, known bool); known=false when the major version can't be extracted or the lookup misses, so "unknown" is distinguishable from "known: not extended".
  • adjustRecommendationForExcludedVersions treats unknown as a hard skip (per the issue's suggested fix): the count stays untouched, and a warning naming engine, version and region is logged once per engine:version pair.
  • Per-instance classification extracted into shouldExcludeForExtendedSupport to keep both functions under the pre-commit gocyclo cap (10); the duplicated inline engine-normalization closure was replaced with the existing normalizeEngineNameForVersion.
  • Tests: TestIsInExtendedSupport and TestIsInExtendedSupport_EdgeCases now assert the known flag on every case; new TestAdjustRecommendationForExcludedVersions_UnknownLifecycle pins the lookup-miss contract (count untouched, warning content, per-version dedup).

Out of scope

Audit finding A10-013 (noted on the issue): making queryRDSInstancesInRegions / queryMajorEngineVersionsWithClient error when every region/engine query fails, and aborting a --purchase run when the lifecycle signal is unavailable. That's a larger change to the query/purchase flow; this PR closes the silent-fallback contract the issue's acceptance criteria cover.

Verification

  • gofmt, go vet, go build ./cmd clean
  • go test ./cmd/ -run 'TestIsInExtendedSupport|TestAdjustRecommendationForExcludedVersions' green
  • Full go test ./... green locally (macOS, go1.27.1)
  • Pre-commit hooks all pass (incl. gocyclo cap 10, gosec, git-secrets)
  • Local golangci-lint (2.11.4, built with go1.26.1) crashes against the installed go1.27.1 toolchain — pre-existing environment mismatch, not caused by this change; CI runs its own pinned lint.

Fixture/mock-based evidence only; no live AWS calls were made.

… false

isInExtendedSupport silently returned false when the engine:majorVersion
key was missing from the lifecycle map, so a partial
DescribeDBMajorEngineVersions response or an unmapped engine made the
extended-support exclusion a silent no-op on a money path: instances
accruing extended-support fees stayed in the RI/SP purchase count.

- isInExtendedSupport now returns (extended, known); known=false when the
  major version can't be extracted or the lookup misses
- adjustRecommendationForExcludedVersions treats unknown as a hard skip:
  the count stays untouched and a warning naming engine, version and
  region is logged once per engine:version pair
- tests pin the new contract for the lookup-miss path, including the
  warning's content and per-version deduplication

Closes #1313
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-quarter Within the quarter impact/few Limited audience effort/s Hours type/bug Defect triaged Item has been triaged labels Oct 7, 2026
@cristim

cristim commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your current included review allowance is based on your included PR review attempts over the past 7 days. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 18 minutes.

@cristim

cristim commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

@cristim
cristim merged commit ab81cfa into main Oct 7, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isInExtendedSupport silently returns false on lifecycle lookup miss (money path)

1 participant