fix(#42): directory content-subspace prefix double-prepended - #77
Open
s2x wants to merge 1 commit into
Open
Conversation
The prefix stored in a directory node already includes the content subspace key (composed in createInternal as contentSubspace->key() . allocatedPrefix). But contentsOfNode(), createInternal(), and removeInternal() prepended the content subspace key again when constructing the returned DirectorySubspace or clearing content keys. For the default (empty) content subspace this was harmless. Inside a partition (non-empty content subspace) it produced a doubled prefix (P + P + key instead of P + key), landing directories at the wrong location and breaking cross-binding interop. The partition branch already passed $prefix directly; this fix aligns the non-partition branch to match. Closes #42
5 tasks
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.
Closes #42
Summary
The prefix stored in a directory node already includes the content subspace key, but
contentsOfNode(),createInternal(), andremoveInternal()prepended it again when constructing the returnedDirectorySubspaceor clearing content keys.For the default (empty) content subspace this was harmless. Inside a partition (non-empty content subspace) it produced a doubled prefix (P + P + key instead of P + key), landing directories at the wrong location and breaking cross-binding interop.
Changes
src/Directory/DirectoryLayer.php: Removed the redundantcontentSubspace->key()prepend incontentsOfNode(),createInternal(), andremoveInternal()— the stored prefix is now used directly, matching the existing partition branch behavior.Tests
tests/Unit/DirectoryDoublePrefixTest.php): 3 tests coveringcontentsOfNode()with empty content subspace, non-empty content subspace, and partition layertests/Integration/DirectoryTest.php): 4 tests covering directory creation inside a partition (single prefix, round-trip, key write/read, and top-level directory prefix)