Page MenuHomeSoftware Heritage

[WIP]: Return more information with revision and release dates
Needs ReviewPublic

Authored by jayeshv on Sep 8 2022, 3:40 PM.

Details

Reviewers
None
Group Reviewers
Reviewers
Maniphest Tasks
T4365: GraphQL: Use the right date time serialization
Summary

Not all revision and release dates are convertable to datetime.
Add a new schema type to handle these two dates and return all the
availalble data.

Related to T4365

Diff Detail

Repository
rDGQL GraphQL API
Branch
timezone-D8425
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 33071
Build 51837: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 51836: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D8425 (id=30376)

Rebasing onto 467e0b7e28...

Current branch diff-target is up to date.
Changes applied before test
commit 124ea6de94268cbf71354b6e89c82f715d7dde3c
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Not all revision and release dates are convertable to datetime.
    Add a new schema type to handle these two dates and return all the
    availalble data.
    
    Related to T4365

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

Build is green

Patch application report for D8425 (id=30377)

Rebasing onto 467e0b7e28...

Current branch diff-target is up to date.
Changes applied before test
commit 79660a4c7058d7471d8ff90ad21cb4a166fa18c7
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Not all revision and release dates are convertable to datetime.
    Add a new schema type to handle these two dates and return all the
    availalble data.
    
    Related to T4365

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

vlorentz added inline comments.
swh/graphql/resolvers/scalars.py
31–32

use isinstance

36

What other types can value be?

swh/graphql/schema/schema.graphql
566

the doc should explain why there are both an ISO8601 date and timestamp + offset.

568

why not just Date?

Add types and support for None date

Build is green

Patch application report for D8425 (id=30439)

Rebasing onto 6e5d34e94d...

First, rewinding head to replay your work on top of it...
Applying: Return more information with revision and release dates
Changes applied before test
commit 09665f45133082d4a0447022bd1b0f921f180e50
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Not all revision and release dates are convertable to datetime.
    Add a new schema type to handle these two dates and return all the
    availalble data.
    
    Related to T4365

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

jayeshv retitled this revision from Return more information with revision and release dates to [WIP]: Return more information with revision and release dates.Sep 12 2022, 11:56 AM
jayeshv marked 2 inline comments as done.

use a timestamp instead of seconds and microseconds

jayeshv added inline comments.
swh/graphql/resolvers/resolvers.py
331

@vlorentz changed this to use a timestamp instead of seconds and microseconds. What do you think?

swh/graphql/resolvers/scalars.py
36

Can be an instance of TimestampWithTimezone or a python datetime. Any other type will return a None.
I don't really know the input (value) can be None, but that is anyway supported.

Build is green

Patch application report for D8425 (id=30441)

Rebasing onto 6e5d34e94d...

First, rewinding head to replay your work on top of it...
Applying: Return more information with revision and release dates
Changes applied before test
commit 41d660696bc4268a1ba8f934ea51bec06967cbbb
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Not all revision and release dates are convertable to datetime.
    Add a new schema type to handle these two dates and return all the
    availalble data.
    
    Related to T4365

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

swh/graphql/resolvers/resolvers.py
331

Using floats loses precision for very high or low timestamps; but I guess that's fine

swh/graphql/resolvers/scalars.py
36

why not two different functions, one for each type?

swh/graphql/resolvers/scalars.py
36

This same function is used to serialize datetimes from both user generated (date field in the Date object) and db dates (date in revision object).
adding two different scalars for both types is perfectly fine, but wouldn't that make a client a bit more complex? (I was trying to keep the number of scalars to a minimum)

swh/graphql/resolvers/scalars.py
36

Fix the typo

This same function is used to serialize datetimes from both user generated (date field in the Date object) and db dates (date in the visit status object).
adding two different scalars for both types is perfectly fine, but wouldn't that make a client a bit more complex? (I was trying to keep the number of scalars to a minimum)

Build is green

Patch application report for D8425 (id=31584)

Rebasing onto 7522a848fa...

Current branch diff-target is up to date.
Changes applied before test
commit 85c9bf459f242c103e46946cb043d66d0648b59f
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Not all revision and release dates are convertable to datetime.
    Add a new schema type to handle these two dates and return all the
    availalble data.
    
    Related to T4365

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

Build is green

Patch application report for D8425 (id=32118)

Rebasing onto c28b65feaf...

Current branch diff-target is up to date.
Changes applied before test
commit 5e8890d818d11314c674bb742898905ac5bdce92
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Not all revision and release dates are convertable to datetime.
    Add a new schema type to handle these two dates and return all the
    availalble data.
    
    Related to T4365

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