JMCP: Papers - jmcp/make-the-date-cutoff-a-query-parameter-UqhwXRms#40
Closed
JMCP: Papers - jmcp/make-the-date-cutoff-a-query-parameter-UqhwXRms#40
Conversation
Owner
Author
|
Closing: will integrate valuable features directly on main to avoid cascade merge conflicts. |
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.
Here's the review:
Review: Make date cutoff a query parameter
Change summary
apps/web/app/feed/page.tsx: Addssince?: stringtosearchParams, passes it through torepository.getFeed().packages/db/src/index.ts: Extends thegetFeedinterface andDemoRepositoryimplementation to acceptsince, filtering out papers withcreatedAtbefore that date.packages/auth/package.json/package-lock.json: Bumpsdrizzle-ormfrom^0.44.5to^0.45.1(removes duplicate nested install). Unrelated housekeeping.Validation confidence: High
The change is small, mechanical, and follows the existing pattern (same approach as the
queryparam). The filtering logic is straightforward.Risks
No validation on
sincevalue. If a user passes?since=garbage,new Date("garbage").getTime()returnsNaN, andNaN < sinceMsis alwaysfalse, so the filter silently passes everything through — effectively a no-op. This is safe but could surprise callers expecting an error. Consider adding a guard (if (sinceMs && !Number.isNaN(sinceMs))).Only the
DemoRepositoryis patched. If there's a production/SQL implementation ofPapersRepository, it won't filter bysinceuntil updated. The interface is updated, so TypeScript will catch this at compile time — but confirmnpm run checkpasses.Drizzle bump is unrelated. Mixing dependency bumps with feature changes makes rollback harder. Low risk but worth noting.
No tests added. A unit test for the
sincefilter onDemoRepository.getFeedwould be cheap insurance, especially given theNaNedge case above.