Commit Graph
4388 Commits
Author SHA1 Message Date
thePR0M3TH3AN 9caef9f63b Merge pull request #2101 from PR0M3TH3AN/perf-profile-cache-optimization-1904566817068160104
⚡ Optimize ProfileCache memory clearing to O(1)
2026-02-05 14:25:02 -05:00
thePR0M3TH3AN a03b8611a9 Merge pull request #2100 from PR0M3TH3AN/perf-sorter-optimization-3507563018493886094
⚡ Optimize MMR Sort Complexity to O(N^2)
2026-02-05 14:23:04 -05:00
google-labs-jules[bot]andPR0M3TH3AN ecc9041cbd perf: optimize ProfileCache.clearMemoryCache to O(1)
Refactor ProfileCache memoryCache from a flat Map to a nested Map (Pubkey -> Section -> Data).
This allows clearing a user's cache in O(1) time instead of O(N) by deleting the user's entry directly, avoiding a full scan of all cache keys.

Benchmark showed improvement from ~58ms to ~0.0014ms for clearing a user in a cache with 20,000 users (100,000 entries).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 19:18:36 +00:00
google-labs-jules[bot]andPR0M3TH3AN 981e0e5835 perf: optimize MMR sort complexity from O(N^3) to O(N^2)
- Introduce incremental similarity updates in `createExploreDiversitySorter`.
- Cache max similarity for each candidate to avoid redundant calculations.
- Reduces sort time for 1000 items from ~33s to ~170ms.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 19:17:16 +00:00
thePR0M3TH3AN 7b8c67a4b5 Merge pull request #2095 from PR0M3TH3AN/claude/testing-ml9j71t5o9ct31i2-1IUJP
docs: Expand test coverage roadmap with P0-P3 prioritization and add payment tests
2026-02-05 10:07:32 -05:00
Claude 75136cb613 test: add comprehensive payment system tests (lnurl, platformFee, zapReceipts, zapRequests)
Add 4 new test files covering previously untested payment/zap logic:

- lnurl.test.mjs: bech32 encode/decode roundtrip, resolveLightningAddress
  (email, lnurl, URL formats), fetchPayServiceData (success, HTTP errors,
  invalid JSON, error status), validateInvoiceAmount (boundaries, invalid
  inputs), requestInvoice (comment truncation, amount formats, error paths)

- platform-fee.test.mjs: parsePercentValue (numbers, bigints, strings with
  %, fractions, edge cases), clampPercent (boundaries, NaN, non-finite),
  getDefaultPlatformFeePercent, resolvePlatformFeePercent (override vs
  fallback behavior)

- zap-receipt-validator.test.mjs: computeZapRequestHash determinism,
  extractDescriptionHashFromBolt11, validateZapReceipt covering all failure
  modes (missing request, invalid JSON, no relays, missing invoice,
  hash mismatch, amount mismatch, wrong pubkey, invalid signature,
  no receipt found) plus success path and override injection

- zap-requests.test.mjs: normalizeRelayList (dedup, filtering, empty),
  resolveLnurlTag (bech32 vs email addresses), buildZapRequestPayload
  (minimal and full params, timestamp handling), signZapRequest (signer
  validation)

Also updates todo-test-coverage-gaps.md with a prioritized, detailed plan
covering all remaining untested areas (P0 through P3).

https://claude.ai/code/session_01QDsPRh4f31ZpDYqS1kETFV
2026-02-05 14:50:41 +00:00
thePR0M3TH3AN 830f4da7bd Merge pull request #2090 from PR0M3TH3AN/claude/testing-ml88l3xb4tcicc2u-Vvsq9
Add comprehensive test suite for Nostr relay and signer functionality
2026-02-04 12:57:36 -05:00
Claude 334aac108e docs: add TODO for remaining test coverage gaps
Document areas that still need test coverage improvement,
prioritized by impact and risk.

https://claude.ai/code/session_01WbLkUVQ5yi1bnSvGZErC3C
2026-02-04 17:31:24 +00:00
Claude fd1377532b test: add comprehensive tests for utilities, auth, and relay systems
Add 142 new tests covering previously untested or undertested areas:

