Fix timeout observations, drop the last-rx feature and evict weak paths

- Record delivery observations with the path of the attempt the ACK
  belongs to, and skip ambiguous ACKs, so a late direct ACK is not
  learned as a flood delivery.
- Remove secondsSinceLastRx from the timeout model: it measured time
  since any companion frame, which was near zero at train and predict.
- When a contact's path history is full, evict the lowest-scoring path
  instead of silently dropping new discoveries.
This commit is contained in:
zjs81 committed 2026-10-25 11:36:13 -07:00
1 parent 6bc6143c4e
commit 82dcab1d92
8 files changed
+70 -31

No files matched your search

+13 -1
View File
@@ -357,8 +357,9 @@ class PathHistoryService extends ChangeNotifier {
updatedPaths.removeWhere((p) => _pathsEqual(p.pathBytes, pathBytes));
// Make room by dropping the weakest path so new discoveries still land.
if (existing == null && updatedPaths.length >= _maxHistoryEntries) {
return;
updatedPaths.remove(_lowestScoredPath(updatedPaths));
}
updatedPaths.insert(0, newRecord);
@@ -540,6 +541,17 @@ class PathHistoryService extends ChangeNotifier {
return ranked;
}
PathRecord _lowestScoredPath(List<PathRecord> paths) {
final fastestTripMs = _getFastestKnownTripMs(paths);
final highestRouteWeight = _getHighestKnownRouteWeight(paths);
double score(PathRecord p) => _scorePathRecord(
p,
fastestTripMs: fastestTripMs,
highestRouteWeight: highestRouteWeight,
);
return paths.reduce((a, b) => score(b) < score(a) ? b : a);
}
int? _getFastestKnownTripMs(List<PathRecord> paths) {
final knownTrips = paths
.where((path) => path.tripTimeMs > 0)