Skip to content

Replace TimeProvider with kotlin.time.Instant#32

Merged
linroid merged 4 commits intomainfrom
refactor/instant-types
Feb 10, 2026
Merged

Replace TimeProvider with kotlin.time.Instant#32
linroid merged 4 commits intomainfrom
refactor/instant-types

Conversation

@linroid
Copy link
Owner

@linroid linroid commented Feb 10, 2026

Summary

  • Remove TimeProvider wrapper, use Clock.System.now() directly
  • Change createdAt/updatedAt fields from Long to kotlin.time.Instant in TaskRecord and DownloadTask
  • kotlin.time.Instant has built-in @Serializable support, no custom serializer needed
  • Update SqliteTaskStore to convert between Instant and epoch millis for SQLite storage

Test plan

  • All library modules build successfully (core, ktor, kermit, sqlite)
  • Verify TaskRecordTest and InMemoryTaskStoreTest pass with Instant types
  • Verify serialization round-trip works correctly

🤖 Generated with Claude Code

linroid and others added 2 commits February 10, 2026 10:53
Eliminate the flat `internal/` and `model/` packages in favor of
domain-based sub-packages that reflect actual responsibility:

- `task/` — DownloadTask, TaskStore, TaskRecord, TaskState, InMemoryTaskStore
- `segment/` — Segment, SegmentCalculator, SegmentDownloader
- `engine/` — HttpEngine, DownloadCoordinator, RangeSupportDetector, ServerInfo
- `file/` — FileAccessor, FileNameResolver, DefaultFileNameResolver, PathSerializer
- `log/` — Logger, KDownLogger
- root — KDown, DownloadConfig, DownloadRequest, DownloadProgress, DownloadState

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the TimeProvider wrapper and use Clock.System.now() directly.
Change createdAt/updatedAt fields from Long to kotlin.time.Instant,
which has built-in serialization support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Base automatically changed from refactor/domain-packages-and-instant-types to main February 10, 2026 02:58
@claude
Copy link

claude bot commented Feb 10, 2026

Code Review

CLAUDE.md Documentation Issue

The package structure documentation in .claude/CLAUDE.md needs to be updated. Line 166 still references the now-deleted TimeProvider:

https://github.com/linroid/KDown/blob/1377888f685a23e3df158a59daa8e279f5b82c01/.claude/CLAUDE.md#L165-L167

The current package structure line includes:

download/ (TimeProvider)

Since TimeProvider has been completely removed in this PR and replaced with kotlin.time.Instant, the package structure documentation should be updated to remove this reference.

Suggested fix:

Remove , download/ (TimeProvider) from the package structure line. The updated line should read:

- Package structure: root (KDown, DownloadConfig, DownloadRequest, DownloadProgress, DownloadState), `task/` (DownloadTask, TaskStore, InMemoryTaskStore, TaskRecord, TaskState), `segment/` (Segment, SegmentCalculator, SegmentDownloader), `engine/` (HttpEngine, DownloadCoordinator, RangeSupportDetector, ServerInfo), `file/` (FileAccessor, FileNameResolver, DefaultFileNameResolver, PathSerializer), `log/` (Logger, KDownLogger), `error/` (KDownError)

Reference: .claude/CLAUDE.md - Architecture Patterns

@linroid
Copy link
Owner Author

linroid commented Feb 10, 2026

@claude Fix PR reviews

@claude
Copy link

claude bot commented Feb 10, 2026

Claude finished @linroid's task in 59s —— View job


Fixed PR Review Issues ✓

Tasks:

  • Read .claude/CLAUDE.md to verify the TimeProvider reference issue
  • Remove download/ (TimeProvider) from package structure documentation
  • Commit and push the fix to the PR branch

Summary:
Successfully removed the outdated download/ (TimeProvider) reference from the package structure documentation in .claude/CLAUDE.md (line 166). Since TimeProvider was completely removed in this PR and replaced with kotlin.time.Instant, the documentation now accurately reflects the current codebase structure.

Changes:

  • Updated .claude/CLAUDE.md:166 to remove , download/ (TimeProvider) from the package structure list
  • Committed and pushed to refactor/instant-types branch

| Branch: refactor/instant-types

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

Test Results

131 tests  ±0   131 ✅ ±0   0s ⏱️ ±0s
 14 suites ±0     0 💤 ±0 
 14 files   ±0     0 ❌ ±0 

Results for commit 7adc4cd. ± Comparison against base commit 2001a6e.

♻️ This comment has been updated with latest results.

TimeProvider has been removed in this PR and replaced with kotlin.time.Instant.

Co-authored-by: Lin Zhang <linroid@users.noreply.github.com>
@claude
Copy link

claude bot commented Feb 10, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@linroid linroid merged commit 959b52c into main Feb 10, 2026
7 checks passed
@linroid linroid deleted the refactor/instant-types branch February 10, 2026 03:10
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.

1 participant