Fix write verification and re-enable it

This commit is contained in:
pleb
2026-03-22 22:50:51 -07:00
parent ef7463a29a
commit ec51dcc52e
9 changed files with 106 additions and 38 deletions
+17 -7
View File
@@ -6,8 +6,8 @@ Production-oriented Prometheus exporter for monitoring a fixed set of Nostr rela
- Probes each configured relay either on an interval, or on-demand when `/metrics` is scraped.
- Uses `@nostrwatch/nocap` for `open` + `read` checks.
- Optionally performs a low-noise write confirmation check (kind `30078` by default) using deterministic `d` tags.
- By default, treats relay `OK` for publish as success; optional read-after-write verification can be enabled.
- Performs a low-noise write confirmation check (kind `30078` by default) using deterministic `d` tags.
- By default, requires read-after-write verification.
- Exposes:
- `/metrics` for Prometheus scraping
- `/healthz` for process and probe-loop health
@@ -49,7 +49,7 @@ Environment variables:
- `PORT` (default: `9464`)
- `LOG_LEVEL` (default: `info`; one of `debug|info|warn|error`)
- `WRITE_CHECK_ENABLED` (default: `true`)
- `WRITE_CHECK_VERIFY_READ` (default: `false`; when `true`, require event read-back after publish)
- `WRITE_CHECK_VERIFY_READ` (default: `true`; set `false` to treat publish `OK` as sufficient)
- `WRITE_CHECK_KIND` (default: `30078`)
- `WRITE_CHECK_PRIVKEY` (optional; supports `nsec1...` or 64-char hex)
@@ -100,13 +100,23 @@ LIVE_RELAY_TEST_EXPECT_NO_FAILURES=1 \
pnpm test test/live.offchain.test.ts
```
Optional knobs:
Faster local loop (reduced stability sampling):
- `LIVE_RELAY_TEST_SAMPLES` (default `12`)
- `LIVE_RELAY_TEST_SCRAPE_EVERY_MS` (default `1500`)
```bash
LIVE_RELAY_TEST_OFFCHAIN=1 \
LIVE_RELAY_TEST_RELAYS="wss://offchain.pub" \
LIVE_RELAY_TEST_SAMPLES=2 \
LIVE_RELAY_TEST_SCRAPE_EVERY_MS=250 \
pnpm test test/live.offchain.test.ts
```
Optional knobs (defaults favor faster feedback):
- `LIVE_RELAY_TEST_SAMPLES` (default `4`)
- `LIVE_RELAY_TEST_SCRAPE_EVERY_MS` (default `500`)
- `LIVE_RELAY_TEST_TIMEOUT_SECONDS` (default `8`)
- `LIVE_RELAY_TEST_RELAYS` (default `"wss://offchain.pub"`; comma-separated relay list)
- `LIVE_RELAY_TEST_WRITE_VERIFY_READ=1` to enable read-after-write verification (disabled by default)
- `LIVE_RELAY_TEST_WRITE_VERIFY_READ=1` to force read-after-write verification
- `LIVE_RELAY_TEST_EXPECT_NO_FAILURES=1` to make the test fail on any write-confirm/probe failures
## Exposed metrics