Page MenuHomeSoftware Heritage

model: Raise error on naive datetimes.
ClosedPublic

Authored by vlorentz on Aug 14 2020, 2:13 PM.

Details

Summary

We may unknowingly pass naive datetimes to the storage through them,
causing the underlying DB to assign them a timezone that might not match
the actual one.

It already happens in swh.model and swh.loader.package tests.

Diff Detail

Repository
rDMOD Data model
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3793 (id=13312)

Rebasing onto d1db7b9954...

Current branch diff-target is up to date.
Changes applied before test
commit 6dd6acecc8297f8c9f77bdae0ccd291ceabdfd8e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Aug 14 14:12:29 2020 +0200

    model: Raise error on naive datetimes.
    
    We may unknowingly pass naive datetimes to the storage through them,
    causing the underlying DB to assign them a timezone that might not match
    the actual one.
    
    It already happens in swh.model and swh.loader.package tests.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/132/ for more details.

anlambert added a subscriber: anlambert.

Indeed, it seems a good idea to restrict naive dates.

This revision is now accepted and ready to land.Aug 14 2020, 3:01 PM
This revision was automatically updated to reflect the committed changes.