-
Notifications
You must be signed in to change notification settings - Fork 21
fix: more recent vallis anchor #778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Contributed by mettwasser in discord
📝 WalkthroughWalkthroughUpdated the VallisCycle model: the fixed start timestamp (lStart) was changed to February 4, 2026 19:46:48 UTC and the time-difference computation in getCurrentCycle was corrected to use lStart.getTime() instead of lStart.getMilliseconds(). No other control flow changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/models/VallisCycle.ts (1)
38-38:⚠️ Potential issue | 🔴 CriticalCritical bug:
getMilliseconds()should begetTime().
Date.prototype.getMilliseconds()returns only the millisecond component of the date (0–999), not the epoch timestamp. SincelStarthas no fractional seconds,.getMilliseconds()returns0for both the old and new anchor dates, making the entire anchor constant irrelevant. The calculation effectively becomesDate.now() % loopTime.This is the actual root cause of the drift the PR intends to fix. Without correcting this line, the anchor update on Line 5 has no effect.
🐛 Proposed fix
- const sinceLast = (Date.now() - lStart.getMilliseconds()) % loopTime; + const sinceLast = (Date.now() - lStart.getTime()) % loopTime;
🤖 Fix all issues with AI agents
In `@lib/models/VallisCycle.ts`:
- Line 5: The anchor constant lStart is fine but the code that reads its numeric
epoch uses lStart.getMilliseconds() (see usage of lStart) which returns only the
milliseconds part (0) instead of the full epoch; change that call to
lStart.getTime() so all cycle math uses the full timestamp, then verify the
provided timestamp '2026-02-04T19:46:48Z' truly aligns to an in-game warm↔cold
boundary so reported cycle times won't be shifted.
🧹 Nitpick comments (1)
lib/models/VallisCycle.ts (1)
10-10: Nit: Typo in interface name —CurrnetCycle→CurrentCycle.Pre-existing, but since you're touching this file: the interface is misspelled. Also, the JSDoc on Line 66 says "Earth Day/Night Cycle" and Line 82 says "cetus cycle" — both should reference Orb Vallis.
|
🎉 This PR is included in version 5.2.16 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What did you fix?
Contributed by mettwasser in discord
corrects the occasional drift
Reproduction steps
Evidence/screenshot/link to line
Considerations
Summary by CodeRabbit
Bug Fixes
Chores
Impact: Cycle start/end and time-until updates may now display corrected values.