Skip to content

Tighten query-count assertions in the upcoming_events_for_user specs #3094

Closed

Description

@mroderick

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.

Test-only change, no production risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions