diff --git a/packages/api/src/routes/transceivers.ts b/packages/api/src/routes/transceivers.ts index e17d2a7..8cff948 100644 --- a/packages/api/src/routes/transceivers.ts +++ b/packages/api/src/routes/transceivers.ts @@ -70,8 +70,9 @@ transceiverRouter.get("/:id", async (req: Request, res: Response) => { is_same_product: true, })); - // Market comparison: technically equivalent products from other vendors - // Same form_factor + speed_gbps + reach within 20% tolerance, different vendor + // Market comparison: strictly equivalent products from other vendors. + // Require hard technical evidence; unknown reach/fiber data must not act as + // a wildcard, otherwise breakout/AOC/cable variants leak into optic matches. // Only real scraped prices (url IS NOT NULL), last 30 days, max 1 per source vendor const comparableResult = await pool.query( `SELECT DISTINCT ON (po.source_vendor_id) @@ -83,12 +84,32 @@ transceiverRouter.get("/:id", async (req: Request, res: Response) => { t2.fiber_type AS comp_fiber_type, t2.wavelengths AS comp_wavelengths FROM transceivers t1 JOIN transceivers t2 ON ( - t2.form_factor = t1.form_factor + ( + t2.form_factor = t1.form_factor + OR ( + t1.form_factor IN ('QSFP-DD', 'QSFP-DD800') + AND t2.form_factor IN ('QSFP-DD', 'QSFP-DD800') + ) + ) AND t2.speed_gbps = t1.speed_gbps + AND t1.reach_meters IS NOT NULL AND t1.reach_meters > 0 + AND t2.reach_meters IS NOT NULL AND t2.reach_meters > 0 + AND LEAST(t1.reach_meters, t2.reach_meters)::numeric / GREATEST(t1.reach_meters, t2.reach_meters) >= 0.85 + AND NULLIF(t1.fiber_type, '') IS NOT NULL + AND NULLIF(t2.fiber_type, '') IS NOT NULL + AND LOWER(t2.fiber_type) = LOWER(t1.fiber_type) + AND substring(t1.wavelengths from '(\\d{3,4})') IS NOT NULL + AND substring(t2.wavelengths from '(\\d{3,4})') IS NOT NULL + AND ABS((substring(t1.wavelengths from '(\\d{3,4})'))::int - (substring(t2.wavelengths from '(\\d{3,4})'))::int) <= 15 AND ( - t1.reach_meters IS NULL OR t1.reach_meters = 0 - OR t2.reach_meters IS NULL OR t2.reach_meters = 0 - OR ABS(t2.reach_meters - t1.reach_meters) <= GREATEST(t1.reach_meters, 1) * 0.25 + ( + (t1.part_number || ' ' || COALESCE(t1.standard_name, '') || ' ' || COALESCE(t1.category, '')) !~* '(breakout|aoc|dac|twinax|active optical cable)' + AND (t2.part_number || ' ' || COALESCE(t2.standard_name, '') || ' ' || COALESCE(t2.category, '')) !~* '(breakout|aoc|dac|twinax|active optical cable)' + ) + OR ( + (t1.part_number || ' ' || COALESCE(t1.standard_name, '') || ' ' || COALESCE(t1.category, '')) ~* '(breakout|aoc|dac|twinax|active optical cable)' + AND (t2.part_number || ' ' || COALESCE(t2.standard_name, '') || ' ' || COALESCE(t2.category, '')) ~* '(breakout|aoc|dac|twinax|active optical cable)' + ) ) AND t2.id != t1.id ) diff --git a/sync/CURRENT.md b/sync/CURRENT.md index 3611535..6987b98 100644 --- a/sync/CURRENT.md +++ b/sync/CURRENT.md @@ -1,9 +1,47 @@ # Current TIP Sync State -Updated: 2026-05-09 13:54 UTC +Updated: 2026-05-09 14:08 UTC ## Newest Work +- FS.com `QDD-2FR4-800G` false comparable correction on 2026-05-09: + - operator spotted that the dashboard showed invalid comparable products for FS.com `QDD-2FR4-800G` + - wrong examples: + - Flexoptix `DQ.2A858HG.z`: actually `800G QSFP-DD to 2x QSFP112 Breakout AOC`, MMF, 1-30m, not a 2km SMF FR4 transceiver + - NADDOD `QDD-800LPO-2DR4`: 500m, not 2km + - root cause: + - FS.com `QDD-2FR4-800G` had `reach_label=2km` but `reach_meters=0` + - API comparable-product SQL treated unknown reach as a wildcard, so non-1:1 products leaked into the dashboard comparison section + - live DB correction: + - `QDD-2FR4-800G` + - `form_factor=QSFP-DD` + - `speed=800G` + - `speed_gbps=800` + - `reach_label=2km` + - `reach_meters=2000` + - `fiber_type=SMF` + - `wavelengths=1310` + - `standard_name=800G QSFP-DD 2FR4` + - remains fully verified + - API correction: + - `packages/api/src/routes/transceivers.ts` + - comparable products now require hard reach evidence on both sides + - reach ratio must be at least `0.85` + - fiber type must match exactly + - primary wavelength must exist on both sides and be within `15nm` + - breakout/AOC/DAC/cable products can only compare to other breakout/AOC/DAC/cable products + - `QSFP-DD` and `QSFP-DD800` are treated as same form-factor family for 800G-class comparisons + - deployment: + - copied API route to Erik + - `pnpm -C packages/api build` passed on Erik + - `pm2 restart tip-api` completed, `tip-api` online + - health: + - public TIP health after restart: `healthy`, load `ok`, memory `13%` + - truth: + - `DQ.2A858HG.z` must never be shown as 1:1 comparable for `QDD-2FR4-800G` + - a 500m NADDOD LPO/2DR4 product must not be shown as 2km comparable + - unknown reach must never act as wildcard in final product comparison + - FS.com 1.6T DR8/2FR4 source correction on 2026-05-09: - operator spotted that FS.com has two distinct 1.6T OSFP variants on the same family: - `OSFP-DR8-1.6T-FL`: 500m, DR8, SMF diff --git a/sync/history/2026-05-09-fscom-qdd-2fr4-false-comparable-fix.md b/sync/history/2026-05-09-fscom-qdd-2fr4-false-comparable-fix.md new file mode 100644 index 0000000..ebae1ee --- /dev/null +++ b/sync/history/2026-05-09-fscom-qdd-2fr4-false-comparable-fix.md @@ -0,0 +1,75 @@ +# FS.com QDD-2FR4 False Comparable Fix + +Date: 2026-05-09 +Actor: Codex + +## Operator Finding + +The dashboard showed invalid comparable products for FS.com `QDD-2FR4-800G`: + +- Flexoptix `DQ.2A858HG.z` + - actually `800G QSFP-DD to 2x QSFP112 Breakout AOC` + - MMF + - 1-30m + - not a 2km SMF FR4 transceiver +- NADDOD `QDD-800LPO-2DR4` + - 500m + - not 2km + +The operator was correct: these are not 1:1 equivalents. + +## Root Cause + +FS.com `QDD-2FR4-800G` had: + +- `reach_label=2km` +- `reach_meters=0` + +The API comparable SQL treated unknown reach as a wildcard, so products with the same form factor and speed could leak into the comparison section even when reach/fiber/protocol differed. + +## Live DB Correction + +Corrected `FS.COM QDD-2FR4-800G`: + +- `form_factor=QSFP-DD` +- `speed=800G` +- `speed_gbps=800` +- `reach_label=2km` +- `reach_meters=2000` +- `fiber_type=SMF` +- `wavelengths=1310` +- `standard_name=800G QSFP-DD 2FR4` +- fully verified remains true + +## API Correction + +Updated `packages/api/src/routes/transceivers.ts`. + +Comparable products now require: + +- form factor exact, except `QSFP-DD` and `QSFP-DD800` are treated as one 800G family +- same `speed_gbps` +- known reach on both sides +- reach ratio at least `0.85` +- known fiber on both sides +- same fiber type +- primary wavelength on both sides +- wavelength difference no more than `15nm` +- breakout/AOC/DAC/cable products only compare to breakout/AOC/DAC/cable products + +This prevents unknown reach from acting as a wildcard. + +## Deployment + +On Erik: + +- copied API route +- `pnpm -C packages/api build` passed +- `pm2 restart tip-api` completed +- public health after restart: healthy, load ok, memory about 13% + +## Lesson For TIPLLM + +Never accept dashboard/API comparable output as source truth if any core field is unknown. + +For final product comparisons, missing reach, fiber or wavelength evidence must exclude a candidate unless a dedicated reviewed equivalence exists. Breakout/AOC/DAC/cable products must not compare to pluggable optical transceivers unless both sides are explicitly the same breakout/cable class.