Files
iptvnator/tools/coverage/coverage-policy.json
T
d8229b98fa feat(playback): record recently viewed only after the stream plays (#1732)
* feat(playback): record recently viewed only after the stream plays

A channel, movie or episode used to enter Recently Viewed (and the
dashboard's Continue Watching hero) the moment it was selected or its
link was resolved, so streams that failed straight away cluttered the
history.

Writers now defer the write to a root PlaybackHistoryGate, keyed by the
stream URL and/or the playback session key. The inline players confirm
those keys once the owned engine's position has advanced by two seconds
(seeks, stalls, pauses and a previous stream's progress do not count),
the radio player does the same, and a launched MPV/VLC session confirms
on `opened`/`playing`. M3U with MPV/VLC configured keeps recording on
selection. Covers M3U (live, radio, movie detail), Stalker (live, radio,
VOD, series), Xtream VOD and series, and the global live collection.

The M3U host's embeddedPlayback is now compared by value: the history
write updates the playlist meta mid-playback, and a new but identical
playback object remounted the engine and restarted the stream.

E2E flows that relied on recording-on-click now play local fixtures
(HLS/TS/WebM routed in place of unreachable or public streams) and wait
for confirmed playback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): tighten recently viewed confirmation per review

- Correlate by session key first: when both the deferred write and the
  confirmation carry a playbackSessionKey, only that is compared, so the
  same stream URL played in another playlist no longer records a failed
  attempt. URLs remain the fallback (portal writes, MPV/VLC sessions).
  The M3U radio player now receives the host's session key.
- Count only playing progress: engines report `playing` (not paused, not
  seeking) with each time update, so short seeks of paused media no
  longer confirm a view.
- Xtream: a write confirmed after a playlist switch still saves to its own
  playlist but no longer replaces the current playlist's recent list.
- Global live tab: a row confirmed after another row was selected still
  moves to the top of an open Recently Viewed list (only a disposed tab
  skips the notification).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): confirm session-keyed history only by its own session

A write deferred with a playback session key (M3U) is now confirmed only
by that key. The app-wide MPV/VLC session confirmation carries just the
URL, so opening the same stream externally from another playlist could
still commit an abandoned attempt. An "Open in MPV/VLC" recovery launch is
instead confirmed by the WebPlayerViewComponent that requested it, under
its own session key, once the launch has opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(playback): keep the history gate off the initial bundle

The `@iptvnator/services` barrel ships in the initial bundle, so adding
PlaybackHistoryGate there (and subscribing to it from the app-wide
ExternalPlaybackService) grew renderer.initialBytes by 1,141 bytes.

- Move the gate to a new lazy-only `playback-data-access` project
  (`@iptvnator/playback/data-access`; scope:shared, domain:playback,
  type:data-access) and register it in the coverage policy.
- The gate subscribes to MPV/VLC session updates itself; it is created by
  the first deferred write, which precedes the launch it waits for.
  ExternalPlaybackService is back to master.
- The Xtream "playlist switched before confirmation" check moves to the
  lazy helper; the initial-path store only takes a `skipListRefresh` flag.

Net effect on this branch: +27 bytes over master (master itself is
108 bytes over the ratchet baseline already).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(playback): drop late Xtream confirmations off the initial path

The Xtream store ships in the initial bundle, so even the small
`skipListRefresh` flag cost 27 bytes there. A confirmation can only
arrive after a switch to another playlist from a slow MPV/VLC launch
(the inline player goes with the page), so the lazy helper now drops it
instead: recording it would misfile the item or replace the other
playlist's recent list. with-recent-items is back to master.

This branch is now 3 bytes below master on renderer.initialBytes; the
ratchet still reports master's pre-existing overage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(playback): pass the spec type-check gate from master

- playback-data-access: align tsconfig.spec.json with the epg-data-access
  config #1705 updated (bundler resolution, global.d.ts for window.electron).
- M3U recent-history spec: type the selectSignal override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): keep late Xtream confirmations in their own playlist history

