MCPcopy Create free account
hub / github.com/code-pushup/cli / recover

Method recover

packages/utils/src/lib/wal.ts:205–217  ·  view source on GitHub ↗

* Recover all records from the WAL file. * Handles partial writes and decode errors gracefully. * Updates the recovery state (accessible via getStats). * @returns Recovery result with records, errors, and partial tail

()

Source from the content-addressed store, hash-verified

203 * @returns Recovery result with records, errors, and partial tail
204 */
205 recover(): RecoverResult<T | InvalidEntry<string>> {
206 if (!fs.existsSync(this.#file)) {
207 this.#lastRecoveryState = { records: [], errors: [], partialTail: null };
208 return this.#lastRecoveryState;
209 }
210 const txt = fs.readFileSync(this.#file, 'utf8');
211 this.#lastRecoveryState = recoverFromContent<T | InvalidEntry<string>>(
212 txt,
213 this.#decode,
214 );
215
216 return this.#lastRecoveryState;
217 }
218
219 /**
220 * Repack the WAL by recovering all valid records and rewriting cleanly.

Callers 4

repackMethod · 0.95
wal.int.test.tsFile · 0.80
wal.unit.test.tsFile · 0.80
finalizeMethod · 0.80

Calls 1

recoverFromContentFunction · 0.85

Tested by

no test coverage detected