From 9fcb1988da22185fa0d9798a4eda79de89fa762f Mon Sep 17 00:00:00 2001 From: Xurkon Date: Fri, 5 Jun 2026 14:19:42 -0500 Subject: [PATCH] fix: preserve learner party kill updates --- Modules/QuestieLearner.lua | 17 ++++++++++++----- Tests/AuditFindings_spec.lua | 8 ++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Modules/QuestieLearner.lua b/Modules/QuestieLearner.lua index c422056..44ec356 100644 --- a/Modules/QuestieLearner.lua +++ b/Modules/QuestieLearner.lua @@ -3128,15 +3128,22 @@ function QuestieLearner:OnCombatLogEvent(timestamp, eventType, srcGUID, srcName, -- Dedupe: if this GUID was processed within the last 5 seconds, skip. -- PARTY_KILL and UNIT_DIED can both fire for the same kill; we only need one. local now = time() - local lastTs = _Learner.killDebounce and _Learner.killDebounce[dstGUID] + local last = _Learner.killDebounce and _Learner.killDebounce[dstGUID] + local lastTs = type(last) == "table" and last.ts or last + local lastEventType = type(last) == "table" and last.eventType or nil if lastTs and (now - lastTs) < 5 then - -- Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] kill dedupe suppressed duplicate event=", eventType, " dstGUID=", dstGUID) - return + -- UNIT_DIED can arrive before PARTY_KILL for our own kill. Never let the + -- bystander-safe cache path suppress the authoritative local kill event. + if eventType ~= "PARTY_KILL" or lastEventType == "PARTY_KILL" then + -- Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] kill dedupe suppressed duplicate event=", eventType, " dstGUID=", dstGUID) + return + end end _Learner.killDebounce = _Learner.killDebounce or {} - _Learner.killDebounce[dstGUID] = now + _Learner.killDebounce[dstGUID] = { ts = now, eventType = eventType } -- Prune entries older than 10 seconds to keep the table bounded - for g, ts in pairs(_Learner.killDebounce) do + for g, entry in pairs(_Learner.killDebounce) do + local ts = type(entry) == "table" and entry.ts or entry if (now - ts) > 10 then _Learner.killDebounce[g] = nil end diff --git a/Tests/AuditFindings_spec.lua b/Tests/AuditFindings_spec.lua index 0838df2..eae95e9 100644 --- a/Tests/AuditFindings_spec.lua +++ b/Tests/AuditFindings_spec.lua @@ -347,4 +347,12 @@ describe("Audit Pass 10 - additional performance findings (snapshot)", function( assert.is_false(has(stream, "val1 % 256")) assert.is_false(has(stream, "val2 % 256")) end) + + it("[L10] UNIT_DIED dedupe cannot suppress a later PARTY_KILL learner update", function() + local learner = read("Modules/QuestieLearner.lua") + + assert.is_true(has(learner, 'local lastEventType = type(last) == "table" and last.eventType or nil')) + assert.is_true(has(learner, 'if eventType ~= "PARTY_KILL" or lastEventType == "PARTY_KILL" then')) + assert.is_true(has(learner, '_Learner.killDebounce[dstGUID] = { ts = now, eventType = eventType }')) + end) end)