feat(deps): migrate to SunCalc 2.0 (supersedes #47) - #55
Merged
Conversation
Supersedes Dependabot PR #47, which could not be merged as-is: suncalc 2.0 is a precision-focused rewrite with breaking changes to units and API shape, so it needs code changes rather than a version bump. - ESM named exports (no default): `import * as SunCalc` at all three call sites (SunCard, MoonCard, console page) - Angles are now degrees, not radians: drop the `* 180 / Math.PI` conversion in SunCard at both the current-altitude readout and the 61-sample arc loop. Left in place this scales ~45deg to ~2578 and pins every arc sample to the top of the card, silently flattening the astronomical curve into a straight line — no type error and no test failure - `getTimes` now returns `Date | null` per event (polar day/night); guard the sunrise/sunset pair and fall back to the card's existing "no data" branch. `goldenHour` stays nullable, so `fmtTime` now renders an em-dash for absent times, matching MoonCard's convention - `getMoonTimes` dropped its `inUTC` arg and scans the UTC calendar day; pass local midnight so the window stays pinned to today's local date instead of rolling over to tomorrow's rise/set after 20:00 EDT - Drop `@types/suncalc`; v2 ships its own typings Azimuth also changed to north-based, but nothing in the app reads azimuth. `getMoonIllumination` gained a `waxing` flag; `getPhaseName` already derives waxing/waning from the phase value, so it is left alone. Verified: tsc, eslint, 601 tests, production build. Since the suite mocks SunCalc entirely it cannot catch the unit change, so the arc math was checked against the real library (peak altitude matches 90 - lat + declination across solstices) and every rendered Sun/Lunar value was cross-checked against SunCalc output on the live Pi data. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0151MxVqVhjffC7xAThxpyV2
timothybrown
added a commit
that referenced
this pull request
Sep 5, 2026
CalVer bump covering the SunCalc 2.0 migration (#55) and the minor-and-patch group + advisory-floor remediation (#56). backend/uv.lock records the editable package's own version, so it is refreshed alongside pyproject.toml — otherwise `uv sync --frozen` fails in CI and on the Pi deploy. The lock diff is that single line; no dependency churn. Claude-Session: https://claude.ai/code/session_0151MxVqVhjffC7xAThxpyV2 Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.
Supersedes #47, which cannot be merged as a plain version bump — suncalc 2.0 is a precision-focused rewrite with breaking changes to units and API shape.
Closes #47.
What changed
tsc(TS1192)SunCard.tsx,MoonCard.tsx,console/page.tsxSunCard.tsx— current altitude + 61-sample arc loopgetTimesreturnsDate | nullper eventtscSunCard.tsx,console/page.tsxgetMoonTimesdroppedinUTC, scans UTC dayMoonCard.tsx@types/suncalcThe two middle-column "nothing" rows are the reason this needed a branch rather than a rubber stamp.
Degrees vs radians. Left in place, the old
* 180 / Math.PIscales a real 45° altitude to ~2578.altToY'sdeg / 90then clamps every arc sample to the top of the card, silently flattening the astronomical sun curve into a straight line. No type error, no test failure.Moon times. v2 scans the UTC calendar day of the instant it is given. Passing
nowmakes the card flip to tomorrow's moonrise/set at 20:00 EDT (00:00 UTC) every evening. Passing local midnight keeps the window on today's local date.Azimuth also became north-based, but nothing in the app reads azimuth.
getMoonIlluminationgained awaxingflag;getPhaseNamealready derives waxing/waning from the phase value, so it is unchanged.Verification
tsc✓ ·eslint✓ · 601 tests ✓ ·next build✓The suite mocks SunCalc entirely, so it is no evidence for the unit change. Verified independently instead:
90 − lat + declinationat 39.125°N: 57.5° today, 74.3° at summer solstice, 27.4° at winter. Arc anchors at the horizon both ends; seasonal height variation preserved.🤖 Generated with Claude Code
https://claude.ai/code/session_0151MxVqVhjffC7xAThxpyV2