Skip to content

feat: status-bar polish — window fit, client telemetry, async LAN rebind, loopback default - #93

Merged
falbany merged 5 commits into
mainfrom
feat/window-fit-and-client-telemetry
Nov 3, 2026
Merged

falbany merged 5 commits into
mainfrom
feat/window-fit-and-client-telemetry

Conversation

@falbany

@falbany falbany commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #92 (LAN serving): make the window fit the enlarged status bar, log web-client activity to the application logger, fix the LAN toggle (which could never work through the HTTP route), and flip the default bind to loopback-only now that LAN is a one-click opt-in.

Window geometry

  • PyWebView window 1000×700 → 1200×700, min_size 800×500 → 1000×500 — the status bar with the LAN toggle needs ~1050px.

Client connection telemetry (profiles.log)

  • WEB_CLIENT event="reconnected" / event="disconnected": idle-threshold sweep (120 s — above the ~60 s browser background-tab throttle — checked every 15 s by a lifespan watchdog).
  • BIND_CHANGED (INFO) on a successful rebind, BIND_CHANGE_FAILED (WARNING) on failure + revert — no silent failures.
  • docs/operations/log-format.md catalogue gains the missing WEB_CLIENT row plus the two bind rows.

Fix: LAN toggle (RuntimeError on rebind)

  • Root cause: the bind route ran on the uvicorn server thread, so rebind() → stop() → self._thread.join() joined the current thread (RuntimeError, HTTP 500). A synchronous in-request rebind is structurally impossible anyway — the old server cannot release its port while serving the request that asked for the rebind.
  • POST /api/system/bind now answers {"status": "rebinding"} immediately; a worker thread rebinds after the response is flushed (revert-on-failure untouched); the UI polls GET /api/system for the real outcome (~1 s) and toasts accordingly.

Loopback-only by default

  • --host / ProFileApp / BackgroundServer all default to 127.0.0.1; --host 0.0.0.0 pre-enables LAN for headless launches, or use the status-bar toggle at runtime.
  • The server-only console banner advertises Network: URLs only when the bind actually exposes them.
  • Spec (2026-11-03-lan-serving-design.md) amended with a dated revision; network-server-guide EN/FR and CHANGELOG updated.

Web UX

  • Copy buttons for the LAN dialog URLs — new CopyableUrl component; ConfirmDialog.message now accepts a ReactNode.

Verification

  • pytest: 1383 passed, failing set a strict subset of the Windows baseline (68 vs 70 — the loopback default fixed 2 pre-existing failures); coverage gate 87.55% ≥ 85%.
  • vitest 177/177, tsc -b clean, dist/ rebuilt.
  • Regression test for the rebind bug is a true integration test (real BackgroundServer + real HTTP POST); banner, sweep, and dialog tests added.
  • Manually tested end-to-end by the author (window fit, LAN toggle on/off from local + LAN client, telemetry lines, copy buttons).

f.albany added 5 commits November 3, 2026 17:16
The bind route handler runs on the uvicorn thread, so a synchronous
rebind() had stop() join the current thread (RuntimeError) — and a
server cannot release its port while still serving the request that
asked for the rebind. The route now answers 'rebinding' immediately
and a worker thread performs the rebind after the response, emitting
BIND_CHANGED / BIND_CHANGE_FAILED. The UI polls /api/system for the
actual outcome instead of trusting an instant refetch.
--host now defaults to 127.0.0.1: the status-bar LAN toggle makes LAN
exposure a one-click opt-in, so serving the network by default is no
longer justified. --host 0.0.0.0 pre-enables LAN for headless launches.
BackgroundServer's own default flips too (safe at every layer), and the
server-only banner advertises Network URLs only when the bind exposes
them. Spec amended with a dated revision; guides + CHANGELOG updated.
New CopyableUrl component (monospace URL + icon-only copy button with
success/error callbacks); ConfirmDialog.message now accepts a ReactNode
so the LAN dialog can embed the URL rows. Clipboard feedback follows the
existing path/filename copy toasts.
@falbany
falbany merged commit 4c4f220 into main Nov 3, 2026
1 check passed
@falbany
falbany deleted the feat/window-fit-and-client-telemetry branch November 3, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant