Skip to content

fix(project): refuse nested project creation and model embedded-asset error - #1875

Merged
tejaskash merged 1 commit into
refactorfrom
fix/1809-nested-project-followups
Jul 30, 2026
Merged

fix(project): refuse nested project creation and model embedded-asset error#1875
tejaskash merged 1 commit into
refactorfrom
fix/1809-nested-project-followups

Conversation

@tejaskash

@tejaskash tejaskash commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Post-review follow-ups from #1809

  • Modeled error for missing embedded assetsEmbeddedAssetSource.read now throws EmbeddedAssetNotFoundError (extends AgentCoreCLIError, internal source, assetPath in meta) instead of a bare Error.
  • Refuse nested project creationFsProjectManager.create now walks up from the working directory looking for the agentcore/agentcore.json project marker and throws a modeled NestedProjectError (user source) if one is found, instead of scaffolding a project inside an existing one.

The "child lifted to root" behavior seen with bun run start is a bun run artifact — bun chdirs to the package root before running the script, so the child was created next to root rather than inside it. A compiled/linked binary would have nested the child inside root. Either way, nesting a project inside a project would confuse project resolution, so create now refuses it explicitly.

Testing

  • New test: creating a project from inside an existing project rejects with NestedProjectError.
  • Updated test: missing embedded asset rejects with EmbeddedAssetNotFoundError.
  • Full suite: 509 pass, 0 fail. tsc --noEmit and Prettier clean.
  • Manual: project create --project-name child from inside a scaffolded root project prints Error: cannot create a project inside an existing AgentCore project (found .../root/agentcore/agentcore.json) and exits 1.

@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Jul 30, 2026
… error

Post-review follow-ups from #1809:
- EmbeddedAssetSource.read now throws a modeled EmbeddedAssetNotFoundError
  instead of a bare Error.
- project create now walks up from cwd for an agentcore/agentcore.json
  marker and throws a modeled NestedProjectError (USER source) instead of
  scaffolding a project inside an existing one.
@tejaskash
tejaskash force-pushed the fix/1809-nested-project-followups branch from 557820c to 22afd02 Compare July 30, 2026 18:36
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.86%. Comparing base (8e2cecf) to head (22afd02).

Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #1875      +/-   ##
============================================
+ Coverage     95.85%   95.86%   +0.01%     
============================================
  Files           198      198              
  Lines          9341     9368      +27     
============================================
+ Hits           8954     8981      +27     
  Misses          387      387              

☔ 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.

@aidandaly24 aidandaly24 left a comment

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.

This looks good to me. I think it's a good choice to keep the Errors inside the files that they are used until we see more use cases for them across the package.

@tejaskash
tejaskash merged commit c7f857b into refactor Jul 30, 2026
8 checks passed
@tejaskash
tejaskash deleted the fix/1809-nested-project-followups branch July 30, 2026 21:27
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.

4 participants