Preserve accepted contacts after transient path read errors

Recheck cached immutable paths before resetting the live table after raw I/O failure. Keep accepted RAM mutations, current jobs and save deadlines when reads recover; stronger source or publication uncertainty still forces full recovery. Use the existing recovery byte and a fixed scratch buffer, with no cache allocation or eviction.

Cover full-cache transient recovery, persistent I/O and checksum failures, nRF unread-scope restoration, active ESP jobs, real uncertain publication and unchanged lazy deadlines with sanitizer tests and restored-reset negative controls.
This commit is contained in:
mikecarper committed 2026-10-16 08:54:12 -07:00
1 parent a3e9bec997
commit 587700a36a
7 files changed
+339 -9

No files matched your search

+17 -1
View File
@@ -50,12 +50,28 @@ class DataStore
// permission to discard contacts. No recovery files or boot counters needed.
enum : uint8_t { ContactRecoveryPending = 1, ContactRecoveryLegacy = 2,
ContactRecoveryBackup = 4, ContactStorageUnavailable = 8,
ContactMigrationDeferred = 16 };
ContactMigrationDeferred = 16,
#if MESH_CONTACT_CACHE
ContactRecoveryRawOnly = 32,
#endif
};
uint8_t _contact_recovery = 0;
void queueContactRecovery(bool legacy = false) {
#if MESH_CONTACT_CACHE
// Source/publication uncertainty always supersedes a raw-read retry.
_contact_recovery &= ~ContactRecoveryRawOnly;
#endif
_contact_recovery |= ContactRecoveryPending
| (legacy ? ContactRecoveryLegacy : 0);
}
#if MESH_CONTACT_CACHE
void queueContactReadRecovery(bool legacy = false) {
if (!(_contact_recovery & ContactRecoveryPending))
_contact_recovery |= ContactRecoveryRawOnly;
_contact_recovery |= ContactRecoveryPending
| (legacy ? ContactRecoveryLegacy : 0);
}
#endif
void clearContactLoadFailure();
#if !defined(NRF52_PLATFORM)
const char* selectContactFile(bool& present);