Skip to content

fix(download-ref): add identifier fields when appending preprint BibTeX - #82

Merged
GiggleLiu merged 1 commit into
QuantumBFS:mainfrom
hz-xiaxz:fix/append-bibtex-identity-fields
Nov 6, 2026
Merged

GiggleLiu merged 1 commit into
QuantumBFS:mainfrom
hz-xiaxz:fix/append-bibtex-identity-fields

Conversation

@hz-xiaxz

@hz-xiaxz hz-xiaxz commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Building a fresh KB with how-to-download-ref (36 refs, 31 from arXiv) ended with kb_doctor.py reporting 81 FAIL findings even though every paper had been fetched, rendered, and appended:

  • bib-md-sync <key>: no rendered entry and bib-md-sync <file>.md: no bibliography entry for every paper
  • bib-required-keys <key>: missing booktitle for every arXiv-only preprint

Cause: Semantic Scholar's citationStyles.bibtex for a preprint carries neither eprint nor doi, and types the entry @Inproceedings with no booktitle. append_bibtex.py wrote it verbatim, so verify_bib.extract_arxiv/extract_doi found no identifier to match against the rendered file. The same gap meant cmd_append's own duplicate check could not recognise the paper on a second run.

Fix

ensure_identity_fields(bibtex, meta) in append_bibtex.py:

  • injects eprint = {…} + archiveprefix = {arXiv} and/or doi = {…} from the cached metadata when the entry lacks them
  • retypes a booktitle-less @Inproceedings as @misc
  • leaves entries that already carry identifiers and a booktitle untouched

Both propose (so the user sees what will be written) and append go through it.

Test

test_append_adds_identity_fields_to_preprint_bibtex seeds S2-shaped preprint metadata, appends, and asserts kb_doctor.check_kb is clean, the re-append is detected as a duplicate, and an already-complete entry is unchanged.

python3 scripts/validate_skills.py, pytest -q, git diff --check all pass.

🤖 Generated with Claude Code

Semantic Scholar's citationStyles.bibtex for an arXiv-only preprint has no
eprint or doi field and is typed @Inproceedings without a booktitle.
append_bibtex.py wrote it verbatim, so a freshly built KB failed kb_doctor
with "bib-md-sync: no rendered entry" for every such paper and
"bib-required-keys: missing booktitle" for the preprints, and the append
helper's own duplicate check could not recognise the paper on a re-run.

ensure_identity_fields() now injects eprint/archiveprefix and doi from the
cached metadata when the entry lacks them, and retypes a booktitle-less
@Inproceedings as @misc. Entries that already carry identifiers are left
unchanged. Both propose and append go through it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@GiggleLiu
GiggleLiu merged commit 13ae62c into QuantumBFS:main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants