diff --git a/solstone/think/surfaces/health.py b/solstone/think/surfaces/health.py index 29aa14e36..ab281c5bb 100644 --- a/solstone/think/surfaces/health.py +++ b/solstone/think/surfaces/health.py @@ -411,6 +411,9 @@ def _scan_talent_day_indexes_for_24h_window( problems: dict[str, list[str]] = {} cutoff = generated_at - _DAY_MS + # Talent day indexes are keyed by content day (cortex's request["day"]), so + # a run executed in this window can live under an arbitrarily old filename. + # The row ts is the only reliable boundary for the 24h health counts. # Health intentionally ignores non-day-index root files; retention scans them # separately so it can explain why deletion was declined. for path in sorted(talents_dir.glob("*.jsonl")): diff --git a/tests/test_log_retention.py b/tests/test_log_retention.py index c5e609696..20100e22a 100644 --- a/tests/test_log_retention.py +++ b/tests/test_log_retention.py @@ -396,6 +396,14 @@ def test_ac8_ac9_talent_logs_indexes_and_malformed_names(journal): assert "malformed_date" in reasons assert "malformed_talent_index_row" in reasons assert "unreadable_talent_index" in reasons + error_paths = {error["path"] for error in result.errors} + malformed_paths = { + error["path"] + for error in result.errors + if error["reason"] == "malformed_talent_index_row" + } + assert old_malformed_index.relative_to(journal).as_posix() in malformed_paths + assert recent_index.relative_to(journal).as_posix() not in error_paths def test_ac10_ac11_symlink_unlinked_only_and_cache_mtime_day_logged(journal):