* Pure gate decision for ONE existing file about to be mutated. * `currentMtimeMs` is the file's mtime on disk right now (caller stats it). * Non-existent files never reach this check (creation is always allowed).
(absPath: string, currentMtimeMs: number)
| 93 | * Non-existent files never reach this check (creation is always allowed). |
| 94 | */ |
| 95 | check(absPath: string, currentMtimeMs: number): GateVerdict { |
| 96 | const recorded = this.seen.get(absPath); |
| 97 | if (recorded === undefined) return { ok: false, kind: 'unread', path: absPath }; |
| 98 | // Allow a small clock-precision slack (some filesystems round mtime). |
| 99 | if (currentMtimeMs > recorded + 1) return { ok: false, kind: 'stale', path: absPath }; |
| 100 | return { ok: true }; |
| 101 | } |
| 102 | |
| 103 | size(): number { |
| 104 | return this.seen.size; |
no test coverage detected