fix: read qrels corpus-id column without trailing space - #52
Merged
oliverholworthy merged 2 commits intoAug 18, 2026
Merged
Conversation
The qrels TSV is written with header 'corpus-id' (no trailing space), but load_positive_docs_with_modality looked up row['corpus-id '], which raised KeyError when the function was used. Signed-off-by: Andrew White <andrewh@cdw.com>
andrewwhitecdw
requested review from
a team,
oliverholworthy and
shan-nvidia
as code owners
July 24, 2026 13:41
shan-nvidia
reviewed
Jul 24, 2026
shan-nvidia
left a comment
Collaborator
There was a problem hiding this comment.
The canonical corpus-id fix is correct, but retaining the legacy trailing-space spelling as an input alias avoids an unnecessary compatibility break. I also recommend covering both header variants and the multi-modality resolution path in the regression tests.
Signed-off-by: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com>
oliverholworthy
approved these changes
Aug 18, 2026
oliverholworthy
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this fix. This had been sitting for a few weeks, so I pushed a small follow-up to address the outstanding feedback and unblock it. The update preserves compatibility with the legacy header and extends the regression coverage.
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.
What
Fix
load_positive_docs_with_modalityto accept both:corpus-id— the canonical headercorpus-id␠— the legacy header, where␠represents a trailing spaceNew files continue to use only the canonical header.
Why
The qrels writer produces
corpus-id, but the loader previously expectedcorpus-idfollowed by a space. This caused aKeyErrorwhen loading normally generated qrels files.Correcting the lookup alone would break existing files adapted to the old behavior, so the loader now supports both spellings.
How
The loader normalizes the exact legacy header to
corpus-idimmediately after reading the TSV. The rest of the function consistently uses the canonical name.Tests cover:
corpus-idcorpus-id␠Validation