Clarify TUI monitoring activation

This commit is contained in:
xavierk
2026-09-15 15:40:29 +05:30
parent d119a09b1f
commit 70dbae65fb
2 changed files with 18 additions and 14 deletions
+12 -9
View File
@@ -67,6 +67,11 @@ from .themes import THEMES, THEME_NAMES, get_theme, get_graph_colors
# Helpers
# ---------------------------------------------------------------------------
_RESUME_HINT = "r resume — enable monitoring and future boots"
_ACTION_LEGEND = (
"p pause · " + _RESUME_HINT + " · c collect · t theme · m motion · d disclosures"
)
def _format_remaining(seconds: float) -> str:
"""Format remaining lifespan as human-readable string."""
if seconds <= 0:
@@ -1164,7 +1169,7 @@ class FenrisTuiApp(App):
# Empty store — greeting with enable hint (IN-3)
self._render_headline(
"[bold]No observations yet[/bold]\n\n"
"Enable monitoring: fenris monitor resume"
"[bold]%s[/bold]" % _RESUME_HINT
)
self.query_one("#usage-history").set_data([])
if self._is_constrained_mode:
@@ -1173,10 +1178,10 @@ class FenrisTuiApp(App):
)
self.query_one("#drive-health").update("")
self.query_one("#service-strip").update(
(
"boot: disabled · timer: inactive · last collect: unknown · freshness: empty\n"
"[bold]CONTINUITY[/bold] %s\n"
"p pause · r resume · c collect · t theme · m motion · d disclosures"
% monitoring_continuity({"boot_enabled": False})
"[bold]CONTINUITY[/bold] %s\n" + _ACTION_LEGEND
) % monitoring_continuity({"boot_enabled": False})
)
else:
# Store fault (FL-4)
@@ -1191,7 +1196,7 @@ class FenrisTuiApp(App):
)
self.query_one("#drive-health").update("")
self.query_one("#service-strip").update(
"p pause · r resume · c collect · t theme · m motion · d disclosures"
_ACTION_LEGEND
)
def _render_all_regions(self, conn: sqlite3.Connection) -> None:
@@ -1279,16 +1284,14 @@ class FenrisTuiApp(App):
status_text = render_status_tui(comp)
# Add TUI-only actions
self.query_one("#service-strip").update(
"%s\n"
"p pause · r resume · c collect · t theme · m motion · d disclosures"
% status_text
"%s\n%s" % (status_text, _ACTION_LEGEND)
)
self._render_paused_banner(comp)
except Exception:
self._hide_paused_banner()
self.query_one("#service-strip").update(
"boot: unknown · timer: unknown · last collect: unknown · freshness: unknown\n"
"p pause · r resume · c collect · t theme · m motion · d disclosures"
+ _ACTION_LEGEND
)
def _render_paused_banner(self, comp) -> None:
+5 -4
View File
@@ -425,7 +425,7 @@ class TestDenseScreen:
quit_rail = app.query_one("#quit-rail")
assert "continuity" in strip
assert "monitoring: active in background · persists across reboots" in strip
assert "p pause · r resume · c collect · t theme · m motion · d disclosures" in strip
assert "r resume — enable monitoring and future boots" in strip
assert "q quit" not in strip
assert rail == "q QUIT TUI"
assert usage.region.y < service.region.y < quit_rail.region.y
@@ -597,13 +597,14 @@ class TestDisclosuresAndGreeting:
class TestFirstRun:
@pytest.mark.asyncio
async def test_first_run_prompt(self, tmp_path):
"""First-run prompt enables timer and opens first period."""
"""First-run prompt makes the keyboard action and boot effect explicit."""
app = FenrisTuiApp(store_path=tmp_path / "nonexistent.db")
async with app.run_test() as pilot:
headline = str(app.query_one("#headline-band").render())
strip = str(app.query_one("#service-strip").render())
assert "no observations yet" in headline.lower()
# The enable hint should mention resume
assert "resume" in headline.lower()
assert "r resume — enable monitoring and future boots" in headline.lower()
assert "r resume — enable monitoring and future boots" in strip.lower()
# ---------------------------------------------------------------------------