fix: detect same-file collisions reliably via basename + git overlap

Live observations showed two engineers both dirty on README.md but zero
collisions firing. Two root causes:

1. normalize() only lowercased and prepended src/, so the same file at
   different path depths ("agent.ts" vs "backend/src/agent.ts") never
   matched. Replace with lowercased-basename matching.
2. Git ground truth (engineer_states.changedFiles) was only used to set
   the unpushed flag, never to match the file. The strongest signal was
   wasted.

Detector now fuses vision currentFile AND git changedFiles into one
file->engineers map, so a collision fires when two people share a dirty
file even if both screens aren't on it at the same instant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaCFWMkYQmTcuPsxaaACft
This commit is contained in:
Ramis
2026-06-27 20:44:01 -07:00
parent dd99050be8
commit e474fef228
2 changed files with 66 additions and 16 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ export class PodMan {
}
const github = await getGithubState(); // cached
const collisions = detectCollisions([...this.contexts.values()], github);
const collisions = detectCollisions([...this.contexts.values()], github, gitStates);
for (const collision of collisions) await this.handle(collision);
}