* 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>)
| 4182 | * until a re-index) keep the path-only behavior rather than regressing. |
| 4183 | */ |
| 4184 | getGeneratedPathsAmong(filePaths: Iterable<string>): Set<string> { |
| 4185 | const unique = [...new Set(filePaths)]; |
| 4186 | const found = new Set<string>(); |
| 4187 | if (unique.length === 0) return found; |
| 4188 | // An index from before schema v9 has no flag, which its migration adds |
| 4189 | // as 0 everywhere: the path convention alone decides (#2913). |
| 4190 | if (!this.hasSchema('files', 'generated')) return found; |
| 4191 | |
| 4192 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 4193 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 4194 | const placeholders = chunk.map(() => '?').join(','); |
| 4195 | const rows = this.db |
| 4196 | .prepare(`SELECT path FROM files WHERE generated = 1 AND path IN (${placeholders})`) |
| 4197 | .all(...chunk) as Array<{ path: string }>; |
| 4198 | for (const row of rows) found.add(row.path); |
| 4199 | } |
| 4200 | return found; |
| 4201 | } |
| 4202 | |
| 4203 | /** |
| 4204 | * A reusable `(path) => boolean` over a bounded candidate list, unioning the |
no test coverage detected