Stale-file Merge path silently discards named server sets (#52) #73
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
In the stale-file Merge & save branch (bcc.py ~L2475):
apply_servers()only writesmcpServersand_disabledMcpServers. Named server sets live inself.full_configunderSETS_KEY(_bccServerSets), written there bysave_server_set(self.full_config, ...).So: user saves a named set → an external process touches the config → user hits Save → Merge → the set is never carried into
fresh, and thenself.full_config = freshdrops it from memory too. No warning, no backup prompt, gone.Severity
Same class as the drag-and-drop silent-overwrite fixed in #8: quiet data loss on a path the user explicitly chose because it sounded safe. "Merge" implies keeping the user's work.
Note
external_change_summarydoes compare all top-level keys, so_bccServerSetsshows up inchanged_keyswhen the disk copy differs — but that reports it as an external change; it doesn't stop the local one being dropped.Suggested fix
Decide the merge semantics for BCC-owned keys explicitly, rather than by omission:
SETS_KEY, and anything else BCC authors) fromself.full_configontofreshbefore writing — BCC is the owner of those keys, so local wins.SETS_KEY, that's a genuine conflict worth surfacing inStaleDialograther than silently picking a side.BCC_OWNED_KEYStuple consulted by the merge, so the next BCC-authored key doesn't reintroduce the same bug.Tests
Config with
_bccServerSetsin memory + an external write to disk + Merge → the set survives in the written file. Add the symmetric case where disk changed the sets too.