From 145d021a5753ee4455f29f16541e9e37c27f4612 Mon Sep 17 00:00:00 2001 From: Chase Granberry Date: Mon, 14 Sep 2026 11:36:39 -0700 Subject: [PATCH] fix: log a page request that the LiveView drops A dropped page request was silent. The `with` fell through to `{:noreply, socket}`, and the catch-all clause did the same. A request that the guard or the cursor validation rejected looked like a page with no rows. Both paths now log the intent, the cursor values and the guard state. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01YBPF1knvgfghTSdxuYryGL --- .../live/search_live/logs_search_lv.ex | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/logflare_web/live/search_live/logs_search_lv.ex b/lib/logflare_web/live/search_live/logs_search_lv.ex index a0a039ce4c..ddff2830e3 100644 --- a/lib/logflare_web/live/search_live/logs_search_lv.ex +++ b/lib/logflare_web/live/search_live/logs_search_lv.ex @@ -494,11 +494,27 @@ defmodule LogflareWeb.Source.SearchLV do ) do {:noreply, update_event_pagination(socket, &EventPagination.mark_loading(&1, intent))} else - _ -> {:noreply, socket} + reason -> + log_dropped_page_request(socket, %{ + intent: intent, + cursor_id: cursor_id, + cursor_timestamp: cursor_timestamp, + reason: reason + }) + + {:noreply, socket} end end - def handle_event("load_events", _params, socket), do: {:noreply, socket} + def handle_event("load_events", params, socket) do + log_dropped_page_request(socket, %{ + params: Map.take(params, ["intent", "cursor-id", "cursor-timestamp"]), + loading: socket.assigns.loading, + tailing?: socket.assigns.tailing? + }) + + {:noreply, socket} + end def handle_event(direction, _, socket) when direction in ["backwards", "forwards"] do rules = socket.assigns.lql_rules @@ -756,6 +772,16 @@ defmodule LogflareWeb.Source.SearchLV do end end + # A page request that never reaches the executor used to be indistinguishable from one + # that returned no rows: both leave the list untouched and the SQL in the debug modal + # unchanged, because that modal only ever shows the initial query. + defp log_dropped_page_request(socket, context) do + Logger.warning("Search: dropped a load_events request | #{inspect(context)}", + source_id: socket.assigns.source.token, + source_token: socket.assigns.source.token + ) + end + defp update_event_pagination(socket, update) do assign(socket, :event_pagination, update.(socket.assigns.event_pagination)) end