Skip to content

feat: ZonedDateTimeStrategy#95

Merged
MessiasLima merged 6 commits into
mainfrom
opencode/issue65-20260701161527
Jul 1, 2026
Merged

feat: ZonedDateTimeStrategy#95
MessiasLima merged 6 commits into
mainfrom
opencode/issue65-20260701161527

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Implemented the ZonedDateTimeStrategy feature.

Changes made:

  • New: core/src/main/kotlin/dev/appoutlet/some/config/ZonedDateTimeStrategy.kt

    • Sealed interface with variants: Default, NearPast, NearFuture, DistantPast, DistantFuture, and Range(min, max, zoneId?).
    • Range validates min <= max and throws IllegalArgumentException with a clear message.
    • Companion default returns Default.
  • Updated: core/src/main/kotlin/dev/appoutlet/some/resolver/JavaZonedDateTimeResolver.kt

    • Now reads the active ZonedDateTimeStrategy from the StrategyProvider.
    • Generates instants within the selected window; Range bounds are inclusive.
    • Uses the supplied ZoneId for Range, otherwise a random available JVM ZoneId.
    • Preserves historical full-range behavior for Default.
    • Added an injectable Clock (defaulting to system UTC) for deterministic “now”-based tests.
  • Updated: core/src/main/kotlin/dev/appoutlet/some/config/SomeConfig.kt

    • Passes strategyProvider to JavaZonedDateTimeResolver.
  • New tests: core/src/test/kotlin/dev/appoutlet/some/config/ZonedDateTimeStrategyTest.kt

    • Covers default, valid/invalid Range construction, custom zone, and shared strategy key.
  • Updated tests: core/src/test/kotlin/dev/appoutlet/some/resolver/JavaZonedDateTimeResolverTest.kt

    • Covers each strategy variant, inclusive Range bounds, fixed vs random zones, pinned instant, and the someSetup { strategy(...) } registration path.

Verification:

./gradlew test --rerun-tasks

All tests pass (core, android, and kotest modules).

Closes #65

New%20session%20-%202026-07-01T16%3A15%3A26.737Z
opencode session  |  github run

Co-authored-by: MessiasLima <MessiasLima@users.noreply.github.com>
@MessiasLima MessiasLima changed the title Added ZonedDateTimeStrategy with full tests. feat: ZonedDateTimeStrategy Jul 1, 2026
@MessiasLima MessiasLima merged commit db352ed into main Jul 1, 2026
1 check passed
@MessiasLima MessiasLima deleted the opencode/issue65-20260701161527 branch July 1, 2026 18:16
@github-project-automation github-project-automation Bot moved this from Ready to Done in Some Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add ZonedDateTimeStrategy for controlling ZonedDateTime generation ranges

1 participant