Context
The FeedbackById query (app Feedback fragment) costs ~5295 under GraphQL Armor. The limit was raised 1200 → 6000 (omnidotdev/infra#48) to stop prod rejections, and the dashboard feed was trimmed (omnidotdev/backfeed-app#200). FeedbackById is the remaining heavy read.
Why it's heavy
The Feedback fragment fans out into six nested connections on a single post, all rendered on the detail page:
attachments
comments(parentId: null) totalCount + commentsWithReplies totalCount
upvotes / downvotes totalCount
userUpvotes / userDownvotes nodes
postTags
The four separate votes connections are the biggest contributor.
Proposed fix (server-side)
Add computed aggregate fields to the Post type via makeExtendSchemaPlugin so the client fetches one cheap field instead of 4–6 connections, e.g.:
voteSummary: { upvotes: Int!, downvotes: Int!, viewerVote: VoteType }
commentCounts: { topLevel: Int!, total: Int! }
Then update the app Feedback fragment to consume these, dropping the nested connections. This lets the cost limit be tightened back toward the peer range (400–1000).
Acceptance
FeedbackById cost well under the limit (target < 1000).
- Detail page renders identically (vote counts, viewer's vote state, comment counts, tags, attachments).
- Limit in
infra/apps/backfeed/k8s.ts revisited downward once landed.
Not urgent (the 6000 limit covers current cost); this is the long-term cleanup.
Context
The
FeedbackByIdquery (appFeedbackfragment) costs ~5295 under GraphQL Armor. The limit was raised 1200 → 6000 (omnidotdev/infra#48) to stop prod rejections, and the dashboard feed was trimmed (omnidotdev/backfeed-app#200).FeedbackByIdis the remaining heavy read.Why it's heavy
The
Feedbackfragment fans out into six nested connections on a single post, all rendered on the detail page:attachmentscomments(parentId: null)totalCount +commentsWithRepliestotalCountupvotes/downvotestotalCountuserUpvotes/userDownvotesnodespostTagsThe four separate
votesconnections are the biggest contributor.Proposed fix (server-side)
Add computed aggregate fields to the
Posttype viamakeExtendSchemaPluginso the client fetches one cheap field instead of 4–6 connections, e.g.:voteSummary: { upvotes: Int!, downvotes: Int!, viewerVote: VoteType }commentCounts: { topLevel: Int!, total: Int! }Then update the app
Feedbackfragment to consume these, dropping the nested connections. This lets the cost limit be tightened back toward the peer range (400–1000).Acceptance
FeedbackByIdcost well under the limit (target < 1000).infra/apps/backfeed/k8s.tsrevisited downward once landed.Not urgent (the 6000 limit covers current cost); this is the long-term cleanup.