Fix parsing of timestamps with newer lava#33
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts JobLogEntry.dt deserialization to handle newer LAVA log timestamps that include an explicit UTC offset (e.g. +00:00), while preserving the existing NaiveDateTime API exposed by this crate.
Changes:
- Added a custom Serde deserializer that accepts both
NaiveDateTimeandDateTime<Utc>and normalizes toNaiveDateTime. - Annotated
JobLogEntry.dtto use the new deserializer. - Added a unit test asserting that timestamps with and without
+00:00deserialize to the sameNaiveDateTime.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In the latest version of lava the dt field is created with atetime.datetime.now(datetime.UTC).isoformat() rather then datetime.datetime.utcnow().isoformat(). This causes the timezone specifier to be added (always +00:00 as the logs are UTC)'. From a Rust perspective the former is a `NaiveDateTime` (no timezone) while the later is a `DateTime<Utc>`. Adjust the parsing to try both, but convert to NaiveDateTime to keep the same user API. In future potentially this could be moved to always be a DateTime to make it more clear to the end-user what the stamp is
3e01455 to
5aab142
Compare
pawiecz
approved these changes
Jun 23, 2026
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.
In the latest version of lava the dt field is created with atetime.datetime.now(datetime.UTC).isoformat() rather then datetime.datetime.utcnow().isoformat(). This causes the timezone specifier to be added (always +00:00 as the logs are UTC)'.
From a Rust perspective the former is a
NaiveDateTime(no timezone) while the later is aDateTime<Utc>. Adjust the parsing to try both, but convert to NaiveDateTime to keep the same user API. In future potentially this could be moved to always be a DateTime to make it more clear to the end-user what the stamp is