[astro] Refresh zodiac handling#19830
Conversation
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
There was a problem hiding this comment.
Pull request overview
This PR refactors zodiac handling in the Astro binding, introducing modern Java time APIs and consolidating calculation methods while adding visual enhancements through icon support.
- Introduces
InstantAPI in favor ofCalendarfor time handling - Unifies zodiac calculation logic across Sun and Moon with new
ZodiacCalcclass - Adds comprehensive icon provider with SVG zodiac sign icons
Reviewed changes
Copilot reviewed 26 out of 52 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| DateTimeUtilsTest.java | Adds unit tests for new Instant-based utility methods |
| SunZodiacCalcTest.java | New test comparing old date-based vs new position-based zodiac calculation |
| MoonZodiacCalcTest.java | Moves moon zodiac test from MoonCalcTest to dedicated test class |
| zodiac*.svg | Adds 13 SVG icons for zodiac signs and default zodiac icon |
| channels.xml | Adds category for zodiac sign channel |
| astro.properties | Adds i18n entries for icon provider |
| PropertyUtils.java | Adds support for Instant type in state conversion |
| MathUtils.java | New utility class extracting common trigonometric functions |
| DateTimeUtils.java | Adds Instant-based methods and consolidates Julian date constants |
| AstroConstants.java | New class for common astronomical constants |
| ZodiacSign.java | Adds helper method for radians per zodiac sign |
| Zodiac.java | Refactors to include start/end Instant fields and validation |
| Sun.java/Moon.java | Changes zodiac field type from nullable SunZodiac to Zodiac |
| ZodiacCalc.java | New unified zodiac calculator using ecliptic longitude |
| SunCalc.java/MoonCalc.java/SeasonCalc.java | Refactors to use MathUtils and unified ZodiacCalc |
| Job.java/DailyJobSun.java/AstroThingHandler.java | Adds Instant-based job scheduling support |
| AstroIconProvider.java | New icon provider for dynamic zodiac sign icons |
| README.md | Documents available zodiac icons |
| NOTICE | Adds attribution for zodiac icon set |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I haven't studied the code, but I will just mention that this introduces a lot of possibilities for bugs. Are you sure that you want to do that in combination with other changes? I would think that moving the Both I've added warnings for the use of these defaults in the next version of the SAT plugin. It's not released yet, but the snapshot exists, so I would recommend using that for test-builds when trying to replace this, by using SAT plugin edit: Come to think of it, I'm not sure if |
|
I checked out this PR locally and ran the "new" SAT plugin, the results actually aren't bad (I don't know if any of the warnings stems from code from this PR):
|
lsiepel
left a comment
There was a problem hiding this comment.
Looked at allmost all files. Need another round to finish.
I did it with Zodiac on purpose because: |
I adressed those coming from this PR and some other but not all. |
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
0b22144 to
19b0b0a
Compare
Great, much fewer warnings now. I made #19866 to address the rest, but as always, there are complications. Why don't I ever learn not to stick my nose into such things 😉 |
In the Asto, there are many places where your nose can be sticked ! |
|
It seems like we missed something here - the introduction of public void schedule(Job job, Instant eventAt) {
long sleepTime = Instant.now().until(eventAt, ChronoUnit.MILLIS);
schedule(job, sleepTime);
logger.debug("Scheduled {} in {}ms (at {})", job, sleepTime, eventAt);
}What must be remembered with Further, if there are |
Good catch. |
I think we'll have to "accept" that logs are using the default timezone. Otherwise, we'll have to inject edit: The new SAT checks doesn't "ban" using the default time zone - as long as it's done explicitly. It only warns when it's used implicitly. |
|
For the logging brought up here, this should suffice I think: if (logger.isDebugEnabled()) {
logger.debug("Scheduled {} in {}ms (at {})", job, sleepTime, eventAt.atZone(ZoneId.systemDefault()));
}But, basically, all use of |
Brought your modification in astro_radiation PR |
* Refreshing zodiac handling Signed-off-by: gael@lhopital.org <gael@lhopital.org> Signed-off-by: Merlin10437 <152161717+Merlin10437@users.noreply.github.com>
This PR is a review of the Zodiac handling in the Astro Binding.
It adds an AstroIconProvider, furnishing appropriate icons for Zodiac signs.
It unifies Zodiac calc method for Sun and Moon. Unit tests comparing old method toward new method added.
It introduces usage of Instant toward Calendar and according unit tests.
Common astro constants, methods, extracted from xxxCalc classes into AstroConstants and MathUtils classes.
This PR holds many changes and serves the following goals:
I've tried to cover changes as possible as doable with tests to ensure no breaking change introduced.