Skip to content

fix(deploy): fail fast on AWS account mismatch#1787

Merged
notgitika merged 3 commits into
mainfrom
fix/deploy-account-mismatch
Jul 23, 2026
Merged

fix(deploy): fail fast on AWS account mismatch#1787
notgitika merged 3 commits into
mainfrom
fix/deploy-account-mismatch

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Summary

  • validate that active AWS credentials belong to the selected deployment target account
  • run the check during preflight, before CDK build, synth, and asset publishing
  • apply the same validation to CLI and TUI teardown deploys after confirmation
  • preserve existing credential validation behavior for callers without a deployment target

The account comparison is integrated into validateAwsCredentials, so credential validity and target ownership are checked with one STS GetCallerIdentity request. Mismatches now name both account IDs and the selected target instead of surfacing later as a generic CDK asset publishing error.

Testing

  • npx vitest run --project unit src/cli/aws/__tests__/account-extended.test.ts src/cli/operations/deploy/__tests__/preflight.test.ts src/cli/commands/deploy/__tests__/deploy-teardown.test.ts
  • npm run typecheck
  • focused ESLint and Prettier checks
  • npm run build

Fixes #761

@notgitika
notgitika requested a review from a team July 17, 2026 02:20
@github-actions github-actions Bot added the size/s PR size: S label Jul 17, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 17, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 17, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 17, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.24.2.tgz

How to install

gh release download pr-1787-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.24.2.tgz

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 40.31% 15049 / 37333
🔵 Statements 39.56% 16039 / 40535
🔵 Functions 34.42% 2567 / 7457
🔵 Branches 33.71% 10022 / 29728
Generated in workflow #4196 for commit c7cd0af by the Vitest Coverage Report Action

Comment thread src/cli/tui/hooks/useCdkPreflight.ts Outdated
@github-actions github-actions Bot added size/m PR size: M and removed size/s PR size: S labels Jul 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 2026
…target

# Conflicts:
#	src/cli/tui/hooks/useCdkPreflight.ts
#	src/cli/tui/screens/deploy/useDeployFlow.ts
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Jul 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 2026
@notgitika
notgitika merged commit 68ceecc into main Jul 23, 2026
33 checks passed
@notgitika
notgitika deleted the fix/deploy-account-mismatch branch July 23, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better error handling during deploy for valid creds but for a different account

2 participants