* fix(timeparsing): add unambiguous "min" minute unit to compact durations
--defer/--due use the compact duration parser, whose smallest unit was
one hour. "+30m" silently parsed as 30 months (rc 0, no warning), so a row
meant to return in half an hour became ready again years later, while
"+30min" was rejected outright.
Add "min" as a new minute spelling alongside h/d/w/m/y. Bare "m" keeps
meaning months, so existing callers are unchanged; redefining or refusing
bare "m" is a semantics change left for maintainer sign-off.
Fixes#6609
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(query): resolve the "min" minutes unit as "N ago" in bd query
The widened compact-duration grammar reached the `bd query` plane through
the evaluator's ungated fallback arm: `isDurationSuffix` classifies a
single rune, so `30min` lexed as TokenIdent, skipped `parseDurationAgo`,
and resolved through `ParseRelativeTime` as 30 minutes in the *future* --
the opposite direction from `created > 30m` (30 months ago) and from the
command's own documented contract at cmd/bd/query.go:66.
Recognize multi-rune duration suffixes in `readNumberOrDuration` so
`30min` lexes as TokenDuration and resolves to 30 minutes ago. Plural,
uppercase, and identifier-continuation spellings (`30mins`, `30MIN`,
`30min-window`) keep their existing identifier classification.
Maintainer review fixups for PR #6629, review iteration 1:
- pin the query-plane semantics with EvaluateAt tests against a fixed now
- make the months assertion in TestParseTimeFlag_MinutesVsMonths
two-sided, so it can no longer stay green if "m" regressed to years
- mention +30min in the ParseRelativeTime error examples
Maintainer review fixups for PR #6629, review iteration 2 (non-gating):
- bind the query lexer's unit set to the shared timeparsing grammar with
a cross-package test. ParseCompactDuration is the oracle, so a unit
added to that grammar but missed in durationWords/isDurationSuffix now
fails loudly instead of silently resolving as a future offset -- the
class this fixup previously closed only for "min". Verified by adding
"sec" to the shared pattern alone: the test discovers and fails it with
no test edit.
- pin that a duration token on a non-time field (label=1min) is still
filtered as a literal string, since parseTimeValue is the only consumer
of ValueType.
- list min/m/y in the bd query duration help, so "m" reads as months
right next to "min". The generated CLI docs are release-pinned
(docs/cli-docs.pin v1.2.2, built from the tag rather than the working
tree), so they are deliberately not regenerated here;
./scripts/generate-cli-docs.sh --check reports them fresh.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>