Clarify TUI monitoring activation

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