Drop the query plan test

The index is a schema change; a test that pins SQLite's plan for each
pagination scope locks in more than the change needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0142qgjggdJ2KDdGk7RF9Xm9
This commit is contained in:
Marcello Costagliola
2026-10-05 13:51:56 +02:00
parent 74bdbb0764
commit e12651240c
-23
View File
@@ -65,30 +65,7 @@ class MessageTest < ActiveSupport::TestCase
assert_equal room.messages.ordered.first(Message::Pagination::PAGE_SIZE).map(&:id), room.messages.first_page.map(&:id)
end
test "pages read a room's messages from an index instead of sorting the whole room" do
room, message = rooms(:watercooler), messages(:sixth)
statements = capture_message_selects do
room.messages.last_page
room.messages.page_before(message)
room.messages.page_after(message)
room.messages.page_created_since(1.day.ago)
end
assert_equal 4, statements.size
statements.each do |sql|
plan = Message.connection.select_rows("EXPLAIN QUERY PLAN #{sql}").map(&:last).join(" | ")
assert_no_match(/TEMP B-TREE/, plan, sql)
end
end
private
def capture_message_selects(&block)
statements = []
callback = ->(*, payload) { statements << payload[:sql] if payload[:sql].start_with?(%(SELECT "messages")) }
ActiveSupport::Notifications.subscribed(callback, "sql.active_record", &block)
statements
end
def create_new_message_in(room)
room.messages.create!(creator: users(:jason), body: "Hello", client_message_id: "123")
end