From 40e809245adf41a9f5ec2b3bae13145a9762587b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 20:29:42 +0000 Subject: [PATCH 1/4] chore(ai): remove dead code (agent) Removed unused exports and functions identified as dead code. - Removed unused exports from `js/utils/storage.js`, `js/utils/storagePointer.js`, `js/utils/videoTags.js`, `js/ui/moderationCopy.js`. - Removed unused function `updateTagPillStrip` from `js/ui/components/tagPillList.js` and associated tests. - Updated `tests/utils/video-tags.test.mjs` to remove test for private function. - Added `artifacts/depcheck.json` showing dependency analysis. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- artifacts/depcheck.json | 1 + js/ui/components/tagPillList.js | 29 --------------------- js/ui/moderationCopy.js | 4 +-- js/utils/storage.js | 4 +-- js/utils/storagePointer.js | 4 +-- js/utils/videoTags.js | 2 +- tests/ui/tag-pill-list.test.mjs | 45 --------------------------------- tests/utils/video-tags.test.mjs | 9 +------ 8 files changed, 9 insertions(+), 89 deletions(-) create mode 100644 artifacts/depcheck.json diff --git a/artifacts/depcheck.json b/artifacts/depcheck.json new file mode 100644 index 00000000..4990648a --- /dev/null +++ b/artifacts/depcheck.json @@ -0,0 +1 @@ +{"dependencies":[],"devDependencies":["autoprefixer","cross-env","postcss","prettier","serve","stylelint","tailwindcss"],"missing":{"@scure/base":["/app/vendor/crypto-helpers.entry.js","/app/tests/zap-split.test.mjs"],"https:":["/app/js/nostrToolsBootstrap.js"]},"using":{"playwright":["/app/debug_sidebar.mjs","/app/tests/embed_playback_check.spec.mjs"],"@playwright/test":["/app/playwright.config.ts","/app/tests/visual/embed-layout.spec.ts","/app/tests/visual/kitchen-sink.spec.ts","/app/tests/visual/moderation.spec.ts","/app/tests/visual/overlay-layers.spec.ts","/app/tests/visual/reduced-motion.spec.ts","/app/tests/e2e/popover.spec.ts","/app/tests/e2e/repro_issue.spec.ts","/app/tests/e2e/toast-service.spec.ts","/app/tests/e2e/ui-modals.spec.ts","/app/tests/e2e/video-modal-share-bug.spec.ts","/app/tests/e2e/webseed-playback.spec.ts","/app/tests/e2e/helpers/uiTestUtils.ts","/app/examples/reproducers/playwright.config.ts","/app/examples/reproducers/issue-sidebar-layout/repro.spec.ts","/app/examples/reproducers/issue-popover-viewport/repro.spec.ts","/app/examples/reproducers/issue-moderation-visibility/repro.spec.ts","/app/examples/reproducers/issue-moderation-ui/playwright.config.ts","/app/examples/reproducers/issue-moderation-ui/repro.spec.ts","/app/examples/reproducers/issue-1-moderation-ui/playwright.config.ts","/app/examples/reproducers/issue-1-moderation-ui/repro.spec.ts","/app/examples/reproducers/issue-003-popover-ref-error/repro.spec.ts","/app/examples/reproducers/issue-002-login-modal-nsec/repro.spec.ts","/app/examples/reproducers/003-video-modal-reg/repro.spec.ts","/app/examples/reproducers/002-sidebar-layout/repro.spec.ts","/app/examples/reproducers/001-popover-404/repro.spec.ts"],"prettier-plugin-tailwindcss":["/app/prettier.config.cjs"],"@tailwindcss/typography":["/app/tailwind.config.cjs"],"@scure/base":["/app/vendor/crypto-helpers.entry.js","/app/tests/zap-split.test.mjs"],"@noble/hashes":["/app/vendor/crypto-helpers.entry.js"],"jsdom":["/app/tests/design-system-metrics.test.mjs","/app/tests/discussion-count-service.test.mjs","/app/tests/edit-modal-submit-state.test.mjs","/app/tests/login-modal-controller.test.mjs","/app/tests/media-loader.test.mjs","/app/tests/modal-accessibility.test.mjs","/app/tests/nip71-form-manager.test.mjs","/app/tests/position-floating-panel.test.mjs","/app/tests/profile-modal-controller.test.mjs","/app/tests/subscriptions-manager.test.mjs","/app/tests/test-setup.mjs","/app/tests/video-card-source-visibility.test.mjs","/app/tests/video-modal-accessibility.test.mjs","/app/tests/ui/app-chrome-controller.test.mjs","/app/tests/ui/hashtag-strip-helper-bounce.test.mjs","/app/tests/ui/popoverEngine.test.mjs","/app/tests/ui/profile-modal-moderation-settings.test.mjs","/app/tests/ui/tag-pill-list.test.mjs","/app/tests/ui/tag-preference-menu.test.mjs","/app/tests/ui/url-health-controller.test.mjs","/app/tests/ui/video-list-view-popular-tags.test.mjs","/app/tests/ui/video-list-view-sorting.test.mjs","/app/tests/ui/helpers/jsdom-test-helpers.mjs","/app/tests/torrent/style-helpers.test.mjs","/app/tests/torrent/toast-service.test.mjs","/app/tests/services/link-preview-service.test.mjs","/app/tests/moderation/video-card.test.mjs","/app/tests/app/channel-profile-moderation.test.mjs","/app/tests/app/hash-change-handler.test.mjs","/app/tests/app/hydrate-sidebar-navigation.test.mjs","/app/examples/reproducers/issue-channel-moderation-test-crash/repro.mjs","/app/examples/reproducers/issue-001-video-card-logic/repro.mjs"],"fake-indexeddb":["/app/tests/dm-db.test.mjs","/app/tests/dm-normalization.test.mjs","/app/tests/nostr-session-actor.test.mjs","/app/tests/storage-service.test.mjs","/app/tests/ui/storageService.test.mjs","/app/tests/services/link-preview-service.test.mjs","/app/tests/nostr/dm-direct-message-flow.test.mjs","/app/tests/nostr/session-actor.test.mjs","/app/scripts/agent/smoke-test.mjs"],"nostr-tools":["/app/tests/dm-decryptor.test.mjs","/app/tests/nostr-private-key-signer.test.mjs","/app/tests/nostr-publish-rejection.test.mjs","/app/tests/nostr-send-direct-message.test.mjs","/app/tests/nostr/adapters.test.mjs","/app/tests/nostr/dm-direct-message-flow.test.mjs","/app/tests/nostr/dmSignalEvents.test.mjs","/app/tests/nostr/integration-remote-flow.test.mjs","/app/tests/nostr/nip46Client.test.js","/app/tests/e2e/repro_issue.spec.ts","/app/scripts/agent/interop-test.mjs","/app/scripts/agent/load-test-relay.mjs","/app/scripts/agent/load-test.mjs","/app/scripts/agent/simple-relay.mjs","/app/scripts/agent/smoke-test.mjs","/app/js/nostrToolsBootstrap.js"],"pixelmatch":["/app/tests/visual/kitchen-sink.spec.ts"],"pngjs":["/app/tests/visual/kitchen-sink.spec.ts"],"ws":["/app/tests/e2e/repro_issue.spec.ts","/app/scripts/agent/interop-test.mjs","/app/scripts/agent/load-test-relay.mjs","/app/scripts/agent/load-test.mjs","/app/scripts/agent/setup-test-env.js","/app/scripts/agent/simple-relay.mjs","/app/scripts/agent/smoke-test.mjs"],"esbuild":["/app/scripts/build-beacon.mjs"],"@floating-ui/dom":["/app/scripts/build-beacon.mjs","/app/scripts/vendor/floating-ui-dom-entry.mjs"],"https:":["/app/js/nostrToolsBootstrap.js"]},"invalidFiles":{},"invalidDirs":{}} diff --git a/js/ui/components/tagPillList.js b/js/ui/components/tagPillList.js index 36153e0a..3f4dac02 100644 --- a/js/ui/components/tagPillList.js +++ b/js/ui/components/tagPillList.js @@ -237,32 +237,3 @@ export function renderTagPillStrip({ return { root, buttons }; } - -export function updateTagPillStrip({ - root, - tags = [], - onTagActivate, - getTagState, - document: doc, -} = {}) { - if (!root) { - throw new Error("A root element is required to update the tag pill strip."); - } - - const resolvedDocument = resolveDocument(doc ?? root?.ownerDocument); - assertDocument(resolvedDocument); - - cleanupExistingButtons(root); - - const buttons = tags.map((tag) => - createTagButton({ - doc: resolvedDocument, - tag, - onTagActivate, - getTagState, - }), - ); - root.append(...buttons); - - return { root, buttons }; -} diff --git a/js/ui/moderationCopy.js b/js/ui/moderationCopy.js index 4ddfaea0..df2b33ed 100644 --- a/js/ui/moderationCopy.js +++ b/js/ui/moderationCopy.js @@ -1,6 +1,6 @@ // js/ui/moderationCopy.js -export function buildModerationReasonText(context) { +function buildModerationReasonText(context) { if (!context) { return ""; } @@ -31,7 +31,7 @@ export function buildModerationReasonText(context) { return combined.charAt(0).toUpperCase() + combined.slice(1); } -export function buildHiddenSummaryLabel(context) { +function buildHiddenSummaryLabel(context) { if (!context) { return ""; } diff --git a/js/utils/storage.js b/js/utils/storage.js index 16457392..8efc8e00 100644 --- a/js/utils/storage.js +++ b/js/utils/storage.js @@ -4,11 +4,11 @@ import { userLogger } from "./logger.js"; const URL_HEALTH_STORAGE_PREFIX = "bitvid:urlHealth:"; const TORRENT_PROBE_STORAGE_PREFIX = "bitvid:torrentProbe:"; -export function getUrlHealthStorageKey(eventId) { +function getUrlHealthStorageKey(eventId) { return `${URL_HEALTH_STORAGE_PREFIX}${eventId}`; } -export function getTorrentProbeStorageKey(infoHash) { +function getTorrentProbeStorageKey(infoHash) { return `${TORRENT_PROBE_STORAGE_PREFIX}${infoHash}`; } diff --git a/js/utils/storagePointer.js b/js/utils/storagePointer.js index 5155cec9..15fd58a2 100644 --- a/js/utils/storagePointer.js +++ b/js/utils/storagePointer.js @@ -8,7 +8,7 @@ export function normalizeStoragePointer(value) { return safeTrim(value); } -export function parseStoragePointer(value) { +function parseStoragePointer(value) { const normalized = normalizeStoragePointer(value); if (!normalized) { return null; @@ -38,7 +38,7 @@ export function buildStoragePointerValue({ provider, prefix } = {}) { return `${normalizedProvider}:${normalizedPrefix}`; } -export function deriveStoragePrefixFromUrl(url) { +function deriveStoragePrefixFromUrl(url) { const trimmed = safeTrim(url); if (!trimmed || !/^https?:\/\//i.test(trimmed)) { return ""; diff --git a/js/utils/videoTags.js b/js/utils/videoTags.js index 0a7188d3..ec841d2e 100644 --- a/js/utils/videoTags.js +++ b/js/utils/videoTags.js @@ -44,7 +44,7 @@ function normalizeTagValue(rawValue) { * @returns {string} The tag prefixed with `#` when a tag exists, otherwise an * empty string. */ -export function formatTagDisplay(tag) { +function formatTagDisplay(tag) { if (typeof tag !== "string") { return ""; } diff --git a/tests/ui/tag-pill-list.test.mjs b/tests/ui/tag-pill-list.test.mjs index 56ff8f99..a6fd9d52 100644 --- a/tests/ui/tag-pill-list.test.mjs +++ b/tests/ui/tag-pill-list.test.mjs @@ -4,7 +4,6 @@ import { JSDOM } from "jsdom"; import { renderTagPillStrip, - updateTagPillStrip, } from "../../js/ui/components/tagPillList.js"; test("renderTagPillStrip builds buttons with labels and icons", () => { @@ -80,47 +79,3 @@ test("renderTagPillStrip wires the activation callback", () => { assert.equal(activations[0].button, buttons[0]); assert(activations[0].event instanceof document.defaultView.Event); }); - -test("updateTagPillStrip replaces buttons and rewires handlers", () => { - const { document } = new JSDOM("").window; - const firstActivations = []; - const secondActivations = []; - - const { root, buttons: initialButtons } = renderTagPillStrip({ - document, - tags: ["nostr"], - onTagActivate(tag) { - firstActivations.push(tag); - }, - }); - - document.body.append(root); - - initialButtons[0].click(); - assert.deepEqual(firstActivations, ["#nostr"]); - - const { buttons: updatedButtons } = updateTagPillStrip({ - root, - document, - tags: ["video"], - onTagActivate(tag, { button }) { - secondActivations.push({ tag, button }); - }, - getTagState: () => "interest", - }); - - assert.equal(root.querySelectorAll("button").length, 1); - assert.equal(updatedButtons[0].dataset.tag, "#video"); - - const updatedIcon = updatedButtons[0].querySelector(".video-tag-pill__icon svg"); - assert(updatedIcon, "updated button should contain the svg icon"); - assert.equal(updatedButtons[0].dataset.preferenceState, "interest"); - assert.equal(updatedButtons[0].dataset.variant, "success"); - - // Ensure the old handler is removed by dispatching a click on the detached button. - initialButtons[0].dispatchEvent(new document.defaultView.Event("click", { bubbles: true })); - assert.deepEqual(firstActivations, ["#nostr"]); - - updatedButtons[0].click(); - assert.deepEqual(secondActivations, [{ tag: "#video", button: updatedButtons[0] }]); -}); diff --git a/tests/utils/video-tags.test.mjs b/tests/utils/video-tags.test.mjs index e1053506..ebdc0ee4 100644 --- a/tests/utils/video-tags.test.mjs +++ b/tests/utils/video-tags.test.mjs @@ -1,7 +1,7 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { collectVideoTags, formatTagDisplay } from "../../js/utils/videoTags.js"; +import { collectVideoTags } from "../../js/utils/videoTags.js"; test("collectVideoTags dedupes across metadata sources and respects casing", () => { const video = { @@ -45,10 +45,3 @@ test("collectVideoTags handles malformed inputs safely", () => { [], ); }); - -test("formatTagDisplay normalizes leading hashes", () => { - assert.equal(formatTagDisplay(" example"), "#example"); - assert.equal(formatTagDisplay("##Example"), "#Example"); - assert.equal(formatTagDisplay(""), ""); - assert.equal(formatTagDisplay(null), ""); -}); From ac05fe34e073fad7bf6b4a469b318df431931a7e 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 14:40:25 +0000 Subject: [PATCH 2/4] chore(ai): remove dead code (agent) Removed unused exports and functions identified as dead code. - Removed unused exports from `js/utils/storage.js`, `js/utils/storagePointer.js`, `js/utils/videoTags.js`, `js/ui/moderationCopy.js`. - Removed unused function `updateTagPillStrip` from `js/ui/components/tagPillList.js` and associated tests. - Updated `tests/utils/video-tags.test.mjs` to remove test for private function. - Added `artifacts/depcheck.json` showing dependency analysis. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- tests/app-batch-fetch-profiles.test.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/app-batch-fetch-profiles.test.mjs b/tests/app-batch-fetch-profiles.test.mjs index df90a4bc..8b267b74 100644 --- a/tests/app-batch-fetch-profiles.test.mjs +++ b/tests/app-batch-fetch-profiles.test.mjs @@ -60,6 +60,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => { nostrClient.writeRelays = [FAST_RELAY, FAIL_RELAY]; nostrClient.pool = { list: (relays, filters) => { + // console.log("pool.list called with relays:", relays); poolListCalls.push({ relays, filters }); const relayUrl = Array.isArray(relays) ? relays[0] : undefined; if (relayUrl === FAST_RELAY) { @@ -96,6 +97,9 @@ test("batchFetchProfiles handles fast and failing relays", async () => { nostrClient.pool = originalPool; } + // console.log("poolListCalls.length:", poolListCalls.length); + // console.log("nostrClient.relays:", nostrClient.relays); + assert.equal(poolListCalls.length, 2, "expected a query per relay"); const [fastCall] = poolListCalls; From a659cf416325744ecb5bfca9bfec9beb0672fb39 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 14:51:11 +0000 Subject: [PATCH 3/4] chore(ai): remove dead code (agent) Removed unused exports and functions identified as dead code. - Removed unused exports from `js/utils/storage.js`, `js/utils/storagePointer.js`, `js/utils/videoTags.js`, `js/ui/moderationCopy.js`. - Removed unused function `updateTagPillStrip` from `js/ui/components/tagPillList.js` and associated tests. - Updated `tests/utils/video-tags.test.mjs` to remove test for private function. - Added `artifacts/depcheck.json` showing dependency analysis. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> From e482d32650220dc4f75042baf5c482fdf058235a 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 15:03:18 +0000 Subject: [PATCH 4/4] chore(ai): remove dead code (agent) Removed unused exports and functions identified as dead code. - Removed unused exports from `js/utils/storage.js`, `js/utils/storagePointer.js`, `js/utils/videoTags.js`, `js/ui/moderationCopy.js`. - Removed unused function `updateTagPillStrip` from `js/ui/components/tagPillList.js` and associated tests. - Updated `tests/utils/video-tags.test.mjs` to remove test for private function. - Added `artifacts/depcheck.json` showing dependency analysis. - Fixed unit test mock for `ProfileModalController` to include `hashtagPreferencesService.load`. 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: () => () => {}, };