Phase 2: Refactor Logs cluster to MCP SDK types#1215
Conversation
Replace string-typed log levels with SDK LoggingLevel across the Logs group components and LoggingScreen. - LogControls: type currentLevel, visibleLevels, and all handlers with LoggingLevel instead of string; type LOG_LEVELS array and LEVEL_COLORS record with LoggingLevel - LogStreamPanel: type visibleLevels as Record<LoggingLevel, boolean> instead of Record<string, boolean> - LoggingScreen: type currentLevel, onSetLevel, visibleLevels state, and toggle handlers with LoggingLevel; extract NO_LEVELS_VISIBLE as a module-level constant - Stories already used LoggingLevel literals; updated type annotations to use Record<LoggingLevel, boolean> - No ConnectedView story changes needed (already passes valid LoggingLevel values) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 42s —— View job Code Review
Clean, focused refactoring. The changes are minimal, consistent, and improve type safety throughout the logging cluster. A few observations:
|
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>
|
Addressed in b068b56:
|
Summary
currentLevel,visibleLevels, and all handler params withLoggingLevelinstead ofstring;LOG_LEVELSarray andLEVEL_COLORSrecord properly typedvisibleLevelsasRecord<LoggingLevel, boolean>currentLevel,onSetLevel, internalvisibleLevelsstate and toggle handlers withLoggingLevel; extractsNO_LEVELS_VISIBLEas module-level constantThis is the smallest cluster — the
LogEntryelement was already refactored in Phase 1 to useLoggingMessageNotification["params"]andLoggingLevelfrom the SDK, so the group/screen layer just needed its type signatures tightened to match.No ConnectedView story changes needed — it already passes valid
LoggingLevelliterals.Test plan
npm run format— passesnpm run lint— passesnpm run build(includestsc -b) — passes🤖 Generated with Claude Code