]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(quickadapter): quarantine corrupt optuna journal log and recover (#102)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 22 Jun 2026 12:31:01 +0000 (14:31 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2026 12:31:01 +0000 (14:31 +0200)
commit3a7303e7b64f3ea57987ad72e8b76e5092e98466
tree28389202dc36d081db470916492e9baa2f3b8f80
parentdfde6e98c581d7a9d514d570616767f2f5d11292
fix(quickadapter): quarantine corrupt optuna journal log and recover (#102)

When `JournalFileBackend`'s replay encounters a corrupt journal record, optuna raises during `JournalStorage.__init__` (Class A/B: immediate `KeyError`/`json.JSONDecodeError`) or defers the raise to the next `_sync_with_backend` (Class C1/C2/C3: truncated tail / malformed last line / bare trailing newline at EOF). Both paths previously caused HPO for the affected pair to be silently skipped on every fit cycle.

Wrap `JournalStorage` construction in a narrow `try / except (KeyError, ValueError, json.JSONDecodeError)`, atomically rename the corrupt log aside as `optuna-<COIN>.log.corrupt-<UTC_µs>`, log a `WARNING`, and retry once on a fresh path. A bounded O(1) tail probe runs BEFORE construction to detect deferred-raise EOF corruption. `OSError` is intentionally excluded so filesystem failures stay operator-actionable.

The recovery follows RocksDB's documented WAL recovery philosophy (quarantine + restart), preserves forensic evidence (rename, no `unlink`), and keeps the live-journal glob `optuna-*.log` from matching quarantined artefacts.
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py