You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: remove lifetime and cwd from WorkspaceRoot (#62)
### TL;DR
Refactored `WorkspaceRoot` to use `Arc<AbsolutePath>` for the path field and separated the `cwd` field from the struct.
### What changed?
- Modified `WorkspaceRoot` struct to use `Arc<AbsolutePath>` for the `path` field instead of a reference
- Removed the `cwd` field from `WorkspaceRoot` and made it a separate return value in `find_workspace_root`
- Updated `find_workspace_root` to return a tuple of `(WorkspaceRoot, RelativePathBuf)` instead of just `WorkspaceRoot`
- Updated all callers of `find_workspace_root` to handle the new return type
- Fixed all references to `workspace_root.path` to properly dereference the Arc when needed
### How to test?
- Run the existing test suite to ensure all functionality works as expected
- Verify that workspace discovery and package graph loading work correctly
- Check that task graph generation functions properly with the new structure
### Why make this change?
This change improves memory management by using `Arc` (Atomic Reference Counting) for the workspace path, allowing it to be shared efficiently across different components without lifetime constraints. Separating the `cwd` from the `WorkspaceRoot` struct makes the API more explicit about what belongs to the workspace definition versus contextual information about the current working directory.
0 commit comments