Skip to content

Pin events listing conditional-GET and /events/past query-cost contracts - #2977

Merged
mroderick merged 2 commits into
masterfrom
spec/pin-events-listing-contracts
Oct 1, 2026
Merged

mroderick merged 2 commits into
masterfrom
spec/pin-events-listing-contracts

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #2973: pins the contracts that review of that change found untested.

  • spec/requests/event_listing_caching_spec.rb (new): 304 through the full stack for /events/past and /events/upcoming with If-None-Match, cache-miss card render, ETag rotation when any of the four tables feeding latest_model_updated (Workshop, Meeting, Event, Member) changes, and the empty-database case. Mirrors the existing pattern in workshop_show_caching_spec.rb.
  • spec/requests/event_card_render_query_cost_spec.rb: adds a /events/past guard mixing Workshop, Meeting, and Event (with sponsorship and organisers) cards, asserting per-card query cost stays flat as cards grow.

One discovery from pinning the ETag loop: the digest input is truncated to the second (expand_cache_key renders a bare Time via to_s), so sub-second updated_at changes do not rotate the ETag. The spec touches with explicit times to advance the maximum deterministically.

Specs only; no application code changed.

Verification

  • bundle exec rspec spec/requests/event_listing_caching_spec.rb spec/requests/event_card_render_query_cost_spec.rb spec/controllers/events_controller_spec.rb: 35 examples, 0 failures
  • Full suite and rubocop app/ green on the source branch; rubocop spec/ clean on the two changed files

mroderick and others added 2 commits October 1, 2026 12:34
…-cost contracts

- Add spec/requests/event_listing_caching_spec.rb: 304 through the full
  stack for /events/past and /events/upcoming, cache-miss card render,
  etag rotation when any of the four tables feeding latest_model_updated
  changes, and stable etag for the empty-database case
- Add a /events/past guard scenario to event_card_render_query_cost_spec
  mixing Workshop, Meeting, and Event cards, asserting the query count
  stays flat as cards grow
@mroderick
mroderick marked this pull request as ready for review October 1, 2026 12:22
@mroderick
mroderick merged commit a772971 into master Oct 1, 2026
10 checks passed
@mroderick
mroderick deleted the spec/pin-events-listing-contracts branch October 1, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant