Skip to content

fix(codegen): use .targets manifest for stale target cleanup#1257

Merged
pyramation merged 1 commit into
mainfrom
fix/clean-stale-targets
Jun 1, 2026
Merged

fix(codegen): use .targets manifest for stale target cleanup#1257
pyramation merged 1 commit into
mainfrom
fix/clean-stale-targets

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

removeStaleTargetDirs was deleting every subdirectory not in the current target list — including hand-written dirs (config/, utils/) that aren't codegen targets. This broke constructive-cli during schema propagation.

Fix: generateMulti now writes a .targets manifest (JSON array of target names) to the output root after successful generation. removeStaleTargetDirs reads this manifest to scope deletions — only directories listed in the previous manifest but absent from the current target list are removed. Dirs not in the manifest (hand-written code) are never touched.

On the first run after this lands, no manifest exists yet → nothing gets cleaned (safe, codegen overwrites its own output anyway). Subsequent runs work correctly.

Link to Devin session: https://app.devin.ai/sessions/e3d4f66d70624516b67179748093d772
Requested by: @pyramation

removeStaleTargetDirs now reads a .targets manifest (written by
generateMulti after successful output) to know which directories
were previously generated. Only those are eligible for removal.
Hand-written directories like config/ and utils/ are never touched.
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation pyramation merged commit bb8a450 into main Jun 1, 2026
38 checks passed
@pyramation pyramation deleted the fix/clean-stale-targets branch June 1, 2026 06:58
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.

1 participant