Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ngs for database access
…ation and streamline database count calls
…ty in form submissions
…r non-existent tags
… empty post scenarios
…tructure for drafts and published posts
…s when limit is not provided
…th total count to make consistent with other plugins
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| model: "post", | ||
| limit: !needsInMemoryFilter ? (query.limit ?? 10) : undefined, | ||
| offset: !needsInMemoryFilter ? (query.offset ?? 0) : undefined, | ||
| where: whereConditions, |
There was a problem hiding this comment.
Inconsistent where parameter between count and findMany
Medium Severity
In getAllPosts, adapter.count receives dbWhere (which converts an empty whereConditions array to undefined), but adapter.findMany on line 114 receives whereConditions directly (potentially an empty array []). If an adapter implementation treats where: [] differently from where: undefined, the total count and the returned items would be filtered inconsistently, producing incorrect pagination metadata. The other new getter functions (kanban, form-builder) all consistently use whereConditions.length > 0 ? whereConditions : undefined for both calls. The findMany call here likely intended to use dbWhere instead of whereConditions.
Additional Locations (1)
| } | ||
|
|
||
| const posts = await adapter.findMany<PostWithPostTag>({ | ||
| model: "post", |
There was a problem hiding this comment.
Blog handler duplicates tag queries before calling getter
Low Severity
When tagSlug is provided, the listPosts handler performs two database queries (tag lookup + postTag lookup) as a guard, then calls getAllPosts which repeats the exact same two queries internally. This doubles the DB roundtrips for every tag-filtered request. The guard exists solely to skip the onPostsRead hook when results are empty — a simpler approach would be to call getAllPosts once and conditionally invoke the hook based on result.items.length, eliminating the redundant queries entirely.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


Changes in this PR:
Closes #32 #52
Note
Medium Risk
Touches core
stack()typing/return shape and adds a new server-side data access path that bypasses authorization hooks, plus changes list endpoint response shapes forblog/kanbanwhich could break consumers if missed.Overview
Adds a typed server-side
stack().apisurface by extendingBackendPluginwith an optionalapi(adapter)factory and returning both the sharedadapterand per-plugin APIs fromstack().Introduces standalone DB getter modules (and exports/tests/docs) for
blog,cms,form-builder,kanban, andai-chat, and wires these getters into each plugin’sapinamespace;cmsalso shares its one-time content-type sync between HTTP routes and the new getters.Refactors
blogandkanbanlist endpoints (and corresponding client/query code + e2e tests) to return paginated envelopes ({ items, total, limit, offset }) and moves list logic into getters (including DB-leveltagSlugfiltering for blog). Also adjusts form submission parsing to allowparsedData: nulland updates UI call sites accordingly. Bumps@btst/stackto2.2.0.Written by Cursor Bugbot for commit 72ddce7. This will update automatically on new commits. Configure here.