# ECP-0090: PAT-Derived Broadcast Identity Promotion Status: Implemented ## Decision Extend default discovery identity synthesis to probe early MPEG-TS packets for Program Association Table (PAT) data and use that to strengthen broadcast-scoped stream IDs. Current rule: - If source/channel metadata already yields a usable broadcast identity, use it. - If transport probing finds PAT data, fill missing `transport_stream_id` and `program_number`. - If PAT shows exactly one non-zero program, that program is eligible for broadcast-scoped convergence. - If PAT is ambiguous (multiple non-zero programs), do not guess; keep `program_number` unset and fall back to source scope when needed. - If the probe sees ATSC PSIP traffic, label the standard as `atsc`; otherwise use a generic `mpegts` fallback when PAT is the only signal. ## Motivation ECP-0089 fixed the first duplication bug by preferring channel metadata over source-local IDs. That still left a hole: - raw TS sources without lineup metadata could not converge, - channel metadata could be incomplete or inconsistent, - and weak identity inputs risked accidental convergence on the wrong broadcast. PAT-derived identity gives us a stronger on-wire fingerprint without waiting for full PSIP/VCT parsing. ## Scope In scope: - PAT parsing in `ec-ts` - bounded transport probing for `tsid` / single-program extraction - source integration for raw TS inputs and HDHomeRun enrichment - tests that enforce "single program promotes, ambiguous stream does not" Out of scope: - full ATSC VCT/MGT descriptor parsing - DVB service table parsing - cryptographic origin authentication for discovery announcements ## Alternatives considered - Keep trusting channel metadata only. Rejected because it leaves raw TS paths weak and incomplete. - Always promote from PAT even with multiple programs. Rejected because it guesses the channel and increases junk-collision risk. - Require manual `--stream-id` for TS inputs. Rejected because it pushes canonicalization burden onto operators. ## Rollout / Reversibility - Additive and reversible: explicit `--stream-id` still overrides everything. - Roll back by removing PAT probing and returning to metadata-only promotion. - Future PSIP/VCT work can refine the broadcast identity without changing the override surface.