Skip to content

refactor(desktop): share relative timestamp formatting - #1445

Merged
skevetter merged 2 commits into
mainfrom
refactor/desktop-relative-timestamps
Oct 9, 2026
Merged

skevetter merged 2 commits into
mainfrom
refactor/desktop-relative-timestamps

Conversation

@skevetter

@skevetter skevetter commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Both timeAgo adapters duplicate the relative timestamp threshold ladder. Move it into a private elapsed-millisecond helper while preserving their guards, signatures, clock evaluation order/count, rounding, literals and edge-case behavior. formatTimestamp and callers remain unchanged.

Add frozen-clock regression tests through both public adapters for minute/hour/day boundaries, multiple days, future/epoch/negative/fractional values, invalid/nonfinite values, missing input and evaluation order.

Closes #1444

Validation on signed head 6d5945239fda317f04706f1229d471651a740c20, integrated with main 56485803a98ccbf0505b1b42b8ecc12629ccfaf9:

  • Focused 39 tests and full desktop 885 tests in 78 files pass.
  • Desktop check, format, applicable hooks and CLI CI lint pass.
  • Production Electron bundles and actual CLI builds for Darwin arm64/amd64, Linux amd64 and Windows amd64 pass; macOS universal CLI runs --version.
  • Local committed CodeRabbit: no findings. Independent Sol High review: no findings; 82,903 differential comparisons equivalent against current main.
  • Saved CodeScene baseline/final: 10.0 with no findings, unchanged. The baseline/final file bytes are identical at this integration; these are retained results rather than a new analyzer run.

The merge commit preserves published history and the exact original two-file patch. Fresh hosted reviews, CI, platform packaging and E2E are required for this head. Local Electron/native node-pty runtime dependencies remain unavailable after rebuild; no script policy was changed. Playwright's checked-in launch uses a mock CLI, so E2E alone does not validate the packaged real backend.

Summary by CodeRabbit

  • Improvements
    • Time-ago labels use consistent elapsed-time formatting for date and millisecond timestamps, with existing thresholds and labels unchanged.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20a78408-9d52-427d-90d2-4f8dec9c9690

📥 Commits

Reviewing files that changed from the base of the PR and between 5648580 and 6d59452.


📒 Files selected for processing (2)
  • desktop/src/renderer/src/lib/utils/time.test.ts
  • desktop/src/renderer/src/lib/utils/time.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

timeAgo and timeAgoMs now share elapsed-time formatting. Tests cover adapter outputs across time boundaries and unusual inputs, and verify clock-call counts and evaluation order.

Changes

Relative timestamp formatting

Layer / File(s) Summary
Shared formatter and adapter coverage
desktop/src/renderer/src/lib/utils/time.ts, desktop/src/renderer/src/lib/utils/time.test.ts
Both adapters delegate elapsed-time formatting to formatElapsedTime, which retains the existing thresholds and labels. Tests cover boundaries, epoch values, missing and invalid inputs, unusual numeric values, and clock behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor


Merge Risk: ⚪ Minimal · up to 6d594

The shared formatter preserves the existing timestamp behavior. No merge blocker is identified; complete the planned hosted checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: extracting shared relative timestamp formatting in the desktop code.
Linked Issues check Passed Direct issue [#1444] requires one private elapsed-millisecond formatter in the two time utility files. time.ts now uses private formatElapsedTime from both timeAgo and timeAgoMs. The public si…
Out of Scope Changes check Passed The whole-PR summary identifies changes only in desktop/src/renderer/src/lib/utils/time.ts and time.test.ts, which are the paths allowed by [#1444]. The implementation and regression tests directl…


  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 6d59452
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ac945844c12830008443ca4

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 6d59452
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ac94584088aa4000851d8fe

@github-actions github-actions Bot added the size/m label Oct 9, 2026
@skevetter
skevetter marked this pull request as ready for review October 9, 2026 15:49
@mergify

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

Copy link
Copy Markdown
Contributor Author

@greptileai please review this pull request at current head e082da3.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the shared helper preserves existing behavior.

Summary

Both relative timestamp functions now share the private formatElapsedTime helper.

  • Both relative-time functions now use the same formatter.

Reviews (2) · Last reviewed commit: "chore(desktop): refresh timestamp integr..." · Reviewed by Greptile

@skevetter
skevetter marked this pull request as draft October 9, 2026 19:40
@skevetter
skevetter marked this pull request as ready for review October 9, 2026 20:02

Copy link
Copy Markdown
Contributor Author

@greptileai please review the updated pull request at current head 6d59452.

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

Please review the current head 6d59452 after integration with main.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@skevetter
skevetter merged commit d68e5d3 into main Oct 9, 2026
35 checks passed
@skevetter
skevetter deleted the refactor/desktop-relative-timestamps branch October 9, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(desktop): share relative timestamp formatting

1 participant