Completion Evidence Pipeline#
CompletionEvidencePipeline (defined in engine/pipeline.py) is the core decision engine inside the subscribeassistantenhanced plugin. Its evaluate() method aggregates six named signals โ M, E, F, I, L, S โ and a helper observation G โ into a CompletionEvidence object that CompletionGuard uses to decide whether a TV subscription should be marked complete.
The pipeline is instantiated by CompletionGuard (see guard.py), which calls evaluate() on every CompletionCheck event for ordinary (non-movie, non-full-best-version) TV subscriptions .
Signals Reference#
All signals operate against a SeasonScope: the set of TMDB episode objects for the current subscription's target season (or episode group). The scope is built once at the start of evaluate() .
| Signal | Tag(s) | Confidence | Role |
|---|---|---|---|
| M | M:mid_season | โ | Hard veto: last aired episode is a mid-season finale |
| E | E:ended, E:canceled, E:finale | High | High-confidence completion via TMDB show status or scope-level finale |
| F | F:unstable | โ | Veto/observation: episode count changed within volatility window |
| I | I:next_season, I:last_ep_beyond, I:all_aired, I:cooldown | Medium / Low | Season-level broadcast completeness via TMDB season data |
| L | L:target_satisfied | Low | Local library satisfies the target episode range |
| S | S:site_complete_pack, S:site_complete_total, S:site_total_ahead, S:site_conflict | โ | Site resource corroboration or veto |
| G | (cadence helper) | โ | Advisory flag: broadcast cadence has expired (attached to cadence_expired field, never drives standalone completion) |
M โ Mid-Season Hard Veto#
check_m_signal() inspects the episode_type field of the last aired episode in scope. If it equals "mid_season", evaluate() immediately returns with hard_veto set and exits . No other signal can override this.
E โ TMDB Show-Level Status (Key Nuance)#
check_e_signal() fires E:ended or E:canceled when mediainfo.tmdb_info["status"] is "Ended" or "Canceled" โ a show-level field. It does not validate whether the target season itself is complete. A show marked "Ended" on TMDB will produce a high-confidence E signal even if the subscription's specific season has episodes yet to air. The second E sub-case (E:finale) is scope-aware: it requires that the scope contains a single, unambiguous finale episode that is already aired and no future episodes remain .
When E fires, the pipeline can bypass an active F (instability) signal โ but only if no future episodes exist in scope .
F โ Volatility / Instability#
_unstable_signal() produces F:unstable when VolatilityTracker detects that the subscription's episode count changed within the configured window. A downward change (volatility_direction == "down") is immediately escalated to a hard veto ; an upward or neutral change is stored as unstable_signal and blocks early exit unless overridden by E or a target-complete composite.
I โ Season-Level Broadcast Signals#
check_i_signal() runs four sub-checks in priority order:
- I-1
I:next_season(medium): TMDB already lists a later season number than the current scope. - I-2
I:last_ep_beyond(medium): TMDB'slast_episode_to_airbelongs to a later season. - I-3
I:all_aired(low): All scope episodes have aired and no future episode exists โ suppressed forhigh_riskscopes . - I-4
I:cooldown(low): No future episode exists and the last aired episode exceeded theseason_cooldown_daysthreshold โ also suppressed forhigh_riskscopes .
Medium-confidence I signals (I-1, I-2) can independently pass CompletionGuard; low-confidence I signals (I-3, I-4) must combine with L:target_satisfied to form a composite target_complete_signal .
L โ Local Library Target Satisfied#
check_l_signal_detail() checks whether locally downloaded episodes satisfy the subscription's target range. L is only evaluated when no blocking future episode is detected in scope . A lone L:target_satisfied signal has low confidence and is subject to policy restrictions (e.g., suppressed for high_risk scopes or scopes with fewer than 3 episodes) .
S โ Site Evidence#
_apply_site_signal() integrates torrent-site metadata (e.g., pack-complete titles, site-reported episode totals). S cannot independently complete a subscription โ it must combine with L:target_satisfied to form a composite medium-confidence signal . If the site reports more episodes than the current scope target, it can issue a S:site_total_ahead hard veto .
G โ Cadence Helper#
_cadence_expired() is an advisory flag attached to every CompletionEvidence that reaches _with_cadence(). It indicates that the broadcast cadence interval has elapsed since the last known episode. G is never used as a standalone completion signal; it informs timeout management in CompletionGuard.
Evaluation Order and Priority#
The pipeline follows a fixed exit-early cascade :
M hard veto โ immediate return (no completion)
F down veto โ immediate return (no completion)
E (+ F bypass check) โ return if E can bypass F
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
I, L, S evaluated
Target-complete composite (L + I-low, or L + S) built
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
unstable (F up) โ observation
high_completion (E) โ return
i_signal (medium) โ return
local_signal (L) โ return
none โ blocked
The CompletionGuard.handle() method then applies mode-based policy (strict / balanced / loose) on top of these evidence tiers .
Key Files#
| File | Purpose |
|---|---|
engine/pipeline.py | CompletionEvidencePipeline โ orchestrates signal evaluation |
engine/signals.py | M, E, I signal implementations |
engine/types.py | CompletionSignal, CompletionEvidence, SeasonScope dataclasses |
guard.py | CompletionGuard โ policy layer that acts on CompletionEvidence |