openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Edition-level `authors` silently corrupted (likely by 2014 author merges) — field is invisible and uneditable in the UI

Open lokesh opened this issue 3 months ago • 9 comments

Problem

Edition-level authors links can be silently corrupted (in this case, apparently by 2014 author-merge operations) and the UI provides no way to see or fix the field — the book page and edit form both show only the work's authors. The bad data is invisible on openlibrary.org but is served to all API and bulk-dump consumers, who inherit it into downstream apps and datasets.

Concrete case — edition OL18241658M (Shiloh, ISBN 0689316143). In the edition JSON:

  • authors → /authors/OL27452A = Jean Little ❌
  • the same record's by_statement = "by Phyllis Reynolds Naylor."
  • its work OL13489W correctly links OL22786A = Phyllis Reynolds Naylor ✅

Version history shows the link was correct from the 2008 import, then rewritten twice in 2014 — consistent with collateral damage from author merges (a misfired merge rewrites every edition that pointed at the merged record, so this is unlikely to be a single record):

revision date edition authors
v4 2010-08-18 OL22786A (Naylor) ✅
v5 2014-05-17 OL1122551A (Paul Galdone) ❌
v6 2014-06-27 OL27452A (Jean Little) ❌ — unchanged for 11 years since

Potential scope: the class is machine-detectable from the dump alone (edition authors disagreeing with the work's authors; here it even contradicts its own by_statement). Cross-referencing a 3,000-edition sample against external sources (Wikidata, LoC, HathiTrust, K10plus) with a data-quality tool I've been building, ~1.3% of editions flagged author disagreements; this record is the first hand-verified as edition-link corruption. Happy to run a broader scan and report back.

(Same record: publish_date "1996" also contradicts its own LC classification PZ7.N24 Sg 1991 and external sources, which agree on 1991.)

Reproducing the bug

  1. Open https://openlibrary.org/books/OL18241658M.json → authors is /authors/OL27452A (Jean Little), while by_statement says "by Phyllis Reynolds Naylor."
  2. Open https://openlibrary.org/books/OL18241658M/Shiloh → the page shows "Phyllis Reynolds Naylor" (the work's author), so the error is invisible on the site.
  3. Open the edition's edit form → there is no field exposing the edition-level authors link, so it can't be corrected through the UI.
  • Expected behavior: the edition's author link matches the work/by_statement (Phyllis Reynolds Naylor), or at minimum is visible and editable so librarians can fix it.
  • Actual behavior: the edition serves Jean Little to API/dump consumers; the website hides the field and the edit form can't touch it.

Context

  • Browser (Chrome, Safari, Firefox, etc): n/a — data-layer issue, reproducible via public JSON API
  • OS (Windows, Mac, etc): n/a
  • Logged in (Y/N): N (visible logged out)
  • Environment (prod, dev, local): prod

Breakdown

Implementation Details (for maintainers)

Possible directions (happy to leave the call to maintainers):

  1. Repair this record: edition authors → OL22786A (and publish_date → 1991).
  2. Size the problem: scan the editions dump for edition-vs-work author disagreements.
  3. Longer term: either expose edition-level authors in the edit UI, or declare work authors canonical and sync/clear stale edition-level links so API/dump consumers aren't served data the site itself ignores.

Requirements Checklist

  • [ ]

Related files

Stakeholders


Instructions for Contributors

  • Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

lokesh avatar Aug 05 '26 17:08 lokesh

⚠️ Contributors, this issue will be ready to work on once:

  • [ ] Triage — maintainers will add Priority: * and Lead: @*
  • [ ] Needs: Staff Decision — which remediation path to pursue: (1) hand-repair the cited record, (2) run/authorize the broader dump scan to size the problem, and/or (3) commit to a longer-term fix (expose edition-level authors in the edit UI, or make work authors canonical and stop serving stale edition-level links)
  • [ ] Needs: Breakdown — the "Requirements Checklist" and "Related files" sections of the template are unfilled; a concrete task list can't be written until the decision above is made

Context

  • The rendering bug is confirmed in code, not just in this one record. Edition.get_authors() merges edition-level authors with work authors: https://github.com/internetarchive/openlibrary/blob/a69a39a1941960d130cf9912a0281c6375ab4597/openlibrary/plugins/upstream/models.py#L124-L129 — but the edition view template never calls it when a work exists; it short-circuits to work.get_authors() only: https://github.com/internetarchive/openlibrary/blob/a69a39a1941960d130cf9912a0281c6375ab4597/openlibrary/templates/type/edition/view.html#L89 (same pattern at L115-L116, and in title_and_author.html). Since nearly every edition has a work, this means any edition-level authors override (correct or corrupted) is effectively unreachable in the rendered page for the vast majority of records — this is systemic, not specific to OL18241658M.
  • The edit form corroborates the report: the "Author" rows in the edition edit form are populated from work.get_authors(), not the edition's own authors field, so there is genuinely no form control that touches edition-level authors: https://github.com/internetarchive/openlibrary/blob/a69a39a1941960d130cf9912a0281c6375ab4597/openlibrary/templates/books/edit/edition.html#L234-L240
  • The merge mechanism that likely caused this is BasicRedirectEngine.update_references, which recursively rewrites every {"key": ...} reference (including on editions) from a merged-away author to the master: https://github.com/internetarchive/openlibrary/blob/a69a39a1941960d130cf9912a0281c6375ab4597/openlibrary/plugins/upstream/merge_authors.py#L50-L63. It behaves as designed for legitimate merges — the risk is a misfired merge (wrong master chosen) silently rewriting every edition that referenced the duplicate, with no UI surface to notice or revert individual edition links afterward.
  • This is a duplicate/continuation of long-standing open issue #2625 ("Editions sometimes have authors field," open since 2019, Lead: @cdrini), which already worked through most of the same questions: whether edition-level authors should exist, whether they should be editable, and whether they can drift from the work after a merge. A 2022 comment on that thread explicitly anticipated this exact failure mode: "edition author links should not impede author merges, rather they should reflect them" (comment). Closed issue #970 ("Removed author lingers in edition record json after deletion from work record") is also related but narrower (deletion, not merge).

Issue Assessment

Open questions

  • Which of the three proposed remediation paths (repair this record / size the problem via a broader scan / redesign the UI-data-model relationship) should be pursued, and in what order? This is a product/architecture call for a lead, not something resolvable from the codebase alone.
  • Should the publish_date discrepancy mentioned parenthetically (1996 vs. the LC-classification-supported 1991) be split into its own issue? It's a different data-quality class (import/cataloging error, not merge corruption) bundled into the same report.
  • Is @lokesh's offer to run the broader 3,000+ edition scan against the dump something the team wants actioned now, and if so, should results land as a new issue or as an update here?

Action items

  • [x] Related files (Answer: openlibrary/plugins/upstream/models.py Edition.get_authors(); openlibrary/templates/type/edition/view.html and openlibrary/templates/type/edition/title_and_author.html for the display short-circuit; openlibrary/templates/books/edit/edition.html for the edit-form gap; openlibrary/plugins/upstream/merge_authors.py BasicRedirectEngine.update_references for the likely corruption mechanism.)
  • [x] Stakeholders (Answer: see below.)
  • [ ] A maintainer should confirm whether the 2019-2022 discussion on #2625 already settled on a direction that should just be applied here, or whether this new evidence (a hand-verified corruption case with version history) changes that conclusion.

🔔 Stakeholders

@jimchamp — owns the librarian merge queue (where the root-cause merge mechanism lives) and JS & partials (which cover the edit-form gap this issue also reports).


Full triage checklist
  • [x] Triage — labels applied per this comment; final Priority:/Lead: still needed from a maintainer
  • [x] Problem / opportunity — clear: a specific, hand-verified corrupted record with reproduction steps and root-cause hypothesis
  • [ ] Scope — bundles three things: a single-record repair, a scan/sizing proposal, and a UI/data-model design question; a Needs: Staff Decision is on file to narrow this
  • [x] Justification — corrupted data is served to all API/dump consumers even though it's invisible on-site; concrete downstream impact
  • [ ] Success & testing criteria — not defined; depends on which remediation path is chosen
  • [ ] Proposal & breakdown — three directions offered, no checklist; breakdown depends on the staff decision above
  • [x] If bug: environment & repro steps — precise repro steps and version-history table provided
  • [x] Risks, concerns, open questions — surfaced by the reporter and expanded on above
  • [x] Richy context — code paths and duplicate issue (#2625) identified; no exact duplicate PR found
  • [x] References — edition JSON, version diffs, and permalinks all present

[!NOTE] This comment was automatically generated by Richy, Open Library's issue enrichment assistant, on behalf of @mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.

openlibrary-bot avatar Aug 05 '26 17:08 openlibrary-bot

One of the author merges is just straight up vandalism: https://openlibrary.org/recentchanges/2014/05/17/merge-authors/48060524 which was reverted by Anand: https://openlibrary.org/recentchanges/2014/07/08/undo/48147719 but the state of the undo software in 2014 was probably such that it did an incomplete job (and the vandal's account is still active).

The data corruption issue is much more widespread and impactful than described here. ANY bad edition author, whether it's a redirect or delete, will block author and work merges, causing them to error. There's a significant set of author records which were deleted by the so-called "MARCbot" with a comment saying they're unused, when, in fact, they are used in edition records, which wasn't taken into account when deleting them. Links from editions to redirected authors happen when the edition records aren't correctly rewritten (probably several causes).

It doesn't make sense to spend time fixing edition authors just to delete them later, so the first thing to do is to decide what the data model actually looks like. Someone needs to drive this decision and then enforce it. I personally believe that primary authors/editors/compilers belong on the work with edition contributors including roles like illustrator, translator, foreword writer, etc which change from edition to edition, but it really depends on how sophisticated you want the data model to be. Any changes to the data model should also be done with an eye towards what the library community is doing with BIBFRAME.

A related issue is that a recent change to the MARC importer started importing some of the non-primary roles, but at the work level instead of the edition level. This has included things like translator which should be moved to the edition, but also roles like "former owner" which don't make sense at all separate from the context of a single copy.

data-quality tool I've been building

I'll be curious to see how this is received given that metadata quality is absolutely the lowest priority (cf. Amazon used book listings & BWB with conflated authors, mispellings, wonky capitalization, etc). To the first approximation, deleting/ignoring all BWB/"Promise" items and Amazon items which aren't from publishers would give you a VERY significant increase in metadata quality.

If you get any traction in recognition of how important data quality is, I'd be happy to share my knowledge on the subject.

tfmorris avatar Aug 05 '26 19:08 tfmorris

As promised, I ran the dump-wide scan. Method: using the 2026-07-31 dumps, compare each edition's own authors against its work's authors, resolving redirects on both sides first (so merged ids don't produce phantom mismatches), and flag only editions whose author set shares nobody with the work's — sharing even one author (translator, illustrator variation) is not flagged.

Results: of 49.3M editions with authors on both levels, 336,285 (0.68%) are fully disjoint from their work. They break into three distinct failure classes:

class count example
Edition credits a genuinely different person than the work (this issue's class) 229,488 OL21310051M High hearts → Jean Little (work: Rita Mae Brown)
Edition points at a different author record with the same name (duplicate author records; breaks identity linking, not display) 102,167 OL35297218M The Dead Zone → OL7829293A "Stephen King" (work: OL19981A "Stephen King")
Edition points at a record literally named "Duplicate of OL…A …" (abandoned merges) 4,630 2,326 editions → "Duplicate of OL23082A George MacDonald"

Two mass-corruption events stand out:

  • 54,429 mismatches involve works claiming "Rand McNally" as author — mostly UK parliamentary documents (edition author "Great Britain.") attached to Rand McNally works.
  • 12,619 editions credit Jean Little (OL27452A) on other people's works — the same signature as this issue's Shiloh record, whose history shows the link was rewritten in mid-2014; that event's blast radius appears to be five figures.

Verification: 8/8 randomly sampled flagged editions still show the corrupted edition-level author in the live API today (the Dead Zone example above was also re-verified live just now). The scan runs offline against the public dump in ~7 minutes, so it's cheap to re-run monthly or against any fix. Happy to share the full JSON (336k records with edition/work/author ids) or the methodology/code if useful.

lokesh avatar Aug 06 '26 16:08 lokesh

data-quality tool I've been building

@tfmorris One of the goals for the year is to do an edit-in-place experiment to encourage participation. What this 'edit-in-place' exploration could entail is a single click process to verify, add, or edit data on a book page. How this is gated, what fields should be editable, how we highlight fields that need verification or are missing is still TBD. The end goal is to make the ramp for patrons to become participants more visible and gentler.

James Ore is a fellow who will be guiding this project. I'm assisting. To better understand the librarian experience so I can better assist with this project, I've been looking at our book data, making edits where I find issues, and taking notes on the process. And to help me get started on the edits, I built a tool that takes OL's book data and cross-references it against other big book databases (Google Books, national libraries, etc.) to see where OL's info disagrees with what most other sources have aligned on. Keeping the human in the loop, but some fixes could be automated in the future if confidence is very high.

Here are a couple of screenshots. Happy to share the tool and make the code public so you and others can try it out:

Image Image

lokesh avatar Aug 06 '26 16:08 lokesh

I've done a quick audit of edition authors not represented in author dumps, to capture deleted authors still referenced. Which is perhaps a slightly different angle from the original report, but @tfmorris' message identifies it as a clear problem.

There are 2,270 'inactive' author records still attached to 124k editions.

Author types:

  Count Type
  ----------       
      3 404
   2107 delete
    160 redirect

I can step through and remove all of these. The deletes were likely removed for being spam or non-author records (or historically merge conflated "please delete me" named records).

The redirects are hopefully represented correctly at the work level, but I can check these before removing them from editions. This should repair any problems with data consistency I may have caused in the past.

I don't know about the mis-match cases (how many seems to be stated above, but the fix -- from @tfmorris' analysis, sounds like it can depend). The problem with mis-matches seems to be that either one could be correct, and there seems to be an idea that there are cases where an author legitimately belongs on the edition but not the work. The causes of these seem to be 'bad-metadata' merges.

hornc avatar Aug 06 '26 22:08 hornc

Following up on my scan above. Lots of prior discussion - @cdrini's #2625 (open since Nov 2019), #3413, #5265, #5594, #970, #9863, #12314.

#2625 has sat at Priority: 4 / Needs: Feedback for seven years, it's invisible to patrons, so it never wins against work that patrons can see. But these discussion often stalled on "how big is this, and what's actually in there?", and that's now cheap to answer. Leaving the numbers on the record so have the next person doesn't start from zero. Nothing here needs a decision today.

1. Where author data actually lives

Editions have four separate people-carrying fields, and no two of them are wired up the same way. Coverage from a 300k-edition sample of the 2026-07-31 dump:

field coverage shape roles? declared in /type/edition? written by on book page? editable? in Solr?
authors 85.4% author-record IDs no yes import no no via work
by_statement 38.5% free text n/a yes import + UI yes yes no
contributions 20.6% strings, e.g. "Halio, Jay L." in-string, often absent yes import (MARC 700/710/711/720) no no yes
contributors 0.3% {role, name} yes no — undeclared UI only yes yes no

Top contributors roles in that sample: Translator, Editor, Illustrator, Contributor, Author, Cover Design, Cover Art, Introduction, Photographer, Foreword, Narrator/Reader.

Three things I hadn't appreciated until I read the schema and the type definition:

Edition authors structurally cannot hold a role. shared_definitions.json#/author is additionalProperties: false with key as the only permitted property. The work side uses author_role, which does have a role slot. So the model is inverted from what you'd expect: the work can express roles, the edition can't. Confirmed in the data — of 256,218 sampled editions with authors, zero author entries carry any field beyond key.

This matters for the direction @hornc argued on #2625 ("editions can have separate authors for different parts and roles (preface, editors, translators etc)"). I think that's the right goal; the obstacle is that authors as specified can't carry it, and neither of the two fields that could is complete.

contributions and contributors are near mirror images — each has what the other lacks. contributions is declared in /type/edition, comes from MARC imports, and is indexed in Solr, but is never rendered or editable. contributors is rendered and editable, but is declared in no schema — not edition.schema.json, not import.schema.json, not the infogami type — and Solr excludes it deliberately (solr/updater/work.py: "contributors wasn't included here in the past, but we likely want it to be edition-only if possible? Excluding for now…"). That's also why it sits at 0.3%: imports structurally can't write it, so only hand edits produce it. #8717 asked for it to be added to the import schema and was closed without the field being added.

Where an edition has both, they're the same people stored twice, already drifting — OL12568519M has contributions: ["Louise Comfort (Illustrator)", …] alongside contributors: [{"role": "Illustrator", "name": "Louis Comfort"}, …].

The work's authors are derived from the edition's, not vice versa. add_book/__init__.py#L291-L298:

if "authors" in edition:
    w["authors"] = []
    for i, akey in enumerate(edition["authors"]):
        author = {"type": {"key": "/type/author_role"}, "author": akey}
        if role := rec["authors"][i].get("role"):   # role survives on the work
            author["role"] = role                   # and is dropped from the edition
        w["authors"].append(author)

And illustrators are explicitly routed away from authors at import (import_edition_builder.py#L111-L112):

def add_illustrator(self, key, val):
    self.add_list("contributions", val + " (Illustrator)")

So edition authors is the import-provenance record, and the work's list is the copy — which is worth keeping in mind for any "just delete them" proposal.

2. The numbers

2026-07-31 dump: 56,615,822 editions, of which 49,788,210 (87.9%) carry their own authors. This isn't a rare legacy remnant.

Of the 49.3M editions that have authors at both levels (1-in-100 spread sample, 492,975 pairs, redirects resolved on both sides):

edition's author set vs. its work's share ≈ editions
identical 95.60% ~47.1M
edition adds people the work lacks 1.57% ~774k
edition has fewer than the work 1.55% ~764k
partial overlap 0.61% ~301k
fully disjoint 0.67% ~336k

The disjoint figure independently reproduces the full scan I posted above (336,285 / 0.68%), by a different method — so I'm fairly confident in the split.

3. The 774k "extra people" are not one thing

This is the bucket I'd flag as most interesting, because it's the one that isn't simply noise. Hand-resolving a sample of editions that add authors beyond the work:

  • OL36225638M My Weirdest School #11 — extra OL1604762A Jim Paillot, the illustrator (work: Dan Gutman)
  • OL42678022M The Black Tulip — extra OL10419220A, an author record literally named "Jose Pavon (translator)" (work: Dumas)
  • OL38797569M Extreme Killing — extra OL219753A Jack Levin and OL7644759A Emma E. Fridel, who are genuine co-authors the work record is missing. Here the edition is more correct than the work.
  • Junk: "The Perfect The Perfect Library", "Benchmark Education Company LLC Staff"

That second one seems worth dwelling on: a cataloguer had nowhere to put the role, so it went into the person's name. That's the missing role slot showing up as data corruption of a different kind — and it isn't fixable by moving the data, because as noted above there is currently no field that is simultaneously role-bearing, importable, indexed, and editable.

4. What I'd take from this

Mostly that "should editions have authors?" is four questions with four different answers, which may be why it's never resolved as one:

  1. ~47.1M exact duplicates — carry no information either way. Low stakes, high volume.
  2. ~336k disjoint — corruption. Repairable now; needs no data-model decision. (Blocked in practice by #3413/#5594, since dangling edition→author refs make merges error out.)
  3. ~774k supersets — the genuinely valuable subset, and a deletion target only if the information is preserved somewhere. But there's currently nowhere to put it: contributions can't express a structured role, and contributors is undeclared, un-importable and unindexed. So this bucket is blocked on picking (or completing) a destination field, which is a data-model decision rather than a cleanup task.
  4. The uneditable field itself (#5265) — independent of 1–3, and the reason any cleanup rots again.

Last note for API consumers reading this — on #10851 the current guidance is to use search.json (work-level) rather than the edition JSON, which I think is the right advice today, but it does mean the edition authors field is knowingly served to every dump and API consumer while being treated as untrustworthy internally.

lokesh avatar Aug 06 '26 23:08 lokesh

Also, for the screenshoted metadata comparison tool, it's not clear what specific problems are being addressed. The results show that maybe there's a problem with a Jean Little merge, but it also shows the tool is not very edition aware. The one row marked as 'real issue' is presumably pointing the the first Arrow edition of Contact, which was published in 1986, https://openlibrary.org/books/OL59020465M/Contact_A_Novel , so the OL metadata is accurate for that record, and that linked item.

Changing publishers and pagination on records just to get more conformity between catalogs doesn't seem like it helps any specific usecase, and in fact could make metadata less accurate.

The UX of step-through-and-fix-each-item risks burying larger systematic causes of issues, even granting that increasing patron participation, not metadata quality, may be the primary goal here. As @tfmorris points out, there are some already well known causes that could be addressed more directly.

hornc avatar Aug 06 '26 23:08 hornc

A few things:

  • I'm pleased with the focus on metadata quality, but agree with @hornc that some data are much more important than others. Things like page count, subtitles which consist of "A novel" or "Roman", etc are way down the list when there are so many more critical data quality issues.
  • contributions vs contributors just sounds like a straight out bug
  • Downstream consumers who don't understand the strengths and weaknesses of OL data are asking for a world of hurt. They need to do significant cleaning before it's useful.

The three examples are worth looking more closely at:

  1. OL36225638M My Weirdest School #11 — extra OL1604762A Jim Paillot, the illustrator (work: Dan Gutman). A BWB source record, but the BWB link is dead, so no way to verify the data, but looking up the ISBN shows that it's an eBook which indicates that it probably never should have been imported since they are typically licensed, not sold, and IA is never going to "scan" it. Similar editions have MARC records including 700 1 $aPaillot, Jim,$eill. indicating the illustrator
  2. OL42678022M The Black Tulip — extra OL10419220A, an author record literally named "Jose Pavon (translator)" (work: Dumas). Another BWB import (strike 1) that was "Independently published" (strike 2) and has an ISBN without any hits on WorldCat, Amazon, or anyplace else in the known universe (strike 3). Another record which never should have been imported for multiple reasons. The "(translator)" annotation was added to that author record after import by someone who also renames things to "Delete" or "See xyz", which is definitely not recommended best practice.
  3. OL38797569M Extreme Killing — extra OL219753A Jack Levin and OL7644759A Emma E. Fridel, who are genuine co-authors the work record is missing. Here the edition is more correct than the work. Yet another BWB import with a dead BWB link, but the ISBN is for the fifth edition. The first three editions only had two co-authors, but only the first got imported because it predated #9901 . The third co-author (Levin) was added for editions four and five. This is one case where it could potentially be useful to have edition-specific authors, but not much fidelity would be lost by just updating the work record with all the authors. Other cases include series which have an overall series editor, but then individual authors for each of the volumes in the series.

When #12314 gets fixed, it may be worth considering reimporting the available MARC records and updating the database. It would need to be done with care, but there have been a great many improvements in the MARC importer over the years. This would be a much higher quality source of data than BWB or Amazon, making the work much easier.

tfmorris avatar Aug 07 '26 03:08 tfmorris

@tfmorris I agree that Downstream consumers who don't understand the strengths and weaknesses of OL data are asking for a world of hurt. They need to do significant cleaning before it's useful. Unfortunately it isn’t just them being hurt. A great many defective records are republished, offered for sale on AMZ BWB etc, then inhaled again here under a new ISBN. This is particularly common in public domain cases. We can’t expect the polluted pool to clean itself.

LeadSongDog avatar Aug 07 '26 03:08 LeadSongDog