Fix #4113: Move relPath & newContent checks in writeToFileTool earlie… #4378
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #4113
Description
Fix tool writeToFile with missing or empty path or missing content.
Checks earlier right after waiting for path & content parameters to be populated, so when block is non-partial, they immediately check instead of later.
This is required as alot of code after requires both to be valid.
Additional unit tests are added to cover these scenarios.
Future work should probably separate partial from non-partial-block logic and modularize the big function for reduced code-complexity.
Test Procedure
Type of Change
Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).Screenshots / Videos
Documentation Updates
Additional Notes
N/A
Get in Touch
Discord:
ruakijImportant
Moves parameter validation earlier in
writeToFileToolto handle missing or emptypathandcontentimmediately, with new tests added.relPathandnewContentchecks earlier inwriteToFileToolto immediately handle missing or empty parameters.writeToFileToolreturns early ifpathorcontentis missing or empty, preventing further processing.writeToFileTool.test.tsto verify behavior whenpathorcontentis missing or empty.This description was created by
for 37fb18d. You can customize this summary. It will automatically update as commits are pushed.