* refactor(timeparsing): export IsCompactDuration
The query lexer keeps its own copy of the compact-duration unit set, and
that copy has drifted from the grammar: it accepts the uppercase units
H D W M Y, which ParseCompactDuration rejects. Export the classifier so
the lexer can ask timeparsing instead of keeping a copy, and pin that it
agrees with ParseCompactDuration on every row, uppercase spellings
included.
AC: AC-1
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(query): classify durations with timeparsing.IsCompactDuration
The query lexer kept its own copy of the compact-duration unit set:
isDurationSuffix for single runes and durationWords for "min". The copy
had drifted. It accepted H D W M Y, which the case-sensitive grammar
rejects, so "created>30M" reached the evaluator as a duration and failed
with the internal error `not a compact duration: "-30M"`, quoting a value
the user never typed.
Classify the whole digit-led lexeme with timeparsing.IsCompactDuration
and delete the copy (isDurationSuffix, durationWords, acceptDurationWord).
Uppercase units now lex as identifiers and fail as an unparseable time;
every lowercase input lexes as before. A unit added to compactDurationRe
now reaches the lexer with no edit here: with "sec" added to the regex
alone, TestCompactDurationGrammarReachesQueryPlane fails on the old lexer
and passes on this one. Retire that test's text naming the deleted copy.
AC: AC-2
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin that uppercase duration units lex as identifiers
"updated>30M", "updated>30H" and "label=30D" lex the value as one
TokenIdent with the text as typed; "updated>30m" and "updated>+30d"
still lex as TokenDuration. On the base lexer the three uppercase rows
fail (typed DURATION).
AC: AC-3
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin the error for an uppercase duration unit
created>, updated<, closed>= and started<= compared to 30M, 30D, 30W,
30Y, 30H or 1H, alone or in "... OR status=open", fail with
`cannot parse time expression: "<value as typed>"`, never with the
internal `not a compact duration` error and never quoting the negated
"-<value>". 30MIN and 30Min, which always took this path, are the
controls. On the base lexer 30 of the 40 subtests fail; the 10 controls
pass.
AC: AC-4
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): bind the lexer's duration grammar to timeparsing both ways
TestCompactDurationGrammarReachesQueryPlane asserted only that every
suffix ParseCompactDuration accepts lexes as a duration. Assert the
reverse too: a suffix it rejects must not lex as TokenDuration, or the
evaluator fails on it with ParseCompactDuration's internal error about a
negated value. Widen the candidates to every one- and two-letter ASCII
suffix in either case, every three-letter lowercase one, and every case
spelling of an accepted three-letter unit.
On the base lexer the reverse sweep fails on exactly [D H M W Y]. A
mutant that case-folds before classifying fails it on those plus the
seven other spellings of "min".
AC: AC-5
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin that a signed uppercase unit stops at the parser
"created>+30M" and "created>-30M" fail Parse and EvaluateAt with
`unexpected token "M" at position 11 (expected end of query)`, as
"created>+30x" already does: a signed digit run has no identifier
fallback, so "+30" is a number and "M" a stray token. On the base lexer
both parsed as a duration and failed in the evaluator with
`not a compact duration: "-30M"` and `"--30M"`; the +30x control passes
on both.
AC: AC-6
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(query): pin the values rejecting uppercase units leaves alone
At a fixed now, created>+30d is still 30 days ago, updated>5pm still
17:00 that day, and label=30M / title=30M still filter the literal
"30M". TestQueryMinutesUnitResolvesAgo already pins created>30m (30
months ago) and created>30min (30 minutes ago). These rows pass on the
base lexer as well, which is the point; a lexer mutant that stops typing
signed lexemes as durations fails the +30d row.
AC: AC-7
Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>