mirror of
https://github.com/block/buzz.git
synced 2026-12-01 13:42:45 +00:00
fix(desktop): repair team-persona mismatch and deduplicate legacy imports
Teams created before PR 852 store the pack manifest ID (e.g. com.wpfleger.sietch-tabr) in PersonaRecord.source_team but the sync and delete predicates compared against TeamRecord.id (a UUID). Additionally TeamRecord.source_dir was often null, so the sync gate never passed. Introduces team_persona_key() as the single derivation used by sync, delete-cascade, and import — extracts the directory name from source_dir (the manifest ID), falling back to team.id for non-directory teams. On launch, sync_team_personas runs a one-time idempotent repair: 1. Backfills source_dir by matching persona source_team values to directories under teams/ 2. Deduplicates PersonaRecords sharing (source_team, slug) — keeps newest by updated_at desc / id asc, repoints TeamRecord.persona_ids and ManagedAgentRecord.persona_id to the winner 3. Self-healing scrub removes any dangling references that point to persona IDs not in the surviving set (crash-window recovery) Saves are ordered reference-holders-first (teams, agents) before the personas they point to, so a crash mid-repair leaves over-pointing (harmless) rather than dangling references (permanent). All repair logic — derivation, backfill, dedup, and the launch orchestrator — lives in team_repair.rs, keeping teams.rs under the base 1000-line file size limit without a per-file override. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
parent
f49cdcdd30
commit
a4d66205d7
@@ -40,7 +40,6 @@ const overrides = new Map([
|
||||
["src-tauri/src/nostr_convert.rs", 1126],
|
||||
["src/shared/api/relayClientSession.ts", 1022],
|
||||
["src-tauri/src/migration.rs", 1295],
|
||||
["src-tauri/src/managed_agents/teams.rs", 1020],
|
||||
]);
|
||||
|
||||
await runFileSizeCheck({
|
||||
|
||||
Reference in New Issue
Block a user