A confirmation that arrives after a switch to another playlist (a slow
MPV/VLC launch) is no longer dropped: the lazy helper saves it to the
captured playlist through the data source, without reloading the store's
recent list, which belongs to the other playlist by then. The store and its
barrel ship in the initial bundle, so the save path stays in the feature
helper; renderer.initialBytes stays under the baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): correlate global live-tab history by its session key

The unified Favorites/Recent live tab deferred its history write by stream
URL only, so the same URL played from another playlist could confirm a
failed selection, and a switch to catch-up before confirmation could never
match. It now defers with the tab's playlist-scoped playbackSessionKey (the
key its players confirm with), and the tab's radio player receives it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): keep MPV/VLC rows of the live tab confirmable by URL

The live tab's session key can only be confirmed by its own inline
players; MPV/VLC confirm the launched URL alone. A row that goes to an
external player (also later, after a double-click) now defers by URL, and
only rows played inline carry the session key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): per-channel M3U history attempts, capability-based Xtream fallback

- M3U: the recently-viewed dedupe key now includes the channel id, so a
  second row of the same URL defers its own write (its session key) and
  is recorded when it plays after the first row failed.
- Xtream late write: key uncached content by Xtream id per
  supportsXtreamSqliteDataSource (the data-source factory's contract), not
  by a generic Electron bridge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: 4gray <fourgray@proton.me>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:23:06 +02:00

450 lines
19 KiB
JSON

{
"version": 1,
"reporting": {
"mergedCoverageDir": "coverage/merged",
"e2eSummaryDir": "coverage/e2e",
"unitCodecovFlag": "unit",
"coverageRatchet": {
"merged": {
"statements": 69.54,
"branches": 59.07,
"functions": 67.44,
"lines": 69.85
},
"criticalFiles": [
{
"path": "apps/electron-backend/src/app/server/http-server.ts",
"statements": {
"minimumCovered": 83,
"minimumPercent": 90.21
}
},
{
"path": "apps/electron-backend/src/app/events/remote-control.events.ts",
"statements": {
"minimumCovered": 112,
"minimumPercent": 96.55
}
},
{
"path": "apps/electron-backend/src/app/events/settings.events.ts",
"statements": {
"minimumCovered": 26,
"minimumPercent": 96.29
}
},
{
"path": "apps/electron-backend/src/app/events/database/downloads.events.ts",
"statements": {
"minimumCovered": 79,
"minimumPercent": 62.69
}
},
{
"path": "apps/electron-backend/src/app/events/database/download-removal-requests.ts",
"statements": {
"minimumCovered": 53,
"minimumPercent": 91.37
}
}
]
}
},
"unitCoverage": {
"description": "Tier A projects collect and trend source coverage. Tier B projects are validated without percentage coverage. Tier C projects are excluded from the source coverage baseline.",
"tierA": [
{
"name": "web",
"root": "apps/web",
"sourceRoot": "apps/web/src",
"jestRootMode": "project",
"validationCommand": "pnpm nx test web",
"e2eTags": ["@web", "@m3u", "@pwa", "@settings"]
},
{
"name": "electron-backend",
"root": "apps/electron-backend",
"sourceRoot": "apps/electron-backend/src",
"validationCommand": "pnpm nx test electron-backend",
"e2eTags": ["@electron", "@critical", "@persistence"]
},
{
"name": "web-backend",
"root": "apps/web-backend",
"sourceRoot": "apps/web-backend/src",
"validationCommand": "pnpm nx test web-backend",
"e2eTags": ["@self-hosted", "@web"]
},
{
"name": "services",
"root": "libs/services",
"sourceRoot": "libs/services/src",
"validationCommand": "pnpm nx test services",
"e2eTags": ["@m3u", "@persistence", "@settings"]
},
{
"name": "epg-data-access",
"root": "libs/epg/data-access",
"sourceRoot": "libs/epg/data-access/src",
"validationCommand": "pnpm nx test epg-data-access",
"e2eTags": ["@epg"]
},
{
"name": "playback-data-access",
"root": "libs/playback/data-access",
"sourceRoot": "libs/playback/data-access/src",
"validationCommand": "pnpm nx test playback-data-access",
"e2eTags": ["@persistence"]
},
{
"name": "m3u-state",
"root": "libs/m3u-state",
"sourceRoot": "libs/m3u-state/src",
"validationCommand": "pnpm nx test m3u-state",
"e2eTags": ["@m3u", "@persistence"]
},
{
"name": "playback-util",
"root": "libs/playback/util",
"sourceRoot": "libs/playback/util/src",
"validationCommand": "pnpm nx test playback-util",
"e2eTags": ["@playback", "@m3u", "@xtream", "@stalker"]
},
{
"name": "playlist-import-feature",
"root": "libs/playlist/import/feature",
"sourceRoot": "libs/playlist/import/feature/src",
"validationCommand": "pnpm nx test playlist-import-feature",
"e2eTags": ["@m3u", "@file-import"]
},
{
"name": "playlist-m3u-feature-player",
"root": "libs/playlist/m3u/feature-player",
"sourceRoot": "libs/playlist/m3u/feature-player/src",
"validationCommand": "pnpm nx test playlist-m3u-feature-player",
"e2eTags": ["@m3u", "@playback"]
},
{
"name": "playlist-shared-ui",
"root": "libs/playlist/shared/ui",
"sourceRoot": "libs/playlist/shared/ui/src",
"validationCommand": "pnpm nx test playlist-shared-ui",
"e2eTags": ["@m3u"]
},
{
"name": "playlist-shared-util",
"root": "libs/playlist/shared/util",
"sourceRoot": "libs/playlist/shared/util/src",
"validationCommand": "pnpm nx test playlist-shared-util",
"e2eTags": ["@m3u"]
},
{
"name": "portal-catalog-feature",
"root": "libs/portal/catalog/feature",
"sourceRoot": "libs/portal/catalog/feature/src",
"validationCommand": "pnpm nx test portal-catalog-feature",
"e2eTags": ["@xtream", "@stalker"]
},
{
"name": "portal-downloads-feature",
"root": "libs/portal/downloads/feature",
"sourceRoot": "libs/portal/downloads/feature/src",
"validationCommand": "pnpm nx test portal-downloads-feature",
"e2eTags": ["@downloads", "@electron", "@persistence"]
},
{
"name": "portal-shared-data-access",
"root": "libs/portal/shared/data-access",
"sourceRoot": "libs/portal/shared/data-access/src",
"validationCommand": "pnpm nx test portal-shared-data-access",
"e2eTags": ["@xtream", "@stalker", "@persistence"]
},
{
"name": "portal-shared-ui",
"root": "libs/portal/shared/ui",
"sourceRoot": "libs/portal/shared/ui/src",
"validationCommand": "pnpm nx test portal-shared-ui",
"e2eTags": ["@xtream", "@stalker"]
},
{
"name": "portal-shared-util",
"root": "libs/portal/shared/util",
"sourceRoot": "libs/portal/shared/util/src",
"validationCommand": "pnpm nx test portal-shared-util",
"e2eTags": ["@xtream", "@stalker"]
},
{
"name": "portal-stalker-data-access",
"root": "libs/portal/stalker/data-access",
"sourceRoot": "libs/portal/stalker/data-access/src",
"validationCommand": "pnpm nx test portal-stalker-data-access",
"e2eTags": ["@stalker"]
},
{
"name": "portal-stalker-feature",
"root": "libs/portal/stalker/feature",
"sourceRoot": "libs/portal/stalker/feature/src",
"validationCommand": "pnpm nx test portal-stalker-feature",
"e2eTags": ["@stalker"]
},
{
"name": "portal-xtream-data-access",
"root": "libs/portal/xtream/data-access",
"sourceRoot": "libs/portal/xtream/data-access/src",
"validationCommand": "pnpm nx test portal-xtream-data-access",
"e2eTags": ["@xtream"]
},
{
"name": "portal-xtream-feature",
"root": "libs/portal/xtream/feature",
"sourceRoot": "libs/portal/xtream/feature/src",
"validationCommand": "pnpm nx test portal-xtream-feature",
"e2eTags": ["@xtream"]
},
{
"name": "database",
"root": "libs/shared/database",
"sourceRoot": "libs/shared/database/src",
"validationCommand": "pnpm nx test database",
"e2eTags": ["@electron", "@persistence"]
},
{
"name": "shared-interfaces",
"root": "libs/shared/interfaces",
"sourceRoot": "libs/shared/interfaces/src",
"validationCommand": "pnpm nx test shared-interfaces",
"e2eTags": ["@m3u", "@xtream", "@stalker"]
},
{
"name": "shared-logging",
"root": "libs/shared/logging",
"sourceRoot": "libs/shared/logging/src",
"validationCommand": "pnpm nx test shared-logging",
"e2eTags": ["@electron", "@xtream", "@stalker", "@settings"]
},
{
"name": "shared-host-health",
"root": "libs/shared/host-health",
"sourceRoot": "libs/shared/host-health/src",
"validationCommand": "pnpm nx test shared-host-health",
"e2eTags": ["@xtream", "@stalker"]
},
{
"name": "m3u-utils",
"root": "libs/shared/m3u-utils",
"sourceRoot": "libs/shared/m3u-utils/src",
"validationCommand": "pnpm nx test m3u-utils",
"e2eTags": ["@m3u"]
},
{
"name": "components",
"root": "libs/ui/components",
"sourceRoot": "libs/ui/components/src",
"validationCommand": "pnpm nx test components",
"e2eTags": ["@m3u", "@search", "@persistence"]
},
{
"name": "ui-epg",
"root": "libs/ui/epg",
"sourceRoot": "libs/ui/epg/src",
"validationCommand": "pnpm nx test ui-epg",
"e2eTags": ["@epg"]
},
{
"name": "@iptvnator/pipes",
"root": "libs/ui/pipes",
"sourceRoot": "libs/ui/pipes/src",
"validationCommand": "pnpm nx test @iptvnator/pipes",
"e2eTags": ["@epg", "@settings"]
},
{
"name": "ui-playback",
"root": "libs/ui/playback",
"sourceRoot": "libs/ui/playback/src",
"validationCommand": "pnpm nx test ui-playback",
"e2eTags": ["@playback", "@m3u"]
},
{
"name": "workspace-dashboard-data-access",
"root": "libs/workspace/dashboard/data-access",
"sourceRoot": "libs/workspace/dashboard/data-access/src",
"validationCommand": "pnpm nx test workspace-dashboard-data-access",
"e2eTags": ["@dashboard", "@persistence"]
},
{
"name": "workspace-dashboard-feature",
"root": "libs/workspace/dashboard/feature",
"sourceRoot": "libs/workspace/dashboard/feature/src",
"validationCommand": "pnpm nx test workspace-dashboard-feature",
"e2eTags": ["@dashboard", "@persistence"]
},
{
"name": "workspace-shell-feature",
"root": "libs/workspace/shell/feature",
"sourceRoot": "libs/workspace/shell/feature/src",
"validationCommand": "pnpm nx test workspace-shell-feature",
"e2eTags": ["@search", "@settings", "@persistence"]
},
{
"name": "workspace-shell-util",
"root": "libs/workspace/shell/util",
"sourceRoot": "libs/workspace/shell/util/src",
"validationCommand": "pnpm nx test workspace-shell-util",
"e2eTags": ["@search", "@settings"]
}
],
"tierB": [
{
"name": "website",
"root": "apps/website",
"validationCommand": "pnpm nx test website",
"reason": "Astro marketing site; build output and targeted static checks are more meaningful than source percentage coverage."
},
{
"name": "packaging",
"root": "tools/packaging",
"validationCommand": "pnpm nx test packaging",
"reason": "Node package identity checks validate generated packaging metadata."
},
{
"name": "release-tools",
"root": "tools/release",
"validationCommand": "pnpm nx test release-tools",
"reason": "Node tests validate release-note parsing, rendering and gate policy; the scripts are release tooling, not shipped source."
},
{
"name": "repository-skills",
"root": "tools/skills",
"validationCommand": "pnpm nx test repository-skills",
"reason": "Node tests validate committed repository-skill metadata and documented paths; the validator is agent tooling, not shipped source."
},
{
"name": "eslint-tools",
"root": "tools/eslint",
"validationCommand": "pnpm nx test eslint-tools",
"reason": "Node tests assert the committed max-lines baseline still matches what the generator produces; the scripts are lint tooling, not shipped source, and percentage coverage over a generated list would not mean anything."
},
{
"name": "performance-tools",
"root": "tools/performance",
"validationCommand": "pnpm nx test performance-tools",
"reason": "Node tests validate the initial-bytes measurement over synthetic build output; the scripts are performance tooling, not shipped source."
},
{
"name": "shared-marketing-fixtures",
"root": "libs/shared/marketing-fixtures",
"validationCommand": "pnpm nx test shared-marketing-fixtures",
"reason": "Screenshot-safe fictional poster catalog shared by both mock servers; the spec asserts catalog order and shape, and percentage coverage over fixture data would not mean anything."
},
{
"name": "remote-control-web",
"root": "apps/remote-control-web",
"validationCommand": "pnpm nx build remote-control-web",
"reason": "Product surface without unit specs today; validate build output and add focused tests when behavior changes."
},
{
"name": "web-e2e",
"root": "apps/web-e2e",
"validationCommand": "pnpm nx run web-e2e:e2e -- --project=chromium",
"reason": "Playwright semantic flow coverage is reported separately."
},
{
"name": "electron-backend-e2e",
"root": "apps/electron-backend-e2e",
"validationCommand": "pnpm nx run electron-backend-e2e:e2e",
"reason": "Playwright semantic flow coverage is reported separately."
}
],
"tierC": [
{
"name": "xtream-mock-server",
"root": "apps/xtream-mock-server",
"reason": "Validated through Playwright API and user-flow tests unless mock behavior changes directly."
},
{
"name": "stalker-mock-server",
"root": "apps/stalker-mock-server",
"reason": "Validated through Playwright API and user-flow tests unless mock behavior changes directly."
},
{
"name": "shared-testing",
"root": "libs/shared/testing",
"reason": "Test helper library."
},
{
"name": "remote-control",
"root": "libs/ui/remote-control",
"reason": "No unit specs yet; validate through remote-control flows or add focused tests when behavior changes directly."
},
{
"name": "shared-portals",
"root": "libs/ui/shared-portals",
"reason": "Type-only library after the dead epg-view/live-epg-panel components were removed; only the LiveEpgPanelSummary interface remains, so there is no runtime code to unit test."
}
]
},
"e2eSemanticCoverage": {
"trackedTags": [
"@critical",
"@electron",
"@web",
"@xtream",
"@stalker",
"@m3u",
"@search",
"@epg",
"@persistence",
"@settings",
"@pwa",
"@self-hosted"
],
"criticalJourneys": [
{
"name": "Electron app starts and renders workspace",
"projects": ["electron-backend-e2e"],
"matchAnyTags": ["@critical"]
},
{
"name": "Xtream portal import, browse, and cached access",
"projects": ["web-e2e", "electron-backend-e2e"],
"matchAnyTags": ["@xtream"]
},
{
"name": "Stalker portal import and browse",
"projects": ["web-e2e", "electron-backend-e2e"],
"matchAnyTags": ["@stalker"]
},
{
"name": "M3U import, playback, and playlist state",
"projects": ["web-e2e", "electron-backend-e2e"],
"matchAnyTags": ["@m3u"]
},
{
"name": "Workspace search across providers",
"projects": ["electron-backend-e2e"],
"matchAnyTags": ["@search"]
},
{
"name": "EPG rendering and source management",
"projects": ["electron-backend-e2e"],
"matchAnyTags": ["@epg"]
},
{
"name": "Favorites, recent items, and restart persistence",
"projects": ["electron-backend-e2e"],
"matchAnyTags": ["@persistence"]
},
{
"name": "Settings persistence and playback options",
"projects": ["web-e2e", "electron-backend-e2e"],
"matchAnyTags": ["@settings"]
},
{
"name": "Self-hosted PWA/backend integration",
"projects": ["web-e2e"],
"matchAnyTags": ["@self-hosted", "@pwa"]
}
]
}
}