test(performance): add end-to-end Xtream benchmark harness (#1300)

* docs(performance): plan Xtream benchmark

* feat(xtream-mock-server): add deterministic 100k fixture

* style(xtream-mock-server): apply repository formatting

* fix(xtream-mock-server): harden performance fixture data

* feat(xtream-mock-server): add performance control plane

* docs(performance): correct Xtream capture plan

* fix(xtream-mock-server): harden performance controls

* fix(xtream-mock-server): harden control lifecycle

* feat(performance): add Xtream preload markers

* feat(performance): trace Xtream main phases

* feat(performance): mark Xtream store publications

* feat(performance): trace Xtream database phases

* feat(performance): trace Xtream delete cancellation

* feat(performance): capture Xtream phase attribution

* feat(performance): mark Sources Xtream refresh

* test(performance): define Xtream benchmark evidence contracts

* test(performance): add Xtream benchmark runner

* test(performance): surface failure evidence writes

* test(performance): align database read clock

* test(performance): preserve capture failure contracts
This commit is contained in:
4gray authored and GitHub committed 2026-07-28 08:08:07 +02:00
1 parent 5e725a06f3
commit a2fafcfc08
256 files changed
+43760 -883

No files matched your search

+1
View File
@@ -52,6 +52,7 @@ export * from './lib/xtream-response.interface';
export * from './lib/xtream-portal.utils';
export * from './lib/xtream-restore-state.util';
export * from './lib/xtream-recently-added.utils';
export * from './lib/xtream-performance-marker.interface';
export * from './lib/xtream-serie-details.interface';
export * from './lib/xtream-serie-item.interface';
export * from './lib/xtream-vod-details.interface';
@@ -35,8 +35,35 @@ export type AppPlaylistGetPerformancePhase =
(typeof APP_PLAYLIST_GET_PERFORMANCE_PHASE)[keyof typeof APP_PLAYLIST_GET_PERFORMANCE_PHASE];
export type AppPlaylistPerformancePhase =
| AppPlaylistGetPerformancePhase
| AppPlaylistUpsertPerformancePhase;
AppPlaylistGetPerformancePhase | AppPlaylistUpsertPerformancePhase;
export const XTREAM_DATABASE_PERFORMANCE_PHASE = {
NORMALIZE_CATEGORIES: 'normalize.categories',
NORMALIZE_CONTENT: 'normalize.content',
NORMALIZE_SEARCH_RANK: 'normalize.search-rank',
SQLITE_CATEGORIES_READ: 'sqlite.categories.read',
SQLITE_CATEGORIES_WRITE_TRANSACTIONS:
'sqlite.categories.write-transactions',
SQLITE_CONTENT_CATEGORY_MAP_READ: 'sqlite.content.category-map-read',
SQLITE_CONTENT_READ: 'sqlite.content.read',
SQLITE_CONTENT_WRITE_TRANSACTIONS: 'sqlite.content.write-transactions',
SQLITE_PLAYLIST_DELETE_COLLECT_IDS: 'sqlite.playlist-delete.collect-ids',
SQLITE_PLAYLIST_DELETE_WRITE_TRANSACTIONS:
'sqlite.playlist-delete.write-transactions',
SQLITE_SEARCH_QUERY: 'sqlite.search.query',
SQLITE_XTREAM_CACHE_CLEAR_WRITE_TRANSACTIONS:
'sqlite.xtream-cache-clear.write-transactions',
SQLITE_XTREAM_DELETE_COLLECT_USER_DATA:
'sqlite.xtream-delete.collect-user-data',
SQLITE_XTREAM_DELETE_WRITE_TRANSACTIONS:
'sqlite.xtream-delete.write-transactions',
} as const;
export type XtreamDatabasePerformancePhase =
(typeof XTREAM_DATABASE_PERFORMANCE_PHASE)[keyof typeof XTREAM_DATABASE_PERFORMANCE_PHASE];
export type DatabaseWorkerPerformancePhase =
AppPlaylistPerformancePhase | XtreamDatabasePerformancePhase;
export interface PerformancePhaseMetadata {
readonly byteCount?: number;
@@ -0,0 +1,58 @@
import { XtreamCodeActions } from './xtream-code-actions';
export const XTREAM_MAIN_PERFORMANCE_PHASE_EVENT_CHANNEL =
'IPTVNATOR_XTREAM_MAIN_PERFORMANCE_PHASE_EVENT';
export const XTREAM_MAIN_PERFORMANCE_PHASE = {
CANCEL_SESSION: 'xtream.cancel-session',
JSON_TRANSFORM: 'xtream.json.transform',
NETWORK_TOTAL: 'xtream.network.total',
RESPONSE_READY: 'xtream.response.ready',
} as const;
export type XtreamMainPerformancePhase =
(typeof XTREAM_MAIN_PERFORMANCE_PHASE)[keyof typeof XTREAM_MAIN_PERFORMANCE_PHASE];
export const XTREAM_PRELOAD_PERFORMANCE_MARKER_CHANNEL =
'IPTVNATOR_XTREAM_PERF_CAPTURE_MARKER';
export const XTREAM_PRELOAD_PERFORMANCE_SCHEMA_VERSION = 1 as const;
export const XTREAM_PRELOAD_PERFORMANCE_METHOD = {
DB_CANCEL_OPERATION: 'dbCancelOperation',
DB_DELETE_PLAYLIST: 'dbDeletePlaylist',
DB_DELETE_XTREAM_CONTENT: 'dbDeleteXtreamContent',
DB_GET_CATEGORIES: 'dbGetCategories',
DB_GET_CONTENT: 'dbGetContent',
DB_GLOBAL_SEARCH: 'dbGlobalSearch',
DB_RESTORE_XTREAM_USER_DATA: 'dbRestoreXtreamUserData',
DB_SAVE_CATEGORIES: 'dbSaveCategories',
DB_SAVE_CONTENT: 'dbSaveContent',
DB_SEARCH_CONTENT: 'dbSearchContent',
XTREAM_CANCEL_SESSION: 'xtreamCancelSession',
XTREAM_REQUEST: 'xtreamRequest',
} as const;
export type XtreamPreloadPerformanceMethod =
(typeof XTREAM_PRELOAD_PERFORMANCE_METHOD)[keyof typeof XTREAM_PRELOAD_PERFORMANCE_METHOD];
export type XtreamPreloadPerformanceBoundary = 'start' | 'end';
export type XtreamPreloadPerformanceOutcome = 'success' | 'error' | null;
export type XtreamPreloadPerformanceCategoryType = 'live' | 'movies' | 'series';
export type XtreamPreloadPerformanceContentType = 'live' | 'movie' | 'series';
export interface XtreamPreloadPerformanceMarker {
schemaVersion: typeof XTREAM_PRELOAD_PERFORMANCE_SCHEMA_VERSION;
sourceEpochMs: number;
ipcCallId: number;
method: XtreamPreloadPerformanceMethod;
boundary: XtreamPreloadPerformanceBoundary;
outcome: XtreamPreloadPerformanceOutcome;
playlistId: string | null;
operationId: string | null;
sessionId: string | null;
action: XtreamCodeActions | null;
categoryType: XtreamPreloadPerformanceCategoryType | null;
contentType: XtreamPreloadPerformanceContentType | null;
itemCount: number | null;
}