Merge origin/main into main

Reconcile the staged-projection and Diagnostics feature work with the CI
quality-gate changes from origin/main. The origin side of every conflict was
lint-only, so the feature imports were kept and the ruff fixes re-applied:

- keep the branch's added imports (timefmt, activity_readout, projection
  ladder helpers) and drop the unused ones ruff reported
- restore `noqa: E402` on the post-bootstrap imports in fenris-monitor and
  keep the `noqa: F401` re-exports in the TUI that tests assert on
- make the TUI monitoring-glyph test clock-relative instead of pinned to a
  fixed date
This commit is contained in:
xavierk
2026-10-06 10:14:09 +05:30
53 changed files with 288 additions and 229 deletions
+5 -11
View File
@@ -10,10 +10,9 @@ Covers:
- AC78-5: Separate freshness, last outcome, boot enablement, activity facts
- AC78-6: 5s poll reevaluates freshness from cached clock
"""
import sqlite3
from datetime import datetime, timedelta, timezone
from pathlib import Path
from unittest.mock import patch, MagicMock
from unittest.mock import patch
import pytest
import sys
@@ -23,12 +22,9 @@ sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from fenris.store import init_store
from fenris.status_composition import (
StatusState,
StatusComposition,
compose_status,
render_status_cli,
render_status_tui,
FRESH_THRESHOLD_S,
STALENESS_THRESHOLD_S,
)
@@ -682,7 +678,6 @@ class TestStoreFaultSuppression:
conn.close()
def test_newer_schema_suppresses_projection(self, tmp_path):
import fenris.store as store_mod
conn = init_store(tmp_path / "test.db")
now = _clock()
@@ -957,8 +952,7 @@ class TestTUIIntegration:
conn = init_store(tmp_path / "test.db")
_insert_segment(conn)
_open_period(conn)
now = _clock()
ts = (now - timedelta(minutes=2)).isoformat()
ts = (datetime.now(timezone.utc) - timedelta(minutes=2)).isoformat()
_insert_sample(conn, ts)
for i in range(20):
d = (datetime(2026, 9, 10) + timedelta(days=i)).strftime("%Y-%m-%d")
@@ -971,7 +965,7 @@ class TestTUIIntegration:
"last_collect_ok": True, "last_collect_age_s": 120,
"last_collect_reason": None,
}):
async with app.run_test() as pilot:
async with app.run_test():
strip = str(app.query_one("#service-strip").render())
assert "●" in strip
assert "Monitoring" in strip or "monitoring" in strip.lower()
@@ -997,7 +991,7 @@ class TestTUIIntegration:
"last_collect_ok": None, "last_collect_age_s": None,
"last_collect_reason": None,
}):
async with app.run_test() as pilot:
async with app.run_test():
strip = str(app.query_one("#service-strip").render())
# Should show Paused state
assert "‖" in strip or "Paused" in strip or "paused" in strip.lower()
@@ -1024,7 +1018,7 @@ class TestTUIIntegration:
"last_collect_ok": False, "last_collect_age_s": 60,
"last_collect_reason": "exit code 3",
}):
async with app.run_test() as pilot:
async with app.run_test():
strip = str(app.query_one("#service-strip").render())
# Should show Error state
assert "✖" in strip or "Error" in strip or "error" in strip.lower()