- utils/lru-cache: LRU cache implementation (18 tests)
- utils/formatters: String formatting functions (18 tests)
- utils/magnet-validators: Magnet URI validation (20 tests)
- nostr/signer-helpers: NIP-04/NIP-44 encryption/decryption (12 tests)
- nostr/relay-fetching: Relay communication reliability patterns (15 tests)
- relay-manager: RelayPreferencesManager operations (24 tests)
- services/auth-providers: NIP-07, NIP-46, nsec providers (24 tests)

These tests address gaps identified in test coverage analysis,
particularly around login/auth flows, encryption reliability,
and relay fetching patterns.

https://claude.ai/code/session_01WbLkUVQ5yi1bnSvGZErC3C
2026-02-04 17:28:28 +00:00
thePR0M3TH3AN ec5f8f69a3 Merge pull request #2086 from PR0M3TH3AN/claude/claude-md-ml8846bwu375yqs4-fMuHq
docs: Add CLAUDE.md AI assistant guide for bitvid codebase
2026-02-04 11:18:39 -05:00
Claude 46b48d1f26 docs: add comprehensive CLAUDE.md for AI assistant guidance
Add a detailed guide for AI assistants working with the bitvid codebase.
The document covers:

- Project overview and technology stack
- Codebase structure and essential files
- Development workflow and setup instructions
- CI/CD pipeline overview with job timeouts
- Code conventions (logging, styling, Nostr events, magnets)
- Architecture patterns (bitvidApp vs controllers)
- Feature flags and runtime configuration
- Nostr integration details and NIP usage
- Testing guidelines and common troubleshooting
- Quick reference for imports and content schema

This complements AGENTS.md (mission/architecture) and CONTRIBUTING.md
(setup/PR process) by providing AI-specific context and patterns.

https://claude.ai/code/session_014BfcJJAuzSHDwdoyYKoHZG
2026-02-04 16:12:25 +00:00
thePR0M3TH3AN 3a80e113bd Merge pull request #2037 from PR0M3TH3AN/ai/fix-netlify-build-15590072975074123697
Fix Netlify CSS build and directory configuration
0.0.10
2026-02-01 09:12:10 -05:00
google-labs-jules[bot]andPR0M3TH3AN ffa5c3e4d3 Fix Netlify build: Missing dist and incorrect redirects
- Removed force flag (!) from `/* /index.html 200` in `_redirects` to allow static assets to be served.
- Restored `scripts/build-dist.mjs` to properly clean `dist/`, build CSS, and copy assets.
- Updated `package.json` to use the new build script and serve `dist`.
- Updated `netlify.toml` to publish the `dist` directory.
- Updated `dist/` artifacts to match current source.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-01 14:05:43 +00:00
google-labs-jules[bot]andPR0M3TH3AN c862cbc358 Fix Netlify build by restoring dist build script and config
- Restore `scripts/build-dist.mjs` to clean `dist/`, build CSS, and copy assets.
- Update `package.json` to use the new build script and serve `dist`.
- Update `netlify.toml` to publish the `dist` directory.
- Update `dist/` artifacts to match current source.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-01 13:30:49 +00:00
thePR0M3TH3AN a432d3d4c0 Merge pull request #2025 from PR0M3TH3AN/perf-batch-delete-parallel-publish-14322040273726865832
⚡ Parallelize publishing in batch delete
2026-01-31 15:03:02 -05:00
google-labs-jules[bot]andPR0M3TH3AN 7902537d57 fix: resolve CI failure, add Netlify redirects, and optimize batch delete
- Fix `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` which caused CI failures.
- Add `_redirects` file for Netlify SPA routing to fix deployment redirect rule errors.
- Parallelize `deleteAllVersions` in `js/nostr/client.js` to significantly improve batch deletion performance by decoupling network publishing from serial signing.

