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

freelock created an issue. See original summary.

  • freelock committed 66e1c0ed on 1.0.x
    fix: #3623179 Context fragment returns most of the thread at depth
    

  • freelock committed 8b925c8b on 1.0.x
    fix: #3623179 Narrow the context sibling window at thread edges
    
freelock’s picture

Status: Active » Fixed

Fixed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.