fix(profiles): a stored <root>/profiles/<name> home names its profile even when the root carries no markers

CI: tests/test_tui_gateway_server.py::test_ensure_session_db_row_stamps_profile_name used a bare tmp
root; profile_name_for_home fell through to None and the row was stamped default. The stored home
is authoritative (its owner resolved it), so the profiles/<name> shape is sufficient.
This commit is contained in:
kshitijk4poor
2026-09-09 12:31:30 +05:30
committed by kshitij
parent a39fedff34
commit c402bcf1d8
+4
View File
@@ -223,6 +223,10 @@ def profile_name_for_home(path: str | Path | None) -> str | None:
named = named_profile_home(candidate)
if named is not None:
return named.name
# A stored profile home is authoritative: its owner already resolved it, so the
# <root>/profiles/<name> shape names the profile even when <root> carries no markers.
if candidate.parent.name == "profiles" and not candidate.name.startswith("."):
return candidate.name
except (OSError, RuntimeError, ValueError):
return None
return None