midi-harbor/specs/011-midi-service-crash-warning/tasks.md
2026-09-28 13:59:10 -05:00

3.5 KiB

Tasks: MIDI Service Crash Warning

Tasks by their numbers in the project-wide sequence, which continues across every spec. Each was built and checked in one piece, so they are not broken into phases.

  • T236 Warn that the MIDI service stopped and was restarted after the daemon replaces one that lost it, without naming applications, since other applications using MIDI may have lost their connection with the service and only a relaunch mends them (R-101, owner decision 2026-09-27), per FR-032, FR-044 — done: a midi_server_replaced event replaces the daemon_started warning, and StatusSummary.midi_server_replaced_at (6) carries the time for as long as that process runs; status warns above its table and --json carries the time; the window shows a banner until dismissed, remembered in the window only; the replacement posts one desktop notification through osascript, none from the sandboxed helper. Protocol 1.2. A CLI test over the binary checks status, status --json and events --json for a replaced daemon and a plain one.

  • T237 Report when each endpoint last received and last sent a message, and a network port's automatic port's traffic, over the contract, in status, the endpoint panel and the diagnostic report, per FR-044, FR-045, FR-048 — done: TrafficCounters.last_received (10) and last_sent (11), stored beside last_activity with one more relaxed store each on the data path; NetworkSessionDetail.automatic_port_counters (11); status gains LAST IN and LAST OUT and a row under each network port for its automatic port. A contract test sends a note into an automatic port over loopback and checks the times each way; swapping the two stores fails it.

  • T238 Log each endpoint's traffic when it moves, so the log says whether a message arrived at a given minute after the history is gone, per FR-048, Constitution Principle III — done: a task reads the counters every 10 s and writes a traffic line at info with the totals and last times, at the first look after a quiet one and then at most once a minute while traffic keeps moving; the data path is unchanged. Not unit tested: the rule restates this code.

  • T242 Date the MIDI service warning when the daemon found the service gone rather than when its replacement started, which can be up to 30 s later while the service comes back, per FR-M04 — done: the daemon records when its watcher saw the loss, and the process replacing it receives the time in MIDI_HARBOR_MIDI_SERVER_LOST_AT, an RFC 3339 time, beside MIDI_HARBOR_REPLACED_BECAUSE; the warning and the midi_server_replaced event carry it, and a replacement not told falls back to its own start. The server-loss test checks the daemon records the time; checked live by starting a replacement with the variable set, and status and the window gave that time.

  • T243 Let dismissing the warning tell the daemon, so a warning seen in one window no longer shows in another or in status (owner request 2026-09-27), per FR-M04 — done: a DismissMidiServerWarning RPC (protocol 1.2) clears it and says whether there was one; the window's Dismiss calls it and hides the banner at once, replacing the window-only dismissal; midi-harbor dismiss-warning, which status now names in its warning. The CLI test checks the time handed over, the dismissal, a second dismissal finding nothing, and status --json after; making the daemon ignore the handed-over time, or not clear the warning, fails it. Checked live both ways: Dismiss in the window cleared status, and dismiss-warning cleared an open window's banner at its next refresh.