* Record what this session had already been served for this project (CG-17), * so the report says which call in the session it is and what the earlier ones * cost. Read-only for now: nothing in the render loop consults it, which is * what keeps the response byte-identical at this stage.
(prior: ExploreProjectState | null)
| 356 | * already holds. |
| 357 | */ |
| 358 | noteSession(prior: ExploreProjectState | null): void { |
| 359 | if (!prior) return; |
| 360 | const byPath = new Map<string, { path: string; ranges: Array<[number, number]>; bytes: number }>(); |
| 361 | for (const call of [...prior.calls].reverse()) { |
| 362 | for (const file of call.files) { |
| 363 | const existing = byPath.get(file.path); |
| 364 | const spans = file.ranges.map((r) => [r.start, r.end] as [number, number]); |
| 365 | if (existing) { |
| 366 | existing.ranges.push(...spans); |
| 367 | existing.bytes += file.bytes; |
| 368 | } else { |
| 369 | byPath.set(file.path, { path: file.path, ranges: spans, bytes: file.bytes }); |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | this.session = { |
| 374 | callIndex: prior.callCount + 1, |
| 375 | priorCalls: prior.callCount, |
| 376 | priorResponseChars: prior.responseBytes, |
| 377 | priorFiles: [...byPath.values()], |
| 378 | }; |
| 379 | } |
| 380 | |
| 381 | /** Candidate count after the `group.score >= floor` filter. */ |
| 382 | setScoreFloor(floor: number, kept: number): void { |
no test coverage detected