Subject: Re: bug#45615: SWH API break?

From: zimoun <[email-masked]>
Date: Mon, 11 Jan 2021 15:45:55 +0100

Hi Ludo,

On Mon, 11 Jan 2021 at 14:12, Ludovic Courtès <[email-masked]> wrote:

>>   (snapshot-url visit-snapshot-url "snapshot_url" string*) ;string | #f

[...]

>> and why it is not string or #f.
>
> As discussed on IRC the other day, the culprit seems to be the recent
> guile-json upgrade (from 4.3.2 to 4.4.1, commit
> f9e1baa8933ea2ed385d0272dbfbe4e22f192bde).
>
> Were you able to check the raw JSON and see where the value is getting
> lost?

Well, maybe I miss something.  The JSON looks like:

https://archive.softwareheritage.org/api/1/origin/https://github.com/Genivia/ugrep/get/

as we already discussed [1] the other day.  From my understanding, when
the field does not exist, before guile-json sets to #f and now it sets
to #<unspecified>; I guess that it is related to the NEWS entry:

--8<---------------cut here---------------start------------->8---
  - Record-JSON mapping now allows using *unspecified* values to indicate a
    field record should not be serialized.
    (Fixes #61)
--8<---------------cut here---------------end--------------->8---

and the behaviour change is described here:

--8<---------------cut here---------------start------------->8---
Unspecified fields will now have the value *unspecified*. You mention
that json->link-record would assign a #f but that's not actually
correct, since a field could be a boolean in which case there would not
be a way to identify it. 
--8<---------------cut here---------------end--------------->8---

<https://github.com/aconchillo/guile-json/issues/61#issuecomment-703212590>

I am not familiar enough with Guile-JSON to see how to fix.  Any tips?

Cheers,
simon

1: <http://logs.guix.gnu.org/guix/2021-01-07.log#180852>