Skip to content

refactor: remove lifetime and cwd from WorkspaceRoot#62

Merged
branchseer merged 1 commit intomainfrom
12-17-refactor_remove_lifetime_and_cwd_from_workspaceroot
Dec 18, 2025
Merged

refactor: remove lifetime and cwd from WorkspaceRoot#62
branchseer merged 1 commit intomainfrom
12-17-refactor_remove_lifetime_and_cwd_from_workspaceroot

Conversation

@branchseer
Copy link
Copy Markdown
Member

@branchseer branchseer commented Dec 17, 2025

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.

Copy link
Copy Markdown
Member Author

branchseer commented Dec 17, 2025

@branchseer branchseer marked this pull request as ready for review December 17, 2025 13:11
@branchseer branchseer requested a review from fengmk2 December 17, 2025 13:13
@branchseer branchseer merged commit dd8bd2d into main Dec 18, 2025
7 checks passed
@branchseer branchseer deleted the 12-17-refactor_remove_lifetime_and_cwd_from_workspaceroot branch December 18, 2025 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants