Repository navigation
Description
Summary
#1280 made calendar commands reject an empty or inverted window as a usage error. calendar freebusy still sends an inverted window to the API when both bounds are RFC3339 timestamps, so the command fails with the Google API error instead.
Current (v0.48.0, also main at e8428c3)
gog calendar freebusy --from 2027-01-02T00:00:00Z --to 2027-01-01T00:00:00Z
# Google API error (400 timeRangeEmpty): The specified time range is empty. (exit 1)
gog calendar freebusy --from 2027-01-02 --to 2027-01-01
# --from (2027-01-02T00:00:00Z) must be before --to (2027-01-02T00:00:00Z) (exit 2; a date-only --to includes that day)resolveFreeBusyRange returns two RFC3339 bounds unchanged and only sends other forms through ResolveTimeRange, which has the new check (calendar_freebusy.go#L73-L87).
Expected
An inverted or empty window is a usage error (exit 2) before the request, whatever form the bounds take, as for the other calendar commands.
One possible approach, not a requirement: keep the passthrough, which preserves the exact instants, but compare the two parsed instants before returning them.
Environment
gog built from main at e8428c3. Reproduced against a local fake of the Calendar API through GOG_GOOGLE_API_BASE_URL; the fake returns the API's timeRangeEmpty error for an empty range.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Nov 11, 2026
Codex review: this still needs some work.
Summary
This issue establishes a current bug: RFC3339 freebusy bounds bypass range validation on main and v0.48.0.
Reproducibility: Current source proves that --from 2027-01-02T00:00:00Z and --to 2027-01-01T00:00:00Z reach Freebusy.Query unchecked; the reporter supplies fake-API reproduction, but no runtime reproduction or tests were run during this review.
Next step
Establish failing command regressions for equal and reversed RFC3339 bounds, then reject them with exit 2 before the FreeBusy query.
Review details
Best possible solution:
Validate parsed RFC3339 instants locally while preserving valid timestamp strings, fractional precision, and the existing timezone-free path.
Do we have a high-confidence way to reproduce the issue?
Current source proves that --from 2027-01-02T00:00:00Z and --to 2027-01-01T00:00:00Z reach Freebusy.Query unchecked; the reporter supplies fake-API reproduction, but no runtime reproduction or tests were run during this review.
Is this the best way to solve the issue?
Comparing parsed instants in the passthrough is a narrow repair; routing all timestamps through the shared resolver would introduce timezone lookups and lose existing fractional-precision behavior.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31.
Label changes
Label changes:
P2: Invalid freebusy inputs produce the wrong error class; valid availability queries remain usable.impact:ux-friction: Equivalent invalid calendar windows receive inconsistent diagnostics and exit codes depending on input format.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: Invalid freebusy inputs produce the wrong error class; valid availability queries remain usable.impact:ux-friction: Equivalent invalid calendar windows receive inconsistent diagnostics and exit codes depending on input format.Evidence reviewed
Acceptance criteria:
What I checked:
internal/cmd/calendar_freebusy.go:73, e8428c36dd31)internal/cmd/time_helpers.go:283, e8428c36dd31)internal/cmd/calendar_freebusy_conflicts_selection_test.go:77, e8428c36dd31)internal/cmd/calendar_freebusy.go:74, f939ed37151a)internal/cmd/calendar_freebusy.go:73, 23b847ca53cf)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed November 11, 2026, 9:15 AM ET / 14:15 UTC.
fix: preserve workspace request and output contracts
steipete commentedon Nov 14, 2026
Fixed in #1336. Equal and inverted RFC3339 free/busy ranges now fail before the API request; valid timestamp strings remain unchanged.
The regression failed against the previous main and passes with the fix. Full
make ci, independent P0–P2 review, and exact-head GitHub CI passed. A built CLI also verified the outgoing request against a synthetic HTTP endpoint.