fix: no-panic temporal phrase resolution by joshuaclayton · Pull Request #251 · memvid/memvid · GitHub
Skip to content

fix: no-panic temporal phrase resolution - #251

Open
joshuaclayton wants to merge 1 commit into
memvid:mainfrom
joshuaclayton:fix/temporal-no-panic
Open

joshuaclayton wants to merge 1 commit into
memvid:mainfrom
joshuaclayton:fix/temporal-no-panic

Conversation

@joshuaclayton

Copy link
Copy Markdown

Date arithmetic in the temporal resolver panics on out-of-range inputs: add_days is checked_add(...).unwrap(), and several resolvers build dates with Date::from_calendar_date(...).unwrap(). A phrase resolved against an anchor date near the edge of the representable range panics inside library code.

This changes the resolution helpers to return Option and propagate None, so those inputs degrade to no resolution instead of a panic. Inputs that resolved before resolve to the same values; 342 lib tests pass with temporal_track enabled.

Date arithmetic in the temporal resolver (add_days, month offsets,
combine) could panic on out-of-range results. Make the resolution
helpers return Option and propagate None instead, so a pathological
phrase or anchor date degrades to 'no resolution' rather than a panic
in library code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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