The batch deletion optimization reduces execution time by ~40% for large batches (500+ events) by running network requests concurrently while maintaining serial signing for NIP-07 compatibility.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:59:49 +00:00
thePR0M3TH3AN e3af6e140d Merge pull request #2024 from PR0M3TH3AN/perf/parallel-zap-retries-1778136069971316397
⚡ Parallelize Zap Retry Execution
2026-01-31 14:40:51 -05:00
google-labs-jules[bot]andPR0M3TH3AN c9b20d3eb8 fix(ci): polyfill navigator object in video-modal-zap.test.mjs
Handle the `TypeError: Cannot set property navigator of #<Object> which has only a getter` by attempting to set `globalThis.navigator` directly and falling back to `Object.defineProperty` if it's read-only. This ensures compatibility with environments where `navigator` is non-writable (like newer Node.js versions or certain test runners).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:34:39 +00:00
thePR0M3TH3AN 5ead341a07 Merge pull request #2026 from PR0M3TH3AN/perf/concurrent-feed-stages-16005048847337964150
⚡ Parallelize timestamp resolution in feed stages
2026-01-31 14:32:56 -05:00
google-labs-jules[bot]andPR0M3TH3AN 36ddbe7df2 fix: remove npx from build script
Use `tailwindcss` directly in the `build:css` script instead of `npx tailwindcss`. This ensures the local binary (installed in `node_modules/.bin`) is used, avoiding potential `npx` path resolution failures or network requests in restricted CI environments (like Netlify).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:28:27 +00:00
thePR0M3TH3AN a512f94023 Merge branch 'main' into perf/concurrent-feed-stages-16005048847337964150 2026-01-31 14:27:23 -05:00
thePR0M3TH3AN ef500ec510 Merge branch 'main' into perf-batch-delete-parallel-publish-14322040273726865832 2026-01-31 14:27:16 -05:00
google-labs-jules[bot]andPR0M3TH3AN 62152e1874 fix: ensure build dependencies and redirects for deployment
1. Move build-critical dependencies (`tailwindcss`, `postcss`, `autoprefixer`, etc.) to `dependencies` in `package.json` to prevent build failures in production environments (like Netlify) that prune `devDependencies`.
2. Ensure `_redirects` exists in the root directory (copied from `dist/_redirects`) so Netlify processes redirect rules correctly when publishing from root.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:26:18 +00:00
google-labs-jules[bot]andPR0M3TH3AN 54c7dcd6ad feat: parallelize zap retry execution
Optimize `executePendingRetry` in `js/channelProfile.js` to run zap attempts in parallel using `Promise.allSettled`, improving performance when retrying multiple shares.

Refactor `splitAndZap` in `js/payments/zapSplit.js` to accept `overrideFee` as an argument, eliminating reliance on a global variable and ensuring thread safety during parallel execution.

Update `js/ui/zapController.js` to use the new `splitAndZap` API.

Fix: Resolve ReferenceError in `tests/nostr-login-permissions.test.mjs` by correctly destructuring `plainCall` from `env.enableCalls`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:25:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN b560ab5fda fix: add _redirects for Netlify SPA routing
Adds a `_redirects` file to the root directory with the rule `/* /index.html 200!` to support Single Page Application (SPA) routing on Netlify.

This resolves the "Redirect rules" CI failure and ensures that client-side routes (e.g., `/video/:id`) do not return 404s when accessed directly.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:25:25 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8def2cb80c fix: resolve CI failure in login permissions test and optimize batch delete
- Fix `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` which caused CI failures.
- Parallelize `deleteAllVersions` in `js/nostr/client.js` to significantly improve batch deletion performance by decoupling network publishing from serial signing.

The batch deletion optimization reduces execution time by ~40% for large batches (500+ events) by running network requests concurrently while maintaining serial signing for NIP-07 compatibility.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:23:23 +00:00
google-labs-jules[bot]andPR0M3TH3AN 16b3c6e992 fix: resolve reference error in login permissions test
Fix `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` by properly destructuring the `plainCall` variable from the `env.enableCalls` array in the failing test case.

