codegouvfr / codegouvfr/catalogi
`isLibreSoftware` is false for most entries because the free-software licence allowlist has the wrong Wikidata IDs
- Dominant language
- TypeScript
- Stars
- 43
- Forks
- 14
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 3
Description
Opening an issue first, as CONTRIBUTING asks, before proposing anything.
On scope, since I saw #566 get redirected and I understand why: this is not a request to list a particular piece of software. It is a defect in catalogi's own code, so it affects any deployment, not just the SILL.
## What I ran into
I was trying to work out why XCP-ng shows as not being free software on the SILL, assuming the fault was in our own Wikidata data. It is not.
`isLibreSoftware` is computed in `api/src/core/adapters/wikidata/getWikidataSoftware.ts`:
```ts
"isLibreSoftware": license === undefined ? false
: freeSoftwareLicensesWikidataIds.includes(license.id),
```
So it reads the software's P275 (copyright license) and checks it against the hardcoded `freeSoftwareLicensesWikidataIds` array at the bottom of the same file.
## The array
I checked all 51 IDs in it against Wikidata. Three point at the licence their comment claims. A sample of the rest:
| ID | Comment says | The item actually is |
|---|---|---|
| `Q309877` | Apache License 2.0 | *Lepismium cruciforme*, a species of cactus |
| `Q334062` | Mozilla Public License 2.0 | Jozo Tomasevich, historian (1908-1994) |
| `Q1277061` | GNU AGPL v3.0 only | Earl Fuller, musician (1885-1947) |
| `Q2464622` | GNU GPL v3.0 or later | Marília, a microregion of Brazil |
| `Q369616` | CeCILL v2.1 | Antigama, a Polish grindcore band |
| `Q39015` | GNU LGPL v3.0 or later | Harlem Désir, politician |
| `Q1507844` | BSD 2-Clause | George Manners, 11th Baron de Ros (d. 1513) |
| `Q5099871` | CeCILL-B | China Railways JF, a series of steam locomotives |
GPL-2.0 is absent from the list in any form, so no GPL-2.0 software can ever evaluate as true. XCP-ng's P275 is `Q27016752` (GPL-2.0-or-later) and is correct, which is what sent me looking at the consumer rather than the data.
On the SILL deployment, 440 of 668 entries currently read `isLibreSoftware: false`. In practice the flag only works for MIT-licensed software. I have not looked at other deployments.
## What I think the fix looks like
Resolve each ID from the Wikidata item that carries the matching SPDX licence ID (P2479), and record the SPDX code in the comment next to each entry, so the table can be re-checked mechanically instead of by eye.
Two entries needed a judgement call:
- **BSD-2-Clause**: `Q18517294` ("2-clause BSD License") is the right item, but it carries no P2479 claim, so it is not reachable by an SPDX lookup. It needs to stay hardcoded with a note.
- **CeCILL-B**: there is no Wikidata item for it at all. I dropped the entry rather than leave it pointing somewhere wrong.
I also removed one duplicate, since "GNU General Public License, version 3.0" is the same licence as GPL-3.0-only. That takes the list from 51 entries to 49.
I have this on a branch and can open a PR if it is useful.
If you would rather derive the list from P2479 at build time instead of maintaining it by hand, that would stop it drifting again, but it is a bigger change, and I did not want to assume which way you would want to go.
Contributor guide
Research direction
Start in api/src/core/adapters/wikidata/getWikidataSoftware.ts, especially the freeSoftwareLicensesWikidataIds array and its isLibreSoftware check. Verify each entry against the Wikidata item carrying the matching SPDX licence ID (P2479), preserving the noted BSD-2-Clause exception and removing the unsupported CeCILL-B and duplicate entry. Done means valid licence IDs are listed with SPDX comments and GPL-2.0-or-later is recognized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100