Skip to content

fix(nodejs): run combine-library with a temporary destination#6262

Draft
jskeet wants to merge 2 commits into
googleapis:mainfrom
jskeet:node-copy-fs
Draft

fix(nodejs): run combine-library with a temporary destination#6262
jskeet wants to merge 2 commits into
googleapis:mainfrom
jskeet:node-copy-fs

Conversation

@jskeet

@jskeet jskeet commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Instead of backing up "kept" files, combine-library is run with a temporary directory as the destination, relying on the "clean" operation in librarian to perform deletions. os.CopyFS is then used to copy the resulting combined library, which means that any file which hasn't been cleaned but is still generated causes a failure. (This improves confidence that we're cleaning everything we should.)

OwlBot YAML file removal is removed from generate, as it already happens as part of the clean operation.

With this change, no default keep list is required, as there is a cleaner separation between generated and handwritten files.

@jskeet jskeet requested a review from quirogas June 2, 2026 10:25
@jskeet jskeet requested a review from a team as a code owner June 2, 2026 10:25
@jskeet

jskeet commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@quirogas I haven't changed any tests here beyond removing the OwlBot one - TestRunPostProcessor_PreservesFiles may no longer be necessary; feedback on that is welcome.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Node.js post-processing and cleaning logic, modifying which files are cleaned and running combine-library in a temporary directory before copying files back using os.CopyFS. Feedback highlights critical issues with this approach: running combine-library in an empty directory prevents it from merging with the existing package.json, which will destroy handwritten changes, and os.CopyFS will silently overwrite existing files instead of failing as expected.

Comment thread internal/librarian/nodejs/generate.go
@jskeet jskeet marked this pull request as draft June 2, 2026 10:28
Comment thread internal/librarian/nodejs/clean.go
Instead of backing up "kept" files, combine-library is run with a
temporary directory as the destination, relying on the "clean"
operation in librarian to perform deletions. `os.CopyFS` is then used
to copy the resulting combined library, which means that any file
which hasn't been cleaned but is still generated causes a failure.
(This improves confidence that we're cleaning everything we should.)

The README.md that's generated is then modified to have the correct
release level and samples.

OwlBot YAML file removal is removed from generate, as it already
happens as part of the clean operation.

With this change, no default keep list is required, as there is a
cleaner separation between generated and handwritten files.
@jskeet jskeet force-pushed the node-copy-fs branch 2 times, most recently from 7d67623 to b31b9f8 Compare June 16, 2026 10:41
This doesn't yet test that the post-processor actually fixes up the
README file, but it stops the existing tests from failing.
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