Skip to content

fix(stalker): keep recent kinds apart, protect resume points and reload channels after an edit - #2236

Open
mahmutyum wants to merge 5 commits into
4gray:masterfrom
mahmutyum:fix/stalker-recent-resume-and-itv-cache
Open

mahmutyum wants to merge 5 commits into
4gray:masterfrom
mahmutyum:fix/stalker-recent-resume-and-itv-cache

Conversation

@mahmutyum

Copy link
Copy Markdown
Contributor

What changed

Three Stalker fixes.

  1. Recently Viewed keeps kinds apart.
    • A local touch (mutatePlaylistHistory, libs/services/src/lib/playlist-history.ts) now takes over an existing row only if the ids match and the kinds are compatible: live, radio, movie or series, from stalkerFavoriteReference. Rows of unknown kind, such as older untyped snapshots, still match by id alone. Episodes of one series still collapse into one row.
    • The unified Recent collection gives Stalker rows a typed uid locally, as synced history already does. Promoting one of two same-id rows therefore no longer drops the other.
  2. Resume points survive resuming. StalkerVodPlaybackController (search, Favorites, Recent and dashboard collections) and the series view now save through the shared createInlinePlaybackPositionWriter, like the catalog detail and Xtream. Each previously had its own 15 s throttle without the writer's resume latch.
  3. Live TV reloads channels after a source edit. StalkerItvCacheService keys its session cache by the playlist id plus stalkerSessionFingerprint (portal endpoint, MAC/device identity, credentials), instead of the id alone.

Docs: docs/architecture/stalker-portal.md covers the recent kind rule and typed uid, the shared writer, and the cache key.

Why

  1. Stalker numbers live channels and VOD separately, so ids collide.
    • Watching movie 42 after live channel 42 replaced the channel's row and inherited its fields.
    • A leftover radio or series_id then reopened the movie as a radio station or a series.
  2. A resuming engine reports timeupdate at about 0 s before its seek to startTime lands, and the old throttles saved that.
    • Resuming a 40-minute movie from search or Favorites wrote position 0 over the saved one.
    • The same happened for an episode from the series page. Closing within 15 s, or a stalled stream, lost the resume point.
  3. Editing a source's portal URL or MAC keeps its id.
    • Live TV kept serving the previous account's full channel list, and their cmds went to the new portal.
    • An unsupported verdict also stayed in force until a manual refresh or a restart.
    • Categories already reloaded, because their resource re-keys on the playlist object.

Release note

  • Added a note under .changes/ (stalker-recent-resume-and-channels.md)
  • Not needed (test-only, docs, CI, or a refactor with no behavior change)

Checks

  • Tests added or updated for the changed behavior
  • pnpm nx lint and the affected pnpm nx test <project> pass

New tests, each failing before the fix:

  • playlist-history.spec.ts (new):
    • radio and movie with id 42 stay two rows, and the movie gets no radio;
    • live channel and series stay two rows;
    • the same item moves up and keeps its fields;
    • an untyped older row still merges.
  • unified-recent-data.service.spec.ts: same-id live channel and movie get distinct uids. The existing radio case now expects the typed uid.
  • stalker-vod-playback-controller.spec.ts and stalker-series-view.resume.spec.ts: a 0.4 s update before startTime is not saved; the first update at the resume point is.
  • stalker-itv-cache.service.spec.ts:
    • a MAC change loads the new account's channels;
    • an unsupported verdict does not carry over to another portal URL.

Run locally:

  • pnpm nx test: portal-stalker-feature 587/587, portal-stalker-data-access 747/747, portal-shared-data-access 351/351 and portal-shared-ui 266/266.
  • pnpm nx test services: 1527/1528. The one failure ("DatabaseService browser guards") fails the same way on unmodified master under the local Node 26; .nvmrc pins 24.
  • Electron E2E: stalker-lazy-vod 6/6, stalker-hide-watched 2/2 and stalker-playback-headers 2/2.
  • Web E2E stalker.e2e.ts (Chromium): 35/35.
  • pnpm nx lint on the touched projects, pnpm run typecheck:web and pnpm run release:notes:validate: pass.

Known follow-ups, deliberately left out:

  • A lazy portal repair rewrites the persisted portal URL, which changes the cache key and causes one extra channel crawl.
  • Each edit leaves the previous account's list in memory for the session.

…ad channels after an edit

- Recently Viewed: a local touch matched rows by normalized id only.
  Stalker numbers live channels and VOD separately, so watching movie 42
  after live channel 42 replaced the channel's row and inherited its
  fields; a leftover `radio` or `series_id` then reopened the movie as a
  radio station or a series. A touch now takes over a row only of a
  compatible kind (from stalkerFavoriteReference); untyped older rows still
  match by id.
- Resume: StalkerVodPlaybackController (search, Favorites, Recent and
  dashboard collections) and the series view kept their own copy of the
  15 s save throttle without the resume latch the shared
  createInlinePlaybackPositionWriter has, so the ~0 s timeupdate an engine
  reports before reaching startTime overwrote the position being resumed
  from. Both now use the shared writer, as the catalog detail and Xtream do.
- Live TV channels: StalkerItvCacheService keyed its session cache by the
  playlist id. Editing the source's portal URL, MAC or credentials keeps the
  id, so Live TV kept serving the previous account's channel list (and its
  cmds, sent to the new portal) and an `unsupported` verdict until a manual
  refresh or restart. The key now adds stalkerSessionFingerprint, so an
  edited connection loads its own list.

The unified Recent collection built local Stalker uids from the id alone,
so promoting one of two same-id rows removed the other from the list; it
now uses the typed reference uid that synced history already used.
@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

Greptile CLI Reused the Greptile CLI review of f8661a2 by a teammate. The code matches this PR, so no new review ran.

[Medium impact] The PR appears safe to merge; no actionable new issues were found.

Summary

This PR keeps Stalker history rows separate when different content kinds share an ID.

  • Stalker Recently Viewed keeps same-numbered items in separate rows.
  • Resumed Stalker movies and episodes keep their saved position.
  • Live TV reloads channels when a Stalker connection changes.
  • Recent hearts and EPG mappings follow the selected Stalker item.
  • The self-hosted M3U check confirms refreshed channels survive reload.

No actionable new issues were found.

Reviews (5) · Last reviewed commit: "Merge master into Stalker fixes for PR #..." · Reviewed by Greptile

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.50746% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@dd89c00). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...-favorites-list/global-favorites-list.component.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #2236   +/-   ##
=========================================
  Coverage          ?   81.91%           
=========================================
  Files             ?     1904           
  Lines             ?   101641           
  Branches          ?    24856           
=========================================
  Hits              ?    83255           
  Misses            ?    11102           
  Partials          ?     7284           
Flag Coverage Δ
unit 81.91% <98.50%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@4gray

4gray commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@greptileai

@4gray

4gray commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@greptileai

@4gray

4gray commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@greptileai

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants