Decouple listening from consuming as the first step toward a full MeshCore client. A new always-on EventHub owns the single device subscription and fans typed MeshEvents out to any number of subscribers; passive-monitor history logging becomes just one subscriber, so listening is now unconditional while the on/off toggle controls only persistence. - core/events.py: MeshEvent envelope + EventKind (OBSERVATION/MESSAGE/ACK) - services/event_hub.py: subscribe/stream/wait_for fan-out, always-on pump - connection.py: Device.subscribe_observations -> unified subscribe_events emitting observations, inbound messages, and acks; add message_from_event / ack_from_event mappers and a simulated message stream on MockDevice - core/models.py: Message and Ack domain models - monitor_service.py: slim to a hub subscriber (recording, not listening) - context.py/menu.py: wire ctx.events into the session lifecycle - config.py: connect_on_start setting (default on) to allow lazy connect - Remove monitor --seconds / foreground capture and Device.listen; monitoring is passive/background only Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
641 B
Python
20 lines
641 B
Python
"""Tests for application settings loading."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from meshtools.core.config import Settings
|
|
|
|
|
|
def test_connect_on_start_defaults_true() -> None:
|
|
"""Eager connect-at-launch is the default when nothing is configured."""
|
|
assert Settings().connect_on_start is True
|
|
|
|
|
|
def test_connect_on_start_loads_from_toml(tmp_path: Path) -> None:
|
|
"""The connect_on_start preference round-trips from the config file."""
|
|
config = tmp_path / "config.toml"
|
|
config.write_text("connect_on_start = false\n", encoding="utf-8")
|
|
assert Settings.load(config).connect_on_start is False
|