feat(CORE-001D1): harden unit-aware workspace persistence
This commit is contained in:
@@ -26,7 +26,14 @@ class WorkspaceRepository:
|
||||
def workspace_exists(self, workspace_id: str) -> bool:
|
||||
if not self.is_valid_workspace_id(workspace_id):
|
||||
return False
|
||||
return self._portfolio_path(workspace_id).exists()
|
||||
portfolio_path = self._portfolio_path(workspace_id)
|
||||
if not portfolio_path.exists():
|
||||
return False
|
||||
try:
|
||||
PortfolioRepository(portfolio_path).load()
|
||||
except (ValueError, TypeError, FileNotFoundError):
|
||||
return False
|
||||
return True
|
||||
|
||||
def create_workspace(self, workspace_id: str | None = None) -> PortfolioConfig:
|
||||
resolved_workspace_id = workspace_id or str(uuid4())
|
||||
|
||||
Reference in New Issue
Block a user