refactor: real pagination for app/dataset/skill list APIs - #7451
Open
ctlaltlaltc wants to merge 2 commits into
Open
refactor: real pagination for app/dataset/skill list APIs#7451ctlaltlaltc wants to merge 2 commits into
ctlaltlaltc wants to merge 2 commits into
Conversation
Coverage Report
File CoverageNo changed files found. |
|
✅ Admin Preview Image Ready! 🕒 Time: 2026-08-05 17:51:05 (UTC+8) |
|
✅ Docs Preview Deployed! 🔗 👀 Click here to visit preview 🕒 Time: 2026-08-05 17:44:14 (UTC+8) |
|
✅ Build Successful - Preview fastgpt Image for this PR: 🕒 Time: 2026-08-05 17:54:00 (UTC+8) |
ctlaltlaltc
marked this pull request as draft
August 5, 2026 01:22
ctlaltlaltc
force-pushed
the
refactor/list-api-pagination
branch
from
August 5, 2026 01:53
26e2b4e to
871b891
Compare
ctlaltlaltc
marked this pull request as ready for review
August 5, 2026 01:53
ctlaltlaltc
marked this pull request as draft
August 5, 2026 08:37
…ization Co-Authored-By: Claude <noreply@anthropic.com>
ctlaltlaltc
force-pushed
the
refactor/list-api-pagination
branch
from
August 5, 2026 09:41
7f06959 to
9dd1950
Compare
ctlaltlaltc
marked this pull request as ready for review
August 5, 2026 09:42
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.
What
Push permission filtering for the three list APIs (
/api/core/app/list,/api/core/dataset/list,/api/core/ai/skill/list) into MongoDB (readableQuery = $or[{_id ∈ myReadableIds}, {tmbId}]) with realskip/limit + countDocumentspagination, unified{list, total}response contract (pageNum/pageSize optional, default 1/50; skill keeps page/pageSize), and create-time sync of parent folder permissions so children created in authorized folders are immediately visible to collaborators.Maintainer review follow-ups (implemented in this PR)
ReadableRoleBitsMask(low 4 role bits, incl. App readChatLog);initListPerCtxnow queries the caller's permission records with$bitsAnySetfiltering for group/org records — tmb-direct records stay unfiltered to preserve the permission=0 nullish priority, with the equivalence documented in code. The team-wide roleList fetch is replaced by a page-scopedgetResourceClbsMap(page items + their parents), dropping per-request permission reads from O(team records) to O(page records).POST /api/admin/dataClean/backfillResourcePermissions(root auth, dry-run by default, skipError/batch/concurrency options) materializes parent-folder collaborators onto children created before the create-sync fix, using the same merge semantics (getResourceOwnedClbs→syncCollaborators); idempotent, batched, and reports anonReadableRoleRecordsaudit stat that validates the bitmask premise.Verification
{list,total}with default first page 50), cross-folder search, folder-collaborator sees a newly created child immediately; backfill verified on a real database (dry-run → write → idempotent re-check, audit 0)searchMatch.$orspread clobbered the permission$or(pre-existing, masked by full-set JS filter) — merged with$andFollow-up (not in this PR)
The following list APIs still use full-fetch + JS filter / no pagination. They will be addressed in follow-up submissions:
/api/support/mcp/list— full team MCP key fetch, no pagination/api/core/plugin/team/tool/list(and the admin variant) — full tool list + JS filter, no pagination/api/support/openapi/list— full fetch + in-memory filter/sort (low priority: key count capped at 100; in-memory key-fragment search is intentional)/api/core/app/template/list— full fetch + JS filter (low priority)/api/support/outLink/list— full per-app fetch (low priority)