Skip to content

fix(#42): directory content-subspace prefix double-prepended - #77

Merged
s2x merged 1 commit into
masterfrom
fix/42-directory-double-prefix
Sep 8, 2026
Merged

fix(#42): directory content-subspace prefix double-prepended#77
s2x merged 1 commit into
masterfrom
fix/42-directory-double-prefix

Conversation

@s2x

@s2x s2x commented Aug 18, 2026

Copy link
Copy Markdown
Member

Closes #42

Summary

The prefix stored in a directory node already includes the content subspace key, but contentsOfNode(), createInternal(), and removeInternal() prepended it 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.

Changes

  • src/Directory/DirectoryLayer.php: Removed the redundant contentSubspace->key() prepend in contentsOfNode(), createInternal(), and removeInternal() — the stored prefix is now used directly, matching the existing partition branch behavior.

Tests

  • Unit tests (tests/Unit/DirectoryDoublePrefixTest.php): 3 tests covering contentsOfNode() with empty content subspace, non-empty content subspace, and partition layer
  • Integration tests (tests/Integration/DirectoryTest.php): 4 tests covering directory creation inside a partition (single prefix, round-trip, key write/read, and top-level directory prefix)
  • All 644 tests pass (436 unit + 208 integration)
  • Lint clean (PHPCS + Rector dry-run + PHPStan level 9)

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
@s2x
s2x force-pushed the fix/42-directory-double-prefix branch from 1ae723b to 0c1d06a Compare September 8, 2026 18:37
@s2x
s2x merged commit 12a6c3f into master Sep 8, 2026
6 checks passed
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.

[Bug] Directory content-subspace prefix is double-prepended (breaks partitions and cross-binding interop)

1 participant