feat(spin-engine): federate multiple physical roots into a single Workspace - #167
Draft
deer wants to merge 2 commits into
Draft
feat(spin-engine): federate multiple physical roots into a single Workspace#167deer wants to merge 2 commits into
deer wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EnginegainscreateWorkspace(List<Path>), letting a single invocation span several physical repository roots as one logicalWorkspace.DefaultEnginevalidates that the given roots don't overlap (one nested in, or equal to, another) via a newrequireDisjointcheck, computes their deepest shared ancestor viacommonAncestor, and creates aFederatedWorkspaceat that synthetic path. Each physical root is then discovered as an ordinary childProjectunder that shared root, soProject#workspace()andProject#stream()work unmodified across repo boundaries.spin's CLI gains a repeatable--root/-roption (backed by the newbuild.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#getWorkspacePathwas checking the originalpathargument instead of the loop'sdetectionPathwhile walking up ancestors forPlugin.MetaClassdetection, so that branch never actually advanced past the starting directory.Reference#equalscomparedproject().name()whilehashCode()used the project's identity hash, violating the equals/hashCode contract; it now comparesproject()directly, which matters once multiple projects across federated roots can share a simple name.Coverage includes unit tests for
commonAncestorand the disjointness/empty-root edge cases inspin-engine, plus a real integration test inspin-engine-tests(FederatedWorkspaceTests, backed by a newFederatedTestPluginand two on-disk fixture roots) verifying that two independently-detected roots actually end up as siblingProjects of oneWorkspacewith a unifiedstream().