Commit Graph
710 Commits
Author SHA1 Message Date
thePR0M3TH3AN 00899694b5 Revert "Fix ignored webseeds in magnet links" 2026-01-30 17:04:15 -05:00
google-labs-jules[bot]andPR0M3TH3AN 2bebaa6465 fix(webtorrent): ensure magnet webseeds are used in stream
Extracts `ws` (web seed) parameters from the magnet link and merges them with the explicit `urlList` (e.g., from direct URL) when initializing the WebTorrent stream. This fixes a regression where magnet-embedded web seeds were ignored if a direct URL was provided.

- Updates `js/magnets.js` to parse `ws` parameters and export `webSeedsFromMagnet`.
- Updates `js/webtorrent.js` to merge magnet web seeds with `opts.urlList`.
- Adds regression test `tests/webtorrent-webseeds.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 22:01:13 +00:00
thePR0M3TH3AN ceccd34681 Revert "Dead Code Cleanup" 2026-01-30 16:51:01 -05:00
thePR0M3TH3AN 80b3a2a8a5 Add permission deferral coverage for login flows 2026-01-30 16:48:03 -05:00
thePR0M3TH3AN 94e92acc68 Merge pull request #1996 from PR0M3TH3AN/ai/dead-code-cleanup-34771678735083742
Dead Code Cleanup
2026-01-30 16:00:28 -05:00
google-labs-jules[bot]andPR0M3TH3AN 60fa6c4282 chore(ai): remove dead code (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 20:54:52 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6347ab0db1 fix(auth): optimize login speed and list decryption
- Reduced decryption timeout for user lists from 90s to 15s to fail faster.
- Optimized NIP-07 decryption calls to avoid retries and long timeouts during critical loading paths.
- Fixed a bug where `loginWithExtension` triggered `getPublicKey` twice, doubling the user interaction time.
- Added a 10s grace period for relay health warnings to prevent false positives on startup.
- Verified `deferBlocks` logic in `authService` prevents blocking the login UI on slow list decryption.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 20:31:24 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6bf3e95a4f Fix list loading reliability and optimize NIP-07 login performance
- Fixes issue where user lists (subscriptions, blocks) fail to load if local cache is stale but metadata store is fresh.
- Updates `js/userBlocks.js` and `js/subscriptions.js` to persist `createdAt` timestamp and use it for incremental fetch `since` parameter.
- Optimizes `js/nostr/client.js` `ensureActiveSignerForPubkey` to reduce redundant `getPublicKey` calls to NIP-07 extension by 50%.
- Adds `preloadedPubkey` support to `createNip07Adapter`.
- Fixes `tests/subscriptions-manager.test.mjs` environment setup to allow CI to pass.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 19:53:04 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5bdca14364 Fix list loading reliability and optimize NIP-07 login performance
- Fixes issue where user lists (subscriptions, blocks) fail to load if local cache is stale but metadata store is fresh.
- Updates `js/userBlocks.js` and `js/subscriptions.js` to persist `createdAt` timestamp and use it for incremental fetch `since` parameter.
- Optimizes `js/nostr/client.js` `ensureActiveSignerForPubkey` to reduce redundant `getPublicKey` calls to NIP-07 extension by 50%.
- Adds `preloadedPubkey` support to `createNip07Adapter`.
- Adds reproduction test for NIP-07 concurrency issue.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 19:35:05 +00:00
google-labs-jules[bot]andPR0M3TH3AN 14dfedc98d Fix NIP-07 adapter race condition and CI test crashes
- Modified `js/nostr/adapters/nip07Adapter.js` to use dynamic getters for capabilities.
- Updated `js/nostr/client.js` to respect getter descriptors on signers.
- Fixed `tests/nostr-login-permissions.test.mjs` and `tests/nostr/adapters.test.mjs` to safely handle read-only global properties in CI.
- Added hardened regression test `tests/nostr/nip07Adapter-race-condition.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 19:04:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN d38585f376 Fix NIP-07 adapter race condition with lazy encryption capability injection
- Modified `js/nostr/adapters/nip07Adapter.js` to use dynamic getters for `capabilities` (nip04/nip44) and unconditionally expose encryption methods.
- Updated `js/nostr/client.js` to use `Object.getOwnPropertyDescriptor` when handling `signer.capabilities`.
- Added `tests/nostr/nip07Adapter-race-condition.test.mjs` to verify the fix.
- Fixed test environment issues in `tests/nostr/adapters.test.mjs` and `tests/nostr-login-permissions.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 18:47:08 +00:00
thePR0M3TH3AN b8fad92b25 Merge pull request #1986 from PR0M3TH3AN/fix-nip07-decryption-13328665886531040373
fix(nostr): correctly resolve signer capabilities when methods are present
2026-01-30 11:43:25 -05:00
google-labs-jules[bot]andPR0M3TH3AN cfb395ff1a fix(tests): update expected relay health state in unit test
This update aligns `tests/services/relay-health-service.test.mjs` with the actual state object structure used in `RelayHealthService`, which now includes `consecutiveFailures` and `lastUserLogAt` properties. This fixes a CI failure in the `agent-review` job.

The previous fix for `tests/app-batch-fetch-profiles.test.mjs` (duplicate variable) is also included in this branch history.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 16:36:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN fdc070479b Optimize post-login sequence to load relays before other data
Prioritizes fetching the user's relay list (NIP-65) immediately after login, ensuring that subsequent data fetches (profile, contact list, DMs, feed) utilize the user's preferred relays instead of default ones. This prevents "slow" or incomplete data loading issues caused by relying on defaults.

- Refactored `authService.applyPostLoginState` to sequence relay loading before profile/block loading.
- Refactored `app.handleAuthLogin` to await relay loading before initiating dependent fetches (Hashtags, Moderation, DMs, NWC, Lists, Feed).
- Updated unit tests in `tests/auth-service.test.mjs` to verify sequential execution and correct return values.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 16:34:12 +00:00
google-labs-jules[bot]andPR0M3TH3AN 991d166254 fix(tests): remove duplicate variable declaration in profile batch fetcher test
This fixes a syntax error in `tests/app-batch-fetch-profiles.test.mjs` where `originalReadRelays` was declared twice, causing the CI `agent-review` job (and subsequent deploy checks) to fail.

The underlying NIP-07 decryption fix (correctly resolving signer capabilities) remains in place from the previous commit.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 16:26:31 +00:00
thePR0M3TH3AN 93f78e60ee Merge pull request #1968 from PR0M3TH3AN/ai/reproducers-popover-video-20260129-656412173162674175
chore(ai): add minimal reproducers for known bugs
2026-01-30 11:07:07 -05:00
thePR0M3TH3AN 063f0d0305 Merge pull request #1979 from PR0M3TH3AN/ai/doc-client-20250224-5696189605440496000
chore(ai): document js/nostr/client.js
2026-01-30 11:00:55 -05:00
google-labs-jules[bot]andPR0M3TH3AN e2b3ab82c9 fix(test): resolve duplicate declaration in batch fetch profile test and fix nip07 permission race
Resolves a SyntaxError where 'originalReadRelays' was declared twice in 'tests/app-batch-fetch-profiles.test.mjs', causing CI failures.
Also fixes a race condition in `js/nostr/client.js` where NIP-07 permission upgrades were not awaited, causing `tests/nostr-login-permissions.test.mjs` to fail. Updated tests to accommodate the multi-pass login flow.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 15:59:58 +00:00
google-labs-jules[bot]andPR0M3TH3AN 65f28991a7 fix(test): remove duplicate variable declaration in batch fetch profile test
Resolves a SyntaxError where 'originalReadRelays' was declared twice in 'tests/app-batch-fetch-profiles.test.mjs', causing CI failures. This change ensures the test file parses and runs correctly.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 15:51:44 +00:00
google-labs-jules[bot]andPR0M3TH3AN 3e08479d04 fix: resolve syntax error in profile batch fetch test
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 15:34:20 +00:00
thePR0M3TH3AN cc7fe64e90 Merge pull request #1946 from PR0M3TH3AN/ai/dead-code-20240123-13702536329573366933
chore(ai): remove dead code (agent)
2026-01-30 10:05:35 -05:00
google-labs-jules[bot]andPR0M3TH3AN e482d32650 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 <[email protected]>
2026-01-30 15:03:18 +00:00
google-labs-jules[bot]andPR0M3TH3AN ac05fe34e0 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 <[email protected]>
2026-01-30 14:40:25 +00:00
thePR0M3TH3AN 9392e08cbd Merge branch 'unstable' into ai/tests-improve-coverage-20250220-10675377090391221934 2026-01-30 09:27:07 -05:00
thePR0M3TH3AN a8c2608a01 Merge branch 'unstable' into ai/deps-scan-913034820998740720 2026-01-30 09:20:22 -05:00
thePR0M3TH3AN b71346c06a Merge branch 'unstable' into ai/interop-tests-20250228-12917398042927663384 2026-01-30 09:19:49 -05:00
thePR0M3TH3AN 667b48c301 Merge branch 'unstable' into telemetry-aggregation-fix-6349074633801704985 2026-01-30 09:19:03 -05:00
thePR0M3TH3AN 80a0bc8bb2 Merge branch 'unstable' into ai/refactor-videomodal-controller-18342133587526974097 2026-01-30 09:18:22 -05:00
thePR0M3TH3AN 646de9014b Merge pull request #1960 from PR0M3TH3AN/ai/ci-health-20250221-16879002849481713
chore(ai): CI health fixes (flaky tests)
2026-01-30 09:16:57 -05:00
thePR0M3TH3AN 36e724a9de Merge pull request #1956 from PR0M3TH3AN/refactor-automated-pr-review-12750616021674214922
feat: enhance automated PR review script with batch processing
2026-01-30 09:15:04 -05:00
google-labs-jules[bot]andPR0M3TH3AN 3055c9c4fb chore(ai): fix unit tests and build script for reproducers
- Fixed `tests/app-batch-fetch-profiles.test.mjs` by mocking `readRelays`.
- Updated `scripts/build-dist.mjs` to exclude `examples/reproducers` from the build output.
- Added minimal reproducers for popover flip bug and VideoCard block action bug.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 12:41:28 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0ac0b6960d fix(ci): update test mocks for ProfileModalController
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 11:53:04 +00:00
google-labs-jules[bot]andPR0M3TH3AN ce2c30574c test(ai): improve unit test coverage and stability (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 11:39:38 +00:00
google-labs-jules[bot]andPR0M3TH3AN f456a6d605 fix(test): mock hashtagPreferencesService.load in profile modal test
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 09:19:46 +00:00
google-labs-jules[bot]andPR0M3TH3AN f87c3bcffe fix(test): mock readRelays in batch-fetch-profiles test
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 09:13:37 +00:00
google-labs-jules[bot]andPR0M3TH3AN 51c5845ae1 fix: resolve missing mock method in profile modal tests
Added the missing `load()` method to the `hashtagPreferences` mock in `tests/profile-modal-controller.test.mjs`. This resolves the `TypeError` encountered during the `handleAddHashtagPreference` test case, ensuring the test suite passes consistently in CI.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 07:48:19 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7a3476f926 fix: flaky unit test in profile batch fetcher
Updated `tests/app-batch-fetch-profiles.test.mjs` to correctly mock `readRelays` in addition to `relays` and `writeRelays`. `profileMetadataService.js` prioritizes `readRelays`, causing the test to make unexpected network calls when falling back to default values. This fix ensures the test isolation holds and assertions pass consistently.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 07:37:47 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7d325e49db 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 <[email protected]>
2026-01-30 06:45:47 +00:00
google-labs-jules[bot]andPR0M3TH3AN a6bf25f9fc 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 <[email protected]>
2026-01-30 06:39:23 +00:00
google-labs-jules[bot]andPR0M3TH3AN 1394c42487 refactor(ai): extract VideoModalController from js/app.js (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 03:45:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN 3dfba92e04 refactor(ai): extract VideoModalController from js/app.js (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 03:40:36 +00:00
google-labs-jules[bot]andPR0M3TH3AN ced1f5456f fix(test): mock load method in profile-modal-controller test
- Add missing `load` method to `baseHashtagPreferences` mock in `tests/profile-modal-controller.test.mjs` to fix `TypeError: this.hashtagPreferencesService.load is not a function` in unit tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 02:34:39 +00:00
google-labs-jules[bot]andPR0M3TH3AN 952dc58ade chore(ai): CI health fixes (flaky tests)
- Fix `tests/app-batch-fetch-profiles.test.mjs` by mocking `readRelays` to ensure deterministic query counts.
- Set `NODE_ENV=test` in `scripts/run-unit-tests.mjs` to prevent `nostr-tools` bootstrap failures in test environment.
- Run `npm ci` and `npm audit fix` to maintain lockfile health.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 02:28:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2ba9b6c4a5 fix(test): mock hashtagPreferencesService.load in profile modal tests
- Updates `tests/profile-modal-controller.test.mjs` to include a mock for `load()` in `baseHashtagPreferences`.
- Resolves the `TypeError: this.hashtagPreferencesService.load is not a function` error seen in CI.
- Ensures unit tests pass for ProfileModalController interactions with the hashtag pane.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 00:27:28 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6ffc53079c fix(test): mock readRelays in batch fetch test to prevent extra queries
- Updates `tests/app-batch-fetch-profiles.test.mjs` to mock `nostrClient.readRelays` alongside `relays` and `writeRelays`.
- Ensures `batchFetchProfilesFromRelays` queries only the mocked test relays (fast/fail), resolving the `4 !== 2` assertion error in CI.
- Matches logic in `profileMetadataService.js` which prioritizes `readRelays`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 23:58:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN 3c9f9841fc fix(test): mock load method in hashtagPreferences service
- Add `load: async () => {}` stub to `baseHashtagPreferences` in `tests/profile-modal-controller.test.mjs` to prevent `TypeError` during `handleAddHashtagPreference` test.
- Fixes CI failure in `tests/profile-modal-controller.test.mjs` where `this.hashtagPreferencesService.load` was undefined.
- Verified with `npm run test:unit:shard3`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 22:30:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN 06dfe6278a chore(ai): add smoke test script (agent)
- Add scripts/agent/smoke-test.mjs for E2E verification
- Fix js/app.js to expose activeProfilePubkey and savedProfiles
- Fix tests/app-batch-fetch-profiles.test.mjs mocking (CI fix)
- Ensure smoke test uses Node.js compatible imports

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 22:00:17 +00:00
google-labs-jules[bot]andPR0M3TH3AN 40e809245a 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 <[email protected]>
2026-01-29 20:29:42 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8b193cf297 chore(ai): fix e2e test race condition and doc js/nostr/client.js (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 16:32:04 +00:00
thePR0M3TH3AN 0e45ff73a4 Merge branch 'unstable' into ai/lint-20260129-7340230365703488282 2026-01-29 08:54:44 -05:00