feat: deterministic reference verification for origin archives - #4
Open
sdgsfh wants to merge 2 commits into
Open
feat: deterministic reference verification for origin archives#4sdgsfh wants to merge 2 commits into
sdgsfh wants to merge 2 commits into
Conversation
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.
Problem
The acceptance gate in
run_archive.py(verify_math_object_origin_archive) combines one deterministic layer (format checks) with a model review across three dimensions. The historical dimension currently has no deterministic support: whether a cited source actually exists — and whether its journal, volume, year, and pages are copied correctly — is judged by the model alone. That is precisely where archives fail silently, because a hallucinated or miscopied citation still looks plausible to a reviewer model.Design
Add
tools/verify_references.py, a deterministic reference checker that runs before/around any model review:[n]numbering in theSourcessection; every in-text citation[n]resolves to a listed source; uncited entries are warnings, not failures.--strictescalates to failure).The tool is stdlib-only and never judges whether a source supports a claim — claim-level support stays with the model review. Exit codes: 0 pass / 1 fail / 2 usage error.
--jsonemits a machine-readable report;--offlinerestricts all lookups to a JSON cache so CI runs without network.Implementation
tools/verify_references.py— CLI and library (verify_archive_text()); fetchers are injectable for testing.tests/test_verify_references.py— 22 offlineunittestcases whose fixtures are trimmed real API responses from the five indexes (Keller 1939 via Crossref DOI + OpenAlex + zbMATH, Alon 1999 via bibliographic query, Jordan 1870 via the Internet Archive, Dudeney 1917 via Open Library, …).run_archive.pyor any production logic.Verification
python -m unittest discover -s tests -p "test_*.py"— 39/39 pass (22 new + the existing 17 runner regressions), Python 3.11.10.1016/0040-9383(87)90009-7), Crossreffamilyfields that carry initials ("H. Kauffman"), and Crossref titles with footnote suffixes ("…cell complexes††Partially supported by…").Limitations
--strictis available for hard enforcement.