-- sql/134-transceiver-ff-speed-errors.sql
-- LUPO-34: data-quality curation view for physically-impossible form_factor x speed
-- combinations. An SFP-class module (SFP/SFP+/SFP28/XFP/GBIC/CSFP) tops out at 25-28G,
-- so speed_gbps >= 50 on such a form factor is a misclassification (surfaced in Lupo's
-- per-SKU price panel as flagged rows). Evidence-based (physics), NOT name-derived.
-- Read-only; the exact corrected speed needs the vendor datasheet (data-owner task).
-- SFP-DD / SFP112 legitimately carry >=100G and are intentionally NOT flagged.
create or replace view v_transceiver_ff_speed_errors as
select t.id, v.name as vendor, t.part_number, t.speed_gbps, t.form_factor
from transceivers t
left join vendors v on v.id = t.vendor_id
where upper(coalesce(t.form_factor, '')) in ('SFP', 'SFP+', 'SFP28', 'XFP', 'GBIC', 'CSFP')
  and t.speed_gbps >= 50;

comment on view v_transceiver_ff_speed_errors is
  'LUPO-34: SFP-class parts with an impossible speed (>=50G). Data-quality curation list; exact correction needs the datasheet.';

-- Usage:
--   select count(*) from v_transceiver_ff_speed_errors;                       -- total to curate
--   select vendor, count(*) from v_transceiver_ff_speed_errors group by 1 order by 2 desc;
