Files
podman/shared/src/collision.ts
T
sb-iam 1901010996 fix(continual-learning): harden wasRealCollision verifier (Codex review)
Addresses the P1 brittleness in the Step 3 verifier so learned_from edges
(graph/live.ts:413) can't be silently zeroed on stage.

- Capture overlap AT detection time as Collision.gitOverlap (podman.ts), while
  engineer_states are still fresh, instead of re-deriving from possibly-stale
  state when the user clicks. deriveWasRealCollision() now prefers this stored
  evidence and only falls back to a live re-derivation for older collisions.
- Canonicalize engineer names (trim + lowercase) on both the capture and the
  fallback path, so "Karti" vs "karti" no longer misses the git state.
- conflictKey now reuses the shared comparableBasename() helper (dedupe).

shared/src/collision.ts gains optional `gitOverlap?: boolean` (additive).
shared rebuilt; backend+frontend typecheck + eslint pass. PLAN.md rung 3 updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 07:57:38 -05:00

38 lines
1.3 KiB
TypeScript

export type CollisionSeverity = 'info' | 'warn' | 'critical';
/**
* A detected overlap between two or more engineers' live work, fused from
* vision-derived contexts and GitHub state.
*/
export interface Collision {
id: string;
podId: string;
/** File both engineers are touching. */
file: string;
/** Symbol-level overlap, if known. */
symbol?: string;
/** Engineer ids involved in the overlap. */
engineers: string[];
severity: CollisionSeverity;
/** Snapshot of relevant GitHub state at detection time. */
githubState?: GithubStateSnapshot;
/**
* Git ground-truth overlap captured AT detection time, while engineer_states
* are still fresh: true when every involved engineer had `file` in their git
* changedFiles. Read as the authoritative wasRealCollision evidence at outcome
* time, so a late click, a stale sidecar, or the engineer_states freshness TTL
* cannot retroactively zero it out.
*/
gitOverlap?: boolean;
detectedAt: string;
}
export interface GithubStateSnapshot {
/** Open branches touching the file, keyed by engineer/login. */
branches?: Record<string, string>;
/** Open PR numbers touching the file. */
openPrs?: number[];
/** Whether any involved engineer has unpushed local changes. */
unpushed?: boolean;
}