zot fetch: Z1 review deferrals — lazy selection before the Z3 timer, plus minors #828
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?
Deferred from the fresh-context review of PR #826 (
stack zot fetch, slice Z1). None affects the manual, targeted runs Z1 is for; the first one blocks the Z3 timer.Blocks Z3 (timer)
zot.fetch.select.select_itemsmaterialises every eligible item (get_item→ fields/creators/tags/collections, plusget_item_typeandhas_full_textper id) before the first attempt, while the Zotero desktop is stopped under--hold.--allon ~167k file-less items will hold the desktop down for minutes before--limitcan bite. Yield lazily (generator, or ids first anditem_refonly after the ledger gate) and fold the deleted/full-text exclusions into the id query.Minor
resolve.title_candidates) is unverified against a real libgenindex.phppage — the fixture is synthetic and the spec's "index page parser the AMA script already exercises" does not exist. Capture a real results page (a search through the proxy returned no rows on 2026-09-22) and pin the anchor regex;([^<]*)also yields an empty title on nested markup.download_url: nullis retried on every candidate of every item instead of disabling Anna's after the first non-md5-specific error; and Anna's is tried once per libgen md5 per item, so an item with several md5s can spend several daily units on one bad CDN day. Consider one Anna's attempt per item.--no-holdon a locked DB surfaces a rawsqlite3.OperationalErrorrather than aBadParameternaming the desktop.--dry-runstill stops/starts the Zotero desktop; either skip the hold for dry runs (reads are safe under WAL) or say so in the help. The env vars (VPN_HTTP_PROXY,ANNAS_ARCHIVE_KEY,ANNAS_DAILY_RESERVE,UNPAYWALL_EMAIL) are not in--help.attach.append_extrastrips leading whitespace from an existingextra; userstrip("\n") + "\n" + line..state/zot/fetch/is not swept at run start (per-item cleanup covers exceptions; aKeyboardInterruptmid-stream still leaves a partial file).select.first_isbnflattens hyphens but not spaces (978 1 64016 228 0→ no ISBN).annas_leftis taken verbatim from the API'sdownloads_left; if live observation shows the API reports the pre-call count, decrement once (else the reserve is breached by one per run).Also noted (pre-existing, not this branch)
--cov-fail-under=99prints FAIL at 98.94–98.95% on main and the CI job still reports success, so the gate is not enforced.