diff --git a/backend/src/graph/live.ts b/backend/src/graph/live.ts index 377b1b3..e4cf481 100644 --- a/backend/src/graph/live.ts +++ b/backend/src/graph/live.ts @@ -60,7 +60,7 @@ function upsertNode( key: string, patch: Partial>, ): string { - const id = nodeKey(kind, key); + const id = nodeKey(kind, kind === 'engineer' ? key.toLowerCase() : key); const cur = b.nodes.get(id); if (!cur) { b.nodes.set(id, { @@ -158,24 +158,7 @@ export async function materializePodGraph(podId: string): Promise 0 ? 'risk' : 'active', - summary: files.length - ? `${files.length} changed file(s) on ${git.branch ?? 'detached'}` - : `on ${git.branch ?? 'detached'}`, - weight: 0.7, - }); - for (const file of files) { - const f = upsertNode(b, 'file', file, { label: file, status: 'risk' }); - upsertEdge(b, eng, f, 'editing', 'edits', 0.6); - } - } - - // 3. Vision (observations): who is active and on which file, with confidence. + // 2. Vision (observations): who is active and on which file, with confidence. for (const o of observations) { if (!o.engineerId) continue; const recent = o.observedAt && now - new Date(o.observedAt).getTime() < ACTIVE_WINDOW_MS; @@ -190,7 +173,7 @@ export async function materializePodGraph(podId: string): Promise(); for (const col of collisionDocs) { collisionById.set(col.id, col); @@ -211,6 +194,24 @@ export async function materializePodGraph(podId: string): Promise 0 ? 'risk' : 'active', + summary: files.length + ? `${files.length} changed file(s) on ${git.branch ?? 'detached'}` + : `on ${git.branch ?? 'detached'}`, + weight: 0.7, + }); + for (const file of files) { + const fid = nodeKey('file', file); + if (b.nodes.has(fid)) upsertEdge(b, eng, fid, 'editing', 'edits', 0.6); + } + } + // 5. Interventions: what PodMan offered for each collision. const interventionById = new Map(); for (const iv of interventionDocs) {