Skip to content

refactor: Standardize time handling using Instant and Clock - #752

Merged
haiphucnguyen merged 1 commit into
mainfrom
feature/improvements
Oct 6, 2026
Merged

haiphucnguyen merged 1 commit into
mainfrom
feature/improvements

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator

Summary

  • Migrates UserProfile domain model fields (createdAt, updatedAt) from LocalDateTime to Instant.
  • Updates repository logic to utilize kotlin.time.Clock and Instant for persistence and default values.
  • Simplifies TimeUtil and removes support for legacy space-separated date formats.
  • Adjusts unit tests to use kotlin.time.Clock for accurate temporal testing.

Related Issue(s)

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Refactor (no functional change)
  • 🧪 Tests
  • 🔧 Chore / tooling / CI

What Changed & Why

How to Test

./gradlew test

Screenshots / Recordings (if applicable)

Checklist

  • I have read the CONTRIBUTING guide
  • My branch is up to date with main
  • I ran ./gradlew spotlessApply and ./gradlew detekt locally
  • I ran ./gradlew test and all tests pass
  • I added/updated tests for my changes (if applicable)
  • I added/updated documentation (if applicable)
  • My commits are signed off (DCO) — git commit -s
  • This PR is focused on a single feature/fix

Additional Notes

Copilot AI balanced review requested due to automatic review settings October 5, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Legacy offset-free profile timestamps are incorrectly reinterpreted as UTC, causing time shifts outside UTC.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
What changed in this PR

Standardizes user-profile timestamps on kotlin.time.Instant and updates supporting persistence and tests.

Changes:

  • Migrates profile timestamps and repository persistence to Instant.
  • Removes obsolete time parsing and Git utilities.
  • Updates tests and native-image metadata.
File Description
UserProfile.kt Migrates profile timestamps to Instant.
TimeUtil.kt Removes LocalDateTime parsing.
Git.kt Deletes the unused Git utility.
UserProfileRepository.kt Reads and writes profile timestamps as instants.
TokenAwareSummarizingMemoryTest.kt Uses Kotlin Clock.
TurnTimelineEntryAppendDedupedTest.kt Stabilizes tool timestamps.
reachability-metadata.json Refreshes native-image metadata.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

- Replaces all usages of `java.time.*` and `java.util.Date` with `kotlin.time.Instant` and `kotlin.time.Clock`.
- Standardizes timestamp representation across all shared models, DTOs, and domain layers.
- Updates database schemas (SQLDelight) and corresponding repository adapters to utilize `kotlin.time.Instant` for persistence.
- Updates utility functions and data mapping logic to ensure cross-platform time consistency.
@haiphucnguyen
haiphucnguyen merged commit e5622e0 into main Oct 6, 2026
8 of 10 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/improvements branch October 6, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants