Skip to content

Fix author_dates_match comparing only year, ignoring month/day#13066

Open
soumojit-D48 wants to merge 1 commit into
internetarchive:masterfrom
soumojit-D48:author-dates-match/fix/full-date-comparison
Open

Fix author_dates_match comparing only year, ignoring month/day#13066
soumojit-D48 wants to merge 1 commit into
internetarchive:masterfrom
soumojit-D48:author-dates-match/fix/full-date-comparison

Conversation

@soumojit-D48

Copy link
Copy Markdown

Closes #13065

fix
Fixes author_dates_match() returning True for authors with different full dates that happen to share the same year. The function was only comparing 4-digit years, ignoring month/day. A bare year like "1650" still matches any full date in that year — the fix only rejects a match when both records have fully specified dates with genuinely different content.
Technical
After extracting years from both date strings and finding they match, the fix adds a check: if both original strings contain more than just the year (e.g. "01 December 1650" not "1650"), and the full strings differ, return False. This preserves the imprecise-date fallback while catching real mismatches.

Testing

  • test_author_dates_match() — all existing assertions still pass
  • The previously-broken assertion now correctly expects False instead of True
  • Run: pytest openlibrary/tests/catalog/test_utils.py

@openlibrary-bot

Copy link
Copy Markdown
Collaborator

Thanks for this contribution, @soumojit-D48! Welcome to Open Library — this appears to be your first contribution.

🤖 Copilot has been assigned for an initial review.

The linked issue (#13065) hasn't been triaged yet — triage happens on Mondays and Fridays. There are currently 29 open non-draft PRs ahead of yours.

PR triage checklist (maintainers / Richy)
  • PR description — not empty; explains what the change does and how to verify it
  • References an issue — PR body contains a #NNN reference
    • Linked issue is triaged — has a Priority: * label (not just Needs: Triage)
    • Linked issue is assigned — has at least one assignee
  • Commit history clean — no WIP/fixup/conflict noise; commit messages are meaningful
  • CI passing — no failing check-runs
  • Test cases present — if the change touches substantive logic, test coverage exists or is explained
  • Proof of testing — PR body includes a description of what was tested, a screenshot, or a video

Note

This comment was automatically generated by PAM, Open Library's Project AI Manager. PAM provides status visibility, performs basic project management functions, and gives actionable feedback so contributors aren't left waiting.

@soumojit-D48

Copy link
Copy Markdown
Author

@mekarpeles pls review this pr!!!

@github-actions github-actions Bot added the Needs: Response Issues which require feedback from lead label Jul 1, 2026
@mekarpeles mekarpeles removed the Needs: Response Issues which require feedback from lead label Jul 4, 2026
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.

Author dates with different month/day but same year are incorrectly considered a match

3 participants