fix: Promote confirmed DM paths

This commit is contained in:
Janez T
2026-04-03 10:27:06 +02:00
parent 3e8d4c2d11
commit 7c9dfd6f63
7 changed files with 52 additions and 13 deletions

1
.gitignore vendored
View File

@@ -79,6 +79,7 @@ play-store/
create_feature_graphic.py
# Tool caches and local state
.devenv/
.cachebro/
.osgrep/
third_party/lpcnet_flutter/

View File

@@ -489,7 +489,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEVELOPMENT_TEAM = JND55328G8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -511,7 +511,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEVELOPMENT_TEAM = JND55328G8;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
@@ -530,7 +530,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEVELOPMENT_TEAM = JND55328G8;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
@@ -547,7 +547,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEVELOPMENT_TEAM = JND55328G8;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
@@ -679,7 +679,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEVELOPMENT_TEAM = JND55328G8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -702,7 +702,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEVELOPMENT_TEAM = JND55328G8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;

View File

@@ -43,7 +43,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>129</string>
<string>130</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>ITSAppUsesNonExemptEncryption</key>

View File

@@ -5,22 +5,22 @@
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000201">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000729">
</testcase>
<testcase classname="fastlane.lanes" name="1: increment_build_number" time="0.700922">
<testcase classname="fastlane.lanes" name="1: increment_build_number" time="1.008455">
</testcase>
<testcase classname="fastlane.lanes" name="2: build_app" time="102.603385">
<testcase classname="fastlane.lanes" name="2: build_app" time="224.694344">
</testcase>
<testcase classname="fastlane.lanes" name="3: upload_to_app_store" time="2538.71069">
<testcase classname="fastlane.lanes" name="3: upload_to_app_store" time="170.718455">
</testcase>

View File

@@ -214,7 +214,9 @@ class PathHistoryService {
pathBytes: selection.pathBytes.toList(),
hopCount: selection.hopCount,
hashSize: selection.hashSize,
source: existing?.source ?? PathRecordSource.learned,
source: success
? PathRecordSource.learned
: existing?.source ?? PathRecordSource.learned,
successCount: (existing?.successCount ?? 0) + (success ? 1 : 0),
failureCount: (existing?.failureCount ?? 0) + (success ? 0 : 1),
lastRoundTripTimeMs: success

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2026.0324.1+43
version: 2026.0402.1+44
environment:
sdk: ^3.9.2

View File

@@ -207,6 +207,42 @@ void main() {
},
);
test(
'confirmed direct delivery promotes an observed path to learned',
() async {
final service = PathHistoryService();
final contact = _buildContact(
seed: 4,
pathBytes: [0xAA, 0xBB],
hopCount: 2,
hashSize: 1,
);
await service.initialize();
await service.recordReceivedBytePath(contact.publicKeyHex, [
0xBB,
0xAA,
], 1);
await service.recordPathResult(
contact.publicKeyHex,
PathSelection(
mode: PathSelectionMode.directHistorical,
pathBytes: Uint8List.fromList([0xAA, 0xBB]),
hopCount: 2,
hashSize: 1,
),
success: true,
roundTripTimeMs: 150,
);
final history = service.historyFor(contact.publicKeyHex);
expect(history.directPaths, hasLength(1));
expect(history.directPaths.single.source, PathRecordSource.learned);
expect(history.directPaths.single.successCount, 1);
expect(history.directPaths.single.lastRoundTripTimeMs, 150);
},
);
test('clear history removes stored direct paths for one contact', () async {
final service = PathHistoryService();