fix: address pre-merge review findings — stale identity strings, pyright error, fragile test path, formatting, README accuracy

Required fixes:
- main.py: update module docstring, startup comment, and FastAPI title from
  'tmux-web coordinator' / 'coordinator service' → 'muxplex' (4 locations)
- test_api.py: replace hasattr/BaseRoute pattern with isinstance(r, (APIRoute,
  APIWebSocketRoute)) to satisfy pyright (union-attr error eliminated)

Recommendations applied:
- test_api.py + test_cli.py: auto-formatted with ruff (blank-line normalisation)
- test_cli.py: replace exec(Path('muxplex/__main__.py').read_text()) with
  importlib.util.find_spec() to obtain the absolute path — no longer assumes
  pytest is invoked from a specific working directory
- README.md: fix architecture table — WebSocket proxy moved from ttyd.py
  description to main.py; ttyd.py now correctly described as lifecycle only

All 178 tests pass; python_check clean (0 errors, 0 warnings).
This commit is contained in:
Brian Krabach
2026-03-28 02:47:18 -07:00
parent 110a503df0
commit 82ec323aaa
4 changed files with 22 additions and 23 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
"""
FastAPI coordinator application for tmux-web.
muxplex — FastAPI application for the tmux session dashboard.
Entry point for the coordinator service. Exposes:
Entry point for the muxplex server. Exposes:
GET /health → {"status": "ok"}
Background poll loop reconciles tmux session state every POLL_INTERVAL seconds.
@@ -138,7 +138,7 @@ async def _poll_loop() -> None:
async def lifespan(app: FastAPI):
global _poll_task
# Startup: kill any orphaned ttyd from a previous coordinator run, then
# Startup: kill any orphaned ttyd from a previous muxplex run, then
# start the background poll loop.
await kill_orphan_ttyd()
_poll_task = asyncio.create_task(_poll_loop())
@@ -170,7 +170,7 @@ async def lifespan(app: FastAPI):
# App
# ---------------------------------------------------------------------------
app = FastAPI(title="tmux-web coordinator", version="0.1.0", lifespan=lifespan)
app = FastAPI(title="muxplex", version="0.1.0", lifespan=lifespan)
# ---------------------------------------------------------------------------