You need to sign in or sign up before continuing.
Fix time discrepancy in open MRs for blob
What does this MR do and why?
Fixes the time discrepancy between the client and server in open MRs for blob query by passing the current time in UTC as part of the request.
Context:
- Currently, the frontend passes only a date without time (e.g.
created_after: "2025-03-17"
) in the query and the backend converts it to midnight. - The backend does:
-
args[:created_after].to_datetime
->"2025-03-17 00:00:00"
-
30.days.ago
(which includes the exact time of day) ->"2025-03-16 08:51:44 UTC"
- checks if created_after falls within 30.days.ago
-
So depending on the time of the day, this validation might fail.
How to set up and validate locally
- Add this line to
app/graphql/resolvers/concerns/resolves_merge_requests.rb
puts "created_after: #{created_after}, 30 days ago: #{30.days.ago}"
- Verify if
created_after
and30 days ago
resolves to the same time + timezone and that thecreated_after
falls within the last 30 days
- Before:
created_after: 2025-03-17T00:00:00+01:00, 30 days ago: 2025-03-16 08:51:44 UTC
- backend converted
created_after
to midnight because current time was not passed fro, client
- backend converted
- After :
created_after: 2025-03-17T08:51:44+00:00, 30 days ago: 2025-03-16 08:51:44 UTC
- backend converts
created_after
to current UTC
- backend converts
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #505449 (closed)
Edited by Jacques Erasmus