Repository navigation
Show recent direct SNR distribution on node Analytics - #2513
Merged
efiten merged 2 commits intoDec 1, 2026
Merged
Conversation
Contributor
Author
|
Kent Beck Gate: PASS (test quality) at |
n30nex
marked this pull request as ready for review
November 29, 2026 18:20
zfouts
approved these changes
Dec 1, 2026
zfouts
left a comment
Contributor
There was a problem hiding this comment.
Reviewed at 9dcf2241. Approving.
- This is frontend-only and reads the existing
snrTrend, which comes fromheardSnrTrend(cmd/server/heard_by.go) over the same direct-heard snapshot that feeds Heard By. So it uses the shared #2453 rule rather than a second definition of "direct". - The data stays bounded: 500 per observer and 500 overall. Taking the newest 500 from rings of 500 per observer is exact.
- I checked the bins by hand: −31 goes to "Below −30", −30 to bin 1, 29.75 to bin 12 and 30 to "30 and above".
- The data comes through
api(), the colour isvar(--accent), there's an empty state, anddaysgoes into the URL hash and is read back, accepting only the four button values. - The unit tests pass locally (16/16).
Nits:
public/node-analytics.js:166: the branch that parses an SNR given as a string can't be reached, because the server always sends a number (float64(r.smp.SNR)/4). It could go, along with the'0'test case.- With 30 days or All on a busy node, the newest 500 readings may all fall in the last day, so the chart can match the 24 h view. The caption says so, which seems fine.
- A screenshot of the chart in the PR would help; the e2e test only saves one when
SCREENSHOT_DIRis set.
zfouts
added a commit
to zfouts/CoreScope
that referenced
this pull request
Dec 2, 2026
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2506. Implements F2 in #1155.
Node Analytics shows how often fixed observers received the node at each SNR level. Fourteen intervals cover readings below −30 dB, five-dB steps through 30 dB, and readings at or above 30 dB. Each bar has a visible count and a labeled table row. The selected time window is bookmarkable.
The chart counts up to 500 of the newest retained SNR readings from the existing node analytics response. One pass fills fourteen counters. Missing readings contribute no samples, and zero counts as a measurement.
The interval and count presentation takes its design from Beacon’s bounded reception analytics and Beacon’s Signal view. CoreScope renders its own HTML and CSS.
Browser checks used a local
#/nodes/<pubkey>/analytics?days=1fixture at 320 px and 1400 px. All fourteen counts matched the server: 16 readings from 17 direct receptions in 24 hours, 18 from 19 in seven days. Both included two 0 dB readings. Keyboard navigation reached the interval table, and returning to the saved window reused the cached analytics response.Regression coverage includes
tests/e2e/test-node-analytics-heard-by-e2e.js:87. Test-only REDd8fc58e0fand GREEN9dcf2241d.Tests before the fix