Skip to content

feat(regions): activity health and hourly traffic trends - #503

Merged
dborup merged 1 commit into
masterfrom
codex/regions-health-trends
Oct 17, 2026
Merged

dborup merged 1 commit into
masterfrom
codex/regions-health-trends

Conversation

@dborup

@dborup dborup commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Third Regions milestone: observed region activity health and hourly traffic trends. Stacked on #502 (which builds on #501); this PR contains only the health/trends increment.

  • Add a Health & trends view without changing the default Latest view or Timeline playback.
  • Show distinct observed relay nodes, relay appearances, last observed relay within the selected scope/interval, and the mean appearances/hour when the selected interval is complete.
  • Plot 1, 24 or 168 disjoint completed UTC-hour bins. Include a keyboard-accessible exact-values table and clearly distinguish complete zero traffic from missing evidence.
  • Reuse period, scope, selected hour and optional previous-period comparison. Health and Timeline preserve the selection and share the already-fetched history snapshot.
  • Initialize Leaflet only when a map is needed. Health does not initialize a hidden map, request tiles, fit bounds or expose playback controls, and it works without Leaflet.

Interpretation and correctness

“Health” describes observed activity and retained evidence, not service availability or radio quality. There is no uncalibrated healthy/degraded/offline score or alarm threshold. Increased traffic can reflect spam, observer reception or routing changes; it does not establish improved network health.

  • Nodes are deduplicated across scopes and hours, including unpositioned relays. Hourly node counts are not added to produce an interval's distinct-node count.
  • Traffic is relay appearances, not globally unique packets. One transmission carried by multiple relay nodes can contribute multiple appearances.
  • The last relay timestamp belongs to the selected scope and interval; absence is not an outage assertion.
  • Partial, unknown, loading or capped hourly evidence is a chart gap, not zero. Retained observations remain explicitly labelled in the table.
  • Hourly means require the entire selected interval to be complete and uncapped. Comparisons, percentages and new/not-observed classifications retain Timeline's stricter requirement that both adjacent periods be complete and uncapped. A zero reference has no percentage increase.
  • A complete selected interval can have an hourly mean even when the previous interval cannot support a comparison.
  • All bins are fixed UTC hours, including across local DST changes. The unfinished current hour remains excluded, as in Timeline.

No backend code, endpoint, schema, persistence, retention, dependency or operator configuration is changed. Any future health thresholds must be evidence-based and exposed through the customizer. Inter-region path evidence remains a later milestone.

Performance

Reuse /api/regions/history and its existing safety caps; no new server scans or per-node requests. Index selected-scope hourly activity once per snapshot/scope change into bounded 504-hour arrays. Activity-bin selection reads at most 168 bins without rescanning sparse history cells; distinct-node and period comparisons continue to use the existing prefix-sum selection. Charts and exact-value rows use keyed updates, bounded by 168 hours. Switching historical views, periods, scopes or timestamps does not fetch another payload.

Local Node 26 / Apple arm64 measurements at the existing 250,000-cell limit (500 relay nodes):

  • Additional activity indexing: 1.258 ms median, 1.567 ms p95 across 30 measured runs.
  • Selecting 168 activity bins: 0.117 ms mean across 1,000 measured runs.
  • Persistent numeric arrays: 5,040 bytes plus 504 timestamp-reference slots; the temporary deduplication marks contain 504 entries.

A second fixture also exercises maximum fanout: 5,000 nodes × 32 scopes (160,000 node/scope pairs), exactly 250,000 valid cells and no truncation. Additional indexing is 2.085 ms median / 2.944 ms p95 across 20 runs; selecting 168 bins is 0.111 ms mean across 1,000 runs. Aggregate storage remains bounded to the same 504 slots, with 1,008 temporary generation-mark bytes.

These measure the additional activity helpers, not JSON parsing, existing history indexing, interval comparison or DOM rendering.

Verification

  • Full Go server and ingestor suites passed unchanged.
  • All 257 JavaScript test files passed.
  • Unit tests pass under Copenhagen and New York timezones, including EU/US DST boundaries, all coverage/cap states, cross-scope/hour deduplication, scope-isolated last relay, zero/reference semantics, bookmark round trips, exact 250,000 cells and no sparse-cell reads after activity indexing.
  • Focused Regions browser suite passed, including 27 checks with desktop/mobile visual validation, Health without Leaflet, local-only view/filter changes, known-zero versus missing bins, keyed rows, keyboard operation, themes, delayed refresh/navigation and teardown.
  • Core browser suite passed: 154 tests and 3 fixture-dependent skips.
  • Instrumented browser validation captures the health paths in the cross-shard frontend coverage report.
  • Independent review has no open findings.

CI is dispatched explicitly on the feature branch because automatic PR workflows target master, while this PR is stacked. The manual run is linked here rather than relying on an automatic PR Checks entry. Existing fork guards prevent publishing or deployment. Not merged or deployed.

Final validation: full CI run 38896478073 passed on 369562f4, including all three server shards, all three browser shards, JavaScript/lint, ingestor, libraries, image validation and both aggregate gates. Final remote-head review has no open findings. The post-push local Regions browser run also passed all 27 checks.

@dborup
dborup changed the base branch from codex/regions-timeline-comparison to master October 17, 2026 11:18
@dborup

dborup commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

Review — CS-Coordinator PR#503 — head 369562f

Verdict: APPROVE

This is a frontend-only increment that reuses /api/regions/history. No backend, endpoint, schema or configuration changes.

Checked

  • Merged tree (master 5ff889db + this head). test-regions-map.js passes (map, timeline and activity unit tests). The diff adds no new innerHTML/insertAdjacentHTML/outerHTML sinks: the Regions code builds DOM with textContent, so scope names and other server values are not interpolated into HTML.
  • Staging (master-5ff889db-pr503, real data):
    • The view select offers Latest, Timeline and Health & trends.
    • Health for 24 h renders the selected-interval summary (313 relay nodes, 28,119 relay appearances), charts and an exact-values table with 24 hourly rows.
    • Missing or partial evidence is labelled as a gap, not as zero.
    • The state is deep-linked (#/regions?window=24h&view=health&at=…).
    • There are 0 panic, fatal, concurrent map or SQLITE_BUSY entries since the deploy.
  • Wording avoids availability claims ("observed activity", not "health score"), and no thresholds are introduced. Future thresholds are rightly deferred to the customizer.

The timeline-depth note from #502 applies here too: on 48 h retention instances, the 7 d view and comparisons will mostly show gaps.

@dborup
dborup merged commit 9933d05 into master Oct 17, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant