feat: add Duration humanize#46
Conversation
|
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). |
There was a problem hiding this comment.
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.
|
Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval). |
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:
Verification
Generated by Choir from commands executed in the leaf workspace.
moon fmt --checkmoon test --target wasm-gcmoon test --target jsmoon test --target native