Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughPeerTube channel and comment listing now paginate through all available results. Channel selection and comment ingestion use accumulated results beyond the default page sizes. Tests cover multi-page responses, selection, ordering, and response errors. ChangesPeerTube pagination
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to PeerTube channel and comment lists now retrieve later pages, with coverage for the affected selection and inbox flows. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Two PeerTube lists were read as a single page. The account's channels
(GET /api/v1/accounts/{name}/video-channels) were requested without
count or start, so PeerTube returned its default page of 15 and
channels past the fifteenth could not be connected or picked, although
the default quota is 20. A video's comment threads were requested as
one page of 100 and never followed start, so on a busy video the older
threads, and new replies on them, never reached the inbox.
Both now go through one helper that requests the largest page PeerTube
accepts and follows start until total.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4df2fc0 to
d95c9fe
Compare
Summary
Two PeerTube lists were read as a single page:
listOwnChannelscalledGET /api/v1/accounts/{name}/video-channelswith nocountorstart, so PeerTube answered with its default page of 15. An account with 16 or more channels could not connect, select, or pick any channel past the fifteenth.ListCommentsaskedGET /api/v1/videos/{id}/comment-threadsfor one page of 100 and never followedstart. The reply trees under each thread are already fully paged (hydrateCommentTree), but threads come newest first (-createdAt). Once a video had more than 100 threads, every poll left the older ones out. New replies posted on them never reached the inbox, and a thread that slipped past the first 100 between two polls was never collected at all.Both lists now go through one small generic helper,
listPeerTubePages. It requests the largest page PeerTube accepts (100) and followsstartuntiltotal. A shared helper also keeps the two loops from tripping thedupllinter.Motivation
listOwnChannelsfeeds three user paths:ListAccountSelections)SelectAccount), which answersunknown peertube channel selectionfor any channel it did not seepeertube_channelspicker (SearchPublishingOptions)ListCommentsfeeds the engagement inbox, the REST comments handler and the MCP comments tool.PeerTube's side, at
v8.3.0:server/core/initializers/constants.ts:PAGINATION.GLOBAL.COUNTisDEFAULT: 15, MAX: 100.server/core/middlewares/pagination.ts:if (!req.query.count) req.query.count = PAGINATION.GLOBAL.COUNT.DEFAULT.server/core/middlewares/validators/pagination.ts: rejects acountabove 100, so paging withstartis the only way past 100.server/core/controllers/api/accounts.ts:/:handle/video-channelsrunspaginationValidatorandsetDefaultPagination, andlistAccountChannelsreturnsgetFormattedObjects(resultList.data, resultList.total), which is{ total, data }.server/core/controllers/api/videos/comment.ts:/:videoId/comment-threadsruns the same two middlewares and returns{ total, data, totalNotDeletedComments }.server/core/models/video/video-comment.ts: inlistThreadsForApi,totalcounts threads (isThread: true).config/default.yaml:video_channels.max_per_user: 20. A stock instance lets a user own more channels than one default page returns, and admins can raise the limit.The loop also stops on an empty page, not only at
total, so a server whosetotalovercounts cannot keep it requesting.Testing
go test ./internal/platform/...)bun run --filter @openpost/web test): no frontend changego vet,gofmt,gofumpt,golangci-lint run ./internal/platform/...: 0 issues, same asmain)start.TestPeerTubeChannelSelectionReadsEveryChannelPageuses 105 channels. It checks that all 105 reachListAccountSelectionsand thatstartgoes0then100. It also checks thatSelectAccountand the composer picker accept channel 105.TestPeerTubeCommentsReadsEveryThreadPageuses 130 threads. It checks that all 130 are listed, including the oldest, and that request and decode failures are still reported.Fails on unmodified
main:Both pass with the fix, and the existing PeerTube tests still pass.
go test ./internal/platform/...isok, andgo build -tags dev ./...is clean.go test -coverprofileshows every changed line runs under the two new tests.Checklist
changes/peertube-channel-pages.mdBreaking Changes
Affected Components
Platform Impact
🤖 Generated with Claude Code