fix: link targets never reveal library entries by type (ruling Q14)

WpLinkTargets answers the library, internal "_" types and every type
without a Divi post_link_url option like a missing ID; replace-text strips
library IDs only from global subtrees.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 15:13:40 +02:00
co-authored by Claude Opus 5.5
parent c7ce924e5a
commit 82ef69a99c
7 changed files with 154 additions and 19 deletions
@@ -464,6 +464,22 @@ final class DiviReplaceTextAbilityTest extends TestCase
self::assertSame([], $byId['skipped_nodes']);
}
/** Ruling P13/Q14: only global subtrees lose their IDs – an undecodable node is matched as stored, with or without access. */
public function testUndecodableNodesAreMatchedAlikeWithAndWithoutLibraryAccess(): void
{
$content = str_replace(
'<!-- /wp:divi/column -->',
'<!-- wp:divi/text {"note": Müller} --><!-- /wp:divi/text --><!-- /wp:divi/column -->',
self::page([self::text('<p>Meier</p>')])
);
$hidden = $this->ability($content)->execute(['search' => 'Müller', 'replace' => 'x']);
$shown = $this->ability($content, false, [7], true)->execute(['search' => 'Müller', 'replace' => 'x']);
self::assertSame(['s0.r0.c0.m1'], array_column($hidden['skipped_nodes'], 'id'));
self::assertSame($shown['skipped_nodes'], $hidden['skipped_nodes']);
}
/** No effective change (search == replacement, cleaned replacement == match): nothing saved. */
public function testNoEffectiveChangeSavesNothing(): void
{