Files
baserow/docs/testing
Davide Silvestri 91fabcb3ab fix(assistant): let Kuma change menu items by uid instead of recreating them (#6295)
* fix(assistant): keep the menu items Kuma resends instead of recreating them

Kuma rebuilt every menu item as a new link with a new uid, so updating a menu deleted the click actions and settings of the items it meant to keep. Items matched by name now keep their uid, type, settings and children.

* fix(assistant): keep Kuma's menu items by uid instead of by name

list_elements now shows each menu item's uid, with sub-links nested
under their parent, and update_element takes the uid back for every
item Kuma keeps. A kept item keeps its type, settings, click actions
and sub-links; a new name renames it and a new page moves a link,
clearing the old page's parameters. children edits the sub-links.

Requests the menu can't apply are refused before anything is saved:
a page on a button, an unknown or repeated uid, or a new item named
like an item being removed, which means Kuma forgot its uid.

* test(assistant): set a non-default variant in the menu round-trip test

* test(assistant): add evals for Kuma's header menu edits

Five kuma-builder cases start from a header menu with a link, a
dropdown, a separator and a button with a click action, the kinds of
items production menus had when Kuma rebuilt them as page links. Each
checks that the items Kuma doesn't change keep their uid, type and
click action: adding a link, renaming the button, removing a sub-link,
making the button open a page, and adding pages one at a time.

The checks are tested against the untouched menu, the right edit and a
rebuild into page links.

* fix(assistant): delete menu items only when Kuma lists them

update_element takes remove_menu_items, the uids of the menu items to
delete. Every current item must come back in menu_items with its uid or
be listed there, so an item Kuma forgets is refused with its name and
uid instead of being deleted. remove_menu_items alone deletes those
items and keeps the rest. The rule also covers a forgotten uid, so it
replaces the check on new items named like removed ones.

* fix(assistant): ask Kuma for the whole menu when it changes one item

"Nothing is deleted unless listed" read to Kuma as permission to send
only the item it changed, which the tool then refused for leaving the
others out. The description now asks for every current item plus the
new ones, and points deletions to remove_menu_items.

* refactor(assistant): share uid helpers and let after_update add result keys

Prepares menu items to follow the table column pattern: canonical_uid and NO_CHANGES move to types/changes.py, the menu listing helpers move to types/menu_items.py, and an element type's after_update hook can now add keys to update_element's result.

* refactor(assistant): merge menu item changes like table column changes

merge_menu_items turns add, update, reorder and remove lists into the full item list core saves. Items it doesn't name are resent as saved, removing a dropdown removes its sub-links, and anything it can't apply is refused before saving, including pages of another application. name_key and unique_in_order are now shared with the table column merge.

* fix(assistant): let Kuma change menu items with add, update, reorder and remove lists

update_element on a menu, header or footer now takes add_menu_items, update_menu_items, reorder_menu_items and remove_menu_items by uid, like table columns, instead of the whole menu. Items Kuma doesn't name stay as saved, the result lists the menu's items after the write and the removed items, and a refused change saves nothing. A header or footer changes the menu nested inside it and refuses when it holds several.

* test(assistant): add evals for reordering menu items and removing a dropdown

Two kuma-builder cases on the header menu scenario check that moving Help keeps every item, its click action and the Products sub-links, and that removing the Products dropdown removes its sub-links and nothing else.

* fix(assistant): warn that undo keeps removed menu items deleted and list custom link urls

Undo restores no menu item change, so the tool now says so next to remove_menu_items, as it does for table columns. list_elements shows a custom link's url, so it no longer looks like a link to nothing. A header's or footer's menu is locked before its items are read.
2026-10-12 09:27:31 +02:00
..