Skip to content

Fix datetime_utils.parse accepting truncated datetimes - #1380

Open
TarunSinghChauhan wants to merge 1 commit into
qdrant:masterfrom
TarunSinghChauhan:fix-datetime-truncated-parse-1349-v2
Open

Fix datetime_utils.parse accepting truncated datetimes#1380
TarunSinghChauhan wants to merge 1 commit into
qdrant:masterfrom
TarunSinghChauhan:fix-datetime-truncated-parse-1349-v2

Conversation

@TarunSinghChauhan

Copy link
Copy Markdown

Fixes #1349. The :00-append retry for hour-only UTC offsets was unguarded, so it also silently accepted truncated datetimes that should be rejected. Guarded the retry to only fire when the string ends in an hour-only offset ([+-]HH).

The hour-only-offset retry (which appends :00 to complete offsets
like +01 -> +01:00) was unguarded, so it also fired for any string
that failed every format in available_formats - including truncated
datetimes like '2024-06-15 12' or '2024-06-15T12:30'. These would
get :00 appended and accidentally match a valid format, causing
local mode to silently accept input that a real Qdrant instance
rejects. Guarded the retry to only fire when the string actually
ends in an hour-only UTC offset ([+-]HH). Verified against all four
cases from the issue: truncated hour and truncated minute now
correctly return None, while the hour-only-offset and valid full
date cases still parse correctly. Fixes qdrant#1349.
@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit 605d7ed
🔍 Latest deploy log https://app.netlify.com/projects/poetic-froyo-8baba7/deploys/6a8e5d1b9a84b90008f2ff06
😎 Deploy Preview https://deploy-preview-1380--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e52e340a-40b9-4a44-b0b9-d38774c9a2ab

📥 Commits

Reviewing files that changed from the base of the PR and between 550484d and 605d7ed.

📒 Files selected for processing (1)
  • qdrant_client/local/datetime_utils.py

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The local datetime parser now uses a regular expression to identify strings ending in signed two-digit hour offsets. It appends :00 and retries parsing only for those inputs. Other inputs that fail the normal formats return None, preventing truncated datetimes from being accepted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 605d7

This localized change restricts the datetime retry behavior to hour-only UTC offsets, with no actionable merge-blocking risk remaining beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: preventing parse() from accepting truncated datetime strings.
Description check ✅ Passed The description directly explains issue #1349 and the guard added for hour-only UTC offsets.
Linked Issues check ✅ Passed The changes address [#1349] by limiting the ':00' retry to strings ending in an hour-only signed offset. This rejects truncated datetimes while preserving valid datetime and hour-only offset parsing.
Out of Scope Changes check ✅ Passed The reported changes are limited to the datetime parsing fallback and its regular-expression guard. No unrelated changes are identified.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

datetime_utils.parse accepts truncated datetimes: the hour-only-offset retry is unguarded

1 participant