Problem/Motivation
The context fragment is meant to load a comment and its surrounding context, but at depth it returns effectively the whole thread. CommentIndex::contextFor() returns ancestors plus the parent's siblings plus own siblings plus children; at level 11 in a 216-comment thread this is nearly everything. Measured: 411,284 bytes and 2,763 ms for one level-11 comment, about 87% of the full page. This is a slice-size problem that survives any amount of index caching.
Steps to reproduce
- Open a node with 200+ comments and a deep thread.
- Request the context fragment for a deep comment.
- Observe the response is most of the thread.
Proposed resolution
- Cap the sibling fan-out in contextFor() to a bounded window around the target, rather than the parent's entire sibling set.
- Keep ancestors and direct children, but bound the breadth.
Remaining tasks
- Verify a deep comment still loads its context without returning most of the thread.
User interface changes
Faster context loading on deep comments.
API changes
None anticipated.
Data model changes
None anticipated.
AI-Generated: Yes (Used Opus 5 and DeepSeek Flash to review and discover these issues)
Comments
Comment #4
freelockFixed.