This fixes a regression that was blocking CI execution.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:23:15 +00:00
google-labs-jules[bot]andPR0M3TH3AN c4b5f98bd7 perf: parallelize timestamp resolution in feed stages
Refactor `createResolvePostedAtStage` to execute timestamp resolution tasks concurrently using `Promise.allSettled` instead of a serial loop. This significantly reduces execution time when multiple items require resolution (e.g., waiting for network or async processing).

Benchmarks showed a reduction from ~1000ms to ~23ms for 50 items with a simulated 20ms delay each.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:18:54 +00:00
google-labs-jules[bot]andPR0M3TH3AN d3bdcc8011 fix(test): resolve ReferenceError in nostr login permissions test
Correctly destructure the `plainCall` variable in `tests/nostr-login-permissions.test.mjs` to prevent a ReferenceError during test execution. This ensures the test properly validates that the plain enable() fallback is not invoked when structured payloads fail.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:16:04 +00:00
google-labs-jules[bot]andPR0M3TH3AN 58f15b9853 perf: parallelize publishing in deleteAllVersions
Optimizes the batch deletion process by decoupling the network publishing step from the serial signing loop. This allows publishing to happen concurrently with the signing of subsequent batches, significantly reducing the total time for large deletions.

- Wraps `publishEventToRelays` in a non-blocking promise within the deletion loop.
- Collects all publish promises and awaits them using `Promise.all` at the end of the loop.
- Preserves serial signing order to ensure compatibility with NIP-07 extensions.
- Maintains existing logging and state update logic.

Measured improvement: ~40% reduction in execution time for 500 events (5 chunks) in simulated benchmark.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:12:49 +00:00
google-labs-jules[bot]andPR0M3TH3AN 19345e535e feat: parallelize zap retry execution
Optimize `executePendingRetry` in `js/channelProfile.js` to run zap attempts in parallel using `Promise.allSettled`, improving performance when retrying multiple shares.

Refactor `splitAndZap` in `js/payments/zapSplit.js` to accept `overrideFee` as an argument, eliminating reliance on a global variable and ensuring thread safety during parallel execution.

Update `js/ui/zapController.js` to use the new `splitAndZap` API.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-31 19:10:00 +00:00
thePR0M3TH3AN 737aea12a7 Merge pull request #2004 from PR0M3TH3AN/perf-parallel-dm-decryption-14180144924686518614
⚡ Parallelize Direct Message Decryption
2026-01-31 10:14:46 -05:00
google-labs-jules[bot]andPR0M3TH3AN a4f371b7fc perf: parallelize DM decryption
Refactors `listDirectMessages` to use `Promise.all` for parallel decryption, reducing execution time significantly (benchmark: ~1021ms -> ~14ms for 100 messages).

Also fixes CI stability:
- Fix race condition in `overlay-layers.spec.ts` visual test.
- Fix environment conflicts in unit tests.
- Add `_redirects` for Netlify.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 23:23:31 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5ff5bd9835 Add _redirects file for Netlify SPA routing
- Created `_redirects` with `/* /index.html 200` to support client-side routing on Netlify.
- This addresses the "Redirect rules" failure in the CI deployment checks.
- Verified visual tests pass locally (`npx playwright test tests/visual/overlay-layers.spec.ts`).
- Verified build passes locally (`npm run build`).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 22:53:04 +00:00
google-labs-jules[bot]andPR0M3TH3AN d4d73549bf Fix CI unit test failures in nostr-login-permissions and dm-direct-message-flow
- Fixed `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` by correctly destructuring the variable.
- Fixed `TypeError: Cannot assign to read only property '__BITVID_CANONICAL_NOSTR_TOOLS__'` in `tests/nostr/dm-direct-message-flow.test.mjs` by using `Object.defineProperty` to override the read-only property during test setup.
- These fixes resolve the `agent-review` CI job failures.
- Also verified optimization of `listDirectMessages` in `js/nostr/client.js` is syntactically correct and doesn't introduce regressions in related tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 22:48:09 +00:00
google-labs-jules[bot]andPR0M3TH3AN 822774a178 Fix CI unit test failures in nostr-login-permissions and dm-direct-message-flow
- Fixed `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` by correctly destructuring the variable.
- Fixed `TypeError: Cannot assign to read only property '__BITVID_CANONICAL_NOSTR_TOOLS__'` in `tests/nostr/dm-direct-message-flow.test.mjs` by using `Object.defineProperty` to override the read-only property during test setup.
- These fixes resolve the `agent-review` CI job failures.
- Also verified optimization of `listDirectMessages` in `js/nostr/client.js` is syntactically correct and doesn't introduce regressions in related tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 22:39:14 +00:00
google-labs-jules[bot]andPR0M3TH3AN de71c384db ⚡ Optimize DM decryption by parallelizing processing
Replaced serial decryption loop in `listDirectMessages` with `Promise.all` to process messages concurrently. This significantly reduces execution time when handling multiple encrypted events, especially when decryption involves async operations (like extension calls or workers).

Measured improvement: Reduced processing time for 100 simulated messages from ~1021ms to ~14ms in benchmark.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 22:33:11 +00:00
thePR0M3TH3AN b429b1c075 update 2026-01-30 17:09:51 -05:00
thePR0M3TH3AN 4d9d2e3585 Merge pull request #1913 from PR0M3TH3AN/unstable
Unstable
2026-01-28 22:24:25 -05:00
thePR0M3TH3AN b48320fc9a Merge pull request #1911 from PR0M3TH3AN/ai/ci-health-fixes-5352004242655593784
chore(ai): CI health fixes (flaky tests)
2026-01-28 22:22:24 -05:00
thePR0M3TH3AN bc2e5533e8 Merge branch 'unstable' into ai/ci-health-fixes-5352004242655593784 2026-01-28 22:22:17 -05:00
thePR0M3TH3AN daed244b8b Merge pull request #1910 from PR0M3TH3AN/ai/todo-triage-YYYYMMDD-143089001340590731
chore(ai): automated TODO triage scan
2026-01-28 22:21:50 -05:00
thePR0M3TH3AN f4c360f4f8 Merge pull request #1909 from PR0M3TH3AN/agent-pr-reviews-14144120924152591610
Automated PR Reviews
2026-01-28 22:21:32 -05:00
google-labs-jules[bot]andPR0M3TH3AN 5cd3131366 fix(ai): update nostr-login-permissions tests to match production logic (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 02:54:13 +00:00
google-labs-jules[bot]andPR0M3TH3AN 224e0c96bb chore(ai): Triage TODOs and generate report (agent)
Scanned the repository for TODO/FIXME/XXX comments.
Identified known flaky test TODOs in tests/visual/moderation.spec.ts, which are already tracked in issues/todo-moderation-tests.md.
No other actionable TODOs found in JS/TS sources.
Generated artifacts/todos.txt as a triage report.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 01:35:37 +00:00
google-labs-jules[bot]andPR0M3TH3AN cfbbf78941 chore(ai): add automated PR review report
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-28 23:49:33 +00:00
thePR0M3TH3AN c3f96c8819 Merge pull request #1906 from PR0M3TH3AN/ai/smoke-tests-20260128-13931457920280615023
chore(ai): add smoke test script (agent)
2026-01-28 17:00:41 -05:00
thePR0M3TH3AN 802f242483 Merge pull request #1908 from PR0M3TH3AN/codex/update-ensureloaded-to-verify-pubkey
Fix ensureLoaded guard to check active pubkey after normalization
2026-01-28 16:58:14 -05:00
thePR0M3TH3AN 10d628fe35 Fix ensureLoaded pubkey guard 2026-01-28 16:57:24 -05:00
thePR0M3TH3AN 2a5fa3ef90 Merge pull request #1907 from PR0M3TH3AN/codex/handle-no-pubkey-case-in-profilemodalcontroller
profileModal: show signer-required empty state for blocked list when signed out
2026-01-28 16:50:27 -05:00