Skip to content

Extract shared display formatting into keep-core (#288)#292

Merged
kwsantiago merged 1 commit intomainfrom
shared-display-formatting
Feb 27, 2026
Merged

Extract shared display formatting into keep-core (#288)#292
kwsantiago merged 1 commit intomainfrom
shared-display-formatting

Conversation

@kwsantiago
Copy link
Contributor

@kwsantiago kwsantiago commented Feb 27, 2026

Summary by CodeRabbit

  • Refactor

    • Consolidated string truncation and timestamp formatting utilities into a centralized library for consistent formatting across desktop and mobile applications.
  • New Features

    • Exposed display formatting utilities (string truncation and timestamp formatting) through the mobile API.

@kwsantiago kwsantiago self-assigned this Feb 27, 2026
@kwsantiago kwsantiago linked an issue Feb 27, 2026 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a55972a and 823ada7.

📒 Files selected for processing (8)
  • keep-core/src/display.rs
  • keep-core/src/lib.rs
  • keep-desktop/src/screen/bunker.rs
  • keep-desktop/src/screen/mod.rs
  • keep-desktop/src/screen/signing_audit.rs
  • keep-desktop/src/screen/wallet.rs
  • keep-mobile/src/keep_mobile.udl
  • keep-mobile/src/lib.rs

Walkthrough

Introduces a new Rust display formatting module in keep-core with three utility functions for truncating strings and formatting timestamps (Unix seconds to UTC strings). Exports these utilities through keep-core's public API and updates keep-desktop and keep-mobile to use the centralized implementations instead of local duplicates.

Changes

Cohort / File(s) Summary
Core Display Module
keep-core/src/display.rs, keep-core/src/lib.rs
Adds new display module with three public utilities: truncate_str() for ASCII string truncation with prefix/suffix preservation, format_timestamp() for Unix-to-UTC conversion (YYYY-MM-DD HH:MM format), and format_timestamp_detailed() for detailed UTC format (Mon DD, YYYY HH:MM:SS). Includes comprehensive unit tests. Module exported via lib.rs.
Desktop Screen Updates
keep-desktop/src/screen/mod.rs, keep-desktop/src/screen/bunker.rs, keep-desktop/src/screen/signing_audit.rs, keep-desktop/src/screen/wallet.rs
Replaces local truncation and timestamp formatting logic with calls to centralized keep_core::display utilities. mod.rs re-exports format_timestamp from core; bunker.rs delegates truncated_pubkey() to core's truncate_str(); signing_audit.rs uses format_timestamp_detailed() and truncate_str(); wallet.rs replaces timestamp formatting pipeline with format_timestamp().
Mobile API Surface
keep-mobile/src/keep_mobile.udl, keep-mobile/src/lib.rs
Exposes three wrapper functions in UDL interface and implements them in lib.rs, delegating to core display utilities with type adaptation (String to &str, u32 to usize conversions).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Issue #288: Directly addresses the proposal to implement shared Rust display-formatting utilities for truncation and timestamp functions, centralizing previously duplicated code across desktop and mobile.

Possibly related PRs

  • PR #285: Centralizes truncation and timestamp helpers into keep-core::display and updates keep-desktop to call/re-export these functions, establishing the foundation for this multi-crate integration.

Poem

🐰✨ Display utilities hop together,
No more scattered snippets to tether,
Timestamps formatted, strings truncated clean,
Shared from the core, now seen by all screens!
—The Code Rabbit 🐇🎩

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: extracting display formatting utilities (truncate_str, format_timestamp, format_timestamp_detailed) from keep-desktop into a shared keep-core module for reuse across keep-desktop and keep-mobile.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shared-display-formatting

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 and usage tips.

@kwsantiago kwsantiago merged commit 38098cf into main Feb 27, 2026
9 checks passed
@kwsantiago kwsantiago deleted the shared-display-formatting branch February 27, 2026 14:17
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.

Extract shared display formatting into Rust

1 participant