fix: don't publish an impossible max temperature - #47
Merged
Conversation
/api/summary served max_temp_c 27058405379 on its first day in production, while no drive in the fleet was above 46 °C. The bad value comes from a row in temperature_history, not from this handler — but a dashboard that paints that number lies with confidence, so the endpoint stops repeating it. Clamps to a physically possible range (0 < t <= 120 °C; drives shut themselves down long before that). Out of range reports 0, which the widget renders as "no data" instead of a fabricated reading. This does NOT fix the corrupt row — that belongs in the temperature ingest path and needs its own look. It stops the corruption from reaching a screen someone trusts. go test ./... 13 packages, 0 failures Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🐳 Preview Images Built!
These preview images can be used for testing before merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lo que pasó
/api/summarysirvió esto en su primer día en producción:Mientras tanto, la flota real:
El valor corrupto viene de una fila de
temperature_history, no de este handler. Pero un dashboard que pinta ese número miente con aplomo, así que el endpoint deja de repetirlo.El fix
Acota a un rango físicamente posible (
0 < t <= 120 °C— los discos se apagan solos mucho antes). Fuera de rango reporta0, que el widget muestra como "sin dato" en vez de una lectura inventada.Lo que NO arregla
La fila corrupta sigue ahí. Eso pertenece a la ruta de ingesta de temperatura y merece su propio análisis. Esto sólo impide que la corrupción llegue a una pantalla en la que alguien confía.
Nota sobre los 13 discos "críticos"
Al revisar esto comprobé el otro dato que parecía sospechoso: los
critical: 13son correctos — coinciden exactamente con lo que devuelve/api/smart/health/allautenticado. No es un bug del resumen.🤖 Generated with Claude Code