Fix invalid dates in feed ordering - #62
Merged
Merged
Conversation
Use the first valid publication or update timestamp across latest, items_since, and merge. Preserve malformed values and source order for equal or missing dates, including dates before 1970. Add regression coverage for fallback dates, stable ordering, precision, merge identity rules, and non-mutating results. Document the date selection contract. Closes #58
houndci-bot
reviewed
Sep 12, 2026
Greptile SummaryThis PR makes feed date handling consistently select the first valid
Confidence Score: 5/5The PR appears safe to merge, with the changed date-selection and ordering behavior covered by focused regression tests. No actionable correctness, security, or repository-rule violations remain; the implementation preserves existing identity semantics while preventing malformed date fields from masking valid fallbacks. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Feed entry] --> B{Valid pubDate?}
B -- Yes --> E[Use pubDate]
B -- No --> C{Valid updated?}
C -- Yes --> F[Use updated]
C -- No --> D{Valid published?}
D -- Yes --> G[Use published]
D -- No --> H[Treat as undated]
E --> I[Stable newest-first ordering]
F --> I
G --> I
H --> J[Place after dated entries]
Reviews (1): Last reviewed commit: "fix: handle invalid dates in feed orderi..." | Re-trigger Greptile |
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.
A malformed
pubDatecould makelatestraise or hide a validupdatedorpublishedtimestamp. Use the first validTimeacross those fields consistently inlatest,items_since, and merge while preserving the original field values.Sort dated entries newest first, retain source order for ties, and place undated entries after even pre-1970 dates. Preserve merge's identity rules and its placement of unidentified entries at the end. Document the behavior and cover fallback dates, nanosecond precision, stable ordering, deduplication, and unchanged inputs.
Validation: reproduced the mixed String/Time comparison error with a failing regression before the fix. The full suite passes on Ruby 3.4.8 (112 tests, 233 assertions; 3 existing network-test omissions). RuboCop, RBS validation, and Steep pass.
GitHub CI passes on Ruby 3.2, 3.3, 3.4, and 4.0, and Greptile reports 5/5 on
e26a025. Hound's style comments were resolved because they conflict with.rubocop.yml: the repository requires double quotes and excludes tests from line-length and method-length checks.Closes #58.