Repository navigation
Compare observers against a pinned reference - #2492
Conversation
|
Review feedback addressed (commit
Kent Beck Gate: PASS (test quality) on |
|
Thanks, the feature works and the deep link (ref, mode, region) round-trips. One blocker on the new endpoint (AGENTS.md rule 0): Measured on a local DB with the production indexes and
With 8 concurrent comparison calls, an unrelated query on the same pool waited 2.12 s for a connection. Suggested fix, following #1910 ( Smaller notes, optional here: the peer table has no cap or paging ( |
|
Review feedback addressed (commit
|
|
Review feedback addressed (commit
Kent Beck Gate: PASS (test quality) on |
|
Thanks, this fixes the blocker. I re-measured at 6M observations with 800k in the window: a cache hit and a region toggle take under 1 ms, 8 cold calls on the same pin run one scan, and an unrelated read stays under 1 ms while 8 distinct pins are cold. The cache is bounded, One design point ( Smaller notes: the scan goroutine has no |
|
Review feedback addressed (commit
|
|
Kent Beck Gate: PASS (test quality) at |
zfouts
left a comment
There was a problem hiding this comment.
Reviewed at fc98bf1b. Approving: efiten's earlier points are all addressed at this head.
- One cache entry and one in-flight scan per reference; region filtering happens on the cached rows.
- Node Reach and the comparison share
coldScans, including the 3 s queue before a 429. - The scan goroutine recovers from a panic, and the panic test shows the queue place, slot and in-flight entry are all released.
- The 45 s timer starts only once a slot is free, so the worst case (3 s + 45 s) stays under the 60 s WriteTimeout.
I traced the limiter on every path (fast slot, queued, cancelled, timed out, panic); each token is handed on or released exactly once. go test -race -count=3 -run 'ObserverComparison|Reach|ColdScan|ReadOnly' and tests/unit/test-compare-overlap.js pass locally.
Non-blocking, for a follow-up if you agree:
- A failed scan isn't cached (
cmd/server/observer_comparison.go:145-149). On a slow host, a scan that hits the 45 s deadline returns a 500 with "context deadline exceeded" to every waiter, and the next click starts another 45 s scan holding one of the two shared slots, so Reach gets 429s in the meantime. Caching the failure for ~10 s, or answering 503 withRetry-After, would stop that. - The 3 s queue belongs to the loader, not the caller (
observer_comparison.go:156). A request that joins an in-flight load at 2.9 s can get a 429 almost at once. Harmless with the retry button; just worth knowing when the docs say "3 s". - Wording:
writeReachColdBusy429(analytics_cold_limit.go:170-176) still says "reach is busy computing other reports", but the busy scan may now be a comparison. - A screenshot of the Reference comparison mode in the PR would help the next reviewer, and
indexFleetNames/observerLabelincompare.jshave only mocked E2E coverage, no unit test.
Conflict resolutions: - cmd/server/store.go ingestNewFromDB: keep both. Each transmission is still redacted once (redactLocatedAdvert); master's per-observation observedFrameEvidence (Kpa-clawbot#2497) runs on the observation's own frame before it is dropped, so it reads exact bytes but keeps only the hop width and reception kind. - cmd/server/store.go nodeZeroHopRegionCounts: take master's version, which moved the frame checks into StoreObs.receivedDirectAdvert. Its legacy-singleton fallback read packetpath.AdvertRouteEvidence(tx.RawHex), which is empty for a located advert under privacy, and the evidence needs the payload length, so frameHead cannot supply it. hiddenFrame now keeps routeEvidence (computed from the whole frame at redaction) and receivedDirectAdvert reads tx.frameRouteEvidence(). Test: TestRedactZeroHopLegacySingletonParity. Follow-ups for master's changes: - TestLocationLeakRoutes: classify GET /api/analytics/observer-comparison (Kpa-clawbot#2492). It returns observer IDs, names, reception counts and SNR deltas, no position. - packet_redact_frames_test.go: ingestNewFromDB takes a clientCount (Kpa-clawbot#2511). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and the advert reception changes to Postgres Brings in 10 master commits: Kpa-clawbot#2366 (catalogue key tier), Kpa-clawbot#2497 (regions count only received adverts), Kpa-clawbot#2498 (archived foreign-advert flags), Kpa-clawbot#2492 (observer comparison), Kpa-clawbot#2511, Kpa-clawbot#2513, Kpa-clawbot#2514, Kpa-clawbot#2517, Kpa-clawbot#2518, Kpa-clawbot#2519. Conflicts: - cmd/ingestor/approved_channels.go: both sides added a mutex to channelKeySet. One mu now serialises refresh, master's setCatalog and the branch's Close, and guards the users.db/Postgres accounts readers as well as master's approvedNames and catalogue tier. - cmd/ingestor/db.go, nodes upsert: master's foreign_advert carry-over on top of the branch's qualified columns and lastSeenClampSQL. Master looked up the archived flag with ?1, which dbx.Rebind turns into $11 on Postgres; it is now a plain ? bound to the public key again, and the EXISTS is wrapped in CASE so Postgres stores 0/1 in the BIGINT column. - cmd/ingestor/db.go, MoveStaleNodes: master's UPDATE that restores an archived foreign flag runs before the branch's portable moveStaleNodesSQL (not master's INSERT OR REPLACE ... SELECT *), with IS DISTINCT FROM 1 instead of the SQLite-only IS NOT 1. Ported to Postgres: - catalog_keys (Kpa-clawbot#2366): pgschema migration 0004_catalog_keys.sql (same columns, CHECKs, defaults and key; LatestVersion 4), the table in sqlite_endstate.sql, and the worker's upsert sets updated_at from excluded.updated_at instead of strftime('%s','now'). - corescope-migrate copies catalog_keys and verify never prints catalog_keys.key_hex (channel secrets), for any store. - GetNodes region filter (Kpa-clawbot#2497) and the observer comparison (Kpa-clawbot#2492) used IS NOT 'tx'; both use IS DISTINCT FROM 'tx'. The comparison's ORDER BY label COLLATE NOCASE is lower(<label expression>) on Postgres, which folds ASCII only under COLLATE "C", as NOCASE does. - docs/catalogue-keys.md: the revert SQL on PostgreSQL. Tests on both backends: - The catalogue key tests that use a store and the Kpa-clawbot#2498 foreign-advert tests run on SQLite and Postgres (onBothStores; insertTx uses RETURNING). - New dual tests for the observer comparison and the GetNodes region filter. - pgschema: an upgrade from version 3 with data; the control migration tests no longer assume 3 is the latest version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SQLite-only forms master brought in this round (Kpa-clawbot#2492, Kpa-clawbot#2497, Kpa-clawbot#2498, Kpa-clawbot#2366) and in the last one (Kpa-clawbot#2486) were only caught by Postgres test runs. The ingestor's portable-SQL guard now also rejects IS NOT with a number, numbered placeholders (dbx.Rebind turns ?1 into $11) and strftime; the server gets a guard for IS NOT with a literal and numbered placeholders. Both scanners have self-tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #671. Compare pins one observer and reports distinct receptions, bidirectional overlap percentages and paired SNR for each peer over 24 hours. Regions filter peers while preserving the reference denominator. Results are cached per pin for 30 seconds.
Reach and reference comparisons now share two of the four SQLite readers. Eight distinct cold requests can queue for up to three seconds. A full or expired queue returns 429 with a two-second retry interval; the page offers a retry for the same selection. A failed or panicking worker releases its reservation. The comparison SQL deadline starts after admission and allows 45 seconds within the server’s 60-second write timeout.
Paired real-handler measurements on 6 million synthetic observations, 800,000 in the window, with 60 observers. Two Reach reports and two comparisons succeeded in all three runs per revision.
OS file caching was uncontrolled. One first scan hit its deadline during a separate CPU-saturated run. The maintainer measured 15–19 s cold on their machine.
Chromium retried into the actual server. The independent SQLite calculation matched all 1,190 peer rows. Shared-budget regression