fix(kitchen): cap a duration at 1000 years and warn (audit C3) #72
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!72
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/audit-c3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Audit C3, present since 1.3.0. A retro-planning offset or a timer of absurd length broke the timeline silently. Measured: exact up to ~1e9 days; at 1e15 days the preparation and the step become 0 minutes (precision lost);
~_{1e400h}gives a total ofInfinity;~{-1e308d}and beyond giveNaN. Non-finite numbers arenullin the compiled JSON, so the times were unreadable, with no warning.Decision (maintainer, after a discussion on the value): cap at 1000 years and warn. The limit is a technical bound, not a judgement on recipes: a 100-year duration is left exactly as written, and so is the limit itself (365000 d); 1000 years is ~5.3e8 minutes, far from where precision is lost.
quantityToMinutes, the single conversion point (the CLI uses it too), caps its result;MAX_DURATION_MINUTES,isDurationTooLongandmaxDurationInare exportedDURATION_OUT_OF_RANGE(severity warning) for a timer or a section's retro-planning offset past the limit; the quantity kept in the JSON is written back capped, in the unit written, so it agrees with the schedule (the retro-planningrawtext is kept as written)Infinity), with nonullin the schedules or metricsNot caught, on purpose: a stray digit under the limit (
-300d->-3000d, 8 years). No cap that leaves a solera alone can.Docs EN/FR: a section in the warnings reference and a line in the time syntax page (the codes table is generated). 14 new tests, which cannot even import the new exports on the previous code. New minor changeset for kitchen (new warning code and exports). ci (1361 tests), conformance 98/98 and a full docs build pass.