refactor(tui): extract Activity readout and show local time

Move activity data assembly out of tui.py into activity_readout, behind
readout(conn, selection, now). Dashboard and fenris-monitor enable now show
local time with a timezone label, inspected points keep a secondary UTC line,
and the legacy UTC-relabelled day and hour branches are gone. Time formatting
(including freshness_age_human) lives in timefmt. Hour offsets now render as
+05:30 to match day labels.
This commit is contained in:
xavierk
2026-10-05 20:21:22 +05:30
parent ef61ececc1
commit 79ebb10dea
20 changed files with 1297 additions and 834 deletions
+19
View File
@@ -84,6 +84,25 @@ class TestEnableIdempotentMatrix:
assert cursor.fetchone() is not None
conn.close()
def test_enable_reports_period_start_in_local_time(
self, store_path, monkeypatch, capsys,
):
"""The opened-at message is local time with its timezone label."""
monkeypatch.setenv("TZ", "Asia/Kolkata")
args = MagicMock(now=True, store_path=store_path)
conn = init_store(store_path)
conn.execute("DELETE FROM monitoring_periods")
conn.commit()
conn.close()
with patch("fenris.monitor.enable_timer"):
cmd_enable(args)
out = capsys.readouterr().out
assert "Monitoring period opened at" in out
assert "Asia/Kolkata +05:30" in out
assert "+00:00" not in out
def test_resume_with_open_period_noop(self, store_path):
"""Resume with open period: no-op (gap stays inside as unknown)."""
# Initialize store and open a period