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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user