File-backed audit storage. Writes JSONL to path via runtime.fs.
At construction, when fs is absent, throws the documented error. Uses
read-modify-write (read the whole file, append a line, write back).
append(entry: StoredAuditEntry): Promise<void>
Read-modify-write with serialized in-process appends via _lock.
Cross-process file contention is inherent to the OS file and not solved here.
close(): Promise<void>
Awaits the serialized write chain so no in-flight append is lost on close.
isHealthy(): Promise<boolean>
Reports whether the audit file's sink is reachable.
Two signals, cheapest first. A most-recent append that FAILED is
conclusive — the trail is demonstrably not being written, whatever the
filesystem says now. Otherwise the target directory is stated, which is
what catches the failure that has no write to observe yet: a volume
unmounted, a path deleted, a network mount gone away.
It deliberately does NOT write a probe file. The M70k LocalStorageProvider
precedent proves a root writable at connect(), but this backend has no
connect phase, and probing by writing on a health interval would either
append junk to the audit trail itself or litter its directory — for a
capability whose whole value is that its file contains exactly what was
logged. A root that is readable but not writable is therefore reported
true until the first append proves otherwise, which is the one gap here
and is the reason the append outcome is tracked at all.
isReady(): boolean
File storage is always ready once constructed (we don't probe the FS).
query(criteria?: AuditQuery): Promise<StoredAuditEntry[]>
Reads and filters lines via matchAuditQuery.