You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clean up native Codegen staging directories - #60058
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-claBot
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
Thanks, @javache. generate-native-code-test.js is included in this PR with two cases: cleanup after successful generation and cleanup when generation throws. I checked the current Test All logs and the file passed on both Node 24 and Node 22.13.0.
Thanks for clarifying, @javache. I pushed fd8f70d using your codegen-utils mock. The test still checks that the generated file is copied and the staging directory is removed. Both cases pass with the built Codegen module unavailable.
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
CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.Shared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.
3 participants
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:
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
finallyblock 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:
scripts/generate-codegen-artifacts.jsfor 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.