task(#937): B1 delete the dead pending_messages API

#855 was filed as "pending messages are stored globally, not per radio".
It is not a scoping bug. `loadPendingMessages`, `savePendingMessages` and
`clearPendingMessages` had no callers anywhere in lib/ or test/, and the key
was absent from the owner's live prefs. The `_pendingMessages` field in
message_retry_service.dart is an unrelated in-memory list that happens to
share the name.

So the surface is DELETED, not scoped: three methods and the key constant.
Scoping it per radio would have been three careful changes and a migration
decision, for an API nothing calls.

This is the finding that justified consolidating #854, #855 and #856 into
one Epic instead of landing three PRs. Nobody reading #855 on its own would
have gone looking for callers, because the issue already told them what the
fix was.

Removed with it:
- the inventory row, replaced by a comment saying the surface is GONE rather
  than reclassified, so the history is readable
- A2's round-trip test, whose job was to prove the thing being deleted
  actually worked. It served that and then became a test of nothing
- 855 from the known-holes expectation, which now reads {854, 856}; that set
  shrinking to empty is what closing Epic B looks like

What still guards it: the inventory's "declared but vanished from source"
check fires if `pending_messages` ever comes back undeclared.

Citadel: meshcore-open-li1
Refs #937, #855, #853

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
feat/938-blocked-per-radio
diffwireauto 1 month ago committed by Benjamin Wiechel
parent 5f856f10c9
commit a7882b62e0

@ -5,7 +5,6 @@ import '../storage/prefs_manager.dart';
class StorageService {
static const String _pathHistoryPrefix = 'path_history_';
static const String _pendingMessagesKey = 'pending_messages';
static const String _repeaterPasswordsKey = 'repeater_passwords';
static const String _repeaterAutoClockSyncAfterLoginKey =
'repeater_auto_clock_sync_after_login';
@ -86,31 +85,6 @@ class StorageService {
}
}
Future<Map<String, String>> loadPendingMessages() async {
final prefs = PrefsManager.instance;
final jsonStr = prefs.getString(_pendingMessagesKey);
if (jsonStr == null) return {};
try {
final json = jsonDecode(jsonStr) as Map<String, dynamic>;
return json.map((key, value) => MapEntry(key, value as String));
} catch (e) {
return {};
}
}
Future<void> savePendingMessages(Map<String, String> pending) async {
final prefs = PrefsManager.instance;
final jsonStr = jsonEncode(pending);
await prefs.setString(_pendingMessagesKey, jsonStr);
}
Future<void> clearPendingMessages() async {
final prefs = PrefsManager.instance;
await prefs.remove(_pendingMessagesKey);
}
/// Save a repeater password by public key hex
Future<void> saveRepeaterPassword(
String repeaterPubKeyHex,

@ -190,17 +190,12 @@ const List<StorageSurface> storageSurfaces = [
'which is why it was never reported',
owner: 'lib/services/storage_service.dart',
),
StorageSurface(
'pending_messages',
verdict: ScopingVerdict.knownHole,
issue: 855,
reason:
'global, but DEAD: loadPendingMessages, savePendingMessages and '
'clearPendingMessages have no callers anywhere in lib/ or test/, and '
'the key is absent from the owner\'s live prefs. The fix is deletion, '
'not scoping',
owner: 'lib/services/storage_service.dart',
),
// `pending_messages` (#855) was listed here and is GONE, not reclassified.
// It had no callers anywhere in lib/ or test/ and the key was absent from
// the owner's live prefs, so the fix was deletion rather than scoping. The
// inventory's "declared but vanished from source" check is what keeps that
// honest in the other direction: if the key ever comes back, the gate fails
// until somebody declares it and says why.
// ---------------------------------------------------------------------------
// Global on purpose. The reason is the point: it stops a later audit

@ -157,18 +157,12 @@ void main() {
});
});
group('#855 pending messages', () {
test('the API round-trips but nothing in the app calls it '
'(Epic B deletes it)', () async {
// Kept deliberately small: the finding is that this API has no
// callers in lib/ or test/, which a unit test cannot assert. It is
// recorded in scoping_inventory.dart and proved by grep. This test
// only pins that the thing being deleted currently works, so the
// deletion is removal of dead code rather than of a live feature.
final storage = StorageService();
await storage.savePendingMessages({'a': 'b'});
expect(await storage.loadPendingMessages(), {'a': 'b'});
});
});
// #855's round-trip test was here and is gone with the API it pinned (B1).
// Its job was to prove the thing being deleted actually worked, so the
// deletion was provably removal of dead code and not of a live feature. It
// served that purpose and then became a test of nothing.
//
// What still guards the deletion: the inventory's "declared but vanished
// from source" check, which fails if `pending_messages` ever returns
// undeclared.
}

@ -67,14 +67,19 @@ void main() {
);
});
test('the known holes are exactly the ones Epic B fixes', () {
test('the known holes are exactly the ones Epic B has left to fix', () {
// Pins the set. A NEW hole cannot hide among the known ones, and a hole
// fixed in Epic B cannot be left mislabelled here.
// Epic B has fixed cannot be left mislabelled here.
//
// #855 is absent on purpose: Epic B DELETED that surface rather than
// scoping it, so there is no hole left to track. This expectation
// shrinks as B1, B2 and B3 land, and reaching an empty set is what
// closing Epic B looks like.
final holes = {
for (final s in storageSurfaces)
if (s.verdict == ScopingVerdict.knownHole) s.issue!,
};
expect(holes, {854, 855, 856});
expect(holes, {854, 856});
});
});

Loading…
Cancel
Save

Powered by TurnKey Linux.