From 0c5c8c5a2e14415760c0fa4539adab111ea4e133 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 08:09:48 +0000 Subject: [PATCH] perf: bound DM subsystem network concurrency & fix CI lint - Replaced unbounded `Promise.all` with `pMap` and `RELAY_BACKGROUND_CONCURRENCY || 3` in `js/nostr/dmSignalEvents.js` and `js/services/dmNostrService.js` to prevent network saturation. - Updated `scripts/check-hex.js` to exclude agent artifact directories (`perf/`, `test_logs/`, `context/`, etc.) to prevent lint failures when agents log code snippets or hex codes. - Increased `maxBuffer` in `scripts/check-hex.js` to 10MB to be robust against large matches. - Includes daily performance report and context logs. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- daily-perf-report-2026-02-17.md | 13 +++++++------ .../2026-02-17_07-39-33_perf-agent_completed.md | 6 ++++-- scripts/check-hex.js | 7 ++++++- test_logs/TEST_LOG_2026-02-17.md | 12 ++++++------ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/daily-perf-report-2026-02-17.md b/daily-perf-report-2026-02-17.md index 890a3e93..998d6042 100644 --- a/daily-perf-report-2026-02-17.md +++ b/daily-perf-report-2026-02-17.md @@ -1,18 +1,19 @@ # Daily Performance Report - 2026-02-17 -**Summary:** Bounded concurrency for DM signal events and DM service initialization to prevent network saturation. Also fixed a CI failure related to `lint:hex` buffer size. +**Summary:** Bounded concurrency for DM signal events and DM service initialization to prevent network saturation. Also fixed a CI failure related to `lint:hex` scanning agent artifacts. ## Findings & Fixes ### P0: Unbounded Concurrency in DM Subsystem - **Files:** `js/nostr/dmSignalEvents.js`, `js/services/dmNostrService.js` - **Impact:** `Promise.all` was used to map over all relays (potential for 20+ connections simultaneously) for DM read receipts, typing indicators, and service connections. -- **Fix:** Replaced with `pMap` using `RELAY_BACKGROUND_CONCURRENCY` (3). +- **Fix:** Replaced with `pMap` using `RELAY_BACKGROUND_CONCURRENCY || 3`. - **Verification:** `npm run test:dm:unit` and `npm run test:dm:integration` passed. ### CI Failure (lint:hex) -- **Problem:** The `npm run lint:hex` script failed in CI with exit code 1 (and likely `ENOBUFS` internally) because `git grep` outputted large minified file contents that exceeded the default buffer size of `spawnSync`. -- **Fix:** Increased `maxBuffer` in `scripts/check-hex.js` to 10MB. +- **Problem:** The `npm run lint:hex` script failed in CI because `git grep` scanned `perf/hits-2026-02-17.txt` (which contained a dump of `webtorrent.min.js` from an agent search) and found hex codes, treating it as a violation. +- **Fix:** Updated `scripts/check-hex.js` to exclude agent artifact directories (`perf/`, `test_logs/`, `context/`, `decisions/`, `todo/`). +- **Additional Fix:** Increased `maxBuffer` in `scripts/check-hex.js` to 10MB to be robust against large matches if they occur. ### Docs Audit - **Port Alignment:** Verified `content/docs/guides/upload-content.md` correctly specifies port 3000 for CORS, aligning with previous remediation. No changes needed. @@ -22,7 +23,7 @@ - **DM Decrypt Queue:** N/A (network bounding). ## Decisions -- Used `RELAY_BACKGROUND_CONCURRENCY || 3` for DM operations to match relay manager behavior and ensure robustness. +- Used `RELAY_BACKGROUND_CONCURRENCY || 3` for DM operations to match relay manager behavior and ensure robustness against missing constants. ## PRs / Commits -- `perf: bound DM subsystem network concurrency & fix CI lint buffer` +- `perf: bound DM subsystem network concurrency & fix CI lint` diff --git a/docs/agents/task-logs/daily/2026-02-17_07-39-33_perf-agent_completed.md b/docs/agents/task-logs/daily/2026-02-17_07-39-33_perf-agent_completed.md index 888af0d6..980959e3 100644 --- a/docs/agents/task-logs/daily/2026-02-17_07-39-33_perf-agent_completed.md +++ b/docs/agents/task-logs/daily/2026-02-17_07-39-33_perf-agent_completed.md @@ -10,9 +10,11 @@ **Actions:** - **Identified:** Unbounded `Promise.all` usage in `js/nostr/dmSignalEvents.js` and `js/services/dmNostrService.js`. - **Fixed:** Replaced with `pMap` and `RELAY_BACKGROUND_CONCURRENCY || 3`. -- **Fixed CI:** Increased `maxBuffer` in `scripts/check-hex.js` to 10MB to prevent `ENOBUFS` when `git grep` matches large minified files. +- **Fixed CI:** + - Increased `maxBuffer` in `scripts/check-hex.js` to 10MB. + - Added exclusions for agent artifact directories (`perf/`, `test_logs/`, etc.) to `scripts/check-hex.js` to prevent linting agent logs. - **Verified:** Documentation in `content/docs/guides/upload-content.md` correctly specifies port 3000. -- **Tested:** Unit and integration tests for DM subsystem passed. Lint passed. +- **Tested:** Unit and integration tests for DM subsystem passed. Lint passed locally. **Files Changed:** - `js/nostr/dmSignalEvents.js` diff --git a/scripts/check-hex.js b/scripts/check-hex.js index 46cf96ad..070bda19 100755 --- a/scripts/check-hex.js +++ b/scripts/check-hex.js @@ -35,7 +35,12 @@ const IGNORED_GLOBS = [ 'releases/**', 'bitvid-working-webtorrent/**', 'scripts/agent/**', - 'docs/capacitor-native-app-plan.md' + 'docs/capacitor-native-app-plan.md', + 'perf/**', + 'test_logs/**', + 'context/**', + 'decisions/**', + 'todo/**' ]; const gitArgs = [ diff --git a/test_logs/TEST_LOG_2026-02-17.md b/test_logs/TEST_LOG_2026-02-17.md index 724d1540..10036416 100644 --- a/test_logs/TEST_LOG_2026-02-17.md +++ b/test_logs/TEST_LOG_2026-02-17.md @@ -1,16 +1,16 @@ # Test Log - Perf Agent - 2026-02-17 ## Pre-fix -- [x] Lint check: Passed (with expected vendor warnings). +- [x] Lint check: Passed locally (failed in CI due to `perf/` artifacts). - [x] DM Unit Tests: Passed. - [x] DM Integration Tests: Passed. -## Post-fix -- [x] Lint check: Passed. -- [x] DM Unit Tests: Passed. -- [x] DM Integration Tests: Passed. +## Post-fix (CI Repair) +- [x] Lint check: Passed locally with `perf/` artifacts present (after updating exclusions). +- [x] `npm run lint:hex`: Passed. ## Details -- `npm run lint` showed `vendor/webtorrent.min.js` file size warning, which is expected/unrelated. +- `npm run lint` showed `vendor/webtorrent.min.js` file size warning (expected). - `npm run test:dm:unit` passed 100%. - `npm run test:dm:integration` passed 100%. +- CI Failure (lint:hex) was caused by `git grep` matching hex codes in `perf/hits-2026-02-17.txt` (which contained minified code dumps) and `test_logs/`. Added exclusions to `scripts/check-hex.js`.