HomeSoftware Heritage

Do not reference unloaded snapshots in origin_visit_update

Description

Do not reference unloaded snapshots in origin_visit_update

When a repository fails to load, and the visit is set to partial status, some
loaders might have been able to generate a snapshot and an identifier, but
without actually loading it to the archive. This generates partial visits
referencing an inexistant snapshot.

Make sure that we only reference a snapshot in origin_visit_update when it's
actually been loaded (and flushed) to storage; do so by turning the
get_snapshot_id method into a loaded_snapshot attribute that gets populated
explicitly after flushing the snapshot to storage.

Details