Skip to content

fix(python): add hard-coded keep list for Spanner migration#5210

Merged
jskeet merged 2 commits intogoogleapis:mainfrom
jskeet:spanner-keep-list
Apr 8, 2026
Merged

fix(python): add hard-coded keep list for Spanner migration#5210
jskeet merged 2 commits intogoogleapis:mainfrom
jskeet:spanner-keep-list

Conversation

@jskeet
Copy link
Copy Markdown
Contributor

@jskeet jskeet commented Apr 8, 2026

The "hard-coded keep list" mechanism which was previously only used for Firestore is now generalized to a map from library name to keep list. We may well only find that it's Spanner and Firestore that need this, but it felt like "1 to 2" was the time to generalize.

There's no specific test for Spanner, but the existing test for Firestore ensures that the mechanism works, and local testing shows that this keep list is currently sufficient to avoid deleting files during generation.

The "hard-coded keep list" mechanism which was previously only used
for Firestore is now generalized to a map from library name to keep
list. We may well only find that it's Spanner and Firestore that need
this, but it felt like "1 to 2" was the time to generalize.

There's no specific test for Spanner, but the existing test for
Firestore ensures that the mechanism works, and local testing shows
that this keep list is currently sufficient to avoid deleting files
during generation.
@jskeet jskeet requested a review from JoeWang1127 April 8, 2026 07:31
@jskeet jskeet requested a review from a team as a code owner April 8, 2026 07:31
Copy link
Copy Markdown
Contributor

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

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 Python migration tool to use a centralized map, pythonExtraKeepLists, for managing library-specific files that should be preserved during migration. This replaces hardcoded logic for the Firestore library and adds a new keep list for the Spanner library. The review feedback recommends using more idiomatic Go by omitting redundant type specifications in the map's composite literals.

Comment thread tool/cmd/migrate/python.go Outdated
Comment thread tool/cmd/migrate/python.go Outdated
Copy link
Copy Markdown
Contributor

@JoeWang1127 JoeWang1127 left a comment

Choose a reason for hiding this comment

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

It would be nice to have a test verified the list is added to the library config.

@jskeet
Copy link
Copy Markdown
Contributor Author

jskeet commented Apr 8, 2026

It would be nice to have a test verified the list is added to the library config.

That would kinda be like having a test for each change to the api.go back when that was mostly data. We've got a test that shows it's added for Firestore; having a Spanner-specific one feels like overkill.

Will merge now, but if you feel strongly about it we can revisit it. (I'm hoping to delete this code within 2 weeks though...)

@jskeet jskeet merged commit 3a5262b into googleapis:main Apr 8, 2026
18 checks passed
@jskeet jskeet deleted the spanner-keep-list branch April 8, 2026 13:03
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.

2 participants