fix: set null publishedDate for yanked versions#4306
Conversation
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
|
There was a problem hiding this comment.
Pull request overview
This PR refactors NuGet package normalization to centralize how “published” dates are parsed, ensuring NuGet’s unlisted/yanked sentinel publish timestamps don’t leak into normalized metadata.
Changes:
- Adds a
parsePublishedDatehelper that returnsnullfor missing/invalid dates and NuGet’s sentinel “unlisted” date. - Replaces inline
Dateparsing/filtering innormalizeNuGetPackagewith the helper forfirstReleaseAt,latestReleaseAt, and per-versionpublishedAt.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request refactors how NuGet package published dates are parsed and handled, centralizing the logic for filtering out sentinel "unlisted" dates and improving code clarity. The main changes are:
Date Parsing Improvements:
parsePublishedDatefunction to handle NuGet's sentinel unlisted date (1900-01-01T00:00:00Z) and returnnullfor absent or invalid dates.Refactoring and Consistency:
Dateparsing and filtering logic for published dates innormalizeNuGetPackagewith calls to the newparsePublishedDatefunction, ensuring consistent handling of unlisted or invalid dates throughout the code.publishedAtin version objects to useparsePublishedDate, further centralizing date validation.Note
Low Risk
Small refactor in NuGet normalization with clearer date filtering; behavior change is limited to published metadata for unlisted versions.
Overview
Centralizes NuGet published date handling in a new
parsePublishedDatehelper that returnsnullfor missing values, invalid dates, and NuGet’s unlisted sentinel (1900-01-01T00:00:00Z).normalizeNuGetPackagenow uses that helper forfirstReleaseAt/latestReleaseAtaggregation and for each version’spublishedAt, so yanked/unlisted versions no longer surface a bogus 1900 publish timestamp.Reviewed by Cursor Bugbot for commit 6580bdd. Bugbot is set up for automated code reviews on this repo. Configure here.