Commit 3b91c6b
TMM: address review, fix dedup tests, inject fake time, fix fingerprint-0
Copilot review (PR #10706):
- preloadNextHopsFromNodeDB() now returns bool; runOnce only latches
nextHopPreloaded once the preload actually ran (retries if nodeDB wasn't
ready), instead of skipping it forever.
- Remove the empty `#if HAS_VARIABLE_HOPS` blocks in the test.
Test correctness:
- Three more position-dedup tests were missing installWellKnownPrimaryChannel()
(dropsDuplicate/allowsMoved were fixed earlier; allowsDuplicateAfterInterval,
cacheFlush, priorRateState were not) — without the well-known-channel gate the
dedup path never runs, so their STOP assertions failed.
Fake-time injection (no more real sleeps):
- Add TrafficManagementModule::s_testNowMs + nowMs(), mirroring HopScalingModule;
route all TMM tick/time reads through nowMs(). Tests advance a virtual clock via
s_testNowMs instead of testDelay() sleeping real 5-6 min across a tick — the
suite drops from ~15 min to ~30 s. Production behaviour is unchanged (nowMs()
inlines to millis()).
Fingerprint-0 fix:
- computePositionFingerprint() never returns 0 now (remap 0 -> 0xFF, mirroring
getLastByteOfNodeNum), so a real position that hashes to 0 doesn't collide with
the "no position seen" sentinel and its duplicates dedup correctly.
test_traffic_management: 34/34 green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3067e82 commit 3b91c6b
3 files changed
Lines changed: 50 additions & 32 deletions
File tree
- src/modules
- test/test_traffic_management
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
| 535 | + | |
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
555 | 558 | | |
556 | 559 | | |
557 | 560 | | |
| |||
607 | 610 | | |
608 | 611 | | |
609 | 612 | | |
610 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
611 | 619 | | |
612 | 620 | | |
613 | 621 | | |
| |||
632 | 640 | | |
633 | 641 | | |
634 | 642 | | |
635 | | - | |
| 643 | + | |
636 | 644 | | |
637 | 645 | | |
638 | 646 | | |
| |||
811 | 819 | | |
812 | 820 | | |
813 | 821 | | |
814 | | - | |
| 822 | + | |
815 | 823 | | |
816 | 824 | | |
817 | 825 | | |
818 | 826 | | |
819 | | - | |
820 | | - | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
821 | 830 | | |
822 | | - | |
823 | 831 | | |
824 | 832 | | |
825 | 833 | | |
| |||
843 | 851 | | |
844 | 852 | | |
845 | 853 | | |
846 | | - | |
| 854 | + | |
847 | 855 | | |
848 | 856 | | |
849 | 857 | | |
| |||
900 | 908 | | |
901 | 909 | | |
902 | 910 | | |
903 | | - | |
| 911 | + | |
904 | 912 | | |
905 | 913 | | |
906 | 914 | | |
| |||
1056 | 1064 | | |
1057 | 1065 | | |
1058 | 1066 | | |
1059 | | - | |
| 1067 | + | |
1060 | 1068 | | |
1061 | 1069 | | |
1062 | 1070 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
67 | 80 | | |
68 | 81 | | |
69 | 82 | | |
| |||
149 | 162 | | |
150 | 163 | | |
151 | 164 | | |
152 | | - | |
153 | | - | |
154 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
155 | 168 | | |
156 | 169 | | |
157 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
| |||
181 | 179 | | |
182 | 180 | | |
183 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
| |||
738 | 740 | | |
739 | 741 | | |
740 | 742 | | |
741 | | - | |
742 | | - | |
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
| |||
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
779 | | - | |
| 779 | + | |
780 | 780 | | |
| 781 | + | |
781 | 782 | | |
782 | 783 | | |
783 | 784 | | |
| |||
786 | 787 | | |
787 | 788 | | |
788 | 789 | | |
789 | | - | |
| 790 | + | |
790 | 791 | | |
791 | 792 | | |
792 | 793 | | |
| |||
900 | 901 | | |
901 | 902 | | |
902 | 903 | | |
| 904 | + | |
903 | 905 | | |
904 | 906 | | |
905 | 907 | | |
| |||
930 | 932 | | |
931 | 933 | | |
932 | 934 | | |
| 935 | + | |
933 | 936 | | |
934 | 937 | | |
935 | 938 | | |
| |||
954 | 957 | | |
955 | 958 | | |
956 | 959 | | |
957 | | - | |
| 960 | + | |
958 | 961 | | |
959 | 962 | | |
960 | 963 | | |
961 | 964 | | |
962 | 965 | | |
963 | 966 | | |
964 | 967 | | |
965 | | - | |
| 968 | + | |
966 | 969 | | |
967 | 970 | | |
968 | 971 | | |
| |||
984 | 987 | | |
985 | 988 | | |
986 | 989 | | |
987 | | - | |
| 990 | + | |
988 | 991 | | |
989 | 992 | | |
990 | 993 | | |
| |||
1225 | 1228 | | |
1226 | 1229 | | |
1227 | 1230 | | |
1228 | | - | |
1229 | | - | |
1230 | 1231 | | |
1231 | 1232 | | |
1232 | 1233 | | |
| |||
1264 | 1265 | | |
1265 | 1266 | | |
1266 | 1267 | | |
1267 | | - | |
1268 | | - | |
1269 | 1268 | | |
1270 | 1269 | | |
1271 | 1270 | | |
| |||
1287 | 1286 | | |
1288 | 1287 | | |
1289 | 1288 | | |
1290 | | - | |
1291 | | - | |
1292 | 1289 | | |
1293 | 1290 | | |
1294 | 1291 | | |
| |||
0 commit comments