Add type-safe guard before LoggingLevel cast in LogControls

Validate the Select value against LOG_LEVELS before casting to
LoggingLevel, ensuring the compiler isn't silently bypassed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-04-18 19:47:03 -04:00
commit b068b564ab

View file

@ -73,7 +73,9 @@ export function LogControls({
data={LOG_LEVELS.map((level) => ({ value: level, label: level }))}
value={currentLevel}
onChange={(value) => {
if (value) onSetLevel(value as LoggingLevel);
if (value && LOG_LEVELS.includes(value as LoggingLevel)) {
onSetLevel(value as LoggingLevel);
}
}}
/>
<Button size="sm" onClick={() => onSetLevel(currentLevel)}>