Database is derived from repos.json
#122
Notifications
Due Date
No due date set.
Blocks
#116 Implement CRUD
reuse/api
Reference: reuse/api#122
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Right now for a project (url) to have an entry in the database it needs to be registered:
And the registration information is stored in
repos.jsonThat means that our database is derived from
repos.json; it effectively is just cache.EDIT: to state it more plainly: the project should have just one persistent database
I think the title describes the main issue of REUSE API: that it depends on a JSON file produced by an app on the same host.
To fix this, forms needs an API from which a consumer app can get the relevant data.
I disagree rather strongly.
I think depending (at all) on
repos.jsonas the data source is hacky.The fact that the file is read-only is the crucial design flaw -- it effectively causes all high priority database 2.0 issues.c
Reading is the only thing that API itself does with the JSON file and I think it does it as well as as it can.
Thus I think adding a reading API to forms is actually low priority.
TLDR: IMO forms can function perfectly well (although a bit kludgy) just with rw acces to
repos.jsonIf one wants to think about forms I think there is a better question:
If two systems were to be redesigned how would we like them to interact with each other?
IMO the rule of hand says "let there be one database!" but with my current knowledge (or lack thereof) about forms I think that is a bad idea.
Forms was introduced for one task only: to provide a boolean information: if a new database record should be created for it.
Achieving this would be as simple as having a plain-text file with URLs that one could
grep -qthrough.Creating an API for getting a boolean value adds complexity.
I think that the conclusion "add an
exists(url: str) -> boolAPI to forms" is a misguided solution for reuse/api problems.It surely add complexity, but an understandable one. Relying on file read access to a file created by an independent application is usually considered bad design.
I consider the return of investment of adding this in forms quite good:
For a very good reason, you'll find an "API first" principle in most professional architectures and organizations ;)
The main problem I see with this "forms first" is the limited time frame @fkobi as for it. The time will not be enough for analyzing and overhauling forms plus implementing the needed changes in the services that use forms as source.
How you set priorities is of course up to you. I am just pointing out that it's generally a bad idea to continue hacking around problems when you should actually solve the root issues once you detected them.
Please see fsfe-system-hackers/forms#130 where I suggest a basic API for Forms that may allow you to build on proper API workflows from the start. I hope this will be helpful for you :)
I agree with that 100%.
However I think your PR is misguided.
Before explaining why I think it is the case I would like to make sure that everyone is on the same page.
If a project/repo is not found within the database only once (if the software functions correctly):
reuse-apineedsformsforms ONLY(!!) for the function that I brought up in the second block of the issue text.Let's assume that your forms PR got merged and this project used it. Great, the issue is fixed!
Or is it..?
Forms still holds all the registration data so it is the authoritative information source.
There are still two databases. Entries in reuse's should exist only if they are present in forms'.
Let me bring up the last line from the issue's description:
In this scenario
api's database is STILL derived fromforms' but this time not directly from a file but from a file accessed via an authenticated HTTP...(And still effectively functions as cache)
Summing up, your proposal does not fix the issue but makes it look better through adding complexity.
EDIT: to make it clear, I did not mean for this comment to be harsh.