Improve castlog report fidelity - #2560
Merged
Merged
Conversation
Three fixes to the post-game report path that feeds castlog.gg: - Forward the SpellBot game id to castlog. The game id only ever arrives in the URL, so castlog had no way to tell a re-report of a match it already had from a brand new match. It is added to the outbound body rather than trusted from the reporter's payload. - Don't forward a report that lost the stale-write guard. `set_metadata` now returns which of the three outcomes happened instead of a bool that conflated "stored" with "ignored as stale", so a delayed report we rejected locally no longer regresses castlog. - Accumulate `links` across reports instead of replacing them. Each writer only knows about its own trackers -- Convoke reports `mythic_track`, SpellBot writes back `castlog` -- so a later report that simply omits a link must not drop it from the game detail page. The merge happens inside the existing conditional UPDATE so the compare-and-set stays atomic. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2560 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 290 290
Lines 23508 23558 +50
Branches 955 957 +2
=========================================
+ Hits 23508 23558 +50 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Castlog reported seeing games where every player
xidis null and no winner is set. The root cause of the null xids is on the Convoke side (see the companion PR incommander-online), but investigating turned up three real problems on this side of the wire.Changes
Forward the SpellBot game id to castlog.
report_matchsends the request body through verbatim, and the game id only ever arrives in the URL path. So castlog had no way to tell a re-report of a match it already has from a brand new match — a single game legitimately produces several reports (the automatic match-end one, a later winner finalization, the post-game modal). The id is injected into the outbound body rather than trusted from the reporter's payload, since we know it authoritatively.Don't forward a report that lost the stale-write guard.
set_metadatareturnedTruewhenever the game existed, whether or not the write applied — conflating "stored" with "accepted and ignored as stale". The endpoint then called castlog unconditionally, so a delayed or out-of-order report we had just rejected locally still got pushed to castlog. It now returns which of the three outcomes happened (APPLIED/STALE/MISSING) and the forward is skipped onSTALE.Accumulate
linksacross reports instead of replacing them. Each writer only knows about its own trackers — Convoke reportsmythic_track, SpellBot writes backcastlog— so a later report that simply omits a link would drop it from the game detail page. The merge happens inside the existing conditionalUPDATEso the compare-and-set stays atomic. Everything outsidelinksis still last-write-wins.Testing
uv run pytest -n3— 1708 passed. Three new cases cover the stale-report forward being skipped, the game id reaching castlog, and links accumulating across reports.🤖 Generated with Claude Code