[CLI] gram view labels every timer as "min" — ~{1h} displays as ~1min #25

Closed
opened 2026-08-31 21:43:46 +02:00 by Nopitch · 1 comment

Version: @gram-lang/cli 1.2.1 (current npm latest), on macOS.

Summary

The terminal renderer prints a timer's numeric value with a hardcoded min suffix, ignoring the parsed unit. The parser and the timing aggregation are both correct — this is display only.

Reproduction

---
title: Secondes
---

## T

A ~{20s} B ~{20sec} C ~{20 s} D ~{90s} E ~{2min} F ~{1h}
$ gram view s.gram --skip-db --no-pager

┌─ Secondes ─────────────────────────────────────┐
│  ⏱  Active: 1h4.5  ·  Total: 1h4.5            │
└────────────────────────────────────────────────┘

─── T ───────────────────────────────────────────
   1.   A ~20min B ~20min C ~20min D ~90min E ~2min F ~1min

Every unit renders as min, including ~{1h} → ~1min. All four of s, sec, min and h are documented units in the times reference.

The model is correct

gram build --pretty keeps the units and aggregates them properly:

{"type":"timer","quantity":{"type":"single","value":1,"text":"1"},"unit":"h"}
...
"timings": {"start":0,"end":64.5,"activeDuration":64.5}

64.5 min = 20s + 20s + 20s + 90s + 2min + 1h. Correct to the decimal. So the defect is confined to the renderer's unit label. Possibly related to the timing refactor in #15.

Impact

gram cook is meant to guide someone step by step in the kitchen. Displaying ~1min for a one-hour rest is actively misleading at the moment it matters most.

Going by the pipeline in CONTRIBUTING, this looks confined to packages/renderer — the compiled JSON that kitchen produces is already correct.

Also, same area: the duration summary

1h4.5 above is correct arithmetic but not a duration anyone reads — presumably 1h04 or 1h04min30s was intended. The same formatter drops the leading zero on whole minutes (Total: 24h7 for 24 h 07 on another recipe), and on a longer recipe the raw float surfaces directly:

⏱  Prep: 35min  ·  Active: 25.083333333333336min  ·  Total: 24h57.58333333333326

One more small thing in the same renderer: @cannelle{1/4 càc} displays as 0,3 càc — a fraction rounded to one decimal rather than shown as 1/4.


Drafted with AI assistance, verified by hand: every reproduction above was run locally against 1.2.1 and its output pasted verbatim.

**Version:** `@gram-lang/cli` 1.2.1 (current npm `latest`), on macOS. ## Summary The terminal renderer prints a timer's numeric value with a hardcoded `min` suffix, ignoring the parsed unit. The parser and the timing aggregation are both correct — this is display only. ## Reproduction ```gram --- title: Secondes --- ## T A ~{20s} B ~{20sec} C ~{20 s} D ~{90s} E ~{2min} F ~{1h} ``` ``` $ gram view s.gram --skip-db --no-pager ┌─ Secondes ─────────────────────────────────────┐ │ ⏱ Active: 1h4.5 · Total: 1h4.5 │ └────────────────────────────────────────────────┘ ─── T ─────────────────────────────────────────── 1. A ~20min B ~20min C ~20min D ~90min E ~2min F ~1min ``` Every unit renders as `min`, including `~{1h}` → `~1min`. All four of `s`, `sec`, `min` and `h` are documented units in the times reference. ## The model is correct `gram build --pretty` keeps the units and aggregates them properly: ```json {"type":"timer","quantity":{"type":"single","value":1,"text":"1"},"unit":"h"} ... "timings": {"start":0,"end":64.5,"activeDuration":64.5} ``` 64.5 min = 20s + 20s + 20s + 90s + 2min + 1h. Correct to the decimal. So the defect is confined to the renderer's unit label. Possibly related to the timing refactor in #15. ## Impact `gram cook` is meant to guide someone step by step in the kitchen. Displaying `~1min` for a one-hour rest is actively misleading at the moment it matters most. Going by the pipeline in CONTRIBUTING, this looks confined to `packages/renderer` — the compiled JSON that `kitchen` produces is already correct. ## Also, same area: the duration summary `1h4.5` above is correct arithmetic but not a duration anyone reads — presumably `1h04` or `1h04min30s` was intended. The same formatter drops the leading zero on whole minutes (`Total: 24h7` for 24 h 07 on another recipe), and on a longer recipe the raw float surfaces directly: ``` ⏱ Prep: 35min · Active: 25.083333333333336min · Total: 24h57.58333333333326 ``` One more small thing in the same renderer: `@cannelle{1/4 càc}` displays as `0,3 càc` — a fraction rounded to one decimal rather than shown as `1/4`. --- *Drafted with AI assistance, verified by hand: every reproduction above was run locally against 1.2.1 and its output pasted verbatim.*
abiwab self-assigned this 2026-09-28 22:15:22 +02:00
Owner

Thanks again for your report! The unit label was indeed wrong in the CLI view, not the renderer: a fix for the timer units, the duration summary and the 1/4 fraction display is up in #38 and will ship in the next release.

Thanks again for your report! The unit label was indeed wrong in the CLI view, not the renderer: a fix for the timer units, the duration summary and the 1/4 fraction display is up in #38 and will ship in the next release.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gram-lang/gram#25
No description provided.