-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCore.lua
More file actions
808 lines (721 loc) · 28.8 KB
/
Core.lua
File metadata and controls
808 lines (721 loc) · 28.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
local ADDON_NAME, ns = ...
local Constants = ns.Constants
local Addon = {
name = ADDON_NAME,
version = "0.1.0",
modules = {},
coreInitialized = false,
runtimeInitialized = false,
initialized = false,
runtime = {
currentSession = nil,
currentMatch = nil,
pendingDuel = nil,
reviewedSessionId = nil,
latestSummarySessionId = nil,
summaryOpenAt = nil,
latestPlayerSnapshot = nil,
totalRawEvents = 0,
warnings = {},
traceLog = {},
},
}
ns.Addon = Addon
local PREFIX = "|cff35c7e5[CombatAnalytics]|r"
local WARNING_LOG_LIMIT = 100
local function chat(message)
if DEFAULT_CHAT_FRAME then
DEFAULT_CHAT_FRAME:AddMessage(message)
end
end
local function appendBounded(list, value, limit)
list[#list + 1] = value
while #list > limit do
table.remove(list, 1)
end
end
local function safeModuleCall(addon, moduleName, methodName)
local module = addon:GetModule(moduleName)
if not module or type(module[methodName]) ~= "function" then
return true
end
local ok, err = xpcall(function()
module[methodName](module)
end, debugstack)
if not ok then
addon:Warn(string.format("%s initialization failed.", moduleName))
addon:Debug("%s", err)
return false
end
return true
end
local function registerSlashCommands(addon)
if addon.slashRegistered then
return true
end
if type(SlashCmdList) ~= "table" then
addon:Warn("Slash command registration deferred because SlashCmdList is unavailable.")
return false
end
SlashCmdList.COMBATANALYTICS = function(msg)
addon:HandleCommand(msg)
end
_G.SLASH_COMBATANALYTICS1 = "/ca"
_G.SLASH_COMBATANALYTICS2 = "/caa"
_G.SLASH_COMBATANALYTICS3 = "/combatanalytics"
addon.slashRegistered = true
return true
end
local function stringifyTraceValue(value)
if value == nil then
return "nil"
end
if type(value) == "boolean" then
return value and "true" or "false"
end
if type(value) == "number" then
return string.format("%.3f", value)
end
return tostring(value)
end
local function formatTraceFields(fields)
if fields == nil then
return ""
end
if type(fields) ~= "table" then
return tostring(fields)
end
local parts = {}
for _, key in ipairs(ns.Helpers.ArrayKeys(fields)) do
local value = fields[key]
if type(value) ~= "table" then
parts[#parts + 1] = string.format("%s=%s", tostring(key), stringifyTraceValue(value))
end
end
return table.concat(parts, " ")
end
function Addon:RegisterModule(name, module)
self.modules[name] = module
module.name = name
module.addon = self
return module
end
function Addon:GetModule(name)
return self.modules[name]
end
function Addon:GetDB()
return CombatAnalyticsDB
end
function Addon:GetSetting(key)
local db = self:GetDB()
local settings = db and db.settings or nil
if settings and settings[key] ~= nil then
return settings[key]
end
return Constants.DEFAULT_SETTINGS[key]
end
function Addon:SetSetting(key, value)
local db = self:GetDB()
if not db then
return
end
db.settings[key] = value
end
function Addon:IsDebugEnabled()
return self:GetSetting("enableDebugLogging")
end
function Addon:IsTraceEnabled()
return self:GetSetting("enableTraceLogging")
end
function Addon:Print(message)
chat(string.format("%s %s", PREFIX, message))
end
function Addon:PrintSuccess(message)
chat(string.format("%s |cff73d98b%s|r", PREFIX, message))
end
function Addon:PrintWarning(message)
chat(string.format("%s |cffffb347%s|r", PREFIX, message))
end
function Addon:AppendTraceEntry(label, fields)
local log = self:GetTraceLog()
log[#log + 1] = {
timestamp = ns.ApiCompat.GetServerTime(),
relative = ns.Helpers.Now(),
label = tostring(label or "trace"),
detail = formatTraceFields(fields),
}
local limit = Constants.TRACE_LOG_LIMIT or 200
while #log > limit do
table.remove(log, 1)
end
end
function Addon:RecordWarning(message)
local entry = {
timestamp = ns.ApiCompat.GetServerTime(),
message = tostring(message or "unknown"),
}
appendBounded(self.runtime.warnings, entry, WARNING_LOG_LIMIT)
local db = self:GetDB()
local maintenance = db and db.maintenance or nil
if maintenance then
maintenance.warnings = maintenance.warnings or {}
appendBounded(maintenance.warnings, entry, WARNING_LOG_LIMIT)
end
end
function Addon:Debug(message, ...)
if not self:IsDebugEnabled() then
return
end
local formatted = message
if select("#", ...) > 0 then
formatted = string.format(message, ...)
end
self:AppendTraceEntry("debug", { message = formatted })
end
function Addon:Warn(message, ...)
local formatted = message
if select("#", ...) > 0 then
-- pcall guard: if a caller passes a malformed format string we still
-- record the warning instead of replacing it with a format error.
local ok, result = pcall(string.format, message, ...)
if ok then
formatted = result
end
end
self:RecordWarning(formatted)
self:AppendTraceEntry("warn", { message = formatted })
end
function Addon:GetTraceLog()
local db = self:GetDB()
local maintenance = db and db.maintenance or nil
if maintenance then
maintenance.traceLog = maintenance.traceLog or {}
return maintenance.traceLog
end
self.runtime.traceLog = self.runtime.traceLog or {}
return self.runtime.traceLog
end
function Addon:Trace(label, fields)
if not self:IsTraceEnabled() then
return
end
self:AppendTraceEntry(label, fields)
end
function Addon:ClearTraceLog()
local log = self:GetTraceLog()
for index = #log, 1, -1 do
log[index] = nil
end
end
function Addon:DumpTraceLog(limit)
local log = self:GetTraceLog()
if #log == 0 then
self:Print("Trace log is empty.")
return
end
limit = math.floor(tonumber(limit) or 20)
if limit < 1 then
limit = 1
elseif limit > (Constants.TRACE_LOG_LIMIT or 200) then
limit = Constants.TRACE_LOG_LIMIT or 200
end
local startIndex = math.max(1, #log - limit + 1)
self:Print(string.format("Trace dump (%d of %d entries):", #log - startIndex + 1, #log))
for index = startIndex, #log do
local entry = log[index]
local timeText = date("%H:%M:%S", entry.timestamp or time())
local detail = entry.detail ~= "" and (" " .. entry.detail) or ""
self:Print(string.format("%s rel=%.3f %s%s", timeText, entry.relative or 0, entry.label or "trace", detail))
end
end
function Addon:SetLatestPlayerSnapshot(snapshot)
self.runtime.latestPlayerSnapshot = snapshot
end
function Addon:GetLatestPlayerSnapshot()
return self.runtime.latestPlayerSnapshot
end
function Addon:SetReviewedSession(sessionId, source)
self.runtime.reviewedSessionId = sessionId
self:Trace("ui.reviewed_session.set", {
sessionId = sessionId or "nil",
source = source or "unknown",
})
end
function Addon:GetReviewedSession()
return self.runtime.reviewedSessionId
end
function Addon:ClearReviewedSession()
self.runtime.reviewedSessionId = nil
self:Trace("ui.reviewed_session.cleared")
end
function Addon:TryRegisterSlashCommands()
return registerSlashCommands(self)
end
function Addon:PrintCommandHelp()
self:Print("|cff73d98bReady|r |cff35c7e5/ca|r opens the dashboard, |cff35c7e5/ca history|r shows sessions, |cff35c7e5/ca insights|r shows coaching.")
self:Print("|cffd7e9ffUtilities|r |cff35c7e5/ca detail|r, |cff35c7e5/ca cleanup|r, |cff35c7e5/ca settings|r, |cff35c7e5/ca trace|r.")
self:Print("|cffd7e9ffDebug|r |cff35c7e5/ca debug actors|r — actor registry, |cff35c7e5/ca debug timeline|r — lane/chronology/confidence counts, |cff35c7e5/ca debug coverage|r — lane coverage.")
end
function Addon:OpenView(viewId, payload)
if not self.runtimeInitialized then
self:InitializeRuntime()
end
if InCombatLockdown and InCombatLockdown() then
self:PrintWarning("CombatAnalytics UI cannot open during combat. Use /ca after combat ends.")
return
end
local mainFrame = self:GetModule("MainFrame")
if mainFrame then
local ok, err = xpcall(function()
mainFrame:ShowView(viewId, payload)
end, debugstack)
if not ok then
self:Warn("CombatAnalytics UI failed to open.")
self:PrintWarning("CombatAnalytics UI failed to open.")
self:Debug("%s", err)
end
end
end
function Addon:ShowSummary(sessionId)
self.runtime.latestSummarySessionId = sessionId
self.runtime.summaryOpenAt = ns.Helpers.Now() + Constants.SUMMARY_AUTO_OPEN_DELAY
end
function Addon:HandleCommand(input)
local tracker = self:GetModule("CombatTracker")
if tracker and tracker.FlushSessionForInspection then
tracker:FlushSessionForInspection()
end
local rawInput = ns.Helpers.Trim(input or "")
if rawInput == "" then
self:OpenView("summary")
return
end
local command, argument = string.match(rawInput, "^(%S+)%s*(.-)$")
command = string.lower(command or "")
argument = string.lower(ns.Helpers.Trim(argument or ""))
if command == "summary" then
self:OpenView("summary")
return
end
if command == "history" then
self:OpenView("history")
return
end
if command == "options" or command == "settings" then
local settingsPanel = self:GetModule("SettingsPanel")
if settingsPanel and settingsPanel.Open then
settingsPanel:Open()
else
self:PrintWarning("CombatAnalytics settings panel is not available.")
end
return
end
if command == "insights" then
self:OpenView("insights")
return
end
if command == "cleanup" then
self:OpenView("cleanup")
return
end
if command == "trace" or command == "traces" then
if argument == "on" then
self:SetSetting("enableTraceLogging", true)
self:PrintSuccess("Trace logging enabled.")
return
end
if argument == "off" then
self:SetSetting("enableTraceLogging", false)
self:PrintSuccess("Trace logging disabled.")
return
end
if argument == "clear" then
self:ClearTraceLog()
self:PrintSuccess("Trace log cleared.")
return
end
self:DumpTraceLog(argument ~= "" and argument or nil)
return
end
if command == "debug" then
-- T122: Diagnostic export subcommand
if argument == "export" then
local store = self:GetModule("CombatStore")
local session = nil
if self.runtime.reviewedSessionId and store then
session = store:GetSessionById(self.runtime.reviewedSessionId)
end
if not session and store then
session = store:GetLatestSession(store:GetCurrentCharacterKey())
end
if not session then
self:PrintWarning("No session available for diagnostic export.")
return
end
self:Print("|cff35c7e5--- Diagnostic Export ---|r")
self:Print(string.format(" id: %s", session.id or "?"))
self:Print(string.format(" context: %s | subcontext: %s", session.context or "?", session.subcontext or "?"))
self:Print(string.format(" result: %s | duration: %.1fs", session.result or "?", session.duration or 0))
self:Print(string.format(" confidence: %s", session.captureQuality and session.captureQuality.confidence or "?"))
-- Match/round identity
local arena = session.arena or {}
self:Print(string.format(" matchKey: %s | roundKey: %s", arena.matchKey or "none", arena.roundKey or "none"))
-- Slot confidence
local roster = arena.roster or {}
for i, slot in ipairs(roster) do
local fc = slot.fieldConfidence or {}
local parts = {}
for k, v in pairs(fc) do parts[#parts + 1] = k .. "=" .. tostring(v) end
self:Print(string.format(" slot[%d]: %s (%s) conf={%s}", i, slot.name or "?", slot.specName or "?", table.concat(parts, ",")))
end
-- DM session IDs
local dm = session.damageMeterImport or {}
self:Print(string.format(" dmSessionIds: %d", #(dm.sessionIds or {})))
-- Timeline event counts by lane
local laneCounts = {}
for _, evt in ipairs(session.timelineEvents or {}) do
local lane = evt.lane or "unknown"
laneCounts[lane] = (laneCounts[lane] or 0) + 1
end
local laneStr = {}
for lane, count in pairs(laneCounts) do
laneStr[#laneStr + 1] = string.format("%s=%d", lane, count)
end
self:Print(string.format(" timelineEvents: %d total {%s}", #(session.timelineEvents or {}), table.concat(laneStr, ", ")))
-- Provenance map
local prov = session.provenance or {}
local provParts = {}
for field, source in pairs(prov) do
provParts[#provParts + 1] = string.format("%s:%s", field, type(source) == "table" and source.source or tostring(source))
end
self:Print(string.format(" provenance: {%s}", table.concat(provParts, ", ")))
-- T028: Build catalog summary
local catalogSvc = self:GetModule("BuildCatalogService")
local liveBuild = catalogSvc and catalogSvc:GetCurrentLiveBuild()
if liveBuild then
self:Print(string.format(" currentBuildId: %s", liveBuild.buildId or "?"))
self:Print(string.format(" loadoutId: %s", liveBuild.loadoutId or "?"))
self:Print(string.format(" snapshotFreshness: %s", liveBuild.snapshotFreshness or "?"))
else
self:Print(" currentBuildId: (no live build)")
end
local store = self:GetModule("CombatStore")
if store then
local db2 = store:GetDB()
local catalog = db2 and db2.buildCatalog
if catalog then
local profileCount = catalog.order and #catalog.order or 0
self:Print(string.format(" buildCatalog: %d profile%s",
profileCount, profileCount == 1 and "" or "s"))
for i, bid in ipairs(catalog.order or {}) do
if i > 5 then
self:Print(string.format(" … (%d more)", profileCount - 5))
break
end
local p = catalog.byId[bid]
if p then
self:Print(string.format(
" [%s] sessions=%d current=%s warnings=%s",
string.sub(bid, 1, 12) .. "…",
p.sessionCount or 0,
p.isCurrentBuild and "yes" or "no",
p.isMigratedWithWarnings and "yes" or "no"))
end
end
end
end
-- Also save to export key
local db = self:GetDB()
if db then
db.diagnosticExport = {
sessionId = session.id,
exportedAt = os.time(),
context = session.context,
confidence = session.captureQuality and session.captureQuality.confidence,
timelineEventCount = #(session.timelineEvents or {}),
laneCounts = laneCounts,
currentBuildId = liveBuild and liveBuild.buildId or nil,
snapshotFreshness = liveBuild and liveBuild.snapshotFreshness or nil,
}
end
self:Print("|cff35c7e5--- End Diagnostic Export ---|r")
return
end
-- T027: /ca debug coverage — per-lane coverage scores for most recent session.
if argument == "coverage" then
local store = self:GetModule("CombatStore")
local session = nil
if self.runtime.reviewedSessionId and store then
session = store:GetSessionById(self.runtime.reviewedSessionId)
end
if not session and store then
session = store:GetLatestSession(store:GetCurrentCharacterKey())
end
if not session then
self:PrintWarning("No session available.")
return
end
local cov = session.coverage
if not cov then
self:PrintWarning("No coverage data in this session (session may predate CoverageService).")
return
end
self:Print("|cff35c7e5--- Coverage Report ---|r")
self:Print(string.format(" Session: %s | %s/%s", session.id or "?", session.context or "?", session.subcontext or "?"))
-- Sorted lane list for stable output.
local lanes = {}
for lane in pairs(cov) do lanes[#lanes + 1] = lane end
table.sort(lanes)
for _, lane in ipairs(lanes) do
local rec = cov[lane]
if type(rec) == "table" then
local score = rec.score or 0
local evCount = rec.eventCount or 0
local dropped = rec.droppedCount or 0
local summary = rec.summary or ""
local bar = string.rep("|cff00cc44#|r", math.floor(score * 10)) ..
string.rep("|cff666666-|r", 10 - math.floor(score * 10))
self:Print(string.format(" %-20s [%s] %.2f ev=%d drop=%d%s",
lane, bar, score, evCount, dropped,
summary ~= "" and (" " .. summary) or ""))
end
end
self:Print("|cff35c7e5--- End Coverage Report ---|r")
return
end
-- /ca debug actors — dump UnitGraphService actor registry
if argument == "actors" then
local ugs = self:GetModule("UnitGraphService")
if not ugs or not ugs.DumpState then
self:PrintWarning("UnitGraphService.DumpState not available.")
return
end
local lines = ugs:DumpState()
if type(lines) == "table" then
for _, line in ipairs(lines) do
self:Print(line)
end
else
self:Print(tostring(lines))
end
return
end
-- /ca debug timeline — count timeline events by lane → chronology → confidence
if argument == "timeline" then
local store = self:GetModule("CombatStore")
local session = nil
if self.runtime.reviewedSessionId and store then
session = store:GetSessionById(self.runtime.reviewedSessionId)
end
if not session and store then
session = store:GetLatestSession(store:GetCurrentCharacterKey())
end
if not session then
self:PrintWarning("No session available.")
return
end
local byLane = {}
for _, evt in ipairs(session.timelineEvents or {}) do
local lane = evt.lane or "unknown"
local chron = evt.chronology or "realtime"
local conf = evt.confidence or "unknown"
if not byLane[lane] then byLane[lane] = {} end
if not byLane[lane][chron] then byLane[lane][chron] = {} end
byLane[lane][chron][conf] = (byLane[lane][chron][conf] or 0) + 1
end
self:Print("|cff35c7e5--- Timeline Summary ---|r")
self:Print(string.format(" Session: %s | total events: %d",
session.id or "?", #(session.timelineEvents or {})))
local laneOrder = {}
for lane in pairs(byLane) do laneOrder[#laneOrder + 1] = lane end
table.sort(laneOrder)
for _, lane in ipairs(laneOrder) do
local chronMap = byLane[lane]
local chronOrder = {}
for chron in pairs(chronMap) do chronOrder[#chronOrder + 1] = chron end
table.sort(chronOrder)
for _, chron in ipairs(chronOrder) do
local confMap = chronMap[chron]
local confOrder = {}
for conf in pairs(confMap) do confOrder[#confOrder + 1] = conf end
table.sort(confOrder)
local parts = {}
for _, conf in ipairs(confOrder) do
parts[#parts + 1] = string.format("%s=%d", conf, confMap[conf])
end
self:Print(string.format(" %-22s [%-10s] {%s}",
lane, chron, table.concat(parts, ", ")))
end
end
self:Print("|cff35c7e5--- End Timeline Summary ---|r")
return
end
local enabled = not self:IsDebugEnabled()
self:SetSetting("enableDebugLogging", enabled)
self:PrintSuccess(string.format("Debug %s.", enabled and "enabled" or "disabled"))
return
end
if command == "export" then
local store = self:GetModule("CombatStore")
local serializer = self:GetModule("ExportSerializer")
if not store or not serializer then
self:PrintWarning("Export module not available.")
return
end
local sessionId = self.runtime.reviewedSessionId
local session = nil
if sessionId then
session = store:GetSessionById(sessionId)
end
if not session then
local characterKey = store:GetCurrentCharacterKey()
session = store:GetLatestSession(characterKey)
end
if not session then
self:PrintWarning("No session to export.")
return
end
local text = serializer.Serialize(session)
self:ShowExportFrame(text)
return
end
if command == "stats" then
local store = self:GetModule("CombatStore")
local dbStats = store and store:GetStorageStats() or {}
local active = tracker and tracker:GetCurrentSession() or nil
self:Print(string.format(
"Stats: stored_sessions=%d stored_matches=%d raw_events=%d active_session=%s active_context=%s",
dbStats.sessions or 0,
dbStats.matches or 0,
dbStats.totalRawEvents or 0,
active and active.id or "none",
active and active.context or "none"
))
return
end
if command == "minimap" then
local current = self:GetSetting("showMinimapButton")
local next = not current
self:SetSetting("showMinimapButton", next)
local minimapButton = self:GetModule("MinimapButton")
if minimapButton then
minimapButton:RefreshVisibility()
end
if next then
self:Print("Minimap button |cff70d196shown|r. Drag to reposition.")
else
self:Print("Minimap button |cffe64d40hidden|r. Use |cff35c7e5/ca minimap|r to show it again.")
end
return
end
-- T123: Manual regression matrix checklist
if command == "regression" then
self:Print("|cff35c7e5--- Regression Matrix ---|r")
self:Print("|cffFFD700Arena:|r")
self:Print(" [ ] 2v2 Skirmish — session created, opponent identified, timeline populated")
self:Print(" [ ] 3v3 Rated — matchKey/roundKey stable, roster resolved, DM import")
self:Print(" [ ] Solo Shuffle — round tracking, scout card, adaptation card")
self:Print(" [ ] Inspect failure — graceful fallback, no error spam")
self:Print("|cffFFD700Duel:|r")
self:Print(" [ ] Accepted duel — session created, opponent identified")
self:Print(" [ ] Cancelled duel — no stale session left")
self:Print(" [ ] To-the-death — subcontext classified correctly")
self:Print("|cffFFD700Dummy:|r")
self:Print(" [ ] Single target — session captured, benchmark updated")
self:Print(" [ ] Repeated pulls — each finalized, aggregates increment")
self:Print("|cffFFD700General:|r")
self:Print(" [ ] /reload during arena prep — no orphan sessions")
self:Print(" [ ] Logout after match — session finalized before save")
self:Print(" [ ] Legacy DB (v2-v5) — migration runs, UI renders without error")
self:Print(" [ ] Mixed-version DB — v2+v3+v4+v5+v6 sessions load together")
self:Print("|cffFFD700Data Quality:|r")
self:Print(" [ ] ConfidencePill shows correct label for each session type")
self:Print(" [ ] Provenance fields populated for new sessions")
self:Print(" [ ] Timeline events have correct lanes")
self:Print("|cff35c7e5--- End Regression Matrix ---|r")
return
end
self:PrintCommandHelp()
end
function Addon:Initialize()
self:InitializeCore()
self:InitializeRuntime()
end
function Addon:InitializeCore()
if self.coreInitialized then
return
end
safeModuleCall(self, "CombatStore", "Initialize")
self.coreInitialized = true
end
function Addon:InitializeRuntime()
if self.runtimeInitialized then
return
end
self:InitializeCore()
self:TryRegisterSlashCommands()
safeModuleCall(self, "UnitGraphService", "Initialize")
safeModuleCall(self, "ArenaRoundTracker", "Initialize")
safeModuleCall(self, "SpellAttributionPipeline", "Initialize")
safeModuleCall(self, "CombatTracker", "Initialize")
safeModuleCall(self, "SnapshotService", "Initialize")
safeModuleCall(self, "DamageMeterService", "Initialize")
safeModuleCall(self, "PartySyncService", "Initialize")
-- MinimapButton: create and show/hide based on saved setting so the
-- button appears immediately on login without needing /ca minimap.
safeModuleCall(self, "MinimapButton", "Initialize")
-- SettingsPanel: register the canvas category with the Blizzard
-- Settings system at startup so it appears in Settings → Addons
-- without the user needing to open it via /ca settings first.
safeModuleCall(self, "SettingsPanel", "Initialize")
self.runtimeInitialized = true
self.initialized = true
if not self.runtime.loginBannerShown then
self.runtime.loginBannerShown = true
self:PrintCommandHelp()
end
end
function Addon:ShowExportFrame(text)
if not self.exportFrame then
local f = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
f:SetSize(520, 160)
f:SetPoint("CENTER")
f:SetMovable(true)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart", f.StartMoving)
f:SetScript("OnDragStop", f.StopMovingOrSizing)
f:SetFrameStrata("DIALOG")
if f.SetBackdrop then
f:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16, insets = { left = 4, right = 4, top = 4, bottom = 4 } })
f:SetBackdropColor(0.1, 0.1, 0.1, 0.95)
end
local title = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
title:SetPoint("TOPLEFT", f, "TOPLEFT", 12, -12)
title:SetText("CombatAnalytics Export")
local close = CreateFrame("Button", nil, f, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", f, "TOPRIGHT", -2, -2)
local editBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
editBox:SetPoint("TOPLEFT", f, "TOPLEFT", 16, -36)
editBox:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -16, 40)
editBox:SetMultiLine(true)
editBox:SetAutoFocus(false)
editBox:SetFontObject("ChatFontNormal")
editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
f.editBox = editBox
local selectBtn = CreateFrame("Button", nil, f, "UIPanelButtonTemplate")
selectBtn:SetSize(100, 22)
selectBtn:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -12, 10)
selectBtn:SetText("Select All")
selectBtn:SetScript("OnClick", function()
editBox:SetFocus()
editBox:HighlightText()
end)
self.exportFrame = f
end
self.exportFrame.editBox:SetText(text or "")
self.exportFrame:Show()
self.exportFrame.editBox:SetFocus()
self.exportFrame.editBox:HighlightText()
end
Addon:RegisterModule("Core", Addon)