feat(emit-bibtex): ledger to BibTeX with cache-resolved authors - #44
Merged
Conversation
The bib_ledger.yml `authors` field is a display string ("Surname et al.
(Year)") and the ledgers carry no doi/arxiv_id/year, so they cannot produce a
real bibliography. For arXiv sources the cached /abs/ blob -- the same bytes the
excerpt anchors point into -- retains the Highwire citation_author/title/date/
arxiv_id tags, from which emit-bibtex reconstructs real biblatex records.
- scripts/emit_bibtex.py (emit-bibtex): cache-Highwire authors, live arXiv Atom
fallback (re-cached so still anchored; --no-live disables), non-arXiv display
string kept + flagged on stderr, dedup by bibkey, reverse-collision notes,
escape & % # _ $ ONLY (never braces), --reconcile audit by arXiv id, --seed
merge, --no-overwrite.
- validators/bibtex_out.py: parseable entries, unique keys, author+title present,
no escaped-brace corruption.
- cli.py registration; docs/architecture.md auxiliary-producer row; 14 tests.
Re-derives F5: 0 true bibkey collisions (162 rows -> 148 keys -> 143 URLs; the
14 extras are cross-dossier dupes of the same URL). closes #43.
Generated with Claude Code
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jpLr4doRxvoh6eBrpGavX
Codex review of the P3 diff; every finding reproduced before fixing. - validators/bibtex_out.py: brace-balanced parser (parse_entries) replaces the \n}-anchored regex -> validates one-line entries, skips @string/@comment, detects unbalanced braces, and only counts author/title at a field position (a field name inside a value no longer fakes the required field). - emit_bibtex.py: Highwire content capture backreferences the opening quote (apostrophes like O'Connor no longer truncate) + rejects data-name=/data-content=; escape \ ~ ^ too (raw ones are TeX commands/active chars); brace-protect an author name containing " and " (corporate names no longer split); surname particles (van/de/von) join the family name; dedup prefers a cache-resolved record over a display-string one regardless of dossier order; usage checks (--seed exists, --no-overwrite) run BEFORE the side-effecting emit; reconcile indexes by arXiv id as a list so reverse collisions both survive. - cli.py: type _print_top_help(stream) as TextIO (pre-existing mypy). - +10 regression tests. Full suite 564 passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #43.
What
emit-bibtex— a deterministicbib_ledger.yml→ biblatex.bibtransform for manuscript authoring. The ledgerauthorsfield is an unusable display string ("Surname et al. (Year)") and the ledgers carry nodoi/arxiv_id/year. For arXiv sources the cached/abs/blob — the same bytes the excerpt anchors point into — retains the Highwirecitation_author/citation_title/citation_date/citation_arxiv_idmeta tags, from which a real record (full author list, title, year, eprint) is reconstructed.How
scripts/emit_bibtex.py(emit-bibtex): cache-Highwire authors → live arXiv Atom fallback (re-cached viacache_sourceso it stays byte-anchored;--no-livedisables) → ledger display string for the ~26 non-arXiv sources (flagged on stderr for hand-fixing). Dedup by bibkey; reverse-collision notes;--reconcileaudit by arXiv id;--seedmerge;--no-overwrite. Escapes& % # _ $only — never braces (the bug in research-kb'sbibtex_generator.py).validators/bibtex_out.py: parseable entries, unique keys,author+titlepresent, no escaped-brace corruption.docs/architecture.mdauxiliary-producer row + 14 tests.Notes
research_vlm_*dossiers: 148 entries, 123 cache-resolved (full author lists, e.g. SigLIP 2's 14 authors), 25 non-arXiv display-string;validators.bibtex_outclean;--reconcilesurfaces real key mismatches vs the two existing fleet bibliographies.Verification
🤖 Generated with Claude Code