fix: final review minors m-1 to m-8

- m-1: the no-change Divi result carries preview_url/edit_url too
- m-2: overview names replace-text's per-page tree_rev
- m-3: divi-shortform documents validation_failed vs not_found for unknown IDs
- m-4: DiviWriter/DiviPageLoader final (no mocks left), neutral NewDraft
  log detail, snapshots are Etappe 4
- m-5: Tested up to 7.1, changelog completed
- m-6: content-create warns when the extras changed the stored layout
- m-7: deleting a whole section outlines nothing instead of the next one
- m-8: uninstall removes the user meta lit_mcp_log_per_page; readme lists it

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 19:35:24 +02:00
co-authored by Claude Opus 5.5
parent b24eb6c3e9
commit 097fef2e32
15 changed files with 136 additions and 21 deletions
@@ -18,10 +18,9 @@ defined('ABSPATH') || exit;
/**
* Loads an entry for the Divi tools: rights and status via PostGuard (spec §4.5), then the
* block tree. Divi 4 shortcode content and unbalanced markup are refused with a hint –
* spec §3.4: Divi 4 content is kept, never edited. Not final so abilities can be tested
* with a mock.
* spec §3.4: Divi 4 content is kept, never edited.
*/
class DiviPageLoader
final class DiviPageLoader
{
public const OUTLINE_HINT = 'Aktuellen Stand mit lit/divi-outline (direkt: lit-divi-outline) neu lesen und die '
. 'Änderung mit der neuen tree_rev wiederholen.';
+7 -5
View File
@@ -23,10 +23,9 @@ defined('ABSPATH') || exit;
* (ruling P16; a mismatch is rev_mismatch and nothing is written), let the ability change the
* tree – only when its whole input validated (all or nothing) –, serialize, save via DiviSaver,
* then lit_mcp_after_save, change log and the ToolResult with changed nodes, affected outline,
* quality warnings (spec §5.5), revision_id, the new rev and tree_rev. Not final so abilities
* can be tested with a mock.
* quality warnings (spec §5.5), revision_id, the new rev and tree_rev.
*/
class DiviWriter
final class DiviWriter
{
public const OUTLINE_TRUNCATED = 'Die Übersicht der geänderten Abschnitte ist gekürzt; vollständig mit '
. 'lit-divi-outline lesen.';
@@ -89,6 +88,7 @@ class DiviWriter
->rev(Rev::ofPost($post))
->with('tree_rev', $page->treeRev())
->warnings($change->warnings())
->urls((string) get_preview_post_link($post), $page->editUrl())
->toArray();
}
@@ -143,7 +143,8 @@ class DiviWriter
/**
* Outline of the sections that contain changed nodes (breadth limit of ruling S18). A removed
* node has no block any more, but its ID from before the removal still names the (surviving)
* section.
* section – unless the removed node was that section itself: its ID now names the next section,
* which did not change (review m-7).
*
* @return array{text: ?string, truncated: bool}
*/
@@ -152,7 +153,8 @@ class DiviWriter
$sections = [];
foreach ($change->entries() as $entry) {
$id = DiviChange::idOf($entry, $index);
if ($id !== null) {
$wholeSection = $entry['block'] === null && $id !== null && ! str_contains($id, '.');
if ($id !== null && ! $wholeSection) {
$sections[explode('.', $id)[0]] = true;
}
}