Page MenuHomeSoftware Heritage

Use api_origin_visit_latest instead of _origin_latest_snapshot in origin search.
ClosedPublic

Authored by vlorentz on Jul 10 2019, 1:37 PM.

Details

Summary

The former only supports an origin id, and fetches a whole snapshot
while we're only interested in knowing if there is such a
snapshot here.

Depends on D1709.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

anlambert added a subscriber: anlambert.
anlambert added inline comments.
swh/web/assets/src/bundles/browse/origin-search.js
51

I think you should check if the snapshot associated to the visit is not null here (cases exist in the archive)

This revision is now accepted and ready to land.Jul 10 2019, 1:56 PM
vlorentz added inline comments.
swh/web/assets/src/bundles/browse/origin-search.js
51

Are you sure the case exists? I checked with @olasd a few weeks ago and he said that's impossible.

The current implementation of snapshot_get_latest even contains an assertion that makes it crash if it happens.

swh/web/assets/src/bundles/browse/origin-search.js
51

Here is an example of a visit with a null snapshot:

https://archive.softwareheritage.org/api/1/origin/34893226/visit/1/

swh/web/assets/src/bundles/browse/origin-search.js
51

latestSnapshotUrl += "?require_snapshot=true"; makes sure we don't get a visit without a snapshot id.

swh/web/assets/src/bundles/browse/origin-search.js
51

Related task that made me find this corner case: T1301

swh/web/assets/src/bundles/browse/origin-search.js
51

I see, this can be safely landed then.

This revision was landed with ongoing or failed builds.Jul 11 2019, 3:50 PM
This revision was automatically updated to reflect the committed changes.