test(mqtt): extract + test remaining inline MQTT decision points (Phase 6)
Close the host-testable gaps named in Phase 6 of STABILITY_TESTABILITY_HANDOFF.md
by moving the last inline decision logic into the pure, host-tested policy seams:
- WiFi STA reconnect backoff: extract the inline ladder + wrap-safe timing from
handleWiFiConnection() into MQTTConnectionPolicy::{wifiReconnectBackoffMs,
wifiReconnectDue,nextWifiBackoffAttempt}. Behavior-preserving (elapsedMs is the
wrap-safe form of the old ULONG_MAX branch); ladder/clamp/attempt-cap unchanged.
- Publication outcome pairing: name the (packet, raw) -> delivered contract as
MQTTPacketQueuePolicy::queuedPacketPublished() and wire both queue-drain sites;
partial success = completed, not retried.
- Freeze MQTTPublicationType enum values in a test (the bridge-side MQTTMessageType
alignment is already enforced by a compile-time static_assert).
Adds host tests for all three (exact boundaries + millis() rollover). Native suite
green (13 dirs); non-PSRAM observer firmware smoke build compiles.
WebConfig batch/reboot/stop state-machine extraction and queue-orchestration
coverage remain open (tracked in the Phase 6 status).
This commit is contained in:
1 parent
2e1a1410ce
commit
b0cf29fb33
7 files changed
+151
-15
No files matched your search
@@ -87,6 +87,17 @@ struct RetryDecision {
|
||||
uint32_t next_retry_ms;
|
||||
};
|
||||
|
||||
// A queued packet counts as delivered if EITHER its structured-packet publish
|
||||
// or its raw-frame publish reached at least one slot. Partial success (one
|
||||
// succeeds while the other fails or was not attempted) is still success — the
|
||||
// packet completes and is not retried. This is the (packet, raw) outcome pairing
|
||||
// fed to retryDecision(); naming it keeps the "partial publish = done" contract
|
||||
// explicit and host-tested rather than inline in the bridge's queue drain.
|
||||
static inline bool queuedPacketPublished(bool packet_published,
|
||||
bool raw_published) {
|
||||
return packet_published || raw_published;
|
||||
}
|
||||
|
||||
static inline RetryDecision retryDecision(bool any_published,
|
||||
uint8_t retry_attempts,
|
||||
uint32_t now) {
|
||||
|
||||
Reference in new issue
Block a user