Select the types of activity you want to include in your feed.
Rename "dirty days" to "updated days" across the codebase
Pure rename of all symbols, variables, constants, CSS classes, HTML IDs, JS functions, API routes, comments, docstrings, log messages, and test names. No behavioral changes.
···11# SPDX-License-Identifier: AGPL-3.0-only
22# Copyright (c) 2026 sol pbc
3344-"""Tests for dirty_days() utility."""
44+"""Tests for updated_days() utility."""
5566import time
7788import think.utils
99-from think.utils import dirty_days
99+from think.utils import updated_days
101011111212-def test_dirty_days_fixture(monkeypatch):
1313- """20250101 has stream.updated but no daily.updated — should be dirty."""
1212+def test_updated_days_fixture(monkeypatch):
1313+ """20250101 has stream.updated but no daily.updated — should be updated."""
1414 monkeypatch.setenv("JOURNAL_PATH", "tests/fixtures/journal")
1515 monkeypatch.setattr(think.utils, "_journal_path_cache", None)
1616- days = dirty_days()
1616+ days = updated_days()
1717 assert "20250101" in days
181819192020-def test_dirty_days_exclude(monkeypatch):
2020+def test_updated_days_exclude(monkeypatch):
2121 """Excluded days should not appear in results."""
2222 monkeypatch.setenv("JOURNAL_PATH", "tests/fixtures/journal")
2323 monkeypatch.setattr(think.utils, "_journal_path_cache", None)
2424- days = dirty_days(exclude={"20250101"})
2424+ days = updated_days(exclude={"20250101"})
2525 assert "20250101" not in days
262627272828-def test_dirty_days_clean(tmp_path, monkeypatch):
2929- """Day with daily.updated newer than stream.updated is not dirty."""
2828+def test_updated_days_clean(tmp_path, monkeypatch):
2929+ """Day with daily.updated newer than stream.updated is not updated."""
3030 monkeypatch.setenv("JOURNAL_PATH", str(tmp_path))
3131 day_dir = tmp_path / "20260101" / "health"
3232 day_dir.mkdir(parents=True)
3333 (day_dir / "stream.updated").touch()
3434 time.sleep(0.05)
3535 (day_dir / "daily.updated").touch()
3636- assert dirty_days() == []
3636+ assert updated_days() == []
373738383939-def test_dirty_days_no_stream(tmp_path, monkeypatch):
4040- """Day without stream.updated is not dirty (no stream data)."""
3939+def test_updated_days_no_stream(tmp_path, monkeypatch):
4040+ """Day without stream.updated is not updated (no stream data)."""
4141 monkeypatch.setenv("JOURNAL_PATH", str(tmp_path))
4242 (tmp_path / "20260101").mkdir()
4343- assert dirty_days() == []
4343+ assert updated_days() == []
+16-17
tests/test_supervisor_schedule.py
···25252626 with (
2727 patch("think.supervisor.datetime") as mock_datetime,
2828- patch("think.supervisor.dirty_days", return_value=["20250101"]),
2828+ patch("think.supervisor.updated_days", return_value=["20250101"]),
2929 ):
3030 mock_datetime.now.return_value.date.return_value = date(2025, 1, 2)
3131 handle_daily_tasks()
···78787979 with (
8080 patch("think.supervisor.datetime") as mock_datetime,
8181- patch("think.supervisor.dirty_days", return_value=["20250101"]),
8181+ patch("think.supervisor.updated_days", return_value=["20250101"]),
8282 ):
8383 mock_datetime.now.return_value.date.return_value = date(2025, 1, 2)
8484 handle_daily_tasks()
···114114 assert _daily_state["last_day"] == date(2025, 1, 1)
115115116116117117-def test_handle_daily_tasks_multiple_dirty_days_chronological(mock_callosum):
118118- """Dirty days are submitted oldest-first so yesterday is processed last."""
117117+def test_handle_daily_tasks_multiple_updated_days_chronological(mock_callosum):
118118+ """Updated days are submitted oldest-first so yesterday is processed last."""
119119 import think.supervisor as mod
120120 from think.supervisor import _daily_state, handle_daily_tasks
121121···133133 with (
134134 patch("think.supervisor.datetime") as mock_datetime,
135135 patch(
136136- "think.supervisor.dirty_days",
136136+ "think.supervisor.updated_days",
137137 return_value=["20250103", "20250104", "20250105"],
138138 ),
139139 ):
···145145 assert days == ["20250103", "20250104", "20250105"]
146146147147148148-def test_handle_daily_tasks_caps_at_max_dirty_catchup(mock_callosum):
149149- """Only the newest MAX_DIRTY_CATCHUP days are processed."""
148148+def test_handle_daily_tasks_caps_at_max_updated_catchup(mock_callosum):
149149+ """Only the newest MAX_UPDATED_CATCHUP days are processed."""
150150 import think.supervisor as mod
151151 from think.supervisor import _daily_state, handle_daily_tasks
152152···161161162162 mod._task_queue.submit = capture_submit
163163164164- all_dirty = [
164164+ all_updated = [
165165 "20250104",
166166 "20250105",
167167 "20250106",
···173173174174 with (
175175 patch("think.supervisor.datetime") as mock_datetime,
176176- patch("think.supervisor.dirty_days", return_value=all_dirty),
176176+ patch("think.supervisor.updated_days", return_value=all_updated),
177177 ):
178178 mock_datetime.now.return_value.date.return_value = date(2025, 1, 11)
179179 handle_daily_tasks()
···184184 assert days == ["20250107", "20250108", "20250109", "20250110"]
185185186186187187-def test_handle_daily_tasks_no_dirty_days(mock_callosum):
188188- """No submissions when there are no dirty days."""
187187+def test_handle_daily_tasks_no_updated_days(mock_callosum):
188188+ """No submissions when there are no updated days."""
189189 import think.supervisor as mod
190190 from think.supervisor import _daily_state, handle_daily_tasks
191191···202202203203 with (
204204 patch("think.supervisor.datetime") as mock_datetime,
205205- patch("think.supervisor.dirty_days", return_value=[]),
205205+ patch("think.supervisor.updated_days", return_value=[]),
206206 ):
207207 mock_datetime.now.return_value.date.return_value = date(2025, 1, 2)
208208 handle_daily_tasks()
209209210210 assert len(submitted) == 0
211211- # State still advances even with no dirty days
211211+ # State still advances even with no updated days
212212 assert _daily_state["last_day"] == date(2025, 1, 2)
213213214214215215def test_handle_daily_tasks_excludes_today(mock_callosum):
216216- """Today is excluded from dirty_days query."""
217217- import think.supervisor as mod
216216+ """Today is excluded from updated_days query."""
218217 from think.supervisor import _daily_state, handle_daily_tasks
219218220219 _daily_state["last_day"] = date(2025, 1, 1)
221220222221 captured_exclude = {}
223222224224- def fake_dirty_days(exclude=None):
223223+ def fake_updated_days(exclude=None):
225224 captured_exclude["value"] = exclude
226225 return ["20250101"]
227226228227 with (
229228 patch("think.supervisor.datetime") as mock_datetime,
230230- patch("think.supervisor.dirty_days", side_effect=fake_dirty_days),
229229+ patch("think.supervisor.updated_days", side_effect=fake_updated_days),
231230 ):
232231 mock_datetime.now.return_value.date.return_value = date(2025, 1, 2)
233232 handle_daily_tasks()
+1-1
think/dream.py
···14411441 if args.activity and not args.facet:
14421442 parser.error("--activity requires --facet")
1443144314441444- # Auto-enable refresh for dirty days (full daily runs only)
14441444+ # Auto-enable refresh for updated days (full daily runs only)
14451445 if not args.refresh and not args.segment and not args.segments:
14461446 health_dir = day_dir / "health"
14471447 stream_marker = health_dir / "stream.updated"
+16-16
think/supervisor.py
···2323from think.runner import DailyLogWriter
2424from think.runner import ManagedProcess as RunnerManagedProcess
2525from think.utils import (
2626- dirty_days,
2726 find_available_port,
2827 get_journal,
2928 get_journal_info,
3029 get_rev,
3130 now_ms,
3231 setup_cli,
3232+ updated_days,
3333)
34343535DEFAULT_THRESHOLD = 60
3636CHECK_INTERVAL = 30
3737-MAX_DIRTY_CATCHUP = 4
3737+MAX_UPDATED_CATCHUP = 4
38383939# Global shutdown flag
4040shutdown_requested = False
···101910191020102010211021def handle_daily_tasks() -> None:
10221022- """Check for day change and submit daily dream for dirty days (non-blocking).
10221022+ """Check for day change and submit daily dream for updated days (non-blocking).
1023102310241024- Triggers once when the day rolls over at midnight. Queries ``dirty_days()``
10241024+ Triggers once when the day rolls over at midnight. Queries ``updated_days()``
10251025 for journal days that have new stream data but haven't completed a daily
10261026- dream yet, then submits up to ``MAX_DIRTY_CATCHUP`` dreams in chronological
10261026+ dream yet, then submits up to ``MAX_UPDATED_CATCHUP`` dreams in chronological
10271027 order (oldest first, yesterday last) via the TaskQueue.
1028102810291029- Dream auto-detects dirty state and enables ``--refresh`` internally, so we
10291029+ Dream auto-detects updated state and enables ``--refresh`` internally, so we
10301030 don't pass it here.
1031103110321032 Skipped in remote mode (no local data to process).
···10581058 _check_segment_flush(force=True)
1059105910601060 today_str = today.strftime("%Y%m%d")
10611061- all_dirty = dirty_days(exclude={today_str})
10611061+ all_updated = updated_days(exclude={today_str})
1062106210631063- if not all_dirty:
10641064- logging.info("Day changed to %s, no dirty days to process", today)
10631063+ if not all_updated:
10641064+ logging.info("Day changed to %s, no updated days to process", today)
10651065 return
1066106610671067- # Take the newest MAX_DIRTY_CATCHUP days (already sorted ascending)
10681068- days_to_process = all_dirty[-MAX_DIRTY_CATCHUP:]
10691069- skipped = len(all_dirty) - len(days_to_process)
10671067+ # Take the newest MAX_UPDATED_CATCHUP days (already sorted ascending)
10681068+ days_to_process = all_updated[-MAX_UPDATED_CATCHUP:]
10691069+ skipped = len(all_updated) - len(days_to_process)
1070107010711071 if skipped:
10721072 logging.warning(
10731073- "Skipping %d older dirty days (max catchup %d): %s",
10731073+ "Skipping %d older updated days (max catchup %d): %s",
10741074 skipped,
10751075- MAX_DIRTY_CATCHUP,
10761076- all_dirty[:skipped],
10751075+ MAX_UPDATED_CATCHUP,
10761076+ all_updated[:skipped],
10771077 )
1078107810791079 logging.info(
10801080- "Day changed to %s, queuing daily dream for %d dirty day(s): %s",
10801080+ "Day changed to %s, queuing daily dream for %d updated day(s): %s",
10811081 today,
10821082 len(days_to_process),
10831083 days_to_process,
+8-8
think/utils.py
···212212 return days
213213214214215215-def dirty_days(exclude: set[str] | None = None) -> list[str]:
215215+def updated_days(exclude: set[str] | None = None) -> list[str]:
216216 """Return journal days with pending stream data not yet processed daily.
217217218218- A day is "dirty" when it has a ``health/stream.updated`` marker that is
218218+ A day is "updated" when it has a ``health/stream.updated`` marker that is
219219 newer than its ``health/daily.updated`` marker (or daily.updated is missing).
220220 Days without ``stream.updated`` are skipped entirely.
221221···227227 Returns
228228 -------
229229 list of str
230230- Sorted list of dirty day strings.
230230+ Sorted list of updated day strings.
231231 """
232232 days = day_dirs()
233233- dirty: list[str] = []
233233+ updated: list[str] = []
234234 for name, path in days.items():
235235 if exclude and name in exclude:
236236 continue
···239239 continue
240240 daily = os.path.join(path, "health", "daily.updated")
241241 if not os.path.isfile(daily):
242242- dirty.append(name)
242242+ updated.append(name)
243243 continue
244244 if os.path.getmtime(stream) > os.path.getmtime(daily):
245245- dirty.append(name)
246246- dirty.sort()
247247- return dirty
245245+ updated.append(name)
246246+ updated.sort()
247247+ return updated
248248249249250250def segment_path(day: str, segment: str, stream: str) -> Path: