- Added `scripts/agent/fuzz-utils.mjs` with random input generators.
- Added `scripts/agent/fuzz-nostrEventSchemas.mjs` to fuzz event builders and validation.
- Added `scripts/agent/fuzz-dmDecryptor.mjs` to fuzz DM decryption logic.
- Added `scripts/agent/fuzz-magnetUtils.mjs` to fuzz magnet URI normalization.
- Added `scripts/agent/summarize-fuzz.mjs` to aggregate reports.
- Generated initial fuzzing reports in `artifacts/`.
- Verified that target functions are robust against malformed inputs.
Co-authored-by: PR0M3TH3AN <[email protected]>
- `js/nostr/client.js`: Exposed `derivePrivateKeyFromSecret` to `NostrClient` (delegating to `SignerManager`) to support programmatic login in E2E tests.
- `tests/e2e/helpers/bitvidTestFixture.ts`: Refactored to use dynamic relay ports based on `workerIndex` to fix parallel execution collisions.
- `scripts/agent/simple-relay.mjs`: Updated `close()` to force terminate connected clients, preventing test teardown hangs.
- `scripts/check-sw-compat.mjs`: Added try-catch around git commands to gracefully handle shallow clones in CI environments.
Co-authored-by: PR0M3TH3AN <[email protected]>
Updates `scripts/agent/load-test.mjs` to import `startRelay` from `./load-test-relay.mjs` which implements event eviction logic, preventing memory issues during extended load tests.
Includes a generated load report in the description (since artifacts are gitignored).
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces pure JS `finalizeEvent` with `nostr-tools/wasm` implementation in `scripts/agent/load-test.mjs`.
This reduces signing time from ~6ms to ~1ms per event (5x-6x speedup), significantly increasing the event generation throughput capacity of the load test agent.
- Adds `nostr-wasm` to devDependencies.
- Updates `scripts/agent/load-test.mjs` to initialize and use WASM crypto.
- Adds `benchmarks/signing_benchmark.mjs` to verify performance gains.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refined scripts/agent/load-test.mjs to generate detailed JSON reports including topHotFunctions and error details.
- Added pnpm-lock.yaml to lock dependencies for reproducible runs.
- Generated artifacts/load-report-20260208.json from a 60s load test run.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `scripts/agent/validate-events.mjs` to validate event builders against schemas, covering standard and specific usage patterns.
- Updated `js/nostrEventSchemas.js` to include NIP-17 event types (`GIFT_WRAP`, `SEAL`, `CHAT_MESSAGE`) and their builders.
- Refactored `js/nostr/client.js` to use NIP-17 builders in `sendDirectMessage`, enabling runtime schema validation.
- Updated `docs/nostr-event-schemas.md` to document the new event types.
Co-authored-by: PR0M3TH3AN <[email protected]>
Implements a load testing script for Nostr relays that simulates multiple clients, generates mixed event traffic (View/Video), and measures performance metrics including latency, throughput, and CPU usage. It also includes strict safety guardrails to prevent accidental load testing against public relays.
Signed-off-by: Jules <[email protected]>
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implements `scripts/agent/interop-test.mjs` to verify Video Post, View Event, and DM flows.
- Uses `NostrClient` with ephemeral keys and a local relay.
- Ensures correct event construction via `nostrEventSchemas.js`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implements `scripts/agent/load-test.mjs` to simulate N clients publishing mixed events.
- Adds `test:load` script to `package.json`.
- Measures roundtrip latency and client-side signing time.
- Generates JSON report in `artifacts/`.
- Includes `--mock` mode for verification without external relay.
- Enforces guardrails against public relay usage.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implement CPU usage tracking in load-test.mjs
- Run load test with 1000 clients for 60s
- Generate load-report.json with identified bottlenecks (crypto)
Co-authored-by: PR0M3TH3AN <[email protected]>
This introduces `scripts/agent/load-test.mjs`, a stress testing tool that:
- Spawns a local relay server in a separate process.
- Simulates N concurrent WebSocket clients.
- Publishes a configurable mix of large (Video Post) and small (View) events.
- Measures and reports on latency, throughput, memory usage, and cryptographic signing time.
- Identifies potential bottlenecks (error rate > 5%, latency > 500ms, sign time > 5ms).
Includes a sample run report in `artifacts/`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `scripts/agent/validate-events.mjs` to verify event builders against schemas.
- Enhanced validation script with test cases for Relay List (object format), Hashtag Preferences (encrypted), and Video Post (additional tags).
- Updated `docs/nostr-event-schemas.md` to document the validation workflow.
- Verified runtime event construction by instrumenting tests with dev mode (reverted clean).
Co-authored-by: PR0M3TH3AN <[email protected]>
Diagnosed a CORS error on local development environment caused by WebTorrent fetching `.torrent` files from R2 buckets (via `xs` parameter) that do not allow localhost origin.
Modified `js/webtorrent.js` to strip the `xs` parameter from magnet links when running on `localhost` or `127.0.0.1`. This prevents the browser from attempting the blocked fetch request, resolving the console error while maintaining functionality (falling back to DHT/peers).
Verified using `scripts/agent/debug_frontend.py` which captures frontend console logs via Playwright.
Tests run:
- `npm run lint`
- `npm run test:unit:shard1`
- `python3 scripts/agent/debug_frontend.py` (verified error is gone)
Co-authored-by: PR0M3TH3AN <[email protected]>
This script validates protocol interoperability by publishing Video Post and View events, and sending Encrypted DMs using ephemeral keys against public relays. It ensures the NostrClient facade and event builders function correctly in a Node.js environment.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `scripts/agent/telemetry-aggregator.mjs` to use a stricter regex for parsing generic logs.
- Require brackets (e.g., `[ERROR]`, `[WARN]`) or trailing colons/word boundaries (e.g., `Error:`, `FAIL`) to match errors.
- Prevent false positives from status messages like "0 errors" or "0 failures".
- Support `[WARN]` as Medium severity.
- Ensure PII sanitization and `ENABLE_TELEMETRY` guardrails are preserved.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `scripts/agent/validate-events.mjs` to verify all event builders produce valid events against the schema.
- Instrumented `js/nostr/nip71.js` to validate NIP-71 events during construction (other builders in `js/nostrEventSchemas.js` were already instrumented).
- Validated all 25 event types using the new tool.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `netlify.toml` to explicitly include redirect and header rules, ensuring they are picked up even if file copying fails or is inconsistent.
- Fix `scripts/agent/smoke-test.mjs` to ensure process cleanup on failure (avoiding zombie processes) and use polling for server startup (improving reliability).
- Verified smoke test passes locally.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `scripts/agent/smoke-test.mjs` which performs an end-to-e2e smoke test using a local relay, Node.js client, and headless Playwright browser.
- Fixed a bug in `js/app.js` where `activeProfilePubkey` and `savedProfiles` getters were missing, preventing auto-login and session restoration.
- The smoke test verifies:
- Login flow (using ephemeral keys and localStorage injection).
- Relay connection (using a local test relay).
- Publish and Receive flow (Video Post).
- DM Encryption/Decryption flow (Node.js client).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `scripts/agent/fuzz-nostrEventSchemas.mjs`, `scripts/agent/fuzz-dmDecryptor.mjs`, and `scripts/agent/fuzz-magnetUtils.mjs`.
- Utilized `scripts/agent/fuzz-lib.mjs` for standardized random input generation and reporting.
- Removed legacy/duplicate fuzz scripts (`fuzz-nostr-schemas.mjs`, etc.) in favor of the new standardized ones.
- Verified all fuzzers run successfully with no crashes using 5000 iterations.
- Added huge string injection (1MB+) to stress test inputs.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implements an interoperability test suite for Nostr events (Video Post, View Event, Encrypted DM).
- Uses `scripts/agent/load-test-relay.mjs` as a local test relay.
- Uses ephemeral keys for signing.
- Verifies roundtrip publishing and fetching.
- Validates schema compliance using `js/nostrEventSchemas.js`.
- Verifies encryption/decryption using `js/dmDecryptor.js`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `scripts/agent/validate-events.mjs` to validate Nostr event builders and ensure test coverage for used builders.
- Updated `docs/nostr-event-schemas.md` to reference the new validation tool.
- Verified that all centralized builders in `js/nostrEventSchemas.js` produce valid events.
- Identified and ignored non-builder functions in the validation script to prevent false positives.
Co-authored-by: PR0M3TH3AN <[email protected]>