Repository navigation
PR #62 follow-up 18: fix resolve_time_range parsing gaps - #70
Merged
Merged
Conversation
- Split `<start> to <end>` (case-insensitive) before the `now-` prefix branch, so "now-1h to now" resolves instead of failing. - Accept `UTC` case-insensitively again, as the pre-port code did. - When local midnight falls in a DST gap, start `today`/`yesterday` at the first instant after the gap instead of erroring. - Evaluate explicit ranges and the fallback against `reference`, so resolve_time_range_at is deterministic in every branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fix/pr62-18-resolve-time-range-parsing # Conflicts: # src/tool_executor.rs
… fix/pr62-18-resolve-time-range-parsing
…ime-range-parsing
…ime-range-parsing
…ime-range-parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #62 (
upstream/tool-catalog-1831). Retarget tomainafter #62 merges.Problem
resolve_time_rangecame in with the upstream tool-catalog port (parseablehq#1831). It had four parsing gaps:"now-1h to now"failed withinvalid time duration: expected number. Thenow-prefix branch ran before thetosplit, and the split was also case-sensitive."timezone": "utc"was rejected becauseparse::<Tz>()is case-sensitive. The pre-port code acceptedutccase-insensitively, so existing callers silently regressed.today/yesterdayreturnedlocal day boundary does not existwhen local midnight falls in a DST gap (for example, America/Santiago every September).Utc::now()rather thanreference, soresolve_time_range_atwasn't deterministic for them.Fix
to(ASCII case-insensitive) first, before any prefix branch.UTC(any case) toTz::UTC. Other zones still go through IANA parsing.first_instant_after_gap).TimeRange::parse_human_time_atpub(crate)and passreferenceto it in both remaining branches. The RFC3339 branch became redundant with the fallback (end = "now"atreference), so it is folded into the fallback.Tests
New tests in
src/tool_executor.rs:time_resolution_parses_now_relative_explicit_ranges_against_reference:now-1h to nowandnow-1h TO now, plus the bare-duration fallback (1h), checked against a fixed 2020 reference.time_resolution_accepts_utc_case_insensitively:utc,UtcandUTC.time_resolution_starts_days_after_a_dst_gap_at_midnight: America/Santiago, 2026-09-06, fortoday,yesterdayand the preceding day's end.cargo test --lib time_resolutionpasses 5/5 locally.Upstream fidelity
This is a small, local diff in upstream-owned code: one visibility change in
src/utils/time.rs, plus branch reordering and one helper inresolve_time_range_at. It is a good candidate to propose upstream. The checked-arithmetic work on the same function (follow-ups 01–13) is separate.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.