From 86d741cefe7447d9450b43023112a9831417e07e Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Tue, 5 May 2026 16:09:09 +0000 Subject: [PATCH 1/2] fix(node): exclude test fixtures from post-processing Excludes `core/generator/gapic-generator-typescript/test-fixtures` from directory traversal in `node_mono_repo.py` to prevent the post-processor from re-adding them to `release-please-config.json`. See https://github.com/googleapis/google-cloud-node/pull/8171 for an example of the issue. --- synthtool/languages/node_mono_repo.py | 1 + tests/test_node_mono_repo.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/synthtool/languages/node_mono_repo.py b/synthtool/languages/node_mono_repo.py index 46cfd3bc5..d4e36cd99 100644 --- a/synthtool/languages/node_mono_repo.py +++ b/synthtool/languages/node_mono_repo.py @@ -482,6 +482,7 @@ def walk_through_owlbot_dirs(dir: Path, search_for_changed_files: bool): packages_to_exclude = [ r"packages/gapic-node-processing/templates/bootstrap-templates", r"node_modules", + r"core/generator/gapic-generator-typescript/test-fixtures", ] if search_for_changed_files: try: diff --git a/tests/test_node_mono_repo.py b/tests/test_node_mono_repo.py index c9e7880a1..a14fe2bbd 100644 --- a/tests/test_node_mono_repo.py +++ b/tests/test_node_mono_repo.py @@ -509,6 +509,33 @@ def test_walk_through_owlbot_dirs_handwritten(mock_subproc_popen): assert any(re.search("handwritten/dlp", d) for d in owlbot_dirs) +@patch("subprocess.run") +def test_walk_through_owlbot_dirs_excluded(mock_subproc_popen): + process_mock = Mock() + attrs = {"communicate.return_value": ("output", "error")} + process_mock.configure_mock(**attrs) + mock_subproc_popen.return_value = process_mock + + with util.copied_fixtures_dir( + FIXTURES / "nodejs_mono_repo_with_staging" + ) as workdir: + excluded_dir = workdir / "core" / "generator" / "gapic-generator-typescript" / "test-fixtures" / "speech" + excluded_dir.mkdir(parents=True) + (excluded_dir / ".OwlBot.yaml").touch() + + regular_dir = workdir / "core" / "generator" / "gapic-generator-typescript" + regular_dir.mkdir(parents=True) + (regular_dir / ".OwlBot.yaml").touch() + + owlbot_dirs = node_mono_repo.walk_through_owlbot_dirs( + workdir, search_for_changed_files=False + ) + + assert not mock_subproc_popen.called + assert any(re.search("core/generator/gapic-generator-typescript$", d) for d in owlbot_dirs) + assert not any(re.search("core/generator/gapic-generator-typescript/test-fixtures/speech", d) for d in owlbot_dirs) + + @patch("subprocess.run") def test_walk_through_owlbot_dirs_no_staging(mock_subproc_popen): process_mock = Mock() From 2c859cb5b12edf29fc5bb3950d628537581eff31 Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Tue, 5 May 2026 16:17:55 +0000 Subject: [PATCH 2/2] fixup tests --- tests/test_node_mono_repo.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/test_node_mono_repo.py b/tests/test_node_mono_repo.py index a14fe2bbd..fdb2dd08b 100644 --- a/tests/test_node_mono_repo.py +++ b/tests/test_node_mono_repo.py @@ -519,12 +519,19 @@ def test_walk_through_owlbot_dirs_excluded(mock_subproc_popen): with util.copied_fixtures_dir( FIXTURES / "nodejs_mono_repo_with_staging" ) as workdir: - excluded_dir = workdir / "core" / "generator" / "gapic-generator-typescript" / "test-fixtures" / "speech" + excluded_dir = ( + workdir + / "core" + / "generator" + / "gapic-generator-typescript" + / "test-fixtures" + / "speech" + ) excluded_dir.mkdir(parents=True) (excluded_dir / ".OwlBot.yaml").touch() regular_dir = workdir / "core" / "generator" / "gapic-generator-typescript" - regular_dir.mkdir(parents=True) + regular_dir.mkdir(parents=True, exist_ok=True) (regular_dir / ".OwlBot.yaml").touch() owlbot_dirs = node_mono_repo.walk_through_owlbot_dirs( @@ -532,8 +539,17 @@ def test_walk_through_owlbot_dirs_excluded(mock_subproc_popen): ) assert not mock_subproc_popen.called - assert any(re.search("core/generator/gapic-generator-typescript$", d) for d in owlbot_dirs) - assert not any(re.search("core/generator/gapic-generator-typescript/test-fixtures/speech", d) for d in owlbot_dirs) + assert any( + re.search("core/generator/gapic-generator-typescript$", d) + for d in owlbot_dirs + ) + assert not any( + re.search( + "core/generator/gapic-generator-typescript/test-fixtures/speech", + d, + ) + for d in owlbot_dirs + ) @patch("subprocess.run")