fix(frontend): нейтральный fallback ещё в 4 enum-lookup-местах (follow-up #2445-B2/B3) #2452

Open
opened 2026-07-05 19:03:49 +00:00 by bot-backend · 0 comments
Collaborator

Follow-up от PR #2451 (epic #2445, B2/B3). Ревьюер нашёл тот же класс бага (object-literal enum-lookup без runtime-guard → краш при недостающем ключе из-за schema-drift/partial-deploy) ещё в 4 site-finder компонентах, не вошедших в исходную аудит-выборку:

  • frontend/src/components/site-finder/BestLayoutsBlock.tsx:66CONFIDENCE_STYLES[dq.confidence] (unguarded)
  • frontend/src/components/site-finder/analysis/ForecastChart.tsx:178CONFIDENCE_RU[f.confidence]
  • frontend/src/components/site-finder/compare/CompareTable.tsx:175CONFIDENCE_RU[c.confidenceLabel] (частично прикрыт c.confidenceLabel ? truthiness-гейтом → рискует только present-but-out-of-union значение, ниже риск)
  • frontend/src/components/site-finder/ptica/compare/PticaCompare.tsx:151 — то же

Scope

Применить тот же ?? нейтральный fallback-паттерн, что в #2451 (ParcelDrawer STATUS_COLORS[...] ?? '#73767E'). Нейтральный default (серый/«—»), не семантически-нагруженный. Добавить not.toThrow тесты для out-of-union.

Estimated: S (1 заход, 4 маленькие правки в непересекающихся файлах).

Refs #2445, #2451

Follow-up от PR #2451 (epic #2445, B2/B3). Ревьюер нашёл тот же класс бага (object-literal enum-lookup без runtime-guard → краш при недостающем ключе из-за schema-drift/partial-deploy) ещё в 4 site-finder компонентах, не вошедших в исходную аудит-выборку: - `frontend/src/components/site-finder/BestLayoutsBlock.tsx:66` — `CONFIDENCE_STYLES[dq.confidence]` (unguarded) - `frontend/src/components/site-finder/analysis/ForecastChart.tsx:178` — `CONFIDENCE_RU[f.confidence]` - `frontend/src/components/site-finder/compare/CompareTable.tsx:175` — `CONFIDENCE_RU[c.confidenceLabel]` (частично прикрыт `c.confidenceLabel ?` truthiness-гейтом → рискует только present-but-out-of-union значение, ниже риск) - `frontend/src/components/site-finder/ptica/compare/PticaCompare.tsx:151` — то же ## Scope Применить тот же `?? нейтральный` fallback-паттерн, что в #2451 (ParcelDrawer `STATUS_COLORS[...] ?? '#73767E'`). Нейтральный default (серый/«—»), не семантически-нагруженный. Добавить not.toThrow тесты для out-of-union. Estimated: S (1 заход, 4 маленькие правки в непересекающихся файлах). Refs #2445, #2451
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#2452
No description provided.