fix: S40 - short form and attrs on the same path refused for new nodes too

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 15:17:42 +02:00
co-authored by Claude Opus 5.5
parent 110beb7698
commit 22bb1528db
3 changed files with 95 additions and 14 deletions
@@ -203,6 +203,34 @@ final class ComposerTest extends TestCase
self::assertSame([], $separate['errors'], 'different paths may be combined');
}
/** Ruling S40: a new node may not reach the same attribute path through short form and attrs. */
public function testComposeRefusesShortFormAndAttrsOnTheSamePath(): void
{
$result = ComposeFixture::composer()->compose([[
'type' => 'section',
'background_color' => '#ffffff',
'attrs' => ['module.decoration.background' => ['desktop' => ['color' => '#000000']]],
'modules' => [[
'type' => 'button',
'text' => 'Neu',
'attrs' => ['button.innerContent' => ['desktop' => ['linkUrl' => '/kontakt']]],
]],
]], null, 'nodes');
self::assertStringContainsString('background_color', $result['errors']['nodes[0].attrs.module.decoration.background']);
self::assertStringContainsString('text', $result['errors']['nodes[0].modules[0].modules[0][0].attrs.button.innerContent']);
self::assertSame([], $result['invalid_paths']);
$separate = ComposeFixture::composer()->compose([[
'type' => 'section',
'modules' => [
['type' => 'button', 'text' => 'Neu', 'attrs' => ['button.decoration.background' => ['desktop' => ['color' => '#ffffff']]]],
['type' => 'heading', 'text' => 'Titel', 'attrs' => ['title.decoration.font.font' => ['phone' => ['size' => '20px']]]],
],
]], null, 'nodes');
self::assertSame([], $separate['errors'], 'different paths, and the default heading level, may be combined');
}
/** Ruling S13: labels go through the choke point; a label that fails is an error, never stored raw. */
public function testLabelsAreCleanedOrReported(): void
{