mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-10-11 01:17:16 +00:00
Red commits: `dc7dcbe`, `76e3217` ([assertion failures](https://github.com/Kpa-clawbot/CoreScope/actions/runs/37059977385)). Fixes #2041; supplies #2085's backend contract. Records at most two route bits per retained advert. Node flood counts now use the same evidence, including mixed and transport-flood adverts. Analytics failures log/count errors while core observation, path and liveness writes continue. The unrelated recent-advert limit clamp is removed. Direct adverts (empty path) describes the observed remaining path across valid hash widths. Firmware can forward an advert down to an empty path; this cannot establish original send mode or RF distance. The `zero_hop` API spelling remains compatible. Successful post-upgrade evidence writes survive observation replacement and restart. Older overwritten frames and failed writes can leave gaps. The UI explains automatic background backfill. ## Measured validation Synthetic Windows workloads; timings are not production guarantees: - 300K retained adverts, one-hour window: median 64.35→39.84 ms; 13.98 MB→145 KB allocated. Seven-day allocations unchanged; five paired samples. - 1M transmissions/11M observations: backfill 5m43s. Simple 10 Hz writer: all 3,423 observations persisted; p99 28 ms, maximum 323 ms. - Simulated pre-backfill cursor: retained evidence ready 4m21s; full catch-up 6m41s, 122 cache invalidations. Normal completed-migration startup bulk-loads current evidence. Portable opt-in scale tests and window benchmarks are included. All 183 frontend suites, full server tests, targeted races, lint and real-API desktop/mobile checks passed. Full [Linux CI](https://github.com/Kpa-clawbot/CoreScope/actions/runs/37063210229) passed at `36def9c`; three independent reviews are clear. Local Windows testing hit the unchanged symlink-privilege test. No configuration changes. Preflight overrides: external script/OpenClaw profile unavailable; repository checks and Chromium used.
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package packetpath
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestAdvertRouteEvidence(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
raw string
|
|
want uint8
|
|
}{
|
|
{"1100aa", 1}, {"1101ffaa", 1}, {"1140aa", 1}, {"100102030400aa", 1},
|
|
{"1200aa", 2}, {"130102030400aa", 2},
|
|
{"1240aa", 2}, {"1280aa", 2}, {"130102030440aa", 2}, {"130102030480aa", 2}, {"12c0aa", 0}, {"1201ffaa", 0},
|
|
{"130102030401ffaa", 0}, {"13zz00000000aa", 0}, {"16ff", 0},
|
|
{"1100zz", 0}, {"1101", 0}, {"1101ff", 0}, {"11c0aa", 0},
|
|
{"1100a", 0}, {"1100", 0}, {"1001020304", 0}, {"100102030400", 0},
|
|
{"", 0}, {"1200" + strings.Repeat("aa", 255), 0},
|
|
{"1100" + strings.Repeat("aa", 185), 0},
|
|
{"1100" + strings.Repeat("aa", 184), 1},
|
|
} {
|
|
if got := AdvertRouteEvidence(tc.raw); got != tc.want {
|
|
t.Errorf("%s: got %d want %d", tc.raw, got, tc.want)
|
|
}
|
|
}
|
|
for mask, want := range []string{"other", "flood", "zero_hop", "mixed"} {
|
|
if got := AdvertKind(uint8(mask)); got != want {
|
|
t.Errorf("mask %d: %s want %s", mask, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func BenchmarkAdvertRouteEvidence(b *testing.B) {
|
|
raw := "1100" + strings.Repeat("ab", 118)
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N; i++ {
|
|
AdvertRouteEvidence(raw)
|
|
}
|
|
}
|