Determining if the following is a bug, enhancement or inconsequential is beyond my skill level. I need direction on what should happen next.
While troubleshooting a problem with populating menu items under the Windows menu of Gramps, Claude identified a gap in the sanitizing portion of the GrampsWindowManager.generate_id()
Found it — this one was a genuine gap in Gramps’ own core code, not something I introduced fresh, but it was exposed by my earlier fix.
GrampsWindowManager.generate_id()builds a GTK menu action name from whateverwindow_idaManagedWindowregisters with:"wm-" + str(window_id), run through Gramps’ ownvalid_action_name(). That sanitizer only replaces a handful of characters — space, underscore, parens, comma, apostrophe — because every existing caller in Gramps uses short, handle-like keys (record handles, plugin IDs). It was never written to expect a full filesystem path, so/sails straight through unsanitized, producingwm-/home/districtsupport/.../README.md— which GTK’s UIManager then rejects at menu-build time. That’s exactly your warning, and it happened on every load or reload of the panel because rebuilding the Windows menu re-triggersgenerate_id()each time.Since I can’t patch Gramps’ own sanitizer from an addon, I fixed it on my side:
window_key_for()now returns a SHA-1 hex digest of the absolute path (prefixedmd-) instead of the raw path itself. Hex digits and-are exactly whatvalid_action_namealready handles fine, so this sidesteps the whole category of problem rather than chasing whatever character it doesn’t sanitize next.I verified this properly rather than just eyeballing it — reproduced your exact nested-folder path shape (
MarkdownBased/PluginMgrPlus/README.md), built the real windows-menu XML through the realGrampsWindowManager/generate_id(), and confirmed: no warning, the generated action name round-trips cleanly throughvalid_action_name()unchanged, and same-file reuse (opening the same README twice) still correctly re-presents the existing window rather than duplicating it. Also reran the full regression suite from the last few rounds (title sync, Windows-menu label, all four footer buttons,gramps://view:links) to make sure nothing else moved.
Claude thread: