Skip to content

feat: add Duration humanize#46

Merged
brickfrog merged 1 commit into
mainfrom
main.ergo-task-add-duration-humanize-1780418501483-596086
Jun 2, 2026
Merged

feat: add Duration humanize#46
brickfrog merged 1 commit into
mainfrom
main.ergo-task-add-duration-humanize-1780418501483-596086

Conversation

@brickfrog

Copy link
Copy Markdown
Owner

Closes bead tempo-z7j.5.

Adds Duration::humanize for deterministic English elapsed formatting over day/hour/minute/second components, including negative durations, sub-second zero output, and the Int64::min_value guard.

Verification:

  • moon fmt --check && moon test --target wasm-gc && moon test --target js && moon test --target native

Verification

Generated by Choir from commands executed in the leaf workspace.

  • moon fmt --check
    • exit: 0
    • head: bf56b67
    • output tail:
Finished. moon: no work to do
  • moon test --target wasm-gc
    • exit: 0
    • head: bf56b67
    • output tail:
Total tests: 285, passed: 285, failed: 0.
  • moon test --target js
    • exit: 0
    • head: bf56b67
    • output tail:
Total tests: 285, passed: 285, failed: 0.
  • moon test --target native
    • exit: 0
    • head: bf56b67
    • output tail:
Total tests: 285, passed: 285, failed: 0.

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new public Duration::humanize formatter to the Tempo core module, providing deterministic English “elapsed time” strings composed from day/hour/minute/second components (dropping any sub-second remainder) while handling negative durations and the Int64::min_value edge.

Changes:

  • Introduce Duration::humanize() and an internal helper to emit pluralized English components.
  • Add unit tests covering multi-component formatting, pluralization, negative durations, sub-second truncation to zero, and Int64::min_value.
  • Export the new API in the generated package interface (pkg.generated.mbti).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/tempo.mbt Adds Duration::humanize and a helper to build English elapsed-time strings from whole seconds.
src/tempo_test.mbt Adds test coverage for Duration::humanize, including edge cases (negative and Int64::min_value).
src/pkg.generated.mbti Exposes Duration::humanize(Self) -> String in the public API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval).

@brickfrog brickfrog merged commit cbb1d9e into main Jun 2, 2026
3 checks passed
@brickfrog brickfrog deleted the main.ergo-task-add-duration-humanize-1780418501483-596086 branch June 2, 2026 16:50
@brickfrog brickfrog mentioned this pull request Jun 2, 2026
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.

2 participants