feat(go-services): Phase 2 — combat_stats accumulator (cross-language exact)
Ports main.py's _combat_session_delta / _combat_merge_into_lifetime (incl. the documented "offense/defense use latest, additively" quirk) and the combat_stats handler (session delta -> DB-backed lifetime merge -> delete-then-insert of combat_stats + combat_stats_sessions). Read handlers gain the live combat overlay (union live + DB), like Python. Validation: - combat.go `combat-merge` CLI folds snapshots through the accumulator; diffed against the Python functions on identical input -> byte-IDENTICAL. - combat_test.go golden test runs in the build (go test now part of the tracker Dockerfile). - Live: 40 combat lifetime rows + 40 session snapshots + rare_events flowing in dereth_go via the shadow consumer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
a5d69ba88d
commit
7350b00341
6 changed files with 347 additions and 4 deletions
|
|
@ -44,6 +44,14 @@ type Server struct {
|
|||
}
|
||||
|
||||
func main() {
|
||||
// `tracker-go combat-merge` reads a JSON array of cumulative session
|
||||
// snapshots from stdin and prints the folded lifetime — a deterministic hook
|
||||
// for cross-language parity testing against the Python combat functions.
|
||||
if len(os.Args) > 1 && os.Args[1] == "combat-merge" {
|
||||
runCombatMergeCLI()
|
||||
return
|
||||
}
|
||||
|
||||
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelInfo}))
|
||||
slog.SetDefault(logger)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue