mirror of
https://github.com/block/buzz.git
synced 2026-11-12 20:31:12 +00:00
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>
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { runFileSizeCheck } from "../../scripts/check-file-sizes-core.mjs";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const projectRoot = path.resolve(__dirname, "..");
|
|
|
|
const MAX_LINES = 1000;
|
|
|
|
const rules = [
|
|
{ root: "src-tauri/src", extensions: new Set([".rs"]), maxLines: MAX_LINES },
|
|
{
|
|
root: "src/app",
|
|
extensions: new Set([".ts", ".tsx"]),
|
|
maxLines: MAX_LINES,
|
|
},
|
|
{
|
|
root: "src/features",
|
|
extensions: new Set([".ts", ".tsx"]),
|
|
maxLines: MAX_LINES,
|
|
},
|
|
{
|
|
root: "src/shared/api",
|
|
extensions: new Set([".ts", ".tsx"]),
|
|
maxLines: MAX_LINES,
|
|
},
|
|
];
|
|
|
|
// TEMP — these files exceed the 1000-line limit and are queued to be split.
|
|
// Do not add to this list; split the file instead. Remove each entry as its
|
|
// file is broken up. Tracked as a follow-up.
|
|
const overrides = new Map([
|
|
["src-tauri/src/commands/agents.rs", 1287],
|
|
["src-tauri/src/managed_agents/nest.rs", 1420],
|
|
["src-tauri/src/managed_agents/runtime.rs", 1465],
|
|
["src-tauri/src/managed_agents/personas.rs", 1080],
|
|
["src-tauri/src/managed_agents/persona_card.rs", 1050],
|
|
["src-tauri/src/huddle/tts.rs", 1364],
|
|
["src/shared/api/tauri.ts", 1196],
|
|
["src-tauri/src/nostr_convert.rs", 1126],
|
|
["src/shared/api/relayClientSession.ts", 1022],
|
|
["src-tauri/src/migration.rs", 1295],
|
|
]);
|
|
|
|
await runFileSizeCheck({
|
|
projectRoot,
|
|
rules,
|
|
overrides,
|
|
label: "Desktop",
|
|
scriptPath: "desktop/scripts/check-file-sizes.mjs",
|
|
});
|