feat: network guard, rate limiter, alerting, historical charts, and read-only mode#12
Merged
Conversation
…y mode
- Network guard detects chain (regtest/testnet/mainnet) and enforces read-only
mode outside regtest; write-protected endpoints return 403 on mainnet/testnet
- Rate limiter middleware with configurable sliding-window budgets (RPM per IP,
separate tighter limit for mutating endpoints); NODESCOPE_FORCE_READONLY env var
- Alerts service: CRUD for metric-based alert rules (mempool_size, bytes, minfee,
rpc_offline) with gt/lt/eq/gte/lte operators and info/warning/critical severities
- Charts service: background snapshot loop storing time-series of mempool metrics;
GET /charts/{metric}?range=1h|6h|24h for sparkline data
- ReadOnlyBanner component shown across all views when node is not regtest
- HistoricalChartsPanel with SVG polyline sparklines for mempool_size/bytes/minfee
- Updated AlertingPanel, HistoricalDashboard, ClusterMempoolPanel, and remaining
components to consume new endpoints and i18n keys
- 50 files: 4 new API modules, 2 new frontend components, updated docs and assets
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.
Summary
403with chain context on mainnet/testnet;NODESCOPE_FORCE_READONLYenv var for manual overrideRATE_LIMIT_RPM(default 600) andRATE_LIMIT_WRITE_RPM(default 30); exempt paths for SSE and health checksmempool_size,mempool_bytes,minfee,rpc_offline) withgt/lt/eq/gte/lteoperators andinfo/warning/criticalseverities;GET /alerts/evaluatefor live trigger checkGET /charts/{metric}?range=1h|6h|24hfor sparkline data;HistoricalChartsPanelwith SVG polylinesAlertingPanel,HistoricalDashboard,ClusterMempoolPaneland all remaining components to consume new endpoints and bilingual i18n keysdocs/api.mdwith new endpointsTest plan
make up) — ReadOnlyBanner must NOT appear, all write actions workNODESCOPE_FORCE_READONLY=true, restart — ReadOnlyBanner appears, mutation endpoints return 403POST /alerts/configs, trigger it by pushing mempool over threshold, verifyGET /alerts/activereturns itGET /charts/mempool_size?range=1hreturns data after ~1 min of uptime; HistoricalChartsPanel renders sparklinesRATE_LIMIT_RPM— verify 429 responsesnpm run lint && npm run format:checkpass infrontend/pytest tests/passes (includingtest_network_guard.py)