Skip to content

feat(spin-engine): federate multiple physical roots into a single Workspace - #167

Draft
deer wants to merge 2 commits into
mainfrom
federated_workspace
Draft

feat(spin-engine): federate multiple physical roots into a single Workspace#167
deer wants to merge 2 commits into
mainfrom
federated_workspace

Conversation

@deer

@deer deer commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Engine gains createWorkspace(List<Path>), letting a single invocation span several physical repository roots as one logical Workspace. DefaultEngine validates that the given roots don't overlap (one nested in, or equal to, another) via a new requireDisjoint check, computes their deepest shared ancestor via commonAncestor, and creates a FederatedWorkspace at that synthetic path. Each physical root is then discovered as an ordinary child Project under that shared root, so Project#workspace() and Project#stream() work unmodified across repo boundaries. spin's CLI gains a repeatable --root/-r option (backed by the new build.spin.option.Root) that federates additional roots alongside the working directory.

Along the way this fixes two latent bugs surfaced by the new code paths. DefaultEngine#getWorkspacePath was checking the original path argument instead of the loop's detectionPath while walking up ancestors for Plugin.MetaClass detection, so that branch never actually advanced past the starting directory. Reference#equals compared project().name() while hashCode() used the project's identity hash, violating the equals/hashCode contract; it now compares project() directly, which matters once multiple projects across federated roots can share a simple name.

Coverage includes unit tests for commonAncestor and the disjointness/empty-root edge cases in spin-engine, plus a real integration test in spin-engine-tests (FederatedWorkspaceTests, backed by a new FederatedTestPlugin and two on-disk fixture roots) verifying that two independently-detected roots actually end up as sibling Projects of one Workspace with a unified stream().

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.

1 participant