fix(codegen): preserve hand-written directories during cleanStaleTargets#1256
Closed
pyramation wants to merge 2 commits into
Closed
fix(codegen): preserve hand-written directories during cleanStaleTargets#1256pyramation wants to merge 2 commits into
pyramation wants to merge 2 commits into
Conversation
removeStaleTargetDirs now checks for the @generated marker before deleting a directory. Directories that contain only hand-written code (e.g. config/, utils/ in constructive-cli) are preserved automatically. This fixes the schema-propagation workflow deleting sdk/constructive-cli support files (config/ and utils/) that cli-commands.ts depends on.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Drop a .generated sentinel file in each target dir during codegen. removeStaleTargetDirs checks for this sentinel (single fs.existsSync) instead of scanning .ts file contents for @generated markers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
removeStaleTargetDirs(added incleanStaleTargets) deleted any subdirectory not matching a codegen target — including hand-written dirs likeconfig/andutils/insdk/constructive-cli/src/. This broke PR #1255.Fix:
generate()now writes a.generatedsentinel file into each target output directory.removeStaleTargetDirschecks for this sentinel (fs.existsSync) before deleting — dirs without it are preserved. No file content scanning.On the first run after this lands, existing dirs won't have sentinels yet so nothing gets cleaned (safe — codegen overwrites them anyway). Subsequent runs work correctly.
Link to Devin session: https://app.devin.ai/sessions/e3d4f66d70624516b67179748093d772
Requested by: @pyramation