* Which of `filePaths` the index flagged as tool-generated (schema v9+). * * Bounded-lookup by design: every consumer already holds a candidate list * (a ranked file group, an FTS result page, a batch of the dominant-file * ranking, the files that hold a route), so this stays a partial-i
(filePaths: Iterable<string>)
| 4071 | * until a re-index) keep the path-only behavior rather than regressing. |
| 4072 | */ |
| 4073 | getGeneratedPathsAmong(filePaths: Iterable<string>): Set<string> { |
| 4074 | const unique = [...new Set(filePaths)]; |
| 4075 | const found = new Set<string>(); |
| 4076 | if (unique.length === 0) return found; |
| 4077 | // An index from before schema v9 has no flag, which its migration adds |
| 4078 | // as 0 everywhere: the path convention alone decides (#2913). |
| 4079 | if (!this.hasSchema('files', 'generated')) return found; |
| 4080 | |
| 4081 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 4082 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 4083 | const placeholders = chunk.map(() => '?').join(','); |
| 4084 | const rows = this.db |
| 4085 | .prepare(`SELECT path FROM files WHERE generated = 1 AND path IN (${placeholders})`) |
| 4086 | .all(...chunk) as Array<{ path: string }>; |
| 4087 | for (const row of rows) found.add(row.path); |
| 4088 | } |
| 4089 | return found; |
| 4090 | } |
| 4091 | |
| 4092 | /** |
| 4093 | * A reusable `(path) => boolean` over a bounded candidate list, unioning the |
no test coverage detected