Skip to content

Clean up native Codegen staging directories - #60058

Open
jipeng6036-del wants to merge 1 commit into
react:mainfrom
jipeng6036-del:fix/codegen-clean-up-temporary-artifacts
Open

jipeng6036-del wants to merge 1 commit into
react:mainfrom
jipeng6036-del:fix/codegen-clean-up-temporary-artifacts

Conversation

@jipeng6036-del

Copy link
Copy Markdown

Summary:

Fixes #60057. The Codegen executor stages each library's generated files in a temporary directory and copies them to the configured output. Repeated invocations leave those staging directories behind. Remove the fresh staging directory in a finally block so it is cleaned up after both successful generation and a generator error.

Thanks to @YevheniiKotyrlo for the CLI reproducer and the build observations. I used Codex to help implement and verify the fix.

Changelog:

[GENERAL] [FIXED] - Clean up temporary native Codegen artifacts after generation.

Test Plan:

  • Both new regression tests failed on the base revision and passed with the change. They cover successful generation and a generator error.
  • Ran scripts/generate-codegen-artifacts.js for a minimal iOS module fixture on Windows. The three generated files were byte-for-byte identical before and after the fix, and the temporary directory went from one leftover entry to zero.
  • The broader Codegen Jest run on Windows passed 53 tests. The same two podspec snapshots fail on the base and on this branch because they expect POSIX path separators.
  • ESLint and Prettier passed for both changed files.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 16, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codegen leaves one folder per library in $TMPDIR on every pod install and Xcode build: generateCode never removes its mkdtempSync folder

1 participant