Page MenuHomeSoftware Heritage

Return more information with revision and release dates
ClosedPublic

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

Details

Summary

Return more information with revision and release dates

Revision and release dates could have different values for offset.
Add a new schema type to handle these two dates and return available
offset as a binary string.

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.

jayeshv retitled this revision from [WIP]: Return more information with revision and release dates to Return more information with revision and release dates.Dec 12 2022, 3:32 PM
jayeshv retitled this revision from Return more information with revision and release dates to [WIP] Return more information with revision and release dates.Dec 20 2022, 10:10 AM

Build is green

Patch application report for D8425 (id=32323)

Rebasing onto c8bc6947fa...

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 d389e69c86db19bed90938384e2e638120fed3b9
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/255/ for more details.

Change offset to a binary string

Build is green

Patch application report for D8425 (id=32332)

Rebasing onto c8bc6947fa...

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 ec9873527f0afbb8e500a51173d2b2b847f536e5
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Revision and release dates could have different values for offset.
    Add a new schema type to handle these two dates and return available
    offset as a binary string.
    
    Related to T4365

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

jayeshv retitled this revision from [WIP] Return more information with revision and release dates to Return more information with revision and release dates.Dec 20 2022, 4:03 PM

Build is green

Patch application report for D8425 (id=32333)

Rebasing onto c8bc6947fa...

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 49ee60bf79d6973b61b76d07033f4e0911148930
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Revision and release dates could have different values for offset.
    Add a new schema type to handle these two dates and return available
    offset as a binary string.
    
    Related to T4365

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

anlambert added a subscriber: anlambert.

LGTM but you also need to wrap the committer_date field from Revision model.

swh/graphql/schema/schema.graphql
622

I just noticed that you forgot to wrap the commiter_date field from the revision model.
You should add it as that info is important to have.

This revision now requires changes to proceed.Dec 21 2022, 11:04 AM

Add committer_date im the revision object

jayeshv added inline comments.
swh/graphql/schema/schema.graphql
622

Thanks, added that.

Build is green

Patch application report for D8425 (id=32340)

Rebasing onto c8bc6947fa...

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 7995e5a4858a71a54a1ac853caabe3a357842215
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Sep 8 15:25:40 2022 +0200

    Return more information with revision and release dates
    
    Revision and release dates could have different values for offset.
    Add a new schema type to handle these two dates and return available
    offset as a binary string.
    
    Related to T4365

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

This revision is now accepted and ready to land.Dec 21 2022, 12:03 PM
jayeshv marked an inline comment as done.

rebase

Build is green

Patch application report for D8425 (id=32341)

Rebasing onto c8bc6947fa...

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

    Return more information with revision and release dates
    
    Revision and release dates could have different values for offset.
    Add a new schema type to handle these two dates and return available
    offset as a binary string.
    
    Related to T4365

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