Repository navigation
fix(core): let a bare 4-digit ISO year parse in MessagingTemplate.parseTime - #701
Conversation
…seTime PR #623 rejected every bare-digit string that was not exactly 10 or 13 digits, so a bare ISO year such as "2026" returned undefined and callers raised Invalid time. Before #623 that form fell through to Date.parse and parsed as Jan 1. Exempt a 4-digit bare year from the catch-all so it reaches the calendar-checked parseAbsoluteTime path. 10-digit epoch seconds, 13-digit epoch milliseconds, and every other bare-digit length keep their #592 behaviour. Fixes #695
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
Fixes #695.
What changed
MessagingTemplate.parseTimerejected every bare-digit string that was not exactly 10 or 13 digits, so a bare 4-digit ISO year ("2026") returnedundefinedand callers raisedInvalid time. Before #623 (for #592) that form fell through toDate.parseand parsed as 2026-01-01.A bare 4-digit year is now exempted from the bare-digit catch-all so it reaches the existing calendar-checked
ModelRouteLimits.parseAbsoluteTimepath — restoring the pre-#623 behaviour for the ISO year form only.Behaviour
2026Date.parse("2026")-> 2026-01-01T00:00:00.000Zundefined(#592, unchanged)The schema description in
packages/schema/src/messaging.tsstill matches (since= ISO time, relative age such as2hor3d, or a bare epoch), so no schema change.Test
Added a regression test in
packages/core/test/messaging-template.test.tsbeside the existing bare-epoch cases:Verification (laptop)
bun test test/messaging-template.test.ts test/tool-messaging.test.ts test/messaging.test.ts-> 39 pass, 0 failbun typecheckinpackages/core-> cleanNeed help on this PR? Tag
@codesmith-botwith what you need.