Skip to content

feat(project): add CDK Toolkit adapter - #2057

Merged
tejaskash merged 2 commits into
refactorfrom
feat/project-cdk-toolkit
Aug 24, 2026
Merged

feat(project): add CDK Toolkit adapter#2057
tejaskash merged 2 commits into
refactorfrom
feat/project-cdk-toolkit

Conversation

@notgitika

@notgitika notgitika commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a backend-local adapter for @aws-cdk/toolkit-lib
  • load the Toolkit lazily and route notifications through the existing logger at debug level
  • keep the Toolkit external in the npm bundle
  • add direct adapter tests without activating deployment

Stack

This is PR 3 of 4 decomposing #2001. The adapter is backend-local rather than part of shared io. Review and merge bottom-up.

  1. refactor(project): move build behind a project backend #2055 - backend build boundary
  2. feat(project): add deploy command contract #2056 - deploy command contract
  3. feat(project): add CDK Toolkit adapter #2057 - CDK Toolkit adapter (this PR)
  4. feat(project): implement safe CDK deployment #2058 - safe deployment implementation

typecheck, lint, format, test all pass

@github-actions github-actions Bot added the size/xl PR size: XL label Aug 20, 2026
@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress size/xl PR size: XL and removed size/xl PR size: XL agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 20, 2026
@notgitika
notgitika marked this pull request as ready for review August 20, 2026 04:12
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from a3da8e2 to 000e3b8 Compare August 20, 2026 04:19
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Aug 20, 2026
@notgitika
notgitika marked this pull request as draft August 20, 2026 04:19
@notgitika
notgitika marked this pull request as ready for review August 20, 2026 04:24
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Aug 20, 2026
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from 000e3b8 to ef1f731 Compare August 20, 2026 17:06
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Aug 20, 2026
Comment thread src/core/project/backends/cdk/toolkit.ts
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from ef1f731 to c4723b3 Compare August 21, 2026 16:01
@codecov-commenter

codecov-commenter commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.26%. Comparing base (fee25e2) to head (9750c4e).

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2057   +/-   ##
=========================================
  Coverage     97.25%   97.26%           
=========================================
  Files           397      398    +1     
  Lines         24125    24192   +67     
=========================================
+ Hits          23463    23530   +67     
  Misses          662      662           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from c4723b3 to 6c52205 Compare August 21, 2026 16:16
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from 6c52205 to 8b9d408 Compare August 21, 2026 17:41
Comment thread scripts/build.ts
Comment thread src/core/project/backends/cdk/toolkit.ts
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from 8b9d408 to 33e58a0 Compare August 21, 2026 18:12
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from 33e58a0 to d5e69ff Compare August 21, 2026 18:21
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from d5e69ff to 5cc76e5 Compare August 24, 2026 14:59
Base automatically changed from feat/project-deploy-contract to refactor August 24, 2026 16:01
PATTERN_MUST_MATCH_SINGLE throws unless the pattern matches exactly one
stack, so an absent result was never "no match". The Toolkit skips a
stack whose synthesized template has no resources, and deletes it if a
stack of that name already exists — both return normally with no stacks.
`?? {}` turned that into a successful deploy with no outputs, so a caller
expecting RuntimeArn got undefined with nothing explaining why.

Assert exactly one stack and name both possibilities in the error,
keeping `?? {}` only for a stack that deployed but declares no outputs.
Both paths are now covered; the fake toolkit takes the stack list so the
resource-less case is reachable from a test.

Also narrows the `external` comment in scripts/build.ts: it describes the
npm bundle only. compile() cannot mark the Toolkit external because a
standalone binary ships no node_modules, so Bun inlines it and rewrites
__dirname to the build machine's path — which resolves on the builder and
fails everywhere else.
@notgitika
notgitika force-pushed the feat/project-cdk-toolkit branch from 5cc76e5 to 9750c4e Compare August 24, 2026 16:01
}

/** Loads the Toolkit only when a deploy operation needs it. */
export const loadCdkToolkit: CdkToolkitLoader = async (ioHost, region) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how this is loaded lazily.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I had my agent test the latency with the static import and it was quite a bit higher. thanks!

@tejaskash
tejaskash merged commit 1a297be into refactor Aug 24, 2026
11 checks passed
@tejaskash
tejaskash deleted the feat/project-cdk-toolkit branch August 24, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants