(path: string)
| 266 | } |
| 267 | |
| 268 | function handleChange(path: string): void { |
| 269 | const source = getSourceForPath(path) |
| 270 | if (!source) return |
| 271 | |
| 272 | // If a deletion was pending for this path (delete-and-recreate pattern), |
| 273 | // cancel the deletion — we'll process this as a change instead. |
| 274 | const pendingTimer = pendingDeletions.get(path) |
| 275 | if (pendingTimer) { |
| 276 | clearTimeout(pendingTimer) |
| 277 | pendingDeletions.delete(path) |
| 278 | logForDebugging( |
| 279 | `Cancelled pending deletion of ${path} — file was recreated`, |
| 280 | ) |
| 281 | } |
| 282 | |
| 283 | // Check if this was an internal write |
| 284 | if (consumeInternalWrite(path, INTERNAL_WRITE_WINDOW_MS)) { |
| 285 | return |
| 286 | } |
| 287 | |
| 288 | logForDebugging(`Detected change to ${path}`) |
| 289 | |
| 290 | // Fire ConfigChange hook first — if blocked (exit code 2 or decision: 'block'), |
| 291 | // skip applying the change to the session |
| 292 | void executeConfigChangeHooks( |
| 293 | settingSourceToConfigChangeSource(source), |
| 294 | path, |
| 295 | ).then(results => { |
| 296 | if (hasBlockingResult(results)) { |
| 297 | logForDebugging(`ConfigChange hook blocked change to ${path}`) |
| 298 | return |
| 299 | } |
| 300 | fanOut(source) |
| 301 | }) |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Handle a file being re-added (e.g. after a delete-and-recreate). Cancels any |
no test coverage detected