aboutsummaryrefslogtreecommitdiffstats
path: root/lib/weather.lua
AgeCommit message (Collapse)AuthorFilesLines
2026-09-17docs: note that sun_t passes a NaN timestamp throughDanilo M.1-0/+5
NaN is a number, so the type guard admits it, and every comparison against NaN is false, so neither clamp catches it and the function returns NaN. Left unguarded on purpose. No caller can produce it: parse() matches %d+ for the sun times and `now` is os.time(). If one ever did, Cairo ignores a NaN coordinate, so the arc would lose its dot rather than the dashboard going blank. A ponytail: comment names the ceiling and where the guard would go. Found while probing the committed code, not by the tests, which do not cover NaN. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add sun position along the daylight arcDanilo M.1-0/+24
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17docs: explain the Beaufort index arithmetic and why compass existsDanilo M.1-0/+9
Two comments, no behaviour change. `force - 1` reads as an off-by-one until you know the scale starts at 0 while ipairs starts at 1, so the loop index is already force + 1. Said plainly now, along with why the fall-through returns 12. compass() has no caller: the card draws arrow(). It is kept because it shares arrow()'s binning exactly, so testing both pins that shared logic from two angles, and switching the card to "S 9 km/h" becomes a one-word change. Without this note the next reader finds an unused function and has to reconstruct the reasoning. Raised by code review as the only two points worth acting on; no Critical or Important issues were found. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add wind conversion, Beaufort and compass tablesDanilo M.1-0/+41
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17fix: guard a nil timestamp in the icon lookupDanilo M.1-1/+5
icon(800, nil, 1500, 1900) compared nil against a number and raised, which in this project is a blank dashboard with no message. The module's own header promises nothing raises, and is_day() already guards the same case, so the inconsistency was the bug. Not reachable from the widget as written: it passes os.time(), and parse() refuses a response without sunrise and sunset, so no caller can currently produce the failing combination. Fixed anyway, because the contract is what future callers will rely on and the fix is one word. The test file also now says why the codepoint VALUES carry no assertion: comparing M.ICON.snow against a literal would only prove the escape was typed twice. Whether E31A draws a snow cloud is what the glyph sheet is for, and mutation testing confirms the assertions cannot see it. Found by code review. The same fix is applied to the plan, so Tasks 2-5 inherit the guarded version. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add OWM condition id to icon mappingDanilo M.1-0/+62
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>