Commit Graph
158 Commits
Author SHA1 Message Date
thePR0M3TH3AN ec3142bd9f Merge pull request #2397 from PR0M3TH3AN/ai/load-test-20260212-6967903642560012014
Add Load Test Script and Report
2026-02-12 15:24:43 -05:00
google-labs-jules[bot]andPR0M3TH3AN 09015833dc Add load test script and report
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-12 19:14:49 +00:00
google-labs-jules[bot]andPR0M3TH3AN af150fdfe1 fix(ai): frontend console error — ensure CSS build on install (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-12 18:15:14 +00:00
google-labs-jules[bot]andPR0M3TH3AN 21a7b43e80 chore(deps): bump esbuild to v0.27.3
- Upgraded esbuild from 0.27.2 to 0.27.3
- Added scripts/agent/analyze_deps.py
- Added artifacts/deps-report.md, npm-audit.json, npm-outdated.json
- Verified with npm run build, lint, and test:unit

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-12 14:39:37 +00:00
google-labs-jules[bot]andPR0M3TH3AN 21220a635d Add fuzzing suite for Nostr parsing, DM decryption, and Magnet normalization
- 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]>
2026-02-10 16:10:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 3ef17d1122 fix(ci): systematic fixes for E2E tests and CI environment
- `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]>
2026-02-10 06:45:11 +00:00
Claude d0a6c9622b feat: add Playwright agent testability infrastructure
Add test harness (window.__bitvidTest__), data-testid attributes, relay
override support, and Playwright fixtures so agents can programmatically
login, seed relay data, and inspect app state during E2E testing.

- js/testHarness.js: exposes loginWithNsec, getAppState, relay overrides
- data-testid attrs on login/upload/video modals, header buttons, feed
- simple-relay.mjs: HTTP seeding API (POST /seed, GET /events, /health)
- bitvidTestFixture.ts: reusable Playwright fixture with mock relay
- agent-testability.spec.ts: E2E tests validating the infrastructure

https://claude.ai/code/session_01XnrszNmdqrAGd8g8qhAn4G
2026-02-10 05:09:46 +00:00
google-labs-jules[bot]andPR0M3TH3AN efdc4f3f50 feat(agent): Update load test script to use robust local relay
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]>
2026-02-09 19:30:43 +00:00
google-labs-jules[bot]andPR0M3TH3AN 1569ce074f feat(perf): accelerate load test signing with WASM
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]>
2026-02-09 18:35:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN 35f95434f7 feat: implement load test script and generate report
- 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]>
2026-02-08 19:18:51 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0f04245440 chore(ai): event schema validation tool + fixes
- 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]>
2026-02-08 05:09:54 +00:00
thePR0M3TH3AN 22fcc97672 Merge pull request #2174 from PR0M3TH3AN/ai/smoke-tests-20260207-2355643236623905980
chore(ai): add smoke test script (agent)
2026-02-07 16:34:40 -05:00
thePR0M3TH3AN 5a3256afef Merge pull request #2173 from PR0M3TH3AN/ai/load-test-20260207-17226311979336768263
feat(agent): implement nostr relay load test script
2026-02-07 16:34:21 -05:00
thePR0M3TH3AN 446443167e Merge pull request #2157 from PR0M3TH3AN/ai/interop-tests-15938759699659615005
Add Nostr Protocol Interop Tests
2026-02-07 16:20:31 -05:00
google-labs-jules[bot]andPR0M3TH3AN 0f626c8ce7 chore(ai): add smoke test script (agent)
- Adds `scripts/agent/smoke-test.mjs` to verify key flows:
  - Local relay setup
  - Local HTTP server (npx serve)
  - `NostrClient` integration (Node.js)
  - Frontend UI verification (Playwright)
  - Login, Video Publish, DM Decryption
- Adds `test:smoke` script to `package.json`
- Generates reports in `artifacts/`

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 21:20:00 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5fa40e3750 feat(agent): implement nostr relay load test script
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]>
2026-02-07 19:38:41 +00:00
thePR0M3TH3AN 4f13d49f66 Merge pull request #2156 from PR0M3TH3AN/telemetry-aggregator-update-15409738198546473637
Update telemetry aggregator to parse test_output.txt
2026-02-07 09:27:28 -05:00
google-labs-jules[bot]andPR0M3TH3AN e3d9ea7e3a feat: add interoperability test script for Nostr protocol verification
- 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]>
2026-02-07 07:10:56 +00:00
google-labs-jules[bot]andPR0M3TH3AN c0251965da Update telemetry aggregator to include test_output.txt
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 06:06:59 +00:00
google-labs-jules[bot]andPR0M3TH3AN da7fc65e94 chore(ai): event schema validation tool + fixes
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 05:09:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6caf650d52 feat(scripts): add load test script for relay stress testing
- 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]>
2026-02-06 19:31:00 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8f83cff04e Implement load test script with rate configuration and multipart event simulation.
- Update `scripts/agent/load-test.mjs` to support `--rate` arg.
- Add multipart video event simulation (Post + Mirror).
- Generate performance report with bottleneck analysis.
- Include `artifacts/load-report.json`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 19:38:01 +00:00
google-labs-jules[bot]andPR0M3TH3AN 50f97ef964 Add load test script and report
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-03 19:17:54 +00:00
google-labs-jules[bot]andPR0M3TH3AN 95b7c6df47 feat: add load test script and report
- 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]>
2026-02-02 19:25:56 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7f848aa810 feat: add load-test script for relay interactions
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]>
2026-02-01 19:09:29 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2f33992192 Fix dependencies (jsdom/nostr-tools conflict) and WebTorrent regression
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-01 13:32:00 +00:00
google-labs-jules[bot]andPR0M3TH3AN 062f79b181 chore(ai): move smoke test to tests/smoke/smoke-test.mjs
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 21:27:57 +00:00
google-labs-jules[bot]andPR0M3TH3AN ac19e4d8a1 chore(ai): add smoke test script (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 21:12:24 +00:00
thePR0M3TH3AN 2da157a06d Merge branch 'unstable' into ai/interop-tests-20260131-17192017166205222144 2026-01-31 14:06:13 -05:00
thePR0M3TH3AN dab5f66fd0 Merge branch 'unstable' into ai/debug-frontend-13808877327263676633 2026-01-31 14:05:39 -05:00
google-labs-jules[bot]andPR0M3TH3AN e922d01da7 fix(ai): frontend console error — report nostr-tools version mismatch (agent)
- Add scripts/agent/debug_frontend.py for diagnosing console errors
- Add issues/requires-security-review-nostr-tools-upgrade.md documenting version mismatch
- Mismatch between package.json (^2.19.4) and runtime (2.17.0) causes protocol errors

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 18:25:46 +00:00
google-labs-jules[bot]andPR0M3TH3AN 041fb241fe Add Nostr protocol interoperability test script using ephemeral keys and public relays
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 07:33:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN 05a3aa2b1f chore(ai): event schema validation tool + fixes
- 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]>
2026-01-31 05:36:48 +00:00
thePR0M3TH3AN ceccd34681 Revert "Dead Code Cleanup" 2026-01-30 16:51:01 -05:00
google-labs-jules[bot]andPR0M3TH3AN 3f9dd916a8 chore(ai): add smoke test script (agent)
- Adds `scripts/agent/smoke-test.mjs` for end-to-end regression testing.
- Verifies key flows: login, relay connect, publish video, publish DM, and DM decryption.
- Uses local relay (port 8899) and local HTTP server (port 8000).
- Generates JSON summary and logs in `artifacts/`.
- Includes Playwright frontend verification.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 21:29:19 +00:00
google-labs-jules[bot]andPR0M3TH3AN 60fa6c4282 chore(ai): remove dead code (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 20:54:52 +00:00
google-labs-jules[bot]andPR0M3TH3AN 4f40025b9d fix(ai): frontend console error — strip xs on localhost (agent)
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]>
2026-01-30 18:53:25 +00:00
google-labs-jules[bot]andPR0M3TH3AN dc2dc70b69 test(fuzz): add fuzzing harnesses for schemas, dm, and magnet utils
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 16:14:02 +00:00
thePR0M3TH3AN b71346c06a Merge branch 'unstable' into ai/interop-tests-20250228-12917398042927663384 2026-01-30 09:19:49 -05:00
thePR0M3TH3AN 667b48c301 Merge branch 'unstable' into telemetry-aggregation-fix-6349074633801704985 2026-01-30 09:19:03 -05:00
thePR0M3TH3AN 55b338ee5a Merge pull request #1962 from PR0M3TH3AN/ai/schema-validate-20250130-4578214465880061430
Event Schema Validation Tool & NIP-71 Instrumentation
2026-01-30 09:17:42 -05:00
google-labs-jules[bot]andPR0M3TH3AN 7ac4d4eee7 feat: add Nostr interop test script
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]>
2026-01-30 07:34:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN 782ecf3cea Refactor telemetry aggregator regex for stricter error detection
- 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]>
2026-01-30 06:33:52 +00:00
google-labs-jules[bot]andPR0M3TH3AN 39c4e2249d chore(ai): event schema validation tool + fixes
- 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]>
2026-01-30 05:34:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 505d8dfc3c fix(deploy): update netlify config and smoke test
- 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]>
2026-01-29 22:44:57 +00:00
google-labs-jules[bot]andPR0M3TH3AN 06dfe6278a chore(ai): add smoke test script (agent)
- Add scripts/agent/smoke-test.mjs for E2E verification
- Fix js/app.js to expose activeProfilePubkey and savedProfiles
- Fix tests/app-batch-fetch-profiles.test.mjs mocking (CI fix)
- Ensure smoke test uses Node.js compatible imports

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 22:00:17 +00:00
google-labs-jules[bot]andPR0M3TH3AN 624dabc576 chore(ai): add smoke test script (agent)
- 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]>
2026-01-29 21:45:32 +00:00
google-labs-jules[bot]andPR0M3TH3AN 28da9e1642 Add fuzzing harnesses for Nostr schemas, DM decryptor, and magnet utils
- 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]>
2026-01-29 16:31:38 +00:00
thePR0M3TH3AN 0114310f23 Merge pull request #1916 from PR0M3TH3AN/ai/interop-tests-20250222-17895204114495764290
Add Nostr interoperability test script
2026-01-29 08:18:41 -05:00
google-labs-jules[bot]andPR0M3TH3AN 5dd9cb542c fix(ci): add _redirects for netlify and clean up interop test
- Create `_redirects` file with catch-all rule (`/* /index.html 200`) to fix Netlify "Redirect rules" check failure and support SPA routing.
- Remove unused `NOTE_TYPES` import from `scripts/agent/interop-test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 07:54:39 +00:00