From dc989f8470bfbdfd2ec116488051c3b3fc753436 Mon Sep 17 00:00:00 2001 From: Maintenance Date: Tue, 24 Nov 2026 12:40:59 -0800 Subject: [PATCH] Honor explicit catalog checkout paths --- src/github_repo_auditor/portfolio_catalog.py | 4 ++- tests/test_portfolio_catalog_truth_hunt.py | 27 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/test_portfolio_catalog_truth_hunt.py diff --git a/src/github_repo_auditor/portfolio_catalog.py b/src/github_repo_auditor/portfolio_catalog.py index 6546f55d..b34d7aa2 100644 --- a/src/github_repo_auditor/portfolio_catalog.py +++ b/src/github_repo_auditor/portfolio_catalog.py @@ -522,7 +522,9 @@ def catalog_entry_for_repo( basename_matches = [ entry for key, entry in repos.items() - if "/" in key and key.rsplit("/", 1)[-1] == normalized_repo_name + if not normalized_project_path + and "/" in key + and key.rsplit("/", 1)[-1] == normalized_repo_name ] if normalized_repo_name and len(basename_matches) == 1: return { diff --git a/tests/test_portfolio_catalog_truth_hunt.py b/tests/test_portfolio_catalog_truth_hunt.py new file mode 100644 index 00000000..b099d0a5 --- /dev/null +++ b/tests/test_portfolio_catalog_truth_hunt.py @@ -0,0 +1,27 @@ +from __future__ import annotations + +from github_repo_auditor.portfolio_catalog import catalog_entry_for_repo + + +def test_catalog_does_not_apply_another_checkout_path_lifecycle_by_basename() -> None: + catalog = { + "repos": { + "retired/legacy-app": { + "lifecycle_state": "archived", + "catalog_key": "retired/legacy-app", + "has_explicit_entry": True, + } + } + } + + entry = catalog_entry_for_repo( + { + "name": "legacy-app", + "full_name": "current-owner/legacy-app", + "path": "apps/legacy-app", + }, + catalog, + ) + + assert entry["has_explicit_entry"] is False + assert entry["lifecycle_state"] == ""