libs: peer lib edits reach the running editor + "placed symbol updated" toast

synced-source subscribes to its SyncStack: remote changes (self-save echoes
consumed via a selfPushed flag) debounce per kind into kicadLibsReload — a
new embind export (pcbjam_libs_reload.h, all three TUs) that drops the lib's
plugin cache (LIBRARY_MANAGER::ReloadLibraryEntry), reloads it, and mails
MAIL_RELOAD_LIB with the nickname so the symbol tree force-refreshes (the
plugin's modify hash is a pinned constant, so a plain sync would skip it).

After the reload, kicadLibsSymbolUsage (new eeschema embind: placed
SCH_SYMBOL count across unique screens) gates LIB_ITEM_UPDATED_EVENT, and
WasmTool shows an amber toast when a PLACED symbol changed — placed copies
keep the previous version until updated from the library.

syncedScopeLibsSource gives PROJECT sessions the synced source under
VITE_LIBS_SOURCE=synced (remote contract for lib listing/createLib, lazy
per-lib SyncStacks for item ops/presync) so realtime reaches open
schematics; previously project sessions silently fell back to the per-item
remote source. Unit tests cover reload debounce, self-echo skip, per-kind
routing, usage-gated event, and the no-Module no-op.

Bumps kicad (MAIL_RELOAD_LIB force-refresh payload).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QRWoXiM9uuo1enXGhAYku
This commit is contained in:
Gergő Törcsvári 2026-07-09 18:21:21 +02:00
commit 9315f56760
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
10 changed files with 649 additions and 11 deletions

View file

@ -51,6 +51,7 @@
#include "collab_common.h"
#include "collab_presence_core.h"
#include "collab_presence_style.h"
#include "pcbjam_libs_reload.h"
#include <algorithm>
#include <chrono>
#include <map>
@ -2004,6 +2005,8 @@ EMSCRIPTEN_BINDINGS(pcbnew) {
function("kicadCollabTestSelectFirst", &pcbCollabTestSelectFirst);
function("kicadCollabTestSelectComponent", &pcbCollabTestSelectComponent);
function("kicadCollabTestClearSelection", &pcbCollabTestClearSelection);
// Library reload after a remote (synced) lib edit — r2-idb-sync realtime.
function("kicadLibsReload", &pcbjam_libs::reloadLibrary);
#endif // !KICAD_MERGED_EMBIND
}
#endif