fix: typed write failures, template rollback, parent and term cleanup

WriteFailed maps to lit_write_failed / lit_partial_write (partial writes are
logged with result partial); old template read before the update; row marker
set before wp_update_post; created terms deleted on rollback; parent must be a
readable non-descendant of a hierarchical type; featured image must be
readable; snapshot keeps empty values; meta comparison after sanitize_meta;
follow-up failures (listener, change log) only add warnings.

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-25 23:11:18 +02:00
co-authored by Claude Opus 5.5
parent 4f9a47fe32
commit a9b2f2db71
18 changed files with 934 additions and 130 deletions
@@ -94,6 +94,7 @@ final class RegisteredMetaSourceTest extends TestCase
public function testUnchangedValueIsNotAFailure(): void
{
$field = new FieldDefinition('count', 'count', 'integer', 'meta', 'writable');
Functions\when('sanitize_meta')->returnArg(2);
Functions\expect('update_post_meta')->once()->with(5, 'count', 3)->andReturn(false);
Functions\expect('get_post_meta')->once()->with(5, 'count', false)->andReturn(['3']);
@@ -101,9 +102,21 @@ final class RegisteredMetaSourceTest extends TestCase
self::addToAssertionCount(1);
}
public function testTheComparisonUsesTheSanitizedValue(): void
{
$field = new FieldDefinition('slug_meta', 'slug_meta', 'string', 'meta', 'writable');
Functions\expect('sanitize_meta')->once()->with('slug_meta', ' Trier ', 'post', 'event')->andReturn('trier');
Functions\when('update_post_meta')->justReturn(false);
Functions\when('get_post_meta')->justReturn(['trier']);
(new RegisteredMetaSource())->write(5, 'event', ['slug_meta' => ' Trier '], ['slug_meta' => $field]);
self::addToAssertionCount(1);
}
public function testFailedUpdateThrows(): void
{
$field = new FieldDefinition('count', 'count', 'integer', 'meta', 'writable');
Functions\when('sanitize_meta')->returnArg(2);
Functions\when('update_post_meta')->justReturn(false);
Functions\when('get_post_meta')->justReturn(['2']);