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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user