- Fix `tests/app-batch-fetch-profiles.test.mjs` by mocking `readRelays` to ensure deterministic query counts.
- Set `NODE_ENV=test` in `scripts/run-unit-tests.mjs` to prevent `nostr-tools` bootstrap failures in test environment.
- Run `npm ci` and `npm audit fix` to maintain lockfile health.
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]>
- Add `audit` script to `package.json` to run `scripts/daily-design-system-audit.mjs`.
- Update `lint:css` to include `css/docs.css` for better coverage.
- Improve `scripts/daily-design-system-audit.mjs` parsing logic for Hex and CSS violations to better handle output formats.
- Generate `REMEDIATION_REPORT.md` with current audit results (No violations).
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]>
- Created scripts/agent/smoke-test.mjs using Playwright for UI tests and Node for DM verification.
- Updated scripts/agent/load-test-relay.mjs to support NIP-45 COUNT frames (dummy).
- Included artifacts generation (logs, screenshots).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Expand fuzzing coverage for `js/nostrEventSchemas.js` to include all builder functions.
- Fix a crash in `buildAdminListEvent` where non-array `hexPubkeys` caused a TypeError.
- Update `scripts/agent/fuzz-dmDecryptor.mjs` and `scripts/agent/fuzz-magnetUtils.mjs` iterations.
- Add reproducer for the `buildAdminListEvent` crash.
- Generate fuzz reports in `artifacts/`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Renamed scripts/agent/validate-events.mjs to scripts/agent/validate-events.test.mjs to prevent potential deployment issues with Netlify or other CI tools treating it as a production asset. Also added shebang.
Co-authored-by: PR0M3TH3AN <[email protected]>
Added scripts/agent/validate-events.mjs to validate event builders against schemas. Verified consistency and added a regression test for event schemas.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Move NIP-07 extension login logic from `js/services/authProviders/nip07.js` to `NostrClient.loginWithExtension`.
- Add `validator` support to `NostrClient` login methods (`loginWithExtension`, `connectRemoteSigner`, `useStoredRemoteSigner`, `registerPrivateKeySigner`) to allow pre-session security checks.
- Update `nip07.js`, `nip46.js`, and `nsec.js` providers to inject `accessControl` checks via the new validator hook, ensuring consistent enforcement of whitelists/blacklists before activating the signer.
- This creates a unified "harness" for all signing methods within `NostrClient` while keeping business logic (access control) in the service layer.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `scripts/automated-pr-review.mjs` to include missing sensitive paths (`js/auth/`, `js/magnetUtils.js`, `js/nostr/adapters/nip07Adapter.js`) and improve commit messaging for automated fixes.
- Add release channel guidance checks for `unstable` branch in `automated-pr-review.mjs`.
- Create `scripts/agent/review-open-prs.mjs` to robustly batch process open PRs using the updated review script.
- Remove redundant scripts `scripts/agent/automated-pr-review.mjs` and `scripts/agent/review-pr.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refactoring `scripts/check-hex.js` to use git's native search instead of `ripgrep` for better portability and dependency reduction.
- Updating `tests/ui/uploadModal-integration.test.mjs` to ensure DOM isolation between tests using `beforeEach` cleanup, resolving state pollution issues.
Co-authored-by: PR0M3TH3AN <[email protected]>
Added scripts/agent/smoke-test.mjs to verify login, relay connection, video publishing, and DM decryption flows using a headless Node.js client.
The script polyfills the necessary browser environment for NostrClient and uses local relay/server resources.
Co-authored-by: PR0M3TH3AN <[email protected]>
Currently, if the automated PR review script encounters failures (lint/test errors), it exits with code 1, but the failure details are only visible in the posted PR comment. In CI environments where the comment might not be immediately accessible or if posting fails, the logs are unhelpful.
This change unconditionally prints the generated review report (including failure details) to `stdout` at the end of the script execution. This ensures that failure reasons are always visible in the CI logs.
Co-authored-by: PR0M3TH3AN <[email protected]>
Implemented fuzz testing harnesses and fixed a circular reference crash in nostrEventSchemas.js. Improved robustness of magnetUtils and dmDecryptor.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implements `scripts/agent/interop-test.mjs` to validate VIDEO_POST, VIEW_EVENT, and DM flows.
- Uses ephemeral keys generated via `nostr-tools`.
- Targets public relays `wss://relay.damus.io` and `wss://nos.lol` for verification.
- Includes retry logic for event propagation verification.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `scripts/agent/telemetry-aggregator.mjs` to dynamically search for `test_unit*.log` and `test_output.log` files in both the root and `artifacts/` directories, instead of using a hardcoded list.
- Verified the aggregator script with a test log containing PII (email, IP, hex key) to ensure sensitive information is correctly redacted in the generated reports.
- Confirmed that the script operates only when `ENABLE_TELEMETRY=true` is set.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `scripts/agent/validate-events.mjs` to validate event builders against schemas.
- Refactored `buildVideoPostEvent` in `js/nostrEventSchemas.js` to automatically generate the required `s` (storage pointer) tag if missing, using `infoHash`, `url`, or `videoRootId`.
- Verified that `js/utils/storagePointer.js` exists and is imported correctly.
- Updated `docs/nostr-event-schemas.md` to reflect the auto-generation behavior.
- Verified fixes with `scripts/agent/validate-events.mjs` and existing unit tests.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Wrap `main` execution in try-catch block to ensure process exits with code 1 on failure.
- Update `runCommand` to throw meaningful errors on spawn failure (e.g. command not found).
- Add explicit check for `gh` CLI availability in CI environment.
- Improve git command error logging in `getChangedFiles` to capture stderr (e.g. "no merge base").
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `scripts/agent/load-test.mjs` to simulate realistic video publishing flows by generating Video Post (Kind 30078), Video Mirror (Kind 1063), and NIP-71 Metadata (Kind 21/22) events for "heavy" load scenarios.
- Refactored the load generation loop to strictly separate cryptographic signing time from network transmission time, ensuring accurate performance metrics.
- Generated a baseline `artifacts/load-report.json` demonstrating ~100 events/sec throughput and sub-10ms signing latency.
- Verified execution against a local relay to prevent public network stress.
Co-authored-by: PR0M3TH3AN <[email protected]>
Implements `scripts/agent/interop-test.mjs` to validate Nostr event schemas and client publishing against public relays.
- Uses ephemeral keys (generated via `nostr-tools`) for safety.
- Connects to `wss://relay.damus.io` and `wss://nos.lol` for testing.
- Verifies:
- Video Post creation (via `buildVideoPostEvent`) and publishing.
- View Event creation (via `buildViewEvent`) and publishing.
- Direct Message sending and decryption (using client's encrypted DM logic).
- Includes necessary Node.js polyfills (`WebSocket`, `crypto`, `localStorage`, `window`) to run browser-targeted client code.
- Update smoke-test.mjs to output structured summary with logs
- Update telemetry-aggregator.mjs to collect from unit, smoke, and load tests
- Update run-unit-tests.mjs to log output to artifacts/test_unit.log
- Ensure PII sanitization in telemetry reports
- Added `scripts/agent/validate-events.mjs` to validate event builders.
- Added `GENERIC_REPOST` (kind 16) to `js/nostrEventSchemas.js` and `docs/nostr-event-schemas.md`.
- Updated `buildRepostEvent` to validate against `GENERIC_REPOST` when producing kind 16 events.
- Updated `scripts/automated-pr-review.mjs` to align with specific prompt requirements for formatting fixes and guardrails.
- Added `js/utils/storage.js` to sensitive paths for security review flagging.
- Created `scripts/agent/review-open-prs.mjs` to iterate over open PRs and run the review script using `gh` CLI.
Added `scripts/agent/smoke-test.mjs` to verify key application flows:
- Local Relay & Web Server availability.
- Protocol flows via `NostrClient` in Node.js (Video Publish, View Publish, DM Send & Decrypt).
- UI availability via Playwright (Headless Browser).
This script generates `artifacts/smoke-report.json` and logs for verification.