Skip data files that fail to load in date-filter path (follow-up to #182)#183
Merged
Merged
Conversation
The year-filter fix lets amendments reach `fetch_and_check_date`. When the index references a data file that 404s, `hit.item` returns an item with no docidentifier and the method crashed on `ret.docidentifier.first.content`. Guard against it so the candidate is skipped and the lookup degrades to "not found" instead of raising. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 13, 2026
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.
Follow-up to #182. That PR was merged with only the year-fallback commit; this robustness guard — needed alongside it — landed on the branch after the merge and so wasn't included.
Why it's needed
The year fix in #182 lets amendments reach
fetch_and_check_date. If the index references a data file that 404s,hit.itemreturns an item with no docidentifier and the method crashes onret.docidentifier.first.content. This is not hypothetical: as of 2026-06-12 the relaton-data-isov2data files forISO 32000-2:2020/DAM 1(data/iso-32000-2-2020-dam-1.yaml) return 404 while index-v1 still lists them, so a live build hit exactly this crash.Fix
Guard
fetch_and_check_dateso a candidate whose data failed to load is skipped and the lookup degrades to "not found" instead of raising:Verified end-to-end against Peter's mn-playground build: with the guard the real Metanorma compile logs a clean
Not found(exit 0) instead of crashing.Tests
"returns nil instead of raising when the data file fails to load"locks the guard.bibliography_spec.rbsuite green.🤖 Generated with Claude Code