Commit Graph
81 Commits
Author SHA1 Message Date
thePR0M3TH3AN 18e08bf2cb feat: refine trust controls and harden BitLogin 2026-07-25 22:25:50 -04:00
thePR0M3TH3ANandClaude Fable 5 8dfd2034b0 feeds: "Most Zapped" sidebar tab ranked by zap totals (#47)
Trending-pattern clone ranked by sats from kind-9735 receipts:

- js/zapTotals.js: per-pointer receipt aggregation. The feed's metric getter
  returns the cached total and schedules a batched fetch (#a/#e chunks via
  the L1 SubscriptionManager) for unknown/stale pointers; amounts parse via
  nip57 bolt11 with the zap request's amount tag as fallback; receipts are
  deduped by id so re-fetches never double-count; zero-receipt answers are
  cached (2-min TTL).
- sorters.js: shared count-ranked sorter (metric desc, recency tie-break,
  author spread, trusted-muted sink); Trending delegates unchanged, Most
  Zapped ranks on runtime.getZapTotal.
- Full wiring: feed definition, view + info popover, change-signal re-rank
  (order settles as receipts stream in), sidebar link, viewManager registry,
  feedCoordinator case/loader, FEED_TYPES.MOST_ZAPPED, and a
  FEATURE_MOST_ZAPPED_FEED flag (default on; off hides the tab).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-03 21:38:53 -04:00
thePR0M3TH3ANandClaude Opus 4.8 e3139e8712 [feed] Break up per-creator clustering in For You / Trending grids
The For You (personalized) and Trending tabs ranked strictly by tier/score and
view count, which stacked a creator's whole back-catalogue into one block.

Add spreadAuthors() to the feed sorters: a gentle diversity re-rank that keeps
the caller's ranked order as the priority but avoids runs of the same author —
at each step it takes the highest-ranked remaining item whose author wasn't
among the last `window` picks (default 1), falling back to the plain top item
when every remaining candidate is a recent author. The #1 ranked item is always
chosen first, so "best-fit"/"most-viewed" stays topmost, and each author's items
keep their relative ranked order.

Applied to createForYouScoreSorter (personalized branch) and createTrendingSorter
(live items). Unlike interleaveByAuthor (full round-robin, used only for For
You's no-signal fallback + Explore), this preserves ranking rather than
flattening it, so each tab keeps its unique ordering process — just de-clustered.
Recent (chronological) and Explore (already diversified) are unchanged.

Tests: tests/feed-engine/spread-authors.test.mjs (7 — top preserved, no
avoidable adjacent dupes, per-author order kept, single-author/short/anon edge
cases, window:2 spread).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-01 10:14:03 -04:00
thePR0M3TH3ANandClaude Opus 4.8 02854d4fb5 feed: add Trending tab — recently-added ranked by view count (#27)
New FEED_TYPES.TRENDING tab: the active (recently-added) source ranked by view
count (recency tiebreak, trusted-muted last), gated by FEATURE_TRENDING_FEED
(default on). Builds on the now-trustworthy view counts (#4).

- createTrendingSorter reads counts from runtime.getViewCount, which resolves
  each video's pointer via the app's canonical deriveVideoPointerInfo against the
  shared viewCounter cache (new getVideoViewCountSnapshot export) — the same
  counts the grid cards already load.
- Live re-rank: viewCounter now emits a coalesced onViewCountsChanged signal;
  while the Trending view is active it debounce-re-runs the feed (cheap re-rank
  over the in-memory active set, no relay re-fetch), so the order settles into
  true trending as counts stream in. Cold cache reads as recency, then improves.
- Pipeline extracted to js/feedEngine/trendingFeed.js (feedCoordinator is at its
  size cap; bumped the cap for the thin load/refresh delegations).
- Wiring: FEED_TYPES + flag, feedCoordinator cases, app.js wrappers,
  applicationBootstrap registration (hides the sidebar link when flag off),
  viewManager init + js/trendingView.js, views/trending.html, sidebar link.

Tests: tests/trending-sorter.test.mjs.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-24 13:06:34 -04:00
thePR0M3TH3ANandClaude Opus 4.8 087cf410cb feed: make Explore "new-to-you + diverse, less recency"
Explore shared the full active set with Recent/For You and leaned on freshness,
so it read like a reshuffled Recently-added. Give it a discovery identity:

- Weights: drop freshness (0.25 -> 0.12) and bump novelty (0.30 -> 0.35) so
  recency stops dominating and topic-novelty leads.
- Add a soft followed-author penalty (weight 0.3): the scorer now reads
  subscriptionAuthors from the Explore runtime and deprioritizes creators you
  already follow, so non-followed creators surface ("new to you"). A penalty,
  not a filter, so the feed stays full if you follow lots of people.
- More variety: lower the diversity sorter's MMR lambda (0.7 -> 0.5).

Also compacted For You's subscriptionAuthors reader to a one-liner to stay
under feedCoordinator's size cap while adding the same reader to Explore.

Tests: explore follows-penalty scoring; existing explore-scorer/diversity +
feedCoordinator suites green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-24 08:50:50 -04:00
thePR0M3TH3ANandClaude Opus 4.8 4873a43135 feed: make For You lead with "your people first" (tiering + discovery fallback)
For You shared the full active set with Recent/Explore and only re-ranked by a
blended score, so when a user's signals were thin it collapsed toward freshness
and looked identical to Recently-added.

Give it a structural identity:
- The scorer tags each item forYouTier: 2 = followed author, 1 = interest/
  watch-topic match, 0 = other.
- The sorter leads with tier (your people first) regardless of raw score, then
  ranks within tier; trusted-muted still sinks last.
- When NOTHING is tiered (logged-out / no follows / no interests) it falls back
  to an author-interleaved discovery order (new interleaveByAuthor) so the feed
  never reads as a chronological clone of Recently-added.

Tests: tests/for-you-tiering.test.mjs (tier beats score, tiers stack, muted
last, no-signal interleave, scorer tier tagging). Existing for-you-scorer suite
still green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-24 08:46:30 -04:00
thePR0M3TH3ANandClaude Opus 4.8 ebacf223c8 fix(watch-history): resolve freshly-watched videos from cache (default video kind in address lookup)
Watch-history cards rendered "Untitled video" / "Unknown" for newly watched
videos. nostrClient.allEvents stores CONVERTED video objects
(convertEventToVideo), which carry tags/pubkey but no `kind` field — only raw
relay events do. resolveEventAddress() did Number(event.kind) → NaN and bailed
with "", so the address (cache-by-"a"-pointer) scan matched nothing. Every video
pointer (all are "a" addresses) was forced to a relay round-trip, and when that
returned nothing the card showed Unknown — even though the just-watched video
was sitting right there in allEvents.

Fix: default to the video kind (30078) when a cached object has no `kind`, so the
local cache scan resolves freshly-watched "a" pointers without a relay round-trip.

Adds tests/watch-history-hydration-cache.test.mjs: relays return nothing, so a
pass can only come from the cache scan (mutation-verified against the NaN-reject
regression). Exports createWatchHistoryHydrationStage for boundary testing.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-21 14:10:21 -04:00
thePR0M3TH3ANandClaude Opus 4.8 c0a8636678 feat(feed): make For You inclusive + ranked by your lists (G1-G5)
The For You feed was chronological, hashtag-interest-EXCLUSIVE, and ignored
follows entirely (docs/feed-algo-audit.md). Now it is inclusive + ranked:

- createForYouScorerStage scores each video: follows-boost (author you follow)
  + interest/watch-topic affinity (cosine vs your interests+watch-history vector)
  + freshness - disinterest penalty. Reuses Explore's vector/similarity helpers.
- createForYouScoreSorter ranks by that score (muted last, recency tiebreak).
- For You pipeline: interests now BOOST not exclude (enforceInterests:false);
  scorer added; chronological sorter replaced. Never empty (falls back to
  recency when you have no follows/interests/history).
- buildForYouFeedRuntime now feeds subscriptionAuthors + watchHistoryTagCounts.

Watched/blocked/muted are still removed (suppression/blacklist/moderation
stages unchanged). Cheat-resistant tests (older boosted items only win via the
boost). Grid renders end-to-end (~1.3s). Weight tuning is a follow-up.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-14 16:57:05 -04:00
google-labs-jules[bot]andPR0M3TH3AN 0ae813ea66 perf(feed): optimize moderation stage with batch author lookups (perf-optimization-agent)
- Implement `getModerationInfoForAuthors` in `ModerationService` for batching.
- Extract utility functions to `js/services/moderationUtils.js` to reduce `ModerationService` size.
- Update `createModerationStage` to use batch lookup, reducing sequential overhead.
- Benchmarks show ~50% improvement (454ms -> 227ms) for 5000 items.
- All unit tests pass.
- Task log: `docs/agents/task-logs/weekly/2026-02-22_01-25-01_perf-optimization-agent_completed.md`

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-22 01:26:39 +00:00
google-labs-jules[bot]andPR0M3TH3AN e62cb15c0e perf: parallelize timestamp resolution in feed engine
Replaces sequential await loop with Promise.any to resolve video timestamps in parallel.
This significantly reduces latency when multiple resolvers are present, especially if the first one is slow.

- Uses Promise.any to take the first valid finite timestamp.
- Wraps resolvers to reject on invalid values.
- Preserves error logging for genuine resolver errors.
- Benchmarks showed improvement from ~100ms to ~11ms in simulated slow scenarios.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-11 12:38:20 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6f49a05302 feat(perf): Optimize feed tag extraction with caching
- Extracted `getVideoTags` to `js/feedEngine/utils.js` with `WeakMap` caching.
- Updated `js/feedEngine/stages.js` and `js/feedEngine/kidsScoring.js` to use the cached utility.
- Removed redundant `collectVideoTags` and `normalizeTagSetFromVideo` functions.
- Added `benchmarks/feed_tags.mjs` to measure performance (approx 25x speedup in tight loops).
- Updated `hasDisinterestedTag` in `utils.js` to use the new utility.

This reduces object allocation and repeated string normalization during feed processing.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-10 19:44:30 +00:00
google-labs-jules[bot]andPR0M3TH3AN f954bf3d89 Optimize feed engine normalization with array marking
- Introduced `NORMALIZED_ARRAY_MARKER` in `js/feedEngine/utils.js` to tag arrays that are already normalized.
- Updated `normalizeItems` in `js/feedEngine/engine.js` to skip O(N) verification if the input array is marked.
- Updated built-in stages and sorters to mark their output arrays using `markAsNormalized` when they safely construct new arrays from normalized inputs.
- This avoids redundant O(N) scans after each stage, improving pipeline performance by ~10% end-to-end and eliminating overhead for trusted stages.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-10 17:00:52 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2275aa3bb1 Optimize feed scoring by caching normalized tag sets
- Introduce `videoTagCache` (WeakMap) in `js/feedEngine/kidsScoring.js`
- Cache result of `normalizeTagSetFromVideo` to avoid re-computation
- Improved benchmark performance by ~35%

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-10 04:59:46 +00:00
Claude 29215d9b5e Speed up Nostr login and fix list sync, storage unlock, and feed registration
- Remove redundant double signer readiness gate evaluation that added 5-10s
  to the login path (authSessionCoordinator)
- Reduce decryption timeouts (10s→6s per scheme, 3s→1.5s retry delay,
  8s→5s NIP-07 no-prompt, 45s→25s overall ensureLoaded) for faster scheme
  fallback during list sync
- Fix storage tab unlock: remove overly strict capabilities check that
  blocked lazy-injecting NIP-07 extensions, and add auto-unlock attempt
  when profile modal opens with an active signer
- Fix subscription/hashtag decryption: always resolve signer for background
  refreshes (was previously gated behind allowPermissionPrompt), and always
  check window.nostr as fallback decryptor regardless of prompt mode
- Fix capabilities check in subscription decryption: use method existence
  instead of dynamic capabilities getter that returns false during lazy
  extension injection
- Wrap Promise.any decryptor calls in Promise.resolve().then() to catch
  synchronous throws from NIP-07 adapter methods when extension modules
  haven't loaded yet
- Make watch-history feed registration race-safe with pre-check and
  try/catch for concurrent registration attempts
- Improve NIP-07 extension detection with DOMContentLoaded listener for
  faster detection of extensions that inject during page load

https://claude.ai/code/session_0174XTB5ADJ9cMBSucqL9Wer
2026-02-09 00:18:43 +00:00
thePR0M3TH3AN fd3f9e723a Split subscriptions/hashtag readiness and expose unavailable preference states 2026-02-08 14:10:39 -05:00
google-labs-jules[bot]andPR0M3TH3AN 7c1f3c9ada perf: Optimize chronological sorter hook resolution
Hoisted the timestamp hook resolution out of the inner loop in `createChronologicalSorter`.
This avoids allocating an array of candidate functions for every comparison during sorting (O(N log N)).
Benchmark shows a ~27% speedup (38ms -> 27ms for 100k items).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 16:55:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN 96dea42692 Optimize object allocation in kids scoring loop
- Replaced array allocation and loop with unrolled scalar comparisons in `kidsScorerStage`.
- Added unit tests and benchmark.
- Measured ~12% performance improvement (282ms -> 249ms for 200k items).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:41:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2320887665 perf: optimize createExploreDiversitySorter with inverted index
- Implements an Inverted Index to reduce redundant similarity checks.
- Replaces O(N) array splice with O(1) Map deletion for candidate tracking.
- Reduces runtime from ~3.5s to ~0.9s for 5000 items (3.9x speedup).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 16:55:05 +00:00
Claude 3a55e1bf03 fix: resolve coordinator refactoring regressions breaking DM, lists, and feed pipeline
- Remove undefined hashtagPreferencesPromise reference in handleAuthLogin
  that caused the feed sync Promise.allSettled to silently fail, preventing
  proper list/profile synchronization before grid refresh
- Add missing getModerationSettings and getActiveProfilePubkey dependency
  injection to authSessionCoordinator, fixing crashes during logout
  moderation reset and profile switch pubkey resolution
- Parallelize NIP-07 permission request with relay readiness instead of
  gating list loading behind it; parallelize subscriptions and hashtag
  preference loading (independent of each other, only blocks must sequence)
- Add native run() alias to feedEngine so callers don't rely solely on
  the applicationBootstrap compatibility shim
- Remove redundant refreshVisibleModerationUi call from renderVideoList
  that re-decorated every video immediately after decoration
- Avoid re-normalizing moderation settings on every getActiveModerationThresholds
  call when settings are already an object

https://claude.ai/code/session_01FCosieUXjEn95KtUeyGemY
2026-02-06 21:42:49 +00:00
google-labs-jules[bot]andPR0M3TH3AN 16458d1bc2 perf: Optimize explore diversity sorter
- Pre-calculate normalized vector norms to avoid O(N^2) recalculation.
- Pre-calculate normalized scores to avoid redundant property access and normalization.
- Combine selection loops to reduce iteration overhead.
- Modify cosineSimilarity to use dot product on normalized vectors.

Benchmark (1000 items): ~240ms -> ~152ms (~37% improvement).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-06 16:49:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6672be9281 Optimize feed engine normalization loop
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 20:50:30 +00:00
google-labs-jules[bot]andPR0M3TH3AN 4c45555b26 Optimize explore diversity sorter to O(N^2)
- Replaced O(N^3) MMR algorithm with O(N^2) implementation
- Cached max similarity penalties to avoid redundant calculations
- Added benchmark script showing ~200x speedup for 1000 items

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 20:12:36 +00:00
google-labs-jules[bot]andPR0M3TH3AN 1846f865f5 Optimize feed engine normalization to reduce GC pressure
- Introduce `NORMALIZED_MARKER` Symbol to mark normalized items.
- Optimize `normalizeDto` to return existing object if marked.
- Optimize `normalizeItems` to scan for markers and return input array if all items are valid and marked, avoiding unnecessary array allocation and object re-creation.
- Preserve safety logic in `runFeed` (handle nulls and always call normalizer) while benefiting from internal optimization.

Benchmark results show ~9x speedup for "Same Instance" updates and ~5x speedup for "Copy Array" updates in the feed pipeline.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 19:43:09 +00:00
thePR0M3TH3AN a36ea40288 Add kids feed registration and sorter 2026-01-23 01:59:57 -05:00
thePR0M3TH3AN ed99db01ea Add kids feed scoring stage 2026-01-23 01:54:11 -05:00
thePR0M3TH3AN ba68c10950 Add kids audience filter stage 2026-01-23 01:50:12 -05:00
thePR0M3TH3AN 4abe9f3d1e Add disinterest tag filter stage 2026-01-22 19:10:27 -05:00
thePR0M3TH3AN c3aa42f39c Add explore feed pipeline 2026-01-22 19:04:50 -05:00
thePR0M3TH3AN 4eabdc3234 Add explore diversity sorter 2026-01-22 18:52:49 -05:00
thePR0M3TH3AN 67b7dc50f4 Add explore scoring stage factory 2026-01-22 18:13:49 -05:00
google-labs-jules[bot] 88fd378648 chore(ai): remove dead code (magnet.js and unused exports)
- Deleted `js/magnet.js` as it was a redundant wrapper for `js/magnetUtils.js`.
- Refactored `js/services/videoNotePayload.js`, `js/ui/components/EditModal.js`, and `js/nostr/nip71.js` to use `magnetUtils.js` and `magnetShared.js`.
- Updated `tests/magnet-utils.test.mjs` to remove tests for the deleted file.
- Removed unused exports `DEFAULT_FEED_CONFIG` and `DEFAULT_CONFIG_SCHEMA` from `js/feedEngine/engine.js` and `index.js`.
- Verified changes with unit tests.
2026-01-22 20:29:07 +00:00
thePR0M3TH3AN 8516382ece Update tag preference filtering 2026-01-18 14:05:47 -05:00
thePR0M3TH3AN 7a29a0b807 Consolidate tag preference filtering stage 2026-01-18 13:38:34 -05:00
thePR0M3TH3AN 0ac64867da Add shared hashtag normalization helper 2026-01-18 13:35:34 -05:00
thePR0M3TH3AN 3a3339a57a Add per-category trusted mute thresholds 2026-01-16 10:49:32 -05:00
google-labs-jules[bot] 8a61acb09c Add debug logging to trace subscription loading hang 2026-01-12 00:10:04 +00:00
google-labs-jules[bot] b07332395b Fix subscription feed hydration and infinite loading state 2026-01-08 19:24:10 +00:00
google-labs-jules[bot] 7d274bc331 feat: incorporate tag preferences into blacklist filter stage
- Implements `hasDisinterestedTag` helper in `js/feedEngine/utils.js` to check for disinterested tags in both raw Nostr tags and NIP-71 metadata.
- Updates `createBlacklistFilterStage` in `js/feedEngine/stages.js` to filter out videos matching `context.runtime.tagPreferences` disinterests.
- Ensures existing blacklist logic remains undisturbed.
- Verified with new unit test `tests/feed-engine-tag-pref.test.mjs` and existing feed engine tests.
2026-01-08 00:52:57 +00:00
google-labs-jules[bot] f2c87051ce feat: add profile hydration to watch history feed
This change introduces `createWatchHistoryProfileHydrationStage` to the
watch history feed pipeline. The stage resolves author profiles for
hydrated videos by:
1. Checking the global `getProfileCacheEntry` for cached profiles.
2. Batching missing profiles into a single Kind 0 relay request.
3. Updating the global cache (`setProfileCacheEntry`) with fetched data.
4. Attaching the resolved profile to `item.metadata.profile`.

This ensures that channel images populate correctly in the watch history
UI (both sidebar and profile modal).
2026-01-07 20:28:44 +00:00
google-labs-jules[bot] c322fcee14 fix(watch-history): add manual refresh and fix dynamic pulling
This commit addresses issues with the watch history not updating dynamically and adds a manual refresh mechanism.

Changes:
- Added a "Refresh" button to the watch history view in `views/history.html` and `js/historyView.js`.
- Updated `watchHistoryService.js` to accept a `forceRefresh` option in `loadLatest`, which bypasses the cache freshness check and triggers a relay fetch.
- Updated `js/feedEngine/watchHistoryFeed.js` to propagate the `forceRefresh` flag from the runtime context to the service.
- Added user feedback (toast messages and logs) for "Clear Local History" and "Republish Now" actions.
- Updated `tests/watch-history.test.mjs` to align with the new `fetchHistory` signature.
2026-01-07 14:05:21 +00:00
google-labs-jules[bot] f2f55830e8 fix: ensure watch history is sorted by most recent first
- Enforce descending month order in `js/nostr/watchHistory.js` by explicitly sorting keys before flattening buckets.
- Update `js/feedEngine/watchHistoryFeed.js` and `js/historyView.js` to use `video.created_at` as a fallback sort key when `watchedAt` is missing or equal.
- Verified logic with `tests/verify_sort.mjs`.
2026-01-07 00:28:39 +00:00
google-labs-jules[bot] 386ddea44a Enhance watch history hydration with relay hints and verbose logging
The watch history hydration process was sometimes failing to retrieve video metadata, resulting in "Untitled video" cards. This was primarily due to only querying the generic relay list and potentially missing content hosted on specific relays.

This commit improves the robustness of `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js` by:
1.  Collecting unique relay hints from the pointer objects (`item.pointer.relay`) of items needing hydration.
2.  Merging these hints with the user's `readRelays` (or fallback `relays`) list. This ensures that if a specific video is known to exist on a niche relay, that relay is queried during the metadata fetch.
3.  Replacing conditional debug logging with `devLogger.info` and `devLogger.warn` to provide detailed insights into the hydration process (item counts, selected relays, generated filters, and fetch results), aiding in future diagnosis.

These changes ensure the application attempts to fetch metadata from all relevant sources indicated by the history data itself.
2026-01-06 13:30:51 +00:00
google-labs-jules[bot] b03d96f041 Add verbose logging and fix relay selection for watch history hydration
The watch history hydration stage was failing silently when relay connections were unstable or misconfigured. This commit:
1. Replaces the conditional debug logger with `devLogger.info` and `devLogger.warn` to ensure visibility of critical hydration steps.
2. Adds detailed logging for item counts, missing ID/address lists, filter generation, and fetch results.
3. Updates the relay selection logic to prioritize `nostrClient.readRelays` over `nostrClient.relays`. This ensures that hydration attempts query the user's specific read-configured relays, which is crucial for fetching metadata when generic relays may be write-only or restricted.

These changes aid in diagnosing "Untitled video" issues and improve the robustness of the metadata fetch process.
2026-01-06 13:18:32 +00:00
google-labs-jules[bot] 93c88704e0 Fix watch history hydration by prioritizing readRelays
The `createWatchHistoryHydrationStage` in the feed engine was incorrectly relying solely on `nostrClient.relays` for network fetches. This could cause hydration failures if `relays` contained write-only servers or was otherwise restricted. This commit updates the logic to prioritize `nostrClient.readRelays` if available, falling back to `nostrClient.relays`. This ensures that hydration attempts query the correct relays configured for reading data.

Fixes an issue where watch history items would display as "Untitled video" due to failed metadata resolution.
2026-01-06 13:11:39 +00:00
google-labs-jules[bot] 7312fa4fa4 Fix watch history hydration using local cache and address support
Updated `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js` to first check `nostrClient.allEvents` for video data before querying relays. This ensures that recently watched videos (which are already in memory) are instantly hydrated in the watch history list, fixing the "Untitled video" issue.

Additionally, implemented robust support for hydrating address pointers (`type: 'a'`) by scanning the cache and constructing proper relay filters for missing items. This covers cases where history items reference videos by `kind:pubkey:d-tag` rather than ID.
2026-01-06 04:06:44 +00:00
google-labs-jules[bot] 914e0abc58 Fix watch history hydration for address pointers with colons
Updated `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js` to properly handle and hydrate watch history items that use address pointers (type 'a'), specifically fixing a bug where d-tags containing colons were being ignored.

Previously, only event ID pointers (type 'e') were being hydrated, and an initial fix for addresses failed for d-tags with colons. This change robustly parses address pointers, constructs appropriate filters, fetches the events, and correctly maps them back to the history items using a `normalizeAddressKey` utility that handles mixed-case pubkeys and complex d-tags.
2026-01-06 03:43:08 +00:00
google-labs-jules[bot] 1f54745840 Fix watch history hydration for address pointers
Updated `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js` to properly handle and hydrate watch history items that use address pointers (type 'a').

Previously, only event ID pointers (type 'e') were being hydrated, causing videos watched via address pointers to display as "Untitled video" with missing metadata. This change parses the address pointers, constructs appropriate filters (normalizing pubkeys to lowercase while preserving d-tag case), fetches the events, and correctly maps them back to the history items using a robust `normalizeAddressKey` utility.
2026-01-06 03:23:45 +00:00
google-labs-jules[bot] 5724ec4e1e Fix watch history hydration for address pointers
Updated `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js` to properly handle and hydrate watch history items that use address pointers (type 'a').

Previously, only event ID pointers (type 'e') were being hydrated, causing videos watched via address pointers to display as "Untitled video" with missing metadata. This change parses the address pointers, constructs appropriate filters, fetches the events, and correctly maps them back to the history items.
2026-01-06 02:51:18 +00:00
google-labs-jules[bot] 99c3f60a23 feat: implement video hydration stage for watch history feed
This introduces a new stage in the watch history feed pipeline that fetches missing video metadata from relays. Since watch history storage was optimized to store only event IDs, this hydration step ensures that the UI can display titles and thumbnails without requiring them to be persisted in the history payload itself.

- Implemented `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js`.
- Integrated `convertEventToVideo` to transform fetched events into usable video objects.
- Added a comprehensive integration test in `tests/watch-history.test.mjs` verifying the full flow from ID-only storage to hydrated feed items.
2026-01-05 20:22:34 +00:00
google-labs-jules[bot] 4c7230f540 Remove metadata storage and handling from watch history
Removes the metadata argument from `WatchHistoryService.publishView` and cleans up the associated caching and resolution logic in `watchHistory.js` and `watchHistoryFeed.js`. Deletes `js/watchHistoryMetadata.js` as it is no longer used.

This simplification ensures watch history strictly manages pointers and timestamps, leaving metadata resolution to higher-level consumers. It also reduces the payload size and complexity of persisted history records.

Tests have been updated to reflect the API changes.
2026-01-05 16:58:59 +00:00