Repository navigation
fix(google): refuse impossible minutes in suggest-time --hours - #51196
Conversation
`orca calendar suggest-time --hours 09:75-17:00` matched the --hours pattern, whose minutes ran to 99. The bound then reached zonedInstant, where Intl throws "RangeError: Invalid time value" after the free/busy request, instead of the usage text. Minutes are now 00-59 like the other clock inputs. Co-Authored-By: Claude <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
ELI5
orca calendar suggest-time --hours 09:75-17:00crashed with an internal error after asking Google for free/busy times. The range check let minutes up to 99 through. Now such a range gets the same usage message as any other bad--hours.What Changed
parseHours(src/main/google/google-calendar-free-time.ts) takes minutes00–59instead of any two digits.--hours 09:75-17:00matched, the two Google requests ran, thenzonedInstantraisedRangeError: Invalid time value.--hours takes a range like 09:00-17:00., before any request is made.24:00as the end of the range, and one-digit hours like9:00, still work.Why
The pattern was the only check on the minutes; what followed compared the padded strings (
from >= to,to > '24:00'), which says nothing about75.Intlthrows on a wall clock that does not exist, so the value has to be refused before it gets there.Linked Issue
Fixes #51189
Visual Proof
N/A: no UI change. The difference is the error text on the command line.
Testing
google-calendar-free-time.test.ts(new) calls the realsuggestCalendarTimewith an in-memoryGoogleApi(calendar lookup and one free/busy answer). It checks that09:75-17:00and09:00-17:60reject withGoogleToolError, and that9:00-24:00still resolves to{ from: '09:00', to: '24:00' }. This is an input-parsing boundary, which the repo rules allow a test for.With the change reverted the test fails with
expected error to be instance of GoogleToolError; the rejection wasRangeError.pnpm check:changed: all 27 checks pass.Performance
None: the same single regex match with a narrower class.
Risk
Level: Low
Only
--hoursvalues with minutes above 59 change behavior: an internal error becomes the usage error. Back out with a plain revert.AI Disclosure
Found, implemented and verified with Claude Code; I reviewed the diff and the test output.
Review
Nothing to flag. The sibling for
--start/--endclock times is #51166.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Not platform-specific.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code