From 782ecf3cea0e7e8c48fcf351d83964c1bc3aeb7d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 06:33:52 +0000 Subject: [PATCH 1/4] 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 <53631862+PR0M3TH3AN@users.noreply.github.com> --- scripts/agent/telemetry-aggregator.mjs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/agent/telemetry-aggregator.mjs b/scripts/agent/telemetry-aggregator.mjs index 615799b2..33541709 100644 --- a/scripts/agent/telemetry-aggregator.mjs +++ b/scripts/agent/telemetry-aggregator.mjs @@ -147,19 +147,26 @@ function collectGenericLogs(filepath, sourceName) { for (const line of lines) { // Simple heuristic for generic logs: look for "Error:" or "Exception:" // and capture following lines that look like stack traces (start with 'at ' or are indented) + // Also support bracketed log levels like [ERROR], [FAIL], [CRITICAL], [WARN] - const isErrorStart = /Error:|Exception:|FAIL|CRITICAL/.test(line); + const errorMatch = line.match(/(?:\[\s*(?:ERROR|FAIL|CRITICAL|EXCEPTION|WARN|WARNING)\s*\])|(?:\b(?:Error|Exception|Warning):)|(?:\b(?:FAIL|CRITICAL)\b)/i); + const isErrorStart = !!errorMatch; const isStackLine = /^\s+at /.test(line) || /^\s+/.test(line); // Indented lines often follow errors if (isErrorStart) { if (currentError) { errors.push(currentError); } + + let severity = 'High'; + if (line.match(/CRITICAL/i)) severity = 'Critical'; + else if (line.match(/WARN|WARNING/i)) severity = 'Medium'; + currentError = { source: sourceName, title: sanitize(line.trim()), details: [sanitize(line.trim())], - severity: 'High' + severity: severity }; } else if (currentError && isStackLine) { currentError.details.push(sanitize(line.trim())); From a6bf25f9fc53a021dac773296c073ccfd28eea76 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 06:39:23 +0000 Subject: [PATCH 2/4] Fix app-batch-fetch-profiles test mocking - Update `tests/app-batch-fetch-profiles.test.mjs` to correctly mock `nostrClient.readRelays`. - Ensure deterministic relay query counts in unit tests. - Fixes CI failure where `actual: 4` vs `expected: 2` due to unmocked read relays. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- tests/app-batch-fetch-profiles.test.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/app-batch-fetch-profiles.test.mjs b/tests/app-batch-fetch-profiles.test.mjs index df90a4bc..f682cab3 100644 --- a/tests/app-batch-fetch-profiles.test.mjs +++ b/tests/app-batch-fetch-profiles.test.mjs @@ -52,12 +52,16 @@ test("batchFetchProfiles handles fast and failing relays", async () => { const originalWriteRelays = Array.isArray(nostrClient.writeRelays) ? [...nostrClient.writeRelays] : nostrClient.writeRelays; + const originalReadRelays = Array.isArray(nostrClient.readRelays) + ? [...nostrClient.readRelays] + : nostrClient.readRelays; const originalPool = nostrClient.pool; const poolListCalls = []; nostrClient.relays = [FAST_RELAY, FAIL_RELAY]; nostrClient.writeRelays = [FAST_RELAY, FAIL_RELAY]; + nostrClient.readRelays = [FAST_RELAY, FAIL_RELAY]; nostrClient.pool = { list: (relays, filters) => { poolListCalls.push({ relays, filters }); @@ -93,6 +97,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => { } finally { nostrClient.relays = originalRelays; nostrClient.writeRelays = originalWriteRelays; + nostrClient.readRelays = originalReadRelays; nostrClient.pool = originalPool; } From 7d325e49db33a86559915d90a020e1a9e56a8588 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 06:45:47 +0000 Subject: [PATCH 3/4] Fix profile-modal-controller test mock - Update `tests/profile-modal-controller.test.mjs` to include a mock for `hashtagPreferences.load`. - Fixes `TypeError: this.hashtagPreferencesService.load is not a function` in unit tests. - Ensures all tests pass locally. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- tests/profile-modal-controller.test.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/profile-modal-controller.test.mjs b/tests/profile-modal-controller.test.mjs index f14c3730..4b8fbf7b 100644 --- a/tests/profile-modal-controller.test.mjs +++ b/tests/profile-modal-controller.test.mjs @@ -274,6 +274,7 @@ function createController(options = {}) { return hashtagStore.disinterests.delete(normalized); }, publish: async () => ({ ok: true }), + load: async () => {}, on: () => () => {}, }; From 3302b5700a8d0f097103467c8729a71816ad07d0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 06:49:24 +0000 Subject: [PATCH 4/4] Use direct tailwindcss executable in build:css - Replace `npx tailwindcss` with `tailwindcss` in `package.json` scripts. - Improves build reliability by avoiding npx lookup issues in CI environments. - Verified build success locally. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 21a8b961..4df9e94a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "start": "npm run build && npx serve", "serve": "npx serve", "build": "node scripts/build-dist.mjs", - "build:css": "npx tailwindcss -c tailwind.config.cjs -i css/tailwind.source.css -o css/tailwind.generated.css --minify", + "build:css": "tailwindcss -c tailwind.config.cjs -i css/tailwind.source.css -o css/tailwind.generated.css --minify", "build:beacon:bundle": "node scripts/build-beacon.mjs", "build:beacon": "npm run build:beacon:bundle && npm run lint:inline-styles", "ci:beacon": "npm run build:beacon",