Skip to content

Skip data files that fail to load in date-filter path (follow-up to #182)#183

Merged
andrew2net merged 1 commit into
lutaml-integrationfrom
fix/issue-181-guard-404-data-file
Jun 12, 2026
Merged

Skip data files that fail to load in date-filter path (follow-up to #182)#183
andrew2net merged 1 commit into
lutaml-integrationfrom
fix/issue-181-guard-404-data-file

Conversation

@andrew2net

Copy link
Copy Markdown
Contributor

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.item returns an item with no docidentifier and the method crashes on ret.docidentifier.first.content. This is not hypothetical: as of 2026-06-12 the relaton-data-iso v2 data files for ISO 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_date so a candidate whose data failed to load is skipped and the lookup degrades to "not found" instead of raising:

ret = hit.item
return unless ret&.docidentifier&.first

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.
  • Full bibliography_spec.rb suite green.

🤖 Generated with Claude Code

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>
@andrew2net andrew2net merged commit 5f72472 into lutaml-integration Jun 12, 2026
11 checks passed
@andrew2net andrew2net deleted the fix/issue-181-guard-404-data-file branch June 12, 2026 20:48
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.

1 participant