Repository navigation
bug: return an empty feed page past the last page instead of a 500 - #1267
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
There was a problem hiding this comment.
✅ Devin Review: No Issues Found
Devin Review analyzed this PR and found no bugs or issues to report.
Custom reviewers
|
Closing as a duplicate of #1263, which carries the same empty-page guard in |
|
I haven't run the new tests yet. They compile and are formatted, but Review of #1267
Gaps I filled
Test PR: #1268, which targets |
Summary
GET /articles/feedwith an offset past the last page returned HTTP 500 (the GraphQLfeedpast its last cursor failed the same way). The page query correctly returns no rows, butArticleQueryService.fillExtraInfostill ran its batch lookups on the empty list. MyBatis renders an empty<foreach>as nothing, soarticlesFavoriteCountbecame... where id in group by A.idand SQLite rejected it (near "group": syntax error).userFavoritesandfollowingAuthorswould hit the same problem next.The fix is one guard at the top of
fillExtraInfo(List<ArticleData>, User):That one method covers every batch read on the feed and
/articlespaths, both REST and GraphQL cursor. Non-empty pages run the same queries as before. The past-end feed now returns{"articles": [], "articlesCount": <total>}with a 200. Over GraphQL it returns an empty page withhasNextPage: false.Also included: a one-line
spotlessJavaApplyreformat ofDefaultJwtServiceTest. Without it,spotlessJavaCheckalready fails onmaster.Overlap with #1263: #1263 has the same guard, but it is stacked on #1259 (the feed ordering change), not
master. This PR is the standalone fix againstmasterfor its own ticket. Only one of the two should land.Tests
Two new cases in
ArticleQueryServiceTest:should_return_empty_user_feed_page_past_the_end(offset) andshould_return_empty_user_feed_cursor_page_past_the_end(cursor).Before the fix, Java 11 (
./gradlew test --tests io.spring.application.article.ArticleQueryServiceTest):After the fix:
REST comparison between the
masterjar and this branch's jar, on copies of the same seeded SQLite DB (50 users, 2,000 articles, logged in as a user who follows 10 authors). Bodies were compared byte for byte:GET /articles/feed?offset=0&limit=20GET /articles/feed?offset=20&limit=20GET /articles/feed?offset=400&limit=20GET /articles/feed?offset=415&limit=20GET /articles/feed?offset=420&limit=20GET /articles/feed?offset=1000&limit=20GET /articles?offset=0&limit=20GET /articles?offset=1980&limit=20GET /articles?offset=2000&limit=20GET /articles?offset=5000&limit=20GET /articles?tag=tag3&offset=0&limit=20Devin-Org: engineering
Implemented in session Fix 500 on article feed past last page
Review with Devin · Open in Devin Desktop