(paths: DecisionPaths)
| 231 | |
| 232 | /** Read the bounded active snapshot. Returns [] if missing/corrupt (caller may rebuild). */ |
| 233 | export function readSnapshot(paths: DecisionPaths): ActiveDecision[] { |
| 234 | if (!existsSync(paths.snapshot)) return []; |
| 235 | try { |
| 236 | const v = JSON.parse(readFileSync(paths.snapshot, "utf-8")); |
| 237 | return Array.isArray(v) ? (v as ActiveDecision[]) : []; |
| 238 | } catch { |
| 239 | return []; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | /** Recompute active from the event log and refresh the snapshot. Returns active. */ |
| 244 | export function rebuildSnapshot(paths: DecisionPaths): ActiveDecision[] { |
no outgoing calls
no test coverage detected