Report uncertain preference saves without promising rollback

This commit is contained in:
mikecarper committed 2026-10-16 13:45:48 -07:00
1 parent f6c00be3e0
commit 5fc0943f59
17 files changed
+807 -45

No files matched your search

+4 -3
View File
@@ -112,7 +112,7 @@ int main() {
cli.callbacks.common_ok = false;
if (guest) cli.set("guest.password new-guest", reply);
else cli.password("password new-admin", reply);
assert(error(reply) && strstr(reply, "unchanged"));
assert(error(reply) && strstr(reply, "unconfirmed") && strstr(reply, "reboot"));
assert(strcmp(cli.prefs.password, "old-admin") == 0);
assert(strcmp(cli.prefs.guest_password, "old-guest") == 0);
assert(cli.prefs.advert_interval == 2 && cli.callbacks.local_updates == 0);
@@ -143,7 +143,7 @@ int main() {
assert(error(reply) && cli.callbacks.saves == 0);
cli.callbacks.common_ok = false;
cli.set((std::string(key) + (flood ? "3" : "120")).c_str(), reply);
assert(error(reply) && strstr(reply, "unchanged"));
assert(error(reply) && strstr(reply, "unconfirmed") && strstr(reply, "reboot"));
assert(cli.prefs.advert_interval == 30 && cli.prefs.flood_advert_interval == 12);
assert(cli.callbacks.local_updates == 0 && cli.callbacks.flood_updates == 0);
cli.callbacks.common_ok = true;
@@ -188,7 +188,8 @@ int main() {
cli.prefs.dirty = false;
cli.callbacks.common_ok = false;
cli.set("multi.acks 2", reply);
assert(error(reply) && strstr(reply, "unsaved changes"));
assert(error(reply) && strstr(reply, "unconfirmed") && strstr(reply, "may be active")
&& strstr(reply, "reboot may differ"));
assert(cli.prefs.multi_acks == 2 && cli.callbacks.persisted.multi_acks == 0);
assert(cli.prefs.dirty && cli._prefs_save_failures == 1);
cli.callbacks.common_ok = true;
+320
View File
@@ -0,0 +1,320 @@
// Insert only actual production parsing and the four bounded CLI branches.
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <helpers/CLICommandUtils.h>
#define BRIDGE_MAX_BAUD 115200
struct NodePrefs {
uint8_t bridge_enabled = 0;
uint8_t rs232_bridge_enabled = 0;
uint32_t bridge_baud = 9600;
uint8_t bridge_uart = 1;
uint8_t espnow_bridge_enabled = 1;
bool operator==(const NodePrefs& other) const {
return bridge_enabled == other.bridge_enabled
&& rs232_bridge_enabled == other.rs232_bridge_enabled
&& bridge_baud == other.bridge_baud && bridge_uart == other.bridge_uart
&& espnow_bridge_enabled == other.espnow_bridge_enabled;
}
};
struct Event {
std::string kind;
bool enabled;
NodePrefs prefs;
};
struct Sensors {
bool gps = false;
bool conflict = false;
bool yield = true;
bool gpsUsesSerialUart(uint8_t) const { return gps; }
bool gpsSerialTransportMayConflict(uint8_t) const { return conflict; }
bool gpsSerialTransportCanYield(uint8_t) const { return yield; }
};
struct Callbacks {
NodePrefs* prefs;
std::vector<Event> events;
std::vector<bool> responses;
size_t response_index = 0;
bool running = false;
bool save_result = true;
unsigned save_calls = 0;
unsigned running_queries = 0;
bool result(const char* kind, bool enabled) {
events.push_back({kind, enabled, *prefs});
assert(response_index < responses.size());
const bool accepted = responses[response_index++];
// A failed apply can have torn down its previous runtime owner. This
// forces rollback rather than accidentally hiding that branch in tests.
running = accepted && enabled;
return accepted;
}
bool setRs232BridgeState(bool enabled) { return result("state", enabled); }
bool restartRs232Bridge() { return result("restart", true); }
bool isRs232BridgeRunning() { ++running_queries; return running; }
bool save() {
events.push_back({"save", false, *prefs});
++save_calls;
return save_result;
}
};
struct CommonCLI {
NodePrefs* _prefs;
Callbacks* _callbacks;
Sensors* _sensors;
bool trySavePrefs() { return _callbacks->save(); }
void rs232(const char*, char*);
void bridge(const char*, char*);
void baud(const char*, char*);
void uart(const char*, char*);
};
@PARSE_ON_OFF@
@PRODUCTION_BRANCHES@
enum class Branch { Rs232, Bridge, Baud, Uart };
static bool isEnable(Branch branch) {
return branch == Branch::Rs232 || branch == Branch::Bridge;
}
static uint8_t& intent(NodePrefs& prefs) {
#ifdef WITH_MQTT_BRIDGE
return prefs.rs232_bridge_enabled;
#else
return prefs.bridge_enabled;
#endif
}
static NodePrefs initial(bool enabled) {
NodePrefs prefs;
intent(prefs) = enabled;
#ifdef WITH_MQTT_BRIDGE
prefs.bridge_enabled = !enabled; // Independent MQTT intent must survive.
#else
prefs.rs232_bridge_enabled = enabled;
#endif
return prefs;
}
static void run(CommonCLI& cli, Branch branch, bool enabled, char* reply,
bool unchanged = false) {
switch (branch) {
case Branch::Rs232:
cli.rs232(enabled ? "rs232.enabled on" : "rs232.enabled off", reply);
break;
case Branch::Bridge:
#ifndef WITH_MQTT_BRIDGE
cli.bridge(enabled ? "bridge.enabled on" : "bridge.enabled off", reply);
#else
assert(false && "standalone bridge branch is not an MQTT command");
#endif
break;
case Branch::Baud:
cli.baud(unchanged ? "bridge.baud 9600" : "bridge.baud 19200", reply);
break;
case Branch::Uart:
cli.uart(unchanged ? "bridge.uart 1" : "bridge.uart 2", reply);
break;
}
}
static NodePrefs candidateFor(NodePrefs before, Branch branch, bool enabled,
bool unchanged = false) {
if (isEnable(branch)) intent(before) = enabled;
else if (branch == Branch::Baud) before.bridge_baud = unchanged ? 9600 : 19200;
else before.bridge_uart = unchanged ? 1 : 2;
return before;
}
static const char* failedReply(Branch branch, bool applied, bool restored) {
if (applied) {
return restored ? "Error: save unconfirmed; reboot may differ"
: "Error: save unconfirmed; runtime restore failed; reboot may differ";
}
switch (branch) {
case Branch::Rs232:
return restored ? "Error: RS232 change failed; setting unchanged"
: "Error: RS232 change failed; previous runtime could not be restored";
case Branch::Bridge:
return restored ? "Error: bridge state change failed; setting unchanged"
: "Error: bridge state change failed; previous runtime state could not be restored";
case Branch::Baud:
return restored ? "Error: bridge failed to restart; baud unchanged"
: "Error: bridge failed to restart; previous baud could not be restored";
case Branch::Uart:
return restored ? "Error: bridge failed to restart; UART unchanged"
: "Error: bridge failed to restart; previous UART could not be restored";
}
assert(false);
return "";
}
static unsigned cases = 0;
static void matrixCase(Branch branch, bool previous, bool applied, bool saved,
bool restored) {
NodePrefs prefs = initial(previous);
const NodePrefs before = prefs;
const bool requested = !previous;
const NodePrefs candidate = candidateFor(before, branch, requested);
Callbacks callbacks{&prefs, {}, {applied, restored}};
callbacks.running = previous;
callbacks.save_result = saved;
Sensors sensors;
CommonCLI cli{&prefs, &callbacks, &sensors};
char reply[160] = {};
run(cli, branch, requested, reply);
assert(callbacks.save_calls == (applied ? 1u : 0u));
assert(callbacks.events[0].kind == (isEnable(branch) ? "state" : "restart"));
assert(callbacks.events[0].prefs == candidate);
if (isEnable(branch)) assert(callbacks.events[0].enabled == requested);
if (applied) {
assert(callbacks.events[1].kind == "save");
assert(callbacks.events[1].prefs == candidate);
}
if (applied && saved) {
assert(!strcmp(reply, "OK"));
assert(prefs == candidate);
assert(callbacks.events.size() == 2);
assert(callbacks.response_index == 1);
} else {
assert(!strcmp(reply, failedReply(branch, applied, restored)));
assert(prefs == before);
assert(callbacks.events.size() == (applied ? 3u : 2u));
const Event& rollback = callbacks.events.back();
assert(rollback.kind == (isEnable(branch) ? "state" : "restart"));
assert(rollback.prefs == before);
assert(rollback.enabled == (isEnable(branch) ? previous : true));
assert(callbacks.response_index == 2);
if (applied) {
assert(strstr(reply, "unconfirmed"));
assert(strstr(reply, "reboot may differ"));
assert(!strstr(reply, "unchanged"));
} else {
assert(!strstr(reply, "unconfirmed"));
}
}
++cases;
}
static void disabledSettingCase(Branch branch, bool saved, bool restored) {
NodePrefs prefs = initial(false);
const NodePrefs before = prefs;
const NodePrefs candidate = candidateFor(before, branch, false);
Callbacks callbacks{&prefs, {}, {restored}};
callbacks.save_result = saved;
Sensors sensors;
CommonCLI cli{&prefs, &callbacks, &sensors};
char reply[160] = {};
run(cli, branch, false, reply);
// A disabled bridge needs no runtime restart to apply UART/baud changes.
assert(callbacks.save_calls == 1);
assert(callbacks.events[0].kind == "save");
assert(callbacks.events[0].prefs == candidate);
if (saved) {
assert(!strcmp(reply, "OK"));
assert(prefs == candidate);
assert(callbacks.events.size() == 1);
assert(callbacks.response_index == 0);
} else {
assert(!strcmp(reply, failedReply(branch, true, restored)));
assert(prefs == before);
assert(callbacks.events.size() == 2);
assert(callbacks.events[1].kind == "state");
assert(!callbacks.events[1].enabled);
assert(callbacks.events[1].prefs == before);
assert(callbacks.response_index == 1);
}
++cases;
}
static void healthyCase(Branch branch, bool previous, bool gps, bool unchanged) {
NodePrefs prefs = initial(previous);
const NodePrefs before = prefs;
const bool requested = unchanged ? previous : !previous;
const NodePrefs candidate = candidateFor(before, branch, requested, unchanged);
const bool applies = isEnable(branch) || previous;
Callbacks callbacks{&prefs, {}, {true}};
callbacks.running = previous;
Sensors sensors;
sensors.gps = gps;
CommonCLI cli{&prefs, &callbacks, &sensors};
char reply[160] = {};
run(cli, branch, requested, reply, unchanged);
const bool paused = gps && ((isEnable(branch) && requested)
|| (branch == Branch::Uart && previous));
assert(!strcmp(reply, paused ? "OK - UART GPS paused" : "OK"));
assert(prefs == candidate);
assert(callbacks.save_calls == 1);
assert(callbacks.events.size() == (applies ? 2u : 1u));
assert(callbacks.response_index == (applies ? 1u : 0u));
for (const Event& event : callbacks.events) assert(event.prefs == candidate);
++cases;
}
#ifndef WITH_MQTT_BRIDGE
static void alreadyRestoredCase() {
NodePrefs prefs = initial(true);
const NodePrefs before = prefs;
Callbacks callbacks{&prefs, {}, {true}};
callbacks.running = true;
callbacks.save_result = false;
Sensors sensors;
CommonCLI cli{&prefs, &callbacks, &sensors};
char reply[160] = {};
// A successfully applied same-value ON leaves the old runtime running.
// A refused disable also leaves it stopped in this adapter and must call
// the restoration callback instead, as covered by matrixCase above.
run(cli, Branch::Bridge, true, reply, true);
assert(!strcmp(reply, "Error: save unconfirmed; reboot may differ"));
assert(prefs == before);
assert(callbacks.events.size() == 2);
assert(callbacks.response_index == 1);
assert(callbacks.running_queries == 1);
++cases;
}
#endif
int main() {
const Branch branches[] = {Branch::Rs232,
#ifndef WITH_MQTT_BRIDGE
Branch::Bridge,
#endif
Branch::Baud, Branch::Uart};
for (Branch branch : branches) {
for (bool applied : {false, true}) {
for (bool saved : {false, true}) {
for (bool restored : {false, true}) {
matrixCase(branch, true, applied, saved, restored);
if (isEnable(branch)) matrixCase(branch, false, applied, saved, restored);
}
}
}
for (bool previous : {false, true}) {
for (bool gps : {false, true}) {
for (bool unchanged : {false, true}) {
healthyCase(branch, previous, gps, unchanged);
}
}
}
}
for (Branch branch : {Branch::Baud, Branch::Uart}) {
for (bool saved : {false, true}) {
for (bool restored : {false, true}) disabledSettingCase(branch, saved, restored);
}
}
#ifndef WITH_MQTT_BRIDGE
alreadyRestoredCase();
#endif
printf("%u actual CommonCLI apply/save/restore cases passed\n", cases);
}
+209
View File
@@ -0,0 +1,209 @@
// Included after the extracted production CommonCLI methods and serializer.
#include <cstdio>
static const char* oldSecret(bool guest) { return guest ? "old-guest" : "old-admin"; }
static const char* newSecret(bool guest) { return guest ? "new-guest" : "new-admin"; }
static const char* retrySecret(bool guest) { return guest ? "retry-guest" : "retry-admin"; }
static const char* currentSecret(const CommonCLI& cli, bool guest) {
return guest ? cli.prefs.guest_password : cli.prefs.password;
}
static void seed(CommonCLI& cli) {
strcpy(cli.prefs.password, oldSecret(false));
strcpy(cli.prefs.guest_password, oldSecret(true));
cli.savePrefs(&cli.fs, PrefsSaveRouting::Scope::Common);
assert(cli._common_save_result_known && cli._common_save_succeeded);
}
static void change(CommonCLI& cli, bool guest, const char* secret, char* reply) {
char command[80] = {};
snprintf(command, sizeof(command), "%s%s", guest ? "guest.password " : "password ", secret);
memset(reply, 0, 160);
if (guest) cli.guestPassword(command, reply);
else cli.password(command, reply);
}
static void assertError(const char* reply, bool guest, const char* attempted) {
assert(strncmp(reply, "Error:", 6) == 0);
assert(strstr(reply, "unconfirmed") != nullptr);
assert(strstr(reply, "reboot") != nullptr);
assert(strstr(reply, "unchanged") == nullptr);
assert(strstr(reply, "OK") == nullptr);
// Neither an old credential nor any attempted credential belongs in an
// error, even though the successful admin command intentionally echoes it.
for (const char* secret : {oldSecret(false), oldSecret(true),
newSecret(false), newSecret(true), attempted}) {
assert(strstr(reply, secret) == nullptr);
}
(void)guest;
}
static void assertSuccess(const CommonCLI& cli, bool guest,
const char* secret, const char* reply) {
assert(cli._common_save_result_known && cli._common_save_succeeded);
assert(strcmp(currentSecret(cli, guest), secret) == 0);
if (guest) assert(strcmp(reply, "OK") == 0);
else {
char expected[80];
snprintf(expected, sizeof(expected), "password now: %s", secret);
assert(strcmp(reply, expected) == 0);
}
}
static void assertReboot(const CommonCLI& cli, bool guest, const char* expected) {
CommonCLI reboot;
reboot.fs.files = cli.fs.files;
reboot.loadPrefsInt(&reboot.fs, "/com_prefs");
assert(strcmp(currentSecret(reboot, guest), expected) == 0);
assert(strcmp(currentSecret(reboot, !guest), oldSecret(!guest)) == 0);
}
static void clearFaults(CommonCLI& cli) {
cli.fs.fail_write = false;
cli.fs.fail_write_after = -1;
cli.fs.fail_read_open = false;
cli.fs.fail_after_publication = false;
cli.fs.fail_rename = 0;
}
static void assertLegacyError(const CommonCLI& cli, const char* reply) {
assert(!cli._common_save_succeeded && cli._prefs_save_failures == 1);
assert(cli.prefs.dirty);
assert(strncmp(reply, "Error:", 6) == 0);
assert(strstr(reply, "unconfirmed") != nullptr);
assert(strstr(reply, "active") != nullptr);
assert(strstr(reply, "reboot") != nullptr);
assert(strstr(reply, "unchanged") == nullptr && strstr(reply, "OK") == nullptr);
assert(strstr(reply, "unsaved") == nullptr);
}
static void assertLegacyReboot(const CommonCLI& cli, uint8_t expected) {
CommonCLI reboot;
reboot.fs.files = cli.fs.files;
reboot.loadPrefsInt(&reboot.fs, "/com_prefs");
assert(reboot.prefs.multi_acks == expected);
assert(strcmp(reboot.prefs.password, oldSecret(false)) == 0);
assert(strcmp(reboot.prefs.guest_password, oldSecret(true)) == 0);
}
int main() {
unsigned scenarios = 0;
for (bool guest : {false, true}) {
char reply[160] = {};
CommonCLI healthy;
seed(healthy);
const auto previous = healthy.fs.files.at("/com_prefs");
change(healthy, guest, newSecret(guest), reply);
assertSuccess(healthy, guest, newSecret(guest), reply);
assertReboot(healthy, guest, newSecret(guest));
const auto candidate = healthy.fs.files.at("/com_prefs");
assert(candidate != previous && candidate.size() == previous.size());
++scenarios;
// Each ordinary rejection leaves the old image on disk. The bool API
// cannot promise that for every false result, so its reply stays cautious.
for (unsigned fault = 0; fault != 4; ++fault) {
CommonCLI cli;
seed(cli);
if (fault == 0) cli.fs.fail_write = true;
if (fault == 1) cli.fs.fail_write_after = 64;
if (fault == 2) cli.fs.fail_read_open = true;
if (fault == 3) cli.fs.fail_rename = 1;
change(cli, guest, newSecret(guest), reply);
assert(!cli._common_save_succeeded);
assertError(reply, guest, newSecret(guest));
assert(strcmp(currentSecret(cli, guest), oldSecret(guest)) == 0);
assert(cli.fs.files.at("/com_prefs") == previous);
clearFaults(cli);
assertReboot(cli, guest, oldSecret(guest));
change(cli, guest, retrySecret(guest), reply);
assertSuccess(cli, guest, retrySecret(guest), reply);
assertReboot(cli, guest, retrySecret(guest));
++scenarios;
}
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
// Atomic publication succeeded, then every public-image readback failed.
// The real writer returns false/Indeterminate, runtime credentials roll
// back, but fresh boot must read the new durable credential. An "unchanged"
// promise here is both false and dangerous for remote administration.
{
CommonCLI cli;
seed(cli);
cli.fs.fail_after_publication = true;
change(cli, guest, newSecret(guest), reply);
assert(!cli._common_save_succeeded);
assertError(reply, guest, newSecret(guest));
assert(strcmp(currentSecret(cli, guest), oldSecret(guest)) == 0);
assert(cli.fs.files.at("/com_prefs") == candidate);
clearFaults(cli);
assertReboot(cli, guest, newSecret(guest));
change(cli, guest, retrySecret(guest), reply);
assertSuccess(cli, guest, retrySecret(guest), reply);
assertReboot(cli, guest, retrySecret(guest));
++scenarios;
}
#endif
}
// Legacy setters retain their live changes after save failure. Exercise the
// actual outer reply guard so the branch's final OK cannot hide either
// known rejection or post-publication uncertainty.
{
char reply[160] = {};
CommonCLI healthy;
seed(healthy);
assert(healthy.prefs.multi_acks == 0);
const auto previous = healthy.fs.files.at("/com_prefs");
healthy.legacySet("multi.acks 1", reply);
assert(strcmp(reply, "OK") == 0 && healthy.prefs.multi_acks == 1);
assert(healthy._common_save_succeeded && healthy._prefs_save_failures == 0);
assert(!healthy.prefs.dirty);
assertLegacyReboot(healthy, 1);
const auto candidate = healthy.fs.files.at("/com_prefs");
assert(candidate != previous && candidate.size() == previous.size());
++scenarios;
for (unsigned fault = 0; fault != 4; ++fault) {
CommonCLI cli;
seed(cli);
if (fault == 0) cli.fs.fail_write = true;
if (fault == 1) cli.fs.fail_write_after = 64;
if (fault == 2) cli.fs.fail_read_open = true;
if (fault == 3) cli.fs.fail_rename = 1;
cli.legacySet("multi.acks 1", reply);
assertLegacyError(cli, reply);
assert(cli.prefs.multi_acks == 1);
assert(cli.fs.files.at("/com_prefs") == previous);
clearFaults(cli);
assertLegacyReboot(cli, 0);
// Retry the same live value: an unchanged assignment must still save.
cli.legacySet("multi.acks 1", reply);
assert(strcmp(reply, "OK") == 0 && cli._common_save_succeeded);
assert(cli._prefs_save_failures == 1 && !cli.prefs.dirty);
assertLegacyReboot(cli, 1);
++scenarios;
}
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
{
CommonCLI cli;
seed(cli);
cli.fs.fail_after_publication = true;
cli.legacySet("multi.acks 1", reply);
assertLegacyError(cli, reply);
assert(cli.prefs.multi_acks == 1);
assert(cli.fs.files.at("/com_prefs") == candidate);
clearFaults(cli);
assertLegacyReboot(cli, 1);
cli.legacySet("multi.acks 0", reply);
assert(strcmp(reply, "OK") == 0 && cli._common_save_succeeded);
assert(cli._prefs_save_failures == 1 && !cli.prefs.dirty);
assertLegacyReboot(cli, 0);
++scenarios;
}
#endif
}
printf("%u actual CommonCLI save scenarios passed\n", scenarios);
}
+6 -6
View File
@@ -373,18 +373,18 @@ int main() {
assert(cli.saves == disabled_saves && mesh.isMqttBridgeRunning() && mesh.isEspNowBridgeRunning());
cli.fail_save = true;
cli.set("rs232.enabled on", reply);
assert(strstr(reply, "setting unchanged") && !mesh.bridge && !mesh._prefs.rs232_bridge_enabled);
assert(strstr(reply, "unconfirmed") && strstr(reply, "reboot") && !mesh.bridge && !mesh._prefs.rs232_bridge_enabled);
assert(cli.saves == disabled_saves && mesh.isMqttBridgeRunning() && mesh.isEspNowBridgeRunning());
cli.fail_save = false;
cli.set("rs232.enabled on", reply); assert(strcmp(reply, "OK") == 0);
const unsigned saved_after_enable = cli.saves;
cli.fail_save = true;
cli.set("rs232.enabled off", reply);
assert(strstr(reply, "setting unchanged") && mesh.isRs232BridgeRunning() && mesh._prefs.rs232_bridge_enabled);
assert(strstr(reply, "unconfirmed") && strstr(reply, "reboot") && mesh.isRs232BridgeRunning() && mesh._prefs.rs232_bridge_enabled);
cli.set("bridge.baud 19200", reply);
assert(strstr(reply, "baud unchanged") && mesh._prefs.bridge_baud == 57600 && Serial2.baud == 57600);
assert(strstr(reply, "unconfirmed") && strstr(reply, "reboot") && mesh._prefs.bridge_baud == 57600 && Serial2.baud == 57600);
cli.set("bridge.uart 2", reply);
assert(strstr(reply, "UART unchanged") && mesh._prefs.bridge_uart == 2 && mesh.isRs232BridgeRunning());
assert(strstr(reply, "unconfirmed") && strstr(reply, "reboot") && mesh._prefs.bridge_uart == 2 && mesh.isRs232BridgeRunning());
assert(cli.saves == saved_after_enable && mesh.mqtt_bridge->begins == wifi_starts);
assert(mesh.espnow_bridge.begins == wireless_starts);
cli.fail_save = false;
@@ -405,7 +405,7 @@ int main() {
// A failed intent save must not signal an uncancellable worker stop.
cli.fail_save = true;
cli.set("mqtt.enabled off", reply);
assert(strstr(reply, "not saved; unchanged") && mesh._prefs.bridge_enabled);
assert(strstr(reply, "unconfirmed") && strstr(reply, "reboot") && mesh._prefs.bridge_enabled);
assert(mesh.isMqttBridgeRunning() && !mesh.isMqttBridgeStopping());
cli.fail_save = false;
cli.set("mqtt.enabled off", reply);
@@ -427,7 +427,7 @@ int main() {
expect_get(cli, "mqtt.stopping", "> off");
cli.fail_save = true;
cli.set("mqtt.enabled on", reply);
assert(strstr(reply, "not saved; unchanged") && !mesh._prefs.bridge_enabled);
assert(strstr(reply, "unconfirmed") && strstr(reply, "reboot") && !mesh._prefs.bridge_enabled);
assert(!mesh.isMqttBridgeRunning());
cli.fail_save = false;
cli.set("espnow.enabled on", reply); assert(strcmp(reply, "OK") == 0);