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
{{ message }}
Repository navigation
Tighten query-count assertions in the upcoming_events_for_user specs #3094
The regression specs added in #3074 assert that query counts stay within +2 of the one-workshop baseline:
spec/queries/dashboard_query_spec.rb:186 — expect(four_query_count).to be <= one_query_count + 2
spec/queries/dashboard_query_spec.rb:205 — expect(four_workshop_queries).to be <= one_workshop_queries + 2
Measured at 6749624, both paths issue 6 queries at one workshop and 6 at four, so exact equality passes today: expect(four_query_count).to eq(one_query_count).
The +2 slack lets a constant extra query per path through, which is the shape a fallback from preload to a non-batched load takes. The .upcoming_events query-count test in the same file asserts exact equality (expect(four_cards).to eq(one_card)).
The bound was relaxed during #3074 after review round 1 called the exact assertion stricter than sibling specs, so this is a deliberate tradeoff, not an oversight. Tightening both assertions restores the guard the N+1 fix was meant to provide.
Activity