Document best practices for Clock/Time handling#6340
Conversation
This commit introduces documentation outlining the architectural pattern for handling time-dependent code. The primary objective is to enforce testability and determinism by using an injected `Clock` instead of static calls to `Instant.now()` or `DateTime.now()`. Specific changes include: - A new section "Best Practices : Time and Clock Handling" in `STYLE_AND_BEST_PRACTICES.md`. This guide details the rationale, provides good/bad code examples for ViewModels and utility functions, and shows how to use a fixed clock in tests. - A corresponding section "Clock/Time Handling" in `architectural-patterns.md` to serve as a quick reference for LLM assisted code reviews. - An update to the pull request checklist in `architectural-patterns.md` to include a check for the use of injected `Clock`.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6340 +/- ##
=======================================
Coverage 85.49% 85.49%
=======================================
Files 763 763
Lines 54640 54640
Branches 7865 7865
=======================================
Hits 46716 46716
Misses 5189 5189
Partials 2735 2735 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Great job! No new security vulnerabilities introduced in this pull request |
|
Claude finished @SaintPatrck's task in 2m 11s —— View job Overall Assessment: APPROVE This PR adds comprehensive documentation for Clock/Time handling patterns to enforce testability and determinism. The documentation covers ViewModels, extension functions, testing approaches, and integrates seamlessly with existing architectural guidance. Code Review DetailsNo findings - This is a well-structured documentation PR with:
The guidance correctly emphasizes using injected 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com |
david-livefront
left a comment
There was a problem hiding this comment.
It's beautiful! 🥹

🎟️ Tracking
Documentation updates
📔 Objective
Outline the architectural pattern for handling time-dependent code.
The primary objective is to enforce testability and determinism by using an injected
Clockinstead of static calls toInstant.now()orDateTime.now().Specific changes include:
STYLE_AND_BEST_PRACTICES.md. This guide details the rationale, provides good/bad code examples for ViewModels and utility functions, and shows how to use a fixed clock in tests.architectural-patterns.mdto serve as a quick reference for LLM assisted code reviews.architectural-patterns.mdto include a check for the use of injectedClock.⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes