internetarchive / internetarchive/openlibrary
Add parity edition_id to Ratings table (help reverse bad merges)
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 138
Description
### Describe the problem that you'd like solved
Right now when works are merged, the resolve_redirects bot will go through and change all references from stale redirects to the most up to date work.
In some cases, it's discovered that the merge was bad -- e.g. imagine if all Artemis Fowl books, which should be 3 different books in a series, were merged into one and all their ratings were combined. In this case, even if the works were split back out into 3 separate books, the ratings have all been combined and there's no way to recover.
The proposal is to add a parity field called `edition_id` which gets set when a patron rates a book. It will not be part of the public key (so still only one vote is allowed per work). What would happen is, if two works were merged into one and later had to be unmerged, we'd be able to look through the ratings table, see where the work_id in the table disagrees with the current work attached to the edition_id, and then update the table's work_id to effectively ~reverse/undo the merge.
TL;DR, use a parity edition_id to keep track of an edition across work merges so if a merge is undone, we can find and update the work_id in the table according to the work_id associated with the stable edition_id.
### Proposal & Constraints
db changes would be easy. We'd still need to make the code changes and update the resolve_redirects code.
I think we'd just need a separate task which goes through Ratings, looks up the Work by edition key, and updates the work key.
The edition_id lets us fix the work_id after a merge
### Additional context
### Stakeholders
Contributor guide
Assessment
This issue has not been assessed yet.