openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

BookWorm: Migrating from bot accounts → self-serve Import service

Open mekarpeles opened this issue 2 months ago • 3 comments

Imports: from bot accounts to a self-serve batch import service (umbrella epic)

This umbrella epic maps the whole Imports direction in one place: where we are, where we are heading, and which issue holds each piece. It does not replace any existing epic. The work stays where it lives — this is the page that says how the pieces relate and why.

  • Refs #12655 (BookWorm — separate DB, FastAPI service). Stays the home of the service and database work.
  • Refs #12844 (Feed Registry & Acquisitions). Stays the home of feeds, acquisitions and provider ingestion.
  • Refs #5792 (Trusted Book Providers) and #10251 (Simplify TBP integration) — both predate the above and have been idle 14 and 12 months. Proposed: fold into #12844 and close.
  • Refs #11264 (Solr acquisitions field) — superseded in approach; see §4.
  • Refs #13755 §6 (new imports get managed Tags). The import-side hook is ours; the vocabulary and pipeline stay in the Tags epic.
  • Refs #7684 (Improve imports) — the 2023 umbrella epic that first gathered the import backlog by source, API, data quality and author resolution. Most of its direction is carried forward here; it remains the index of the individual quality/source issues (e.g. #6555, BWB import quality). Treat this epic as the live direction and #7684 as the catalogue it draws from.

Facts below are marked [verified] when checked against code on master or read-only GETs against openlibrary.org on 2026-09-30, and [reported] when taken from an issue or PR body.


Why we are doing this

Today the only way a partner gets data into Open Library at scale is a bot account with write access to the production application. That is the thing to move away from, and there are four separate reasons (the objectives of this work), each of which independently justifies it.

1. Mitigate risk — bot access is a permission problem we keep answering by hand. Bot access grants broad, hard-to-audit write permission to the production application. There are, as of 2026-10-15, 10 open Bot Request-labelled issues (query linked so the count stays current rather than drifting) [verified]. Every one is an individual judgement about how much of the production application to expose to an outside party, made by a human, with no tiering and no self-serve path. It does not scale, and the answer we keep reaching for is more trust than the task needs.

2. Site reliability — the import API is a firehose pointed straight at the app. POST /api/import writes to the catalogue directly. #12655 already says of it: "we want to move away from this" [reported]. A partner who wants to submit 10,000 records today either gets write access to the live application or waits for a human to run a script.

3. The batch system shares Open Library's database, and saturates it. import_batch and import_item live in the production openlibrary database, and manage-imports.py drains them continuously against the same database that serves readers. That coupling is why import volume is a production-capacity question rather than a queue-depth question.

4. Hands-free — the legacy strategy made staff run imports on partners' behalf. Getting a partner's data in has meant a staff member running import tasks by hand, one partner at a time. That is toil that does not scale and is the human cost the self-serve model exists to remove.

Where we are heading: a partner submits a batch themselves, watches it, and never touches the application. Self-serve creation, review and approval; an isolated queue that cannot starve the site; and failures that say what went wrong.


Who imports, and how it varies

The self-serve model has to serve more than one kind of importer, and the right UI/API/tiering decisions depend on which. Audiences:

  1. Agentic agents — automated callers acting for a user or org.
  2. Partner projects — e.g. Wikidata.
  3. Libraries.
  4. Individuals / librarians.
  5. Book applications — third-party apps integrating OL.
  6. Publishers.

And the same audience varies along axes that change what the system must support:

  • Frequency: a one-time import vs. an ongoing feed.
  • Size: a few records vs. ~1M bulk items.
  • Content: books, authors, series.
  • Technical comfort: some will use an upload UI; others the openlibrary-client. Both paths (§7) have to exist because these audiences do not overlap in capability.

This taxonomy is why §7 needs both a UI and a client, why §13's tiering cannot be one-size, and why "size" feeds directly into the pacing problem in §9.


Status at a glance

# Area Status
1 Feed Registry (feed_registry table + FeedRegistry) ✅ On master, feeds registered
2 Acquisitions table and interface ✅ On master, populated in production
3 opds_acquisitions surfaced in search.json ✅ Deployed and verified in production
4 Scheduled harvest (nothing fires today) 🟡 PR written, unmerged; gated on a load question
5 BookWorm as a standalone FastAPI service 🟡 Prototype exists in another org; contract frozen
6 Isolated openlibrary_imports database 🔴 Not provisioned; three deploy steps unowned
7 Self-serve batch UI (create, review, approve, monitor) 🔴 No issue, no design
8 Failure diagnosis — why did this record fail? 🔴 Thousands of opaque errors; no owner
9 Import performance / retry-succeeds failures 🔴 Cause never established
10 New imports get managed Tags (#13755 §6) 🔴 No issue, no hook
11 Author resolution on import 🟡 Known-bad behaviour, one open issue
12 Cover imports from partners 🟡 Blocked on a design decision (#13682)
13 Bot-access policy / trust tiers 🔴 open Bot Request issues waiting on a policy that does not exist

Four items have nothing behind them — no issue, no PR, no owner: §7, §8, §10 and §13. Three of those four are the ones a partner actually experiences.


1–3. What has landed ✅

Feed Registry. CREATE TABLE feed_registry is in openlibrary/core/schema.sql on master, with FeedRegistry in openlibrary/bookworm/registry.py [verified]. Feeds are registered.

Note for anyone reading #12844: its checkbox 1 says this is unmerged and conflicting. That is stale — it refers to the abandoned PR #12846, not to what shipped.

Acquisitions. CREATE TABLE acquisitions is on master and populated in production [verified]. #12844 checkbox 2 is checked but caveated "not yet wired into live flow"; that caveat expired in September.

opds_acquisitions in search.json. Merged and deployed. All three provenance markers — harvested, synthesized, edition_providers — verified against production on two works including the multi-link case [verified]. #12844 checkbox 4 reads "not started."

Consequence worth stating plainly: read cold, #12844 says one of four subtasks is done. Three and a half are, and all three errors understate progress. Anyone triaging this concludes the effort has stalled when it is mostly built. Fixing those checkboxes is the cheapest item on this page.


4. Nothing schedules a harvest 🟡

The single most important operational fact about imports right now. Feeds are registered, the harvester is merged, and manage-imports.py is scheduled and draining. But grep -il 'bookworm\|harvest' across all of olsystem returns zero [verified]. The back half of the pipeline runs continuously; the front half has never fired on a schedule.

So this is not "in progress" — it is switched off. The line is written: internetarchive/olsystem#458, open and not draft, 17 */6 * * *, +14 lines in one file [verified]. It is unmerged, not unwritten.

It is gated, and the gate is an ordering rather than a code change.

Feeds register as pending, and harvest_all skips anything not active (openlibrary/bookworm/harvest.py) — so merging #458 while everything is pending is a no-op [verified]. But registry.py defaults rows with no status key to active, and the status field only landed on 2026-09-07, so any feed registered before that date is active with nobody having flipped a switch [verified]. Against the feed sizes declared in openlibrary/bookworm/cli.py: Lenny is 96 items and honours ?modified_since; Better World Books is not registered (its feed returns 403 from Cloudflare); Project Gutenberg is ~78,000 items, and an unseeded first run is thousands of paged fetches [verified].

One combination is dangerous: project_gutenberg, registered before 2026-09-07, cursor still NULL. Both halves are printable read-only, no database access required:

python -m openlibrary.bookworm.cli register --ol-config /olsystem/etc/openlibrary.yml --show

Prescribed order: merge #458 (no-op) → confirm with --show → activate Lenny alone and watch one tick → seed Gutenberg with register --since <recent> --reseed before activating it. Never add --max-pages: a truncated crawl advances the cursor past pages it never fetched, permanently skipping them [verified].

  • [ ] Fix the unbounded row fetch in acquisitions.get_by_editions — no SQL LIMIT, on the one shared synchronous connection. Safe at today's ~96 rows, not at harvest volume. Needs a per-edition window function (ROW_NUMBER() OVER (PARTITION BY edition_id …)); a global LIMIT is wrong and was already tried and reverted.
  • [ ] Settle the load question in §9 before activating any large feed.
  • [ ] Merge #458 and follow the activation order above.

5–6. BookWorm as its own service, with its own database 🟡🔴

The target: openlibrary_imports, a separate Postgres database, and BookWorm as a service that owns it — so import volume stops being a production-capacity question. The core move #12655 makes is to separate the submission of imports from the processing of them: a patron's submission lands in BookWorm's own store and queue, and processing drains against that rather than against the database serving readers, so a large submission cannot degrade openlibrary.org.

What exists. openlibrary/bookworm/ on master is a harvester library and CLI: registry.py, harvest.py, cli.py, opds.py, tests/ [verified]. There are no routes, no ASGI mount and no compose service — the service does not exist in this repo.

A working prototype does exist, in another organisation: ArchiveLabs/openlibrary-bookworm, branch feat/mvp-batch-import-api, PR #1 open and not a draft — FastAPI app, SQLAlchemy models, Dockerfile, compose, 17 passing tests [verified]. It was unfindable by every search anyone ran, because it is a different repo in a different org. Bharat Kalluri is leading this prototyping.

Reconciliation findings that should shape the PR rather than be discovered during it:

  • It dedupes per-batch only, with no global path. core/imports.py on master implements both scopes deliberately: add_items dedupes globally because firehose sources re-offer unchanged records constantly and — its own docstring — "re-queuing them is what previously overwhelmed the database"; add_or_refresh_items scopes per-batch so one feed cannot refresh and effectively steal another batch's row [verified]. The answer is both, chosen by source type. Per-batch-only would reintroduce the exact saturation this epic exists to remove.
  • It validates source names against a vendored copy of OL's identifiers.yml. Keep this — it rejects a source name that is not a real OL identifier at the door. Read OL's canonical openlibrary/plugins/openlibrary/config/edition/identifiers.yml rather than a vendored copy, so there is no file to drift.
  • Better World Books has three names in three namespaces, and two are correct. bwb: is the slug live rows carry in ia_id; betterworldbooks is the provider/feed name and is what the acquisitions trust check compares against; better_world_books is the edition identifier name and is the only one declared in identifiers.yml [verified]. Keep both fields distinct — a record carrying the identifier spelling as its provider silently loses its acquisitions.
  • Follow the coverstore pattern, per @mekarpeles: a package inside openlibrary/ that deploys with the app, so ol-home0 still deploys one repo. openlibrary/coverstore/ is the precedent, and docker/ol-db-init.sh shows how a second database is created and its schema.sql applied [verified] — that answers two of the three deploy steps for dev.

The genuinely unowned step: how the production database is provisioned and its DDL applied. ol-db-init.sh is the dev bootstrap. Nothing in any repo says who does this in production, or how the nginx route is added.

  • [ ] Open the reconciliation PR in this repo, Refs #12655, following the coverstore shape.
  • [ ] Name an owner for production provisioning, DDL application and the nginx route.
  • [ ] Price the ia_id → source+value migration: it needs a prefix→identifier mapping for every historical source, and that mapping exists in no repo.

7. Self-serve: creating, reviewing, approving and monitoring batches 🔴

This is the item that makes the "why" real, and it has no issue. Everything above is plumbing; this is what a partner touches.

The model we are heading toward. Every logged-in patron — not just approved bots — can create their own streams / channels / projects (a batch is the current, narrower name for this), and submit any number of import records into one. The patron chooses which stream a submission goes to; a stream is a durable, named container they return to, not a throwaway per-upload artifact.

What exists today: POST /import/batch/new accepts JSONL, and a non-admin submission lands as needs_review [reported, #12655]. There is no UI for reviewing it, no way for a submitter to see what happened to their batch, and no approval flow. The current UI at openlibrary.org/import/batch/new and the APIs behind it both need updating — the batch system was not built for patron-facing self-serve, and two limitations below are structural, not cosmetic.

The defect that shapes the API change: every submission silently creates a new batch. batch_imports.py names each batch after a hash of the submitted payload, so there is no way to add records to an existing stream — resubmitting makes another one [verified]. That is the opposite of the stream model above. The fix is a deliberate choice at submit time: pick an existing batch from a dropdown, or explicitly create one by naming it. Creating a batch by name on demand likely needs a new "create batch" API endpoint distinct from the submit endpoint.

Prescriptions:

  • [ ] A batch has a name a human chose, and the patron picks the target. #12656 (allow specifying a batch name on submit) is open and is a prerequisite for any UI — a queue of unnamed, auto-created batches cannot be reviewed. The UI must offer choose existing batch (dropdown) or create new batch (name it), and the API must support creating a batch as its own step — a likely new endpoint, not a side effect of submitting records.
  • [ ] A submitter can see their own batch: per-record status, and the reason for each failure (§8). This is the difference between self-serve and a black box.
  • [ ] A reviewer can approve, reject or partially approve a needs_review batch, with the decision recorded against the batch rather than applied invisibly. Today pending imports go unreviewed: /import/batch/pending exists, but there is no notification telling staff a batch is waiting and no effective tooling for reviewing one — so submissions that need review simply sit. Both the notification and the review tools are in scope here.
  • [ ] Retry failed records from the UI. There is no way today, via UI or API, to re-run one or more import records that failed; an admin (and eventually a submitter) must be able to retry a selected set. This is the human-facing half of §9's "does retry belong in the queue" question — both are needed: automatic retry for transient failures, manual retry for the rest.
  • [ ] Upgrade openlibrary-client to drive this flow: (a) create an import batch/stream, and (b) submit a set of import records to an existing batch. Today the client cannot do either — there is a PR, not carefully tested — so there is no clean scripted path to the self-serve model.
  • [ ] Make the format conversion tractable. A major technical bottleneck is that converting a partner's catalogue into our import schema is non-trivial, independent of the upload mechanics. BharatKalluri/openlibrary-plugin is one direction worth evaluating as a conversion aid.
  • [ ] Monitoring: queue depth, throughput, and failure rate per batch and per source.
  • [ ] Audiences cannot find the official, current import process — because it is not clearly documented anywhere. This is the first bottleneck a new importer hits. The existing pages (data-importing, the-import-pipeline) and the import schema exist but do not add up to a findable, current, end-to-end path.
  • [ ] Walk one real contributor request end-to-end and document it so people can eventually self-serve — rattnak to pick a single GitHub issue where a contributor is asking for batch-import help, step through the entire submission process, write it up, and identify everything that is broken along the way. #8542 (batch import documentation for developers) is open and should become the home of this write-up rather than pointing at the current manual path. There are many such open contributor requests; the point is to turn one into a working, documented path. Producing that documentation page and choosing that first request are the immediate next steps.

8. Why did this record fail? 🔴

We have thousands of failures with no usable explanation, and this is a strategy problem rather than a message-wording problem. import_item.error is a free-text column, and ImportItem.set_status() NULLs data when a row reaches a terminal status — so the record that failed is gone and the reason is a string nobody designed.

The symptom is visible from outside in a cluster of issues that are all the same issue:

  • #10633 — Goodreads import fails with poor explanation
  • #4275 — tell users which Goodreads imports fail
  • #13244 — IA import failing incorrectly with "identifier not found"
  • #10756 — IA import fails due to missing publisher
  • #9641 — IA import 500s if no publish_date

Prescriptions:

  • [ ] A typed failure reason, not free text: a small closed set (validation, duplicate, unresolvable author, cover fetch refused, upstream 4xx/5xx, internal) plus a human message. Without the type, a failure rate cannot be broken down and nobody can tell one thousand duplicate-skips from one thousand real defects.
  • [ ] Retain enough of the submitted record to explain the failure — today data is NULLed.
  • [ ] Surface it to the submitter (§7), which is the only thing that makes it self-serve.
  • [ ] Treat the five issues above as instances of this, not as five separate fixes.

9. Import performance and the retries that succeed 🔴

A real measurement, cause never established: 79 of 94 Lenny records returned internal-error, and every one succeeded on serial retry [verified, measured during #12844 work]. Nobody has determined whether that is concurrency or write rate, and ImportBot has shown roughly 84% failure under 8-way concurrency [reported].

Why this gates §4 rather than sitting beside it: if the cause is write rate, then scheduling the harvest converts a dormant pipeline into a failing one — and the symptom of a write-rate failure is records silently not arriving, which is also the symptom of nothing running. An arrival count cannot tell those apart.

  • [ ] Establish the cause before activating any large feed. Distinguish concurrency from write rate — the fix differs completely.
  • [ ] Never report an arrival count without a denominator. Report records arrived against feeds active and records offered, with the active-feed count printed first.
  • [ ] Decide whether retry belongs in the queue rather than in whoever notices.

10. New imports get managed Tags 🔴 — the #13755 §6 hook

#13755 §6 states it exactly: no issue, no hook, and every work imported since the backfill has no genres [reported]. The Tags backfill covered ~866K existing works; the import path was never taught to do the same thing, so the gap reopens with every import and widens daily.

This is an imports-side hook, and it is genuinely cross-division:

  • The hook is ours. Somewhere in the import path, a new work's messy subjects should be mapped through the controlled vocabulary and promoted to managed Tag references.

  • The vocabulary and mapping are the Tags effort's (open-Book-Genome-Project/tags), and we should call it rather than reimplement it.

  • It is blocked on a Tags decision we do not own: #13755 §2 has an unresolved decision on canonical field names and stored shape (plural genres/subgenres/audiences vs the pipeline's singular audience; {"key": …} refs vs plain strings). An import hook written before that decision writes the losing shape and joins the migration it should have avoided.

  • It reaches Solr, which is Search & Discovery's: #13650/#13753 add genre_key/*_name fields, and those reads inherit the same naming decision.

  • [ ] File the import-side hook as its own issue under this epic, explicitly blocked on #13755 §2.

  • [ ] Agree with the Tags effort which side owns subject→Tag mapping at import time.

  • [ ] Confirm with Search & Discovery that an import-time Tag write indexes correctly, and coordinate on the bulk-write hazard #13755 §3 describes.


11. Author resolution 🟡

Adjacent and badly behaved. #7756 — stop creating bad author records from BWB import — is the open issue, and #13656 (DNB duplicated edition import) is the same family. The import path creates author records when it cannot match, which is how a partner feed manufactures duplicates at scale. #5788 (authority identifiers as author identifiers) is the obvious lever.

  • [ ] Decide the import-time policy: match, create, or refuse and report (a typed failure per §8, which is what makes refusal acceptable).
  • [ ] An author the importer cannot resolve should be a reviewable batch item (§7), not a silent new record.

12. Cover imports from partners 🟡

A partner's book arriving without its cover is an import failure, not a cover-service failure. Measured: Bookdash has 814 works in the search index and 0% of a 100-work sample carry a cover, against Standard Ebooks at 100% and Project Gutenberg at 90% [verified, 2026-09-30]. Every component reported healthy for a year — the cover service's controls behaved exactly as documented, and the importer imported — because nobody owned the seam.

One correction worth making here, because it has already cost a redesign in the wrong repository. The blocker for the in-repo importers is an application-level host allowlist — an SSRF control — not a network firewall. #13682 ("Cover imports broken for 4 of 5 in-repo importers — design decision needed before implementation") is the live issue and is blocked on a maintainer design decision, correctly: loosening an SSRF control is a security change and is not ours to make unilaterally. It carries Module: Cover Service, Module: Import and Lead: @RayBB, and has no assignee [verified]. WAF rules do separately block some requests — #13755 §2 records 2 works blocked that way — but they are a different mechanism from the one stopping these importers, and conflating them sends the fix to the wrong layer.

  • [ ] Get the #13682 design decision. Nothing should be implemented before it.
  • [ ] Until then, treat cover completeness as a monitored metric rather than an assumption: a provider landing works at a near-zero cover ratio is a defect, and it is detectable in one query.

13. Bot access: a policy, not a column 🔴

#12655 answers the access question with trust_level text default 'review' [reported]. That is a column, not a trust model. It does not say who approves a submitter, what a tier permits, what rate limit attaches to one, or what a submitter can see about their own data. The open Bot Request issues in "Why" are waiting on that policy, and until it exists each one is a bespoke decision. They also sit idle — there is no process that acknowledges a request, labels it, points the requester at the batch-import path, or sets a lead — so a request that should be redirected to self-serve instead waits for a human who may never be prompted.

  • [ ] Write the tiering: what an untrusted, reviewed and trusted submitter may each do.
  • [ ] Decide who approves a tier change, and record the decision somewhere auditable.
  • [ ] Triage the open Bot Request issues against it, and say so on each.
  • [ ] Set up the GitHub project-management path for these requests: an automatic reply to the requester, the right labels, and a lead assignment — so a request moves instead of stalling. The Open Library Issue Enrichment Action could be extended to recognise "Import"/bot-access requests and respond differently (label them, reply with the documented batch-import path).

Cross-division seams

Each of these is owned here because Imports owns the outcome, even where the code is someone else's. The tell that a seam is unowned is that every component reports healthy while the user-visible result is wrong — which is exactly what happened with covers.

Seam Other side What Imports owns
Managed Tags on new imports (§10) Tags epic #13755; Search & Discovery for Solr the import-time hook
Tags and acquisitions in Solr Search & Discovery (#13650/#13753, #11264) that what we write is indexable
Covers (§12) Cover service; #13682 decision does a partner's book arrive complete
Borrowing from a Lenny node Lenny that Lenny's data arrives via Feed Registry & Acquisitions so the borrow path has provenance
Import throughput (§9) production database capacity not saturating it

On Lenny specifically: Lenny should land its data through Feed Registry and Acquisitions rather than a bespoke path, because that is what gives a patron a borrow button with provenance — the harvested marker now verified in production is exactly that. Lenny is registered as a feed today and is the smallest, safest feed to activate first (§4).


Decisions needed from @mekarpeles

  1. Is this epic canonical for direction, with #12655 narrowed to the service and #12844 to feeds/acquisitions? And do #5792 / #10251 / #11264 fold in and close?
  2. Who provisions the production openlibrary_imports database, applies its DDL, and adds the nginx route? Three steps that exist in no repo today.
  3. The trust tiering in §13 — the open Bot Request issues are waiting on it.
  4. Scheduling: does #458 merge now (a no-op) so activation becomes a separate, observable step, or does it wait on §9?

And two that are not his:

  • The #13682 cover decision sits with whoever owns that SSRF control; the issue is labelled Lead: @RayBB and unassigned, so naming its decider is itself an open item.
  • The #13755 §2 field-name and shape decision belongs to the Tags effort; §10 is blocked on it either way.

What this epic does not cover

Not a substitute for #12655 or #12844, and it does not re-plan either. It does not cover MARC character-encoding defects (#13617, #8798), the Goodreads server-side refactor (#12277), or Amazon/Creators API lookups (#13316) — those are import-adjacent but independently scoped. It makes no claim on the Tags pipeline, which is @Chisomnwa's and @mekarpeles's.

mekarpeles avatar Sep 30 '26 15:09 mekarpeles

[!WARNING] Parts of this epic require access to internal infrastructure, production systems, or institutional knowledge unavailable to community contributors (production database provisioning, internetarchive/olsystem changes, nginx routing). Those parts can only be resolved by a maintainer or staff member.

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

  • [ ] Needs: Staff Decision — see the epic's own "Decisions needed from @mekarpeles" section (canonicality of the epic, production DB/DDL/nginx ownership, trust-tiering policy, #458 scheduling order), plus the two decisions it flags as belonging elsewhere (#13682 cover SSRF call, #13755 §2 field-naming call)
  • [ ] Needs: Staff / Internal — production openlibrary_imports database provisioning, DDL application, and nginx routing are not things a community contributor can do
  • [ ] Needs: Lead — no Lead: @* label is currently applied to this issue itself (individual cross-division seams already have their own leads via their own issues)

Context (from actually running the commands below against master @ 1ccaa334a50e10e9462539a8d51708435bb7628f and gh issue/pr view)

  • Feed Registry and Acquisitions tables are confirmed on master: CREATE TABLE feed_registry at schema.sql#L166-L179, CREATE TABLE acquisitions at schema.sql#L146-L161.
  • The "default rows with no status to active" behavior and its 2026-09-07 introduction date are both confirmed exactly: registry.py#L46-L57 (comment states the rationale), landed in commit 2cd225e94 (2026-09-07, Mek). harvest_all's skip-if-not-active logic is at harvest.py#L494-L515.
  • cli.py's FEEDS config (cli.py#L204-L236) matches the epic's description, including DEFAULT_PROVIDERS excluding Better World Books.
  • acquisitions.get_by_editions genuinely has no SQL LIMIT — its own docstring at acquisitions.py#L289-L293 says so explicitly and gives the 10,000-row cost.
  • add_items (global dedupe, imports.py#L252-L278) vs add_or_refresh_items (per-batch dedupe, imports.py#L130-L233) is correctly described. One small attribution slip: the "re-queuing previously overwhelmed the database" phrase lives in add_or_refresh_items's docstring (line 136) and in harvest.py#L273-L274, not in add_items's own docstring.
  • The coverstore precedent is real and directly analogous: openlibrary/coverstore/ has its own schema.sql, asgi_app.py, server.py, and docker/ol-db-init.sh#L1-L11 shows exactly the "createdb + apply package-local schema.sql" pattern the epic proposes reusing.
  • import_item.error is confirmed as a free-text column, defined in infobase_schema.sql#L537-L556 (not core/schema.sql, worth knowing if searching for it).
  • ArchiveLabs/openlibrary-bookworm PR #1 checks out exactly as described: open, not draft, branch feat/mvp-batch-import-api, FastAPI + SQLAlchemy + Alembic + docker-compose + 17 tests.
  • Two other issues touch adjacent ground and aren't referenced here: #13270 (Epic: Lenny ↔ Open Library integration) and #12138 (Solr bulk indexing BWB & Lenny OPDS pricing) — not duplicates, but worth cross-linking given this epic's own section on Lenny.

Issue Assessment

Open questions

  • Given the finding below that #12655's own architecture premise is now contested, should this epic's status table (rows 5–6) be revisited before being used as a planning reference?
  • Should #5792/#10251/#11264 really all be folded in and closed as a group, given #11264 specifically looks live rather than idle (see below)?

Action items

  • [x] Is #11264 accurately described as "superseded in approach"? (Answer: Doesn't look like it — gh issue view 11264 shows it open with a concrete BWB "buy" acquisition JSON example worked out between @mekarpeles and @MarcCoquand as recently as 2025-11-03, and updatedAt of 2026-04-08. That reads as active, not dormant — worth confirming with whoever is currently driving it before folding it into #12844.)
  • [x] Does #12655's checklist still reflect reality? (Answer: No, and in a way beyond what this epic already flags for #12844 — a 2026-09-21 comment on #12655 notes 4 checklist items are already merged (#13241, #13565, #13561, #13173), and separately states that what shipped to master (openlibrary/bookworm/, a harvester library/CLI) is not the standalone FastAPI/DB service #12655 originally scoped — i.e. the architecture split this epic describes as settled is, per that comment, still an open question on #12655 itself.)
  • [x] Does ImportItem.set_status() NULL data specifically for the failed case §8 is about? (Answer: The opposite — imports.py#L387-L398 only NULLs data when status != "failed". For status == "failed", data is retained. If that's correct, the submitted record isn't actually gone for failed imports today — the diagnosis gap in §8 may be entirely about error being untyped free text rather than about the source data being unavailable, which would narrow that scope of work.)
  • [ ] internetarchive/olsystem#458 could not be verified from this environment (the repo isn't reachable with the credentials available here) — needs someone with olsystem access to confirm it's open, non-draft, and matches the described 17 */6 * * * diff before it's used as a planning fact.
  • [ ] Four items in the status table have no filed issue at all (§7 self-serve UI, §8 typed failure reasons, §10 import-side Tags hook, §13 trust tiering) — each would need to actually exist as an issue before Needs: Breakdown or Good First Issue sub-tasks could be carved out of them.

🔔 Stakeholders

@hornc — listed lead for "imports, big data"; this is the most directly on-topic match in the stakeholders reference for an imports-wide epic. (Git history on openlibrary/bookworm/ and the recent core/imports.py import-logic commit is entirely @mekarpeles's own work, so blame doesn't surface a second maintainer there.)


Full triage checklist
  • [x] Triage — correct labels applied or removed
  • [x] Problem / opportunity — problem is clear, audience identified, actionable
  • [x] Scope — issue is well-scoped; does not try to do too many things (explicitly a status map with its own "what this epic does not cover" section, not an implementation issue)
  • [x] Justification — reasoning and impact stated; sufficient for leads to prioritize
  • [x] Success & testing criteria — top-level success is defined ("a partner submits a batch themselves... and never touches the application"); per-subtask criteria vary since 4 subtasks aren't filed yet
  • [x] Proposal & breakdown — concrete plan present; checklist actionable for a contributor
  • [ ] If bug: environment & repro steps — n/a, not a bug
  • [x] Risks, concerns, open questions — identified and surfaced (own "Decisions needed" section, plus corrections above)
  • [x] Richy context — relevant code, commits, PRs reviewed; no duplicate found (two adjacent-but-distinct epics noted above)
  • [x] References — permalinks and cross-issue links present throughout

[!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 Sep 30 '26 15:09 openlibrary-bot

Adding a data point for the "Book applications" and "Individuals" audiences, from a first test of the batch queue by a third-party app.

I maintain BiblioGenius, a free and open-source personal library app (Rust and Flutter): https://bibliogenius.org, code at https://codeberg.org/bibliogenius. Readers add books by ISBN; when no open catalogue recognises a book, they enter it by hand. Users have asked whether these entries could be given back to a commons, and we are exploring whether your batch queue could be the way.

One measurement that may be useful to you: checking the 567 ISBNs of one ordinary French library, 133 (23%) return no result from your search API (I cross-checked a sample with the Books API). They are not obscure: French editions of Morpurgo, Pennac, Kessel, Burgess or Zamyatin from major publishers.

As a first test I submitted four of them from my own account: batch #2128 (https://openlibrary.org/import/batch/2128), with source_records of the form bibliogenius:, now in needs_review.

Two specifics of our case that may inform the tiering and UI discussion:

  • Our records would come as many very small batches, one reader at a time, each from their own account after an explicit consent step, rather than one consolidated feed. Would you prefer that, or a single project source submitting consolidated batches?
  • Some records have no ISBN (small presses, self-published, old books) and would rely on title, authors, publisher and publish date. Is that acceptable for review?

If it helps, I can document what we hit as a third-party app using this flow, and adjust fields, cadence or identifiers to whatever you prefer.

federico-calo avatar Oct 16 '26 14:10 federico-calo

Following up on §13 ("there is no process that acknowledges a request, labels it…"): I've done the labeling part.

New label: Type: Import Request: "Request to bring an external catalog, dataset, MARC dump or feed into OL. Not for importer bugs."

It's on 29 issues (18 open, 11 closed) where someone outside staff asks us to bring a source in. That covers dataset and catalog requests, bot-account requests whose purpose is importing, and community requests to add a Trusted Book Provider.

Cleanup on those issues:

  • Removed Type: Question (7) and Type: Feature Request (4). Besides being the wrong kind, Type: Question makes the enrichment bot reply only "try Discussions" to non-staff authors. That reply is all #14049 got.
  • Removed Module: Import (10), so that label stays about importer code. If you watch Module: Import for incoming requests, filter on the new label instead.
  • Left Bot Request, Theme: Trusted Book Providers, leads and priorities as they were.

Not labeled: bot requests that only edit records (#13191, #13659, #13885) and staff-filed source and provider issues (#7324, #7802, #8543 and others). It's easy to extend if we want those included.

For the "walk one real contributor request end-to-end" task, here are the open ones.

RayBB avatar Nov 17 '26 22:11 RayBB