From 83499ae5c40f3d87e0d0b56b8d45d14e3176be21 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:36:45 +0000 Subject: [PATCH] audit(tests): fix skipped auth tests and produce audit report - Refactored `tests/auth-service.test.mjs` to use `node:test` API so it is detected by the runner. - Removed console noise from `tests/watchHistory/watch-history-telemetry.test.mjs`. - Generated daily audit report `test-audit-report-2026-02-12.md`. - Updated test logs and tracking artifacts. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- CONTEXT.md | 17 +- DECISIONS.md | 10 +- TEST_LOG.md | 5457 ++++++++++++++++- TODO.md | 10 +- test-audit-report-2026-02-12.md | 35 + tests/auth-service.test.mjs | 541 +- .../watch-history-telemetry.test.mjs | 1 - 7 files changed, 5759 insertions(+), 312 deletions(-) create mode 100644 test-audit-report-2026-02-12.md diff --git a/CONTEXT.md b/CONTEXT.md index 8f8d6464..2f005345 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -1,14 +1,5 @@ -# Context: bitvid-perf-agent +# Context +This audit verifies the quality and coverage of the bitvid test suite. +Date: 2026-02-12 +Agent: bitvid-test-audit-agent -## Mission -Daily, measurable improvement of app responsiveness and documentation accuracy. - -## Scope -- **Repo:** `PR0M3TH3AN/bitvid` (unstable) -- **Focus:** - - P0: Fix unbounded concurrency in background tasks. - - Docs: Ensure `/content` upload guides match runtime behavior. - -## Current Task (Run 1) -- Fix unbounded concurrency in `js/nostr/commentEvents.js`. -- Fix outdated CORS port in `content/docs/guides/upload-content.md`. diff --git a/DECISIONS.md b/DECISIONS.md index dd0da7a0..863ebe31 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -1,9 +1,3 @@ -# Decisions Log +# Decisions +- Using built-in Node.js test runner as discovered in scripts. -## Performance -- **2026-02-xx:** Use `pMap` with `RELAY_BACKGROUND_CONCURRENCY` (3) for comment publishing and fetching. - - **Rationale:** `Promise.all` floods the network when users have many relays. Bounding concurrency prevents resource exhaustion. - -## Documentation -- **2026-02-xx:** Standardize local dev port to 3000 in docs. - - **Rationale:** Matches `npm start` default and `README.md`. diff --git a/TEST_LOG.md b/TEST_LOG.md index 7d10d0fb..9385258e 100644 --- a/TEST_LOG.md +++ b/TEST_LOG.md @@ -1,5 +1,5452 @@ -# Test Log - -## Run 1 (Performance & Docs) -- **Baseline:** Found unbounded `Promise.all` in `js/nostr/commentEvents.js`. -- **Verification:** (Pending) +TAP version 13 +# Subtest: renderChannelVideosFromList decorates videos before storing +ok 1 - renderChannelVideosFromList decorates videos before storing + --- + duration_ms: 199.189275 + type: 'test' + ... +# Subtest: renderChannelVideosFromList applies moderation blur without existing metadata +ok 2 - renderChannelVideosFromList applies moderation blur without existing metadata + --- + duration_ms: 51.81465 + type: 'test' + ... +# Subtest: applyChannelVisualBlur blurs banner and avatar when viewer mutes author +ok 3 - applyChannelVisualBlur blurs banner and avatar when viewer mutes author + --- + duration_ms: 11.487824 + type: 'test' + ... +# Subtest: moderation override clears channel blur via event wiring +ok 4 - moderation override clears channel blur via event wiring + --- + duration_ms: 41.311943 + type: 'test' + ... +# Subtest: channel header moderation badge reflects blur state and override actions +ok 5 - channel header moderation badge reflects blur state and override actions + --- + duration_ms: 51.136496 + type: 'test' + ... +# Subtest: channel video cards update moderation state in place when summary changes +ok 6 - channel video cards update moderation state in place when summary changes + --- + duration_ms: 33.423774 + type: 'test' + ... +# Subtest: createFeedCoordinator - loadForYouVideos + # Subtest: loadForYouVideos executes successfully + ok 1 - loadForYouVideos executes successfully + --- + duration_ms: 3.141801 + type: 'test' + ... + 1..1 +ok 7 - createFeedCoordinator - loadForYouVideos + --- + duration_ms: 5.234491 + type: 'test' + ... +# Subtest: handleHashChange defaults to for-you when logged in +ok 8 - handleHashChange defaults to for-you when logged in + --- + duration_ms: 136.375706 + type: 'test' + ... +# Subtest: handleHashChange defaults to most-recent-videos when logged out +ok 9 - handleHashChange defaults to most-recent-videos when logged out + --- + duration_ms: 65.884185 + type: 'test' + ... +# Subtest: handleHashChange respects explicit view regardless of login state +ok 10 - handleHashChange respects explicit view regardless of login state + --- + duration_ms: 10.129186 + type: 'test' + ... +# Subtest: hydrateSidebarNavigation reveals chrome controls for authenticated viewers +ok 11 - hydrateSidebarNavigation reveals chrome controls for authenticated viewers + --- + duration_ms: 129.215341 + type: 'test' + ... +# Subtest: hydrateSidebarNavigation hides chrome controls for logged-out viewers +ok 12 - hydrateSidebarNavigation hides chrome controls for logged-out viewers + --- + duration_ms: 16.815718 + type: 'test' + ... +# Subtest: isUserLoggedIn returns false when no user pubkey is set +ok 13 - isUserLoggedIn returns false when no user pubkey is set + --- + duration_ms: 3.461914 + type: 'test' + ... +# Subtest: isUserLoggedIn treats extension logins as authenticated +ok 14 - isUserLoggedIn treats extension logins as authenticated + --- + duration_ms: 0.727681 + type: 'test' + ... +# Subtest: isUserLoggedIn guards against mismatched nostrClient state +ok 15 - isUserLoggedIn guards against mismatched nostrClient state + --- + duration_ms: 0.40678 + type: 'test' + ... +# Subtest: isUserLoggedIn ignores anonymous session actor mismatches +ok 16 - isUserLoggedIn ignores anonymous session actor mismatches + --- + duration_ms: 0.494294 + type: 'test' + ... +# Subtest: isUserLoggedIn rejects mismatched managed session actors +ok 17 - isUserLoggedIn rejects mismatched managed session actors + --- + duration_ms: 0.520986 + type: 'test' + ... +# Subtest: handleModerationOverride decorates stored and current videos then refreshes UI +ok 18 - handleModerationOverride decorates stored and current videos then refreshes UI + --- + duration_ms: 7.638841 + type: 'test' + ... +# Subtest: handleModerationOverride resumes deferred playback +ok 19 - handleModerationOverride resumes deferred playback + --- + duration_ms: 1.054371 + type: 'test' + ... +# Subtest: handleModerationBlock requests a block, clears overrides, and refreshes hidden state +ok 20 - handleModerationBlock requests a block, clears overrides, and refreshes hidden state + --- + duration_ms: 3.724481 + type: 'test' + ... +# Subtest: handleModerationBlock returns false when viewer is logged out +ok 21 - handleModerationBlock returns false when viewer is logged out + --- + duration_ms: 0.754321 + type: 'test' + ... +# Subtest: handleModerationSettingsChange refreshes feeds with updated thresholds +ok 22 - handleModerationSettingsChange refreshes feeds with updated thresholds + --- + duration_ms: 6.080419 + type: 'test' + ... +# Subtest: orders similar videos by shared tags then timestamp +ok 23 - orders similar videos by shared tags then timestamp + --- + duration_ms: 4.342539 + type: 'test' + ... +# Subtest: returns no matches when the active video lacks tags +ok 24 - returns no matches when the active video lacks tags + --- + duration_ms: 0.548732 + type: 'test' + ... +# Subtest: skips candidates without tag metadata +ok 25 - skips candidates without tag metadata + --- + duration_ms: 0.326721 + type: 'test' + ... +# Subtest: filters NSFW and private videos when NSFW content is disabled +ok 26 - filters NSFW and private videos when NSFW content is disabled + --- + duration_ms: 0.334698 + type: 'test' + ... +# Subtest: createNip07SigningAdapter + # Subtest: uses explicit extension if provided + ok 1 - uses explicit extension if provided + --- + duration_ms: 3.095052 + type: 'test' + ... + # Subtest: falls back to window.nostr if no extension provided + ok 2 - falls back to window.nostr if no extension provided + --- + duration_ms: 0.537814 + type: 'test' + ... + # Subtest: throws error if no extension available + ok 3 - throws error if no extension available + --- + duration_ms: 1.629492 + type: 'test' + ... + # Subtest: prioritizes explicit extension over window.nostr + ok 4 - prioritizes explicit extension over window.nostr + --- + duration_ms: 0.675012 + type: 'test' + ... + 1..4 +ok 27 - createNip07SigningAdapter + --- + duration_ms: 7.965653 + type: 'suite' + ... +# Subtest: NIP-04/44 Compliance: Encryption Preference + # Subtest: createNip46Cipher prefers nip44.v2 when available + ok 1 - createNip46Cipher prefers nip44.v2 when available + --- + duration_ms: 27.566551 + type: 'test' + ... + # Subtest: createNip46Cipher falls back to nip04 if nip44 is missing + ok 2 - createNip46Cipher falls back to nip04 if nip44 is missing + --- + duration_ms: 12.274133 + type: 'test' + ... + 1..2 +ok 28 - NIP-04/44 Compliance: Encryption Preference + --- + duration_ms: 134.567681 + type: 'test' + ... +# Subtest: NIP-04/44 Compliance: Decryption Fallback + # Subtest: decryptNip46PayloadWithKeys handles nip44 (v2) payload + ok 1 - decryptNip46PayloadWithKeys handles nip44 (v2) payload + --- + duration_ms: 33.53945 + type: 'test' + ... + # Subtest: decryptNip46PayloadWithKeys handles nip04 payload + ok 2 - decryptNip46PayloadWithKeys handles nip04 payload + --- + duration_ms: 36.515407 + type: 'test' + ... + 1..2 +ok 29 - NIP-04/44 Compliance: Decryption Fallback + --- + duration_ms: 71.870269 + type: 'test' + ... +# Subtest: NIP-07 Compliance: Retry Logic + # Subtest: runNip07WithRetry succeeds on first try + ok 1 - runNip07WithRetry succeeds on first try + --- + duration_ms: 2.562754 + type: 'test' + ... + # Subtest: runNip07WithRetry retries on timeout error + ok 2 - runNip07WithRetry retries on timeout error + --- + duration_ms: 21.062555 + type: 'test' + ... + # Subtest: runNip07WithRetry fails after max retries or if error is not timeout + ok 3 - runNip07WithRetry fails after max retries or if error is not timeout + --- + duration_ms: 1.464623 + type: 'test' + ... + 1..3 +ok 30 - NIP-07 Compliance: Retry Logic + --- + duration_ms: 26.916078 + type: 'test' + ... +# Subtest: NIP-65 Compliance: Relay List Loading + # Subtest: loadRelayList requests Kind 10002 + ok 1 - loadRelayList requests Kind 10002 + --- + duration_ms: 4.996454 + type: 'test' + ... + # Subtest: loadRelayList parses r tags correctly + ok 2 - loadRelayList parses r tags correctly + --- + duration_ms: 0.376593 + type: 'test' + ... + 1..2 +ok 31 - NIP-65 Compliance: Relay List Loading + --- + duration_ms: 177.420753 + type: 'test' + ... +# Subtest: Video Note Compliance (Kind 30078 & NIP-71) + # Subtest: prepareVideoPublishPayload creates Kind 30078 event + ok 1 - prepareVideoPublishPayload creates Kind 30078 event + --- + duration_ms: 3.331152 + type: 'test' + ... + # Subtest: prepareVideoPublishPayload includes NIP-71 tags when provided + ok 2 - prepareVideoPublishPayload includes NIP-71 tags when provided + --- + duration_ms: 1.197564 + type: 'test' + ... + 1..2 +ok 32 - Video Note Compliance (Kind 30078 & NIP-71) + --- + duration_ms: 45.735407 + type: 'test' + ... +# Subtest: js/designSystem/dynamicStyles.js + # Subtest: registerScope + # Subtest: should register a scope and return a string ID + ok 1 - should register a scope and return a string ID + --- + duration_ms: 128.999324 + type: 'test' + ... + # Subtest: should create a style element or use adoptedStyleSheets + ok 2 - should create a style element or use adoptedStyleSheets + --- + duration_ms: 14.88879 + type: 'test' + ... + # Subtest: should insert rules with the correct selector + ok 3 - should insert rules with the correct selector + --- + duration_ms: 12.274826 + type: 'test' + ... + # Subtest: should handle "&" in selectors + ok 4 - should handle "&" in selectors + --- + duration_ms: 9.656756 + type: 'test' + ... + 1..4 + ok 1 - registerScope + --- + duration_ms: 167.373908 + type: 'suite' + ... + # Subtest: setVariables + # Subtest: should update CSS variables on the scope + ok 1 - should update CSS variables on the scope + --- + duration_ms: 11.610165 + type: 'test' + ... + # Subtest: should handle removing variables + ok 2 - should handle removing variables + --- + duration_ms: 9.634174 + type: 'test' + ... + 1..2 + ok 2 - setVariables + --- + duration_ms: 21.488225 + type: 'suite' + ... + # Subtest: releaseScope + # Subtest: should remove rules and clean up + ok 1 - should remove rules and clean up + --- + duration_ms: 23.395996 + type: 'test' + ... + # Subtest: should return false for non-existent scope + ok 2 - should return false for non-existent scope + --- + duration_ms: 7.562256 + type: 'test' + ... + 1..2 + ok 3 - releaseScope + --- + duration_ms: 31.270442 + type: 'suite' + ... + # Subtest: Isolation + # Subtest: should manage scopes independently for different documents + ok 1 - should manage scopes independently for different documents + --- + duration_ms: 18.181094 + type: 'test' + ... + 1..1 + ok 4 - Isolation + --- + duration_ms: 18.357129 + type: 'suite' + ... + # Subtest: Edge cases + # Subtest: should handle invalid selectors gracefully + ok 1 - should handle invalid selectors gracefully + --- + duration_ms: 11.611139 + type: 'test' + ... + # Subtest: should handle missing document gracefully + ok 2 - should handle missing document gracefully + --- + duration_ms: 7.05738 + type: 'test' + ... + # Subtest: should fallback to