fix(stats): harden duplicate-line cleanup and tracking

- Reject malformed requests and sub-day cleanup windows
- Reset deduplication across media and subtitle-track changes
- Handle karaoke bursts ending with a long hold frame
This commit is contained in:
2026-08-11 22:20:50 -07:00
parent fa4c734e30
commit 046a87a826
15 changed files with 410 additions and 55 deletions
+3 -3
View File
@@ -56,12 +56,12 @@ export interface CliInvocations {
texthookerOpenBrowser: boolean;
}
/** `--lookback-days` narrows the duplicate-line cleanup; anything unusable means no limit. */
/** `--lookback-days` narrows the duplicate-line cleanup; fractions are floored. */
function parseStatsLookbackDays(value: unknown): number | null {
if (typeof value !== 'string' && typeof value !== 'number') return null;
const days = Number(value);
if (!Number.isFinite(days) || days <= 0) {
throw new Error('Stats --lookback-days must be a positive number of days.');
if (!Number.isFinite(days) || days < 1) {
throw new Error('Stats --lookback-days must be at least one day.');
}
return Math.floor(days);
}