()
| 528 | * view of the config — only writes need the stricter contract enforced in |
| 529 | * `updateConfig`. */ |
| 530 | export async function loadConfig(): Promise<PersistedConfig> { |
| 531 | const result = await loadConfigSafely() |
| 532 | if (result.readable) return result.config |
| 533 | // Unreadable: callers reading for display can fall back to defaults rather |
| 534 | // than crashing. Writes go through `updateConfig`, which uses |
| 535 | // `loadConfigSafely` directly and aborts instead of clobbering. |
| 536 | return { ...DEFAULT_CONFIG } |
| 537 | } |
| 538 | |
| 539 | function sanitizeForPersist(cfg: PersistedConfig): PersistedConfig { |
| 540 | const normalized = normalizePersistedConfig(cfg) |
no test coverage detected