feat(zot): stack zot fetch — Zotero full-text connector, slice Z1 #826
Reference in New Issue
Block a user
Delete Branch "feat/zot-fetch-z1"
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?
Slice Z1 of the Zotero full-text connector (spec
docs/superpowers/specs/2026-09-09-zotero-annas-connector-design.md, plandocs/superpowers/plans/2026-09-22-zotero-fetch-z1.md, operator-approved 2026-09-22).What it does
stack zot fetchattaches a PDF/EPUB to Zotero items that lack one:--collection NAME | --tag TAG | --type TYPE | --item KEY | --all(+--typeas a narrowing filter); always skips items with a PDF/EPUB child, deleted items and thedocumenttype.VPN_HTTP_PROXY); ISBN → libgen; ISBN-less book → libgen title search. Candidates ordered Unpaywall first; books epub before pdf, papers pdf only.ads.php→get.php(browser UA, Referer, one retry after the DB-3306 throttle page), then Anna's fast-download API by md5 underANNAS_DAILY_RESERVE(default 5). Files validated by status, content-type, 10 kB floor and magic bytes.sudocopy intodata/zotero/data/storage/<KEY>/as 100999:100999; provenance is exactly asource:<x>tag and anmd5:line inextra.data/zotero/fetch_ledger.jsonl, one line per attempt with anoteexplaining every miss;no_candidate/all_failedwait 30 days (or--retry),quotaanderror(transport/5xx/throttle) retry next run.--dry-runlists candidates and writes nothing;--hold(default) stops/starts the zotero container around the run.Review
Fresh-context review found no Critical issues; the three Important ones (an Anna's quota 403 aborting the run, no per-item exception isolation, transient failures becoming 30-day misses with no note) are fixed in
d821cccwith tests that failed first. Deferred, to file as follow-ups: lazy selection before the Z3 timer (--allmaterialises every eligible item while Zotero is stopped), and eight minors listed in the plan workspace ledger.Test plan
uv run pytest tests/zot/fetch tests/cli/test_zot_fetch.py— 122 passed,src/zot/fetchat 100% line coverage, no network in tests (httpx.MockTransport, fixtures captured through the proxy 2026-09-22)/home/kert/stackafter merge):stack zot fetch --collection "AMA Coding Publications" --dry-runlists candidates;--type journalArticle --limit 20attaches ≥1 Unpaywall and ≥1 libgen/Anna's PDF with every miss explained in the ledger🤖 Generated with Claude Code
Live acceptance, criterion 1 (run 2026-09-24 from the worktree with the live Zotero DB/storage symlinked in; dry-run is read-only):
Selection, ISBN parsing, the proxied libgen JSON lookups and the miss notes all behave live. Criterion 2 (
--type journalArticle --limit 20, which writes) runs from/home/kert/stackonce this lands on main. Follow-ups: #828 (milestone P51).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.