()
| 499 | // ─── Persistence ─────────────────────────────────────────────────────────── |
| 500 | |
| 501 | _save() { |
| 502 | try { |
| 503 | const dir = path.dirname(this._stateFile); |
| 504 | if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); |
| 505 | const state = { |
| 506 | phase: this._phase, |
| 507 | targetTest: this._targetTest, |
| 508 | redConfirmed: this._redConfirmed, |
| 509 | cycleId: this._cycleId, |
| 510 | startedAt: this._startedAt, |
| 511 | requirements: this._requirements, |
| 512 | loopActive: this._loopActive, |
| 513 | regressionClean: this._regressionClean, |
| 514 | updatedAt: new Date().toISOString(), |
| 515 | }; |
| 516 | const tmp = this._stateFile + `.tmp.${process.pid}`; |
| 517 | fs.writeFileSync(tmp, JSON.stringify(state, null, 2), { mode: FILE_MODE }); |
| 518 | fs.renameSync(tmp, this._stateFile); |
| 519 | } catch { |
| 520 | // Non-fatal |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | _load() { |
| 525 | try { |
no outgoing calls
no test coverage detected