fix: fail fast on missing project create dependencies - #2178
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice tight fix. Moving checkCreateDependencies ahead of projectTree.write(destination) correctly ensures a missing dependency fails before any files are scaffolded, and the new negative-path test (fails before writing files or running npm when a later dependency is missing) locks that behavior in by asserting commands === [] and that the target directory was never created.
A few things I verified while reviewing:
createProjectTreebuilds an in-memoryFsTreeNodeand does no I/O, so running the pre-flight check betweencreateProjectTreeandprojectTree.writeis safe.- The upfront check keys off
scaffoldRuntimeInput?.language === "Python"foruv, whileinstallRuntimeDependenciesre-checks based onpyproject.tomlexistence. The redundant late check is harmless and preserves the existing safety net if the two ever drift. - Harness-only paths correctly only check
npm+gitupfront (the harness scaffold path does no external commands until the shared npm-install/git-init steps). - Tests use real temp dirs and only stub
runner/checkToolat the process boundary — no excessive mocking. - No telemetry needed; this is a bug fix, not a new user-facing feature.
Nothing blocking.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2178 +/- ##
=========================================
Coverage 97.08% 97.08%
=========================================
Files 536 536
Lines 36979 36996 +17
=========================================
+ Hits 35901 35918 +17
Misses 1078 1078 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| ); | ||
|
|
||
| // Validate required tools exist before starting creation flow | ||
| await this.checkCreateDependencies(input); |
There was a problem hiding this comment.
do we need a similar check in the add runtime flow? I believe right now we'll fail after writing files if uv/npm is missing based on the code:
agentcore-cli/src/core/project/manager.tsx
Lines 338 to 343 in a24c744
There was a problem hiding this comment.
Good call out. Just updated the PR with a check for this flow as well
|
Claude Security Review: no high-confidence findings. (run) |
| ); | ||
| } | ||
|
|
||
| if (input.resourceType === "runtime") { |
There was a problem hiding this comment.
nit: could this be inside the switch to avoid the extra branching?
Hoping to clean this up anyway, so I say we merge and comeback.
1a89e33 to
d86d07a
Compare
|
Claude Security Review: no high-confidence findings. (run) |
Description
Add preflight dependency check to
agentcore createflow. This change prevents a project scaffolding and a full NPM install from occurring before failing onuvmissing.Create now validates required tools exist before scaffolding project files or starting installation.
npmwhen dependency installation is enableduvfor Python runtime templatesgitwhen repository init is enabledType of Change
Testing
How have you tested the change?
bun run test(2790 pass, 0 fail)npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.