Skip to content

fix(cli): treat cancelled context as terminal in engine-version fan-out - #2139

Open
cristim wants to merge 2 commits into
mainfrom
fix/ctx-cancel-terminal-engine-versions
Open

cristim wants to merge 2 commits into
mainfrom
fix/ctx-cancel-terminal-engine-versions

Conversation

@cristim

@cristim cristim commented Oct 7, 2026

Copy link
Copy Markdown
Member

Why

queryMajorEngineVersionsWithClient downgraded every per-engine error to a
warning, so a cancelled context or expired deadline produced a partial
version map with a nil error. Callers then treated incomplete
extended-support data as a complete query — the exact silent-partial-result
class flagged before on this codebase (PR #1225 surfaced this instance).

What

  • The per-engine loop checks ctx.Err() before each engine and after each
    failed fetch; a cancelled caller context returns nil plus the context
    error instead of continuing the fan-out.
  • Detection uses the caller's ctx.Err(), not errors.Is on the API
    error: the AWS SDK wraps its own internal timeouts (credential-fetch
    deadlines) as context.DeadlineExceeded, and those must still degrade to
    the pre-existing per-engine warning.

Tests

New cases in cmd/multi_service_engine_versions_paginate_test.go:

  • bare context.Canceled mid-fan-out stops after the first engine
  • SDK-wrapped (%w) context.Canceled behaves the same
  • expired deadline fails fast with zero API calls
  • already-cancelled context fails fast with zero API calls

Full cmd package suite green locally (ok ... 459s), gofmt/go vet/
pre-commit hooks clean. Test evidence is mock-based; the fan-out loop has no
real-AWS path to exercise locally.

Closes #1325

queryMajorEngineVersionsWithClient downgraded every per-engine error to a
warning, so a cancelled context or expired deadline produced a partial
version map with a nil error and callers treated it as a complete query.

The loop now checks ctx.Err() before each engine and after each failed
fetch, returning nil plus the context error instead of continuing. The
caller's context is checked rather than the wrapped API error so
SDK-internal timeouts (e.g. credential-fetch deadlines) still degrade to
the pre-existing per-engine warning.

Closes #1325
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 16 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 68 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-cli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 91eb7fc3-5297-4865-8be5-ed95a7f1a16c
📥 Commits

Reviewing files that changed from the base of the PR and between ad57326 and 7d9bfc0.

📒 Files selected for processing (2)
  • cmd/multi_service_engine_versions.go
  • cmd/multi_service_engine_versions_paginate_test.go
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-quarter Within the quarter impact/internal Team-internal only 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.

… lint

The golangci-lint misspell and unconvert checks flagged the #1325 test
additions (British "cancelled" spellings, error() conversion of
context.Canceled). No behavior change.

Refs #1325

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/internal Team-internal only 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.

ctx.Canceled silently swallowed in queryMajorEngineVersionsWithClient (surfaced by PR #1225)

1 participant