Report health on every transport, not only the broker
A shop configured for the HTTP route uploaded 17 bills correctly today and never once appeared on the fleet board. Nothing logged it, because from the terminal's point of view nothing had failed: the reporter was typed against MqttOrderTransport and started behind an `is MqttOrderTransport` check, so on HTTP it was silently never constructed. A monitoring feature that quietly does not exist on one of two supported routes is worse than no feature, because the blank square reads as "no terminals" rather than "not wired up". publishHealth moves onto the OrderTransport interface. The broker publishes to the health topic as before; HTTP posts the same payload to POST /pos/health; the simulated route does nothing, which is the honest answer for a till with no back office configured. The reporter is now started for every route. There was no test for the reporter at all, which is why this shipped. There are five now, including one that fails on the old code. Also removes test/widget_test.dart — the stock `flutter create` counter test, referencing a MyApp that never existed here. It has never compiled and was the only red in the suite. 263 tests pass, analyzer clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,5 +106,18 @@ abstract class OrderTransport {
|
||||
|
||||
bool get isConnected;
|
||||
|
||||
/// Sends one heartbeat, and never throws.
|
||||
///
|
||||
/// On the interface rather than on the broker transport alone, because it was
|
||||
/// on the broker transport alone and that was the bug: the reporter was
|
||||
/// started behind an `is MqttOrderTransport` check, so a shop on the HTTP
|
||||
/// route uploaded every bill correctly and never once appeared on the fleet
|
||||
/// board. Nothing logged it, because nothing had gone wrong — the feature
|
||||
/// simply did not exist on that route.
|
||||
///
|
||||
/// A transport with nowhere to send it does nothing. That is a real answer,
|
||||
/// not a stub: the simulated route has no back office to tell.
|
||||
Future<void> publishHealth(String payload);
|
||||
|
||||
Future<void> dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user