Skip to content

fix(cdk): conditionally pass harnesses prop for CDK construct compat#1248

Merged
jesseturner21 merged 1 commit into
previewfrom
fix/cdk-harness-compat
May 14, 2026
Merged

fix(cdk): conditionally pass harnesses prop for CDK construct compat#1248
jesseturner21 merged 1 commit into
previewfrom
fix/cdk-harness-compat

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Summary

Fixes e2e http-gateway-targets.test.ts failure on both npm and main CDK variants.

Preview's vended cdk-stack.ts passes harnesses to AgentCoreApplication, but the npm-published @aws/agentcore-cdk package doesn't have this prop in its TypeScript interface. With strict: true, the CDK app fails to compile during synth, producing no stack — then deploy errors with NoStack: CloudFormationStack object does not hold a stack.

Fix: build the AgentCoreApplication props dynamically and cast, so the harnesses property is only present when harnesses are actually configured.

Test plan

  • E2E http-gateway-targets.test.ts passes on both npm and main variants

The vended cdk-stack.ts passes `harnesses` to AgentCoreApplication, but
the npm-published @aws/agentcore-cdk package doesn't have this prop in
its interface. TypeScript strict mode rejects the unknown property at
compile time, causing synth to fail and deploy to error with "NoStack".

Fix by building props dynamically and casting, so the property is only
present when harnesses are configured.
@notgitika notgitika requested a review from a team May 14, 2026 15:11
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.54% 10037 / 23049
🔵 Statements 42.8% 10665 / 24913
🔵 Functions 40.4% 1692 / 4188
🔵 Branches 40.28% 6513 / 16166
Generated in workflow #2959 for commit 4be00c4 by the Vitest Coverage Report Action

@agentcore-cli-automation agentcore-cli-automation left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fix looks correct — pragmatic workaround for the npm-published @aws/agentcore-cdk not yet exposing harnesses in its props type. Snapshot is in sync with the vended file. No blocking issues from my side.

One minor observation (non-blocking): the // eslint-disable-next-line @typescript-eslint/no-explicit-any comment on line 60/62 sits above const appProps: Record<string, unknown> = { spec };, but the as any it's meant to silence is on the new AgentCoreApplication(...) line a few lines below. Today this is harmless because src/assets is excluded from this repo's ESLint and the vended CDK project has no lint script — but if a downstream user adds linting with @typescript-eslint/no-explicit-any enabled, the comment won't disable the right line. Easy follow-up: move the comment directly above this.application = new AgentCoreApplication(...), or keep the original prop literal and just append as any to it (which would be shorter overall).

Worth considering a TODO/FIXME pointing at this so it can be ripped out once the npm package gains the harnesses prop.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 14, 2026
@jesseturner21 jesseturner21 merged commit 681700f into preview May 14, 2026
17 checks passed
@jesseturner21 jesseturner21 deleted the fix/cdk-harness-compat branch May 14, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants