Refactor LoRa airtime tests and add new functionality
- Updated LoRa airtime calculations in `lora_airtime_test.dart` to reflect new reference values. - Introduced new tests for LDRO behavior and preamble symbol calculations. - Added `contact_path_width_test.dart` to validate path hash width handling in contacts. - Enhanced `model_changes_test.dart` to ensure legacy data migration works correctly. - Created `remote_node_stats_test.dart` to decode and validate remote node statistics. - Implemented `map_marker_parse_test.dart` for parsing marker text with coordinate validation. - Developed `map_tile_cache_key_test.dart` to ensure API keys are excluded from cache keys. - Added `message_retry_failure_test.dart` to test message retry service behavior on failures. - Extended `path_history_service_test.dart` to preserve learned state across path attempts. - Enhanced `received_image_store_test.dart` to handle concurrent writes and review fixes. - Implemented `repeater_command_service_test.dart` to validate command response handling. - Created `store_tolerant_parsing_test.dart` to ensure stores skip malformed records gracefully. - Cleared untranslated JSON file for localization updates.
This commit is contained in:
1 parent
d5f54dfa11
commit
d74587c167
105 files changed
+6419
-2072
No files matched your search
@@ -630,6 +630,9 @@ enum ImageReassemblyFailureReason {
|
||||
/// Reassembled but the metadata byte was undecodable
|
||||
/// ([ImageChunkStatus.unsupportedFormat]).
|
||||
unsupportedFormat,
|
||||
|
||||
/// Dropped by [ImageReassembler.clear] (disconnect / new session).
|
||||
disconnected,
|
||||
}
|
||||
|
||||
/// A fully reassembled image.
|
||||
@@ -852,10 +855,27 @@ class ImageReassembler {
|
||||
/// Keys of the remembered completed images (test/debug aid).
|
||||
Iterable<ImageStreamKey> get completedKeys => _recentlyCompleted.keys;
|
||||
|
||||
/// Drops everything (e.g. on disconnect). Does not fire [onFailed].
|
||||
void clear() {
|
||||
/// Drops everything (e.g. on disconnect). In-progress streams are reported
|
||||
/// through [onFailed] right away, so their bubbles stop showing "receiving";
|
||||
/// nothing is left behind for [evictExpired] to report later.
|
||||
void clear({DateTime? now}) {
|
||||
final at = now ?? _clock();
|
||||
final dropped = _pending.values.toList();
|
||||
_pending.clear();
|
||||
_recentlyCompleted.clear();
|
||||
for (final entry in dropped) {
|
||||
onFailed?.call(
|
||||
ImageReassemblyFailure(
|
||||
key: entry.key,
|
||||
total: entry.total,
|
||||
receivedDataChunks: entry.bodies.length,
|
||||
hadParity: entry.hasParity,
|
||||
firstSeen: entry.firstSeen,
|
||||
expiredAt: at,
|
||||
reason: ImageReassemblyFailureReason.disconnected,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Feeds one received GRP_DATA blob.
|
||||
@@ -883,6 +903,12 @@ class ImageReassembler {
|
||||
// A parity chunk must carry at least its length byte.
|
||||
return ImageChunkOutcome(ImageChunkStatus.malformed, header: header);
|
||||
}
|
||||
if (!header.isParity && body.length > kImageChunkBodyBytes) {
|
||||
// The blob cap leaves room for one byte more than the XOR buffer holds;
|
||||
// such a body can never come from [buildImageChunks] and would overrun
|
||||
// parity recovery.
|
||||
return ImageChunkOutcome(ImageChunkStatus.malformed, header: header);
|
||||
}
|
||||
|
||||
final key = ImageStreamKey(
|
||||
senderPrefix: header.senderPrefix,
|
||||
|
||||
Reference in new issue
Block a user