You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, this is the result of my big clever redesign of the threading code in #1190. I saw this bug and hoped I could override the parent_depth test in app/views/comments/_threads.html.erb by comparing thread_id, but with @lonjil’s report of #1251 it’s clear this is a more general problem. In that one, like here, the comments are in the wrong place because the parent comments have identical votes (~half of comments have one or two upvotes and zero flags) and the low byte of their id is identical. (We get ~200 comments per day, note that in both reports’ screenshots the parents are posted 2 days apart.)
This is going to be some amount of redesign to the confidence_order field and Comment#update_score_and_recalculate! for a reliable fix. I had considered that siblings might swap order a bit (see comment) but I didn’t realize that I was setting up a 1 in 256 chance that they’d swap children because of it.
An obvious fix would be to increase the comment id component of confidence_order to two bytes. It would seem that it reduces the chances from 1 in 256 to 1 in 65,536. However! We get ~200 comments per day and stories accept comments for 90 days (Story::COMMENTABLE_DAYS), so we only see ~18,000 comment IDs in the period available for a collision.
That works in practice but not in theory. I don’t love that it would set up an ever rarer bug if we grow. I have a hunch there’s a better fix available that I’m not immediately seeing, one that doesn’t increase the width of confidence_order_path. Maybe it’ll come to me, or maybe someone else has an idea for a fix?
On my threads page, a 3 days old comment on a story is threaded under a more recent comment on another story.
The text was updated successfully, but these errors were encountered: