[PR #6340] [MERGED] Document best practices for Clock/Time handling #12644

Closed
opened 2026-04-11 03:48:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6340
Author: @SaintPatrck
Created: 1/8/2026
Status: Merged
Merged: 1/9/2026
Merged by: @SaintPatrck

Base: mainHead: document-clock-handling-guidelines


📝 Commits (1)

  • a2a9312 Document best practices for Clock/Time handling

📊 Changes

2 files changed (+133 additions, -0 deletions)

View changed files

📝 .claude/skills/reviewing-changes/reference/architectural-patterns.md (+39 -0)
📝 docs/STYLE_AND_BEST_PRACTICES.md (+94 -0)

📄 Description

🎟️ 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 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.

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6340 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 1/8/2026 **Status:** ✅ Merged **Merged:** 1/9/2026 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `main` ← **Head:** `document-clock-handling-guidelines` --- ### 📝 Commits (1) - [`a2a9312`](https://github.com/bitwarden/android/commit/a2a9312484f00d1a89b6affbf912d27c474ae0f0) Document best practices for Clock/Time handling ### 📊 Changes **2 files changed** (+133 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.claude/skills/reviewing-changes/reference/architectural-patterns.md` (+39 -0) 📝 `docs/STYLE_AND_BEST_PRACTICES.md` (+94 -0) </details> ### 📄 Description ## 🎟️ 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 `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`. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-11 03:48:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#12644