Added `scripts/cancel-all-ci-runs.sh` to allow users to cancel all in-progress and queued GitHub Actions runs.
This script requires the GitHub CLI (`gh`) to be installed and authenticated.
It uses batch cancellation (`xargs`) and an increased limit (1000) for efficiency and coverage.
This commit adds `scripts/agent/interop-test.mjs` to verify protocol interoperability using `NostrClient` and `nostrEventSchemas` against a local test relay. Covers Video Post (kind 30078), View Event (kind 30079), and Encrypted DM.
Verified locally with Node.js and `simple-relay.mjs`.
- Created `scripts/agent/validate-events.mjs` to validate event builders against schemas.
- Instrumented all event builders in `js/nostrEventSchemas.js` to run validation in dev mode.
- Added `tests/event-schemas.test.mjs` to CI suite.
- Updated `docs/nostr-event-schemas.md` with validation instructions.
- Add `scripts/automated-pr-review.mjs` to run format, lint, tests, and security checks.
- Add `.github/workflows/agent-pr-review.yml` to trigger the review on PRs.
- Script flags sensitive file changes (crypto/storage) and posts comments.
- Script attempts to commit formatting micro-fixes if permissions allow.
- Add `Dockerfile` based on `mcr.microsoft.com/playwright:v1.57.0-jammy`.
- Add `scripts/run-playwright-docker.sh` to build and run the container with volume mounts.
- Add `.dockerignore` to prevent host `node_modules` from corrupting the build.
- Update `README.md` with usage instructions.
- Add `scripts/setup-pre-commit.sh` to install a git pre-commit hook.
- The hook runs `npm run lint` and `npm run build:css` to enforce quality and build consistency.
- Update `CONTRIBUTING.md` to document the new hook setup under Development Setup.
- Updated `playwright.config.ts` to use separate projects for 'visual' and 'e2e' tests.
- Configured 'visual' project to retain screenshots, traces, and videos on failure.
- Set Playwright output directory to `artifacts/test-results`.
- Added `scripts/show-artifacts.sh` to help locate test artifacts.
- Updated `KNOWN_ISSUES.md` and `README.md` with debugging instructions.
- Implement `scripts/agent/load-test.mjs` for stress testing local relays.
- Simulate N clients publishing Video Post and View Events.
- Measure latency (Build, Sign, RTT), throughput, and system resources.
- Update `scripts/agent/simple-relay.mjs` to support configurable `PORT`.
- Include `artifacts/load-report-20260122.json` from a 1000-client run.
- Remove `wss://open.video.lukewarlow.uk:443/announce` from `DEFAULT_WSS_TRACKERS` in `js/constants.js`.
- This tracker was returning `net::ERR_SSL_PROTOCOL_ERROR`, causing console noise and connection failures.
- Added `scripts/agent/debug_frontend.py` to help diagnose frontend initialization errors.
Verified with `scripts/agent/debug_frontend.py` that the error is resolved.
Ran `npm run format`, `npm run lint`, and `npm run test:unit`.
Fuzzer discovered a crash when `pointerTags` is passed as null.
Added array check to prevent TypeError.
Also added fuzz harnesses for schemas, dm decryptor and magnet utils.
- Format `css/tailwind.source.css` with Prettier.
- Add allowlist entry for `VideoCard.js` media query pixel value in `scripts/check-design-tokens.mjs`.
- Remove accidental artifact `js/ui/dm/jules_session_4520373547615093905.zip`.
- Fix bug in `js/app.js` and `js/services/moderationActionController.js` where blocked users' videos were not correctly hidden in the UI immediately after blocking.
- Fix bug in `tests/app/moderation-overrides.test.mjs` where `userBlocks` mocks were insufficient to reflect state changes.
- Format `css/tailwind.source.css` with Prettier.
- Add allowlist entry for `VideoCard.js` media query pixel value in `scripts/check-design-tokens.mjs`.
- Remove accidental artifact `js/ui/dm/jules_session_4520373547615093905.zip`.
- Adds `scripts/agent/interop-test.mjs` to verify protocol compliance.
- Tests Video Post, View Event, and encrypted Direct Message publishing/decryption.
- Uses ephemeral keys and a local relay (`simple-relay.mjs`).
- Polyfills browser environment for `NostrClient` execution in Node.js.
- Update `scripts/telemetry-aggregator.mjs` to dynamically discover `test_unit*.log` files and include `server.log`.
- Enhance error collection to handle both TAP failures and generic JS crashes/errors.
- Implement robust PII sanitization for IPs, emails, hex keys, and local paths.
- Aggregate errors by stack trace fingerprint and generate a Markdown report for triage.
- Ensure the process is opt-in (via manual script execution) and artifacts are local-only.
Updates scripts/agent/review-pr.mjs to fetch the base branch of PRs and
include specific release channel guidance (Main vs Unstable) in the
automated review report, as per AGENTS.md instructions.
Added `scripts/agent/smoke-test.mjs`, a Playwright-based smoke test that:
- Spins up a local web server (`python -m http.server`) and local relay (`scripts/agent/simple-relay.mjs`).
- Launches a headless browser to interact with the served app.
- Verifies key flows: Login, Video Publish, Verification, and DM Decryption.
- Reports status to `artifacts/smoke-summary-YYYYMMDD.json` and logs.
This fulfills the requirement for a regression smoke test covering key user flows.
- Adds scripts/agent/load-test.mjs to simulate N clients connecting to a relay.
- Publishes video and view events at a configurable rate.
- Measures write latency (Client -> Relay -> OK).
- Monitors local relay process (CPU/Mem) if applicable.
- Generates JSON report in artifacts/load-report-YYYYMMDD.json.
- Includes guardrails against public relays.
Test Run Summary (20 clients, 10s):
- Total Requests: 377
- Successful: 377
- Throughput: 37.7 req/s
- Avg Latency: 34.5ms
- P95 Latency: 61.0ms
- Add `scripts/agent/fuzz-nostr-schemas.mjs` to fuzz event builders and validation
- Add `scripts/agent/fuzz-dm-decryptor.mjs` to fuzz DM unwrapping
- Add `scripts/agent/fuzz-magnet-utils.mjs` to fuzz magnet normalization
- Utilize `scripts/agent/fuzz-lib.mjs` for randomization and reporting
- Verify that `scripts/agent/setup-test-env.js` is imported to polyfill globals
- Output reports to `artifacts/`
No crashes were found during the initial fuzzing run (5000 iterations per target).
- Fix `scripts/check-design-tokens.mjs` to allow a mobile breakpoint.
- Add Dev Container documentation to `CONTRIBUTING.md`.
- Fix missing dependency injection in `tests/helpers/moderation-test-helpers.mjs` to resolve some unit test failures in a fresh environment.
- Implements `scripts/agent/interop-test.mjs` to verify Nostr protocol compatibility.
- Uses `NostrClient` programmatically with ephemeral keys (no persistence).
- Defines a strict test relay list (`relay.damus.io`, `nos.lol`) to avoid spam.
- Validates Video Post publishing (Kind 30078) using `js/nostrEventSchemas.js` builders.
- Validates View Event publishing (Kind 30079).
- Validates DM encryption and decryption (Kind 4) using `js/dmDecryptor.js`.
- Adheres to AGENTS.md guardrails (no session actor comments).
- Outputs clear pass/fail logs for verification.
- Created scripts/agent/validate-events.mjs to validate event builders against schemas.
- Added schemas and builders for Kind 5 (Deletion) and Kind 4 (Legacy DM) to js/nostrEventSchemas.js.
- Updated js/nostr/client.js to use new builders for Kind 5 and Kind 4 events.
- Updated js/nostr/client.js to use buildVideoPostEvent for video reverts.
- Verified all builders produce valid events.
Extracts `decorateVideoModeration` and related helper methods from `js/app.js` into a new `js/services/moderationDecorator.js` service. This improves separation of concerns by moving complex moderation logic out of the main application class.
AGENTS.md Checklist:
1. Identify Logic: Extracted `decorateVideoModeration`, `deriveModerationReportType`, `deriveModerationTrustedCount`, `getReporterDisplayName`, `normalizeModerationSettings`, `getActiveModerationThresholds`.
2. Create Controller Method: Created `ModerationDecorator` class with `decorateVideo` method.
3. Create `bitvidApp` Wrapper: Replaced `decorateVideoModeration` in `js/app.js` with a wrapper that delegates to `this.moderationDecorator.decorateVideo`.
4. Wire Up Callbacks: Passed `getProfileCacheEntry` to `ModerationDecorator` constructor.
5. Remove Old Code: Removed extracted methods from `js/app.js`.
Also added unit tests for `ModerationDecorator` and ensured runtime settings updates are propagated.
- Removed a TODO comment in `scripts/agent/validate-events.mjs` as the functionality was already implemented.
- Optimized the code to avoid redundant `JSON.parse` calls.
- Verified the script passes all validation tests.
- Created `artifacts/issue_telemetry_json.md` to track the larger task of handling JSON logs in telemetry aggregation.
- Adds `scripts/agent/review-pr.mjs` to automate PR checks (lint, format, test).
- Implements micro-fix logic to auto-commit formatting changes.
- Adds guardrails for sensitive files (security/protocol review).
- Generates a Markdown report with test failure analysis.
- Added `scripts/agent/interop-test.mjs` to verify Nostr protocol compatibility (Video Post, View Event, DM) using ephemeral keys.
- Added `scripts/agent/setup-test-env.js` to polyfill browser globals for Node.js execution.
- Ensures events are constructed via schema builders and published to test relays.
Introduces `scripts/agent/telemetry-aggregate.mjs` to parse, sanitize, and aggregate error logs from the `artifacts/` directory.
- Scans logs for errors and stack traces.
- Sanitizes PII (IPs, emails, keys) using regex.
- Groups errors by stack trace fingerprint (SHA256).
- Outputs a JSON summary (`artifacts/error-aggregates.json`) and a Markdown report (`ai/reports/telemetry-YYYYMMDD.md`).
- Suggests owners based on stack trace paths.
- Created `scripts/agent/validate-events.mjs` to validate all event builders against schemas.
- Updated `docs/nostr-event-schemas.md` to match codebase (fixed `WATCH_HISTORY` key, removed unused `STORAGE_CHALLENGE`).
- Added `validateEventAgainstSchema` to `js/nostrEventSchemas.js` for runtime validation in dev mode.
- Instrumented `buildVideoPostEvent` to use runtime validation.
- Verified that all 22 builders produce conformant events.
- Created scripts/agent/smoke-test.mjs to verify key flows (login, relay connect, publish, DM decrypt).
- The script uses Playwright to run a headless browser test against a local HTTP server and a local relay.
- Outputs logs to artifacts/smoke-YYYYMMDD.log and a JSON report.
- Verified local execution passes.