Skip to content

fix(cal): show resolved times in create --dry-run - #91

Merged
robpc merged 1 commit into
mainfrom
fix/cal-dry-run-resolved-times
Sep 3, 2026
Merged

robpc merged 1 commit into
mainfrom
fix/cal-dry-run-resolved-times

Conversation

@robpc

@robpc robpc commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Follow-up to #90, closing the gap noted there: cal create --dry-run echoed the raw --start / --end strings back, so the #89 offset bug could only be observed by creating a real event.

The change

The preview now shows what the write would actually send, in the same flat shape _parse_event produces — so a dry-run target and a real receipt read alike:

--start 2026-11-11T17:30:00   ->   "start": "2026-11-11T17:30:00-05:00"

The whole of #89 is now diagnosable without touching a calendar.

  • All-day values stay bare dates. There is no offset to resolve, so don't invent one: --start 2026-11-11 previews as "2026-11-11".
  • Explicit offsets pass through unchanged.
  • Unparseable input is now INVALID_INPUT from the preview, rather than surfacing only on the real call. A preview that accepts input the real call will reject is not much of a preview.

Why this shape

Idea 031 and ADR-004 already say a dry-run exists so the caller can verify what would happen. Echoing back the string they typed does not do that. Replacing the raw value rather than adding a second field keeps the preview and the receipt directly comparable, and the input is already in the caller's own command.

Refactor

_parse_time_input becomes the module-level parse_time_input so the command layer can resolve a time without performing the write. It never used self, and being private it carried no external contract, so no shim is left behind.

Verification

879 tests pass (5 new), ruff clean. Verified against a live account with no mutations — the #89 repro, an all-day event, and unparseable input.

🤖 Generated with Claude Code

The preview echoed the raw --start/--end strings back, which tells the caller
nothing they did not already type. It also hid the issue #89 class of bug: a
naive datetime silently landing on a different UTC offset was only observable
by creating a real event and reading the receipt.

Dry-run now shows what the write would actually send, in the same flat shape
`_parse_event` produces, so a preview and a real receipt read alike:

    --start 2026-11-11T17:30:00  ->  "start": "2026-11-11T17:30:00-05:00"

All-day values stay bare dates — there is no offset to resolve, so don't
invent one. Unparseable input is now an INVALID_INPUT error from the preview
rather than surfacing only on the real call, which is the point of a preview.

This is idea 031 / ADR-004 applied to `cal create`: a dry-run exists so the
caller can verify what *would happen*.

`_parse_time_input` becomes the module-level `parse_time_input` so the command
layer can resolve a time without performing the write. It never used `self`,
and being private it carried no external contract, so no shim is left behind.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@robpc
robpc merged commit 847861d into main Sep 3, 2026
7 checks passed
@robpc
robpc deleted the fix/cal-dry-run-resolved-times branch September 